:root {
  color-scheme: light;
  
  /* Light Mode Design Tokens */
  --bg-app: #f4f6fb;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #eeebff;
  --border-color: #e2e8f0;
  --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.04), 0 8px 12px -6px rgba(0, 0, 0, 0.04);
  --shadow-sidebar: 4px 0 24px -4px rgba(15, 23, 42, 0.03);
  --scrollbar-bg: #f1f5f9;
  --scrollbar-thumb: #cbd5e1;
  --border-hover: #cbd5e1;
  --focus-ring: rgba(79, 70, 229, 0.15);
  --bg-footer: rgba(244, 246, 251, 0.85);
}

html[data-theme="dark"] {
  color-scheme: dark;

  /* Dark Mode Design Tokens */
  --bg-app: #0b0f19;
  --bg-sidebar: #111827;
  --bg-card: #1f2937;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.12);
  --border-color: #374151;
  --shadow-card: 0 12px 30px -4px rgba(0, 0, 0, 0.3), 0 8px 16px -6px rgba(0, 0, 0, 0.3);
  --shadow-sidebar: 4px 0 24px -4px rgba(0, 0, 0, 0.4);
  --scrollbar-bg: #111827;
  --scrollbar-thumb: #374151;
  --border-hover: #4b5563;
  --focus-ring: rgba(99, 102, 241, 0.25);
  --bg-footer: rgba(11, 15, 25, 0.85);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

/* App Layout Structure */
.app-layout {
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Mobile Header (Hidden on Desktop) */
.mobile-header {
  display: none;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  align-items: center;
  gap: 16px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  height: 60px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.mobile-logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.icon-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* Sidebar Layout */
.sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
  box-shadow: var(--shadow-sidebar);
  z-index: 100;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
}

.brand-logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #ffffff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.brand-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.sidebar-collapse-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sidebar-collapse-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
}

/* Search Box */
.sidebar-search-container {
  padding: 10px 16px 6px;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

#tool-search {
  padding: 8px 12px 8px 32px;
  font-size: 0.85rem;
  border-radius: 8px;
  background: var(--bg-app);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.85rem;
  font-family: inherit;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.theme-toggle-btn {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  cursor: pointer;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  transform: rotate(15deg);
}

/* Show/Hide Sun/Moon Icons depending on theme */
html:not([data-theme="dark"]) .sun-icon {
  display: none;
}
html[data-theme="dark"] .moon-icon {
  display: none;
}

/* Mobile Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* Main Content Area */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 48px 48px 0 48px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  overflow-y: auto;
  height: 100vh;
}

.main-content.no-header {
  padding-top: 24px;
}

.main-content.no-header .tool-stage {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.main-content.no-header .tool-card.active {
  margin-top: auto;
  margin-bottom: auto;
}

.main-header {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.main-header.wide-header {
  max-width: none;
}

/* Collapsed Sidebar Layout Modifications (Desktop only) */
@media (min-width: 769px) {
  .collapsed-sidebar .sidebar {
    width: 78px;
  }

  .collapsed-sidebar .brand-text,
  .collapsed-sidebar .sidebar-search-container,
  .collapsed-sidebar .nav-item span,
  .collapsed-sidebar .theme-label {
    display: none !important;
  }

  .collapsed-sidebar .sidebar-brand {
    flex-direction: column;
    justify-content: center;
    padding: 16px 0;
    gap: 10px;
  }

  .collapsed-sidebar .brand-logo-container {
    justify-content: center;
  }

  .collapsed-sidebar .nav-item {
    justify-content: center;
    padding: 8px 0;
  }

  .collapsed-sidebar .sidebar-footer {
    padding: 12px 0;
    align-items: center;
  }

  .collapsed-sidebar .theme-switch-wrapper {
    justify-content: center;
    width: 100%;
  }

  /* Active/Collapsed styling for collapse button in brand header */
  .collapsed-sidebar .sidebar-collapse-btn {
    background: var(--accent);
    color: #ffffff;
    transform: rotate(180deg);
  }
  
  .collapsed-sidebar .sidebar-collapse-btn:hover {
    background: var(--accent-hover);
    color: #ffffff;
    transform: scale(1.05) rotate(180deg);
  }
}

@media (max-width: 768px) {
  .sidebar-collapse-btn {
    display: none !important;
  }
}

.main-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--text-main), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Tool Stage */
.tool-stage {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
}

/* Some tools (e.g. ImgMeta) need full-width layout */
.tool-stage.wide-tool {
  max-width: none;
}

/* Tool Card Styles */
.tool-card {
  display: none; /* Hidden by default */
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow-card);
  flex-direction: column;
  gap: 20px;
}

.tool-card.active {
  display: flex;
  animation: fadeInScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.tool-card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 8px;
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.form-group.border-top {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  margin-top: 8px;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-main);
}

textarea {
  resize: none;
}

textarea,
input,
select {
  font: inherit;
  font-size: 0.95rem;
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

textarea:hover,
input:hover,
select:hover {
  border-color: var(--border-hover);
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: var(--bg-card);
}

textarea[readonly],
input[readonly] {
  background: var(--bg-app);
  opacity: 0.75;
  cursor: text;
}

textarea[readonly]:focus,
input[readonly]:focus {
  box-shadow: none;
  border-color: var(--border-color);
  background: var(--bg-app);
}

/* Action Buttons */
.btn-primary {
  align-self: flex-start;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #ffffff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Layout Utilities */
.row {
  display: flex;
  gap: 16px;
  width: 100%;
}

.row > * {
  flex: 1;
}

.flex-1 {
  flex: 1;
}

/* Counter & Conversion Results Visuals */
.count-results {
  margin-top: 8px;
}

.result-box {
  background: var(--accent-light);
  border: 1px solid rgba(79, 70, 229, 0.1);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.3s ease;
}

.result-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  font-family: 'Outfit', sans-serif;
}

.result-banner {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
  border-radius: 4px 12px 12px 4px;
  padding: 16px 20px;
  font-weight: 600;
  color: var(--text-main);
  font-size: 1.05rem;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.banner-label {
  color: var(--text-muted);
  font-weight: 500;
}

/* Small note status messages */
.small {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.small.note {
  margin-top: -8px;
}

.status-msg {
  min-height: 18px;
  color: #ef4444; /* Alert color */
  font-weight: 500;
}

html[data-theme="dark"] .status-msg {
  color: #f87171;
}

/* Color Preview Swatch Bar */
.color-preview-bar {
  height: 56px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  transition: background-color 0.25s ease;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}

/* Base Converter Grid Outputs */
.grid-outputs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
}

.grid-outputs .full-width {
  grid-column: span 2;
}

/* Responsive Rules */
@media (max-width: 900px) {
  .main-content {
    padding: 32px 32px 0 32px;
  }

  .main-content.no-header {
    padding-top: 20px;
  }
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    height: 100vh;
    box-shadow: none;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.open {
    left: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.15);
  }

  .main-content {
    padding: 80px 20px 0 20px; /* Offset for mobile header */
  }

  .main-content.no-header {
    padding-top: 72px; /* Offset for mobile header (60px) + 12px margin */
  }

  .tool-card {
    padding: 20px;
  }

  .main-header h1 {
    font-size: 1.75rem;
  }

  .row {
    flex-direction: column;
    gap: 16px;
  }

  .grid-outputs {
    grid-template-columns: 1fr;
  }

  .grid-outputs .full-width {
    grid-column: span 1;
  }
}

/* Inline copy button and label row styling for premium feel */
.label-row-with-copy {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.copy-btn-inline {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(79, 70, 229, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1;
}

.copy-btn-inline:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.copy-btn-inline.copied {
  background: #10b981;
  color: #ffffff;
  border-color: #10b981;
}

html[data-theme="dark"] .copy-btn-inline {
  border-color: rgba(99, 102, 241, 0.3);
}

html[data-theme="dark"] .copy-btn-inline:hover {
  background: var(--accent);
  color: #ffffff;
}

html[data-theme="dark"] .copy-btn-inline.copied {
  background: #059669;
  border-color: #059669;
}

/* Secondary Button Styles */
.btn-secondary {
  align-self: flex-start;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* Search input group styling for IP Lookup */
.search-input-group {
  display: flex;
  gap: 12px;
  width: 100%;
}

@media (max-width: 500px) {
  .search-input-group {
    flex-direction: column;
    gap: 8px;
  }
  .search-input-group button {
    width: 100%;
  }
}

/* Loader spinner styling */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Map visual layout */
.iplookup-results-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: stretch;
  width: 100%;
}

@media (max-width: 900px) {
  .iplookup-results-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.map-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  height: 100%;
}

.map-container {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  flex: 1;
  min-height: 250px;
}

/* ImgMeta Styles */
.imgmeta-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  margin-top: 8px;
}

.imgmeta-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 14px;
  padding: 40px 20px;
  text-align: center;
  background: rgba(79, 70, 229, 0.02);
  transition: all 0.25s ease;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
}

.imgmeta-dropzone:hover,
.imgmeta-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.imgmeta-dropzone svg {
  color: var(--text-muted);
  margin-bottom: 16px;
  transition: color 0.25s ease;
}

.imgmeta-dropzone:hover svg,
.imgmeta-dropzone.dragover svg {
  color: var(--accent);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dropzone-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.dropzone-or {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 8px 0;
}

.dropzone-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 16px;
  max-width: 320px;
}

/* Results grid layout */
.imgmeta-results-grid {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 20px;
  width: 100%;
  animation: fadeInScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@media (max-width: 900px) {
  .imgmeta-results-grid {
    grid-template-columns: 1fr;
  }
}

/* Preview column card */
.imgmeta-preview-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.imgmeta-preview-card {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
}

.imgmeta-img-container {
  aspect-ratio: 4/3;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  position: relative;
  max-height: 140px;
}

.imgmeta-img-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.imgmeta-raw-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--accent);
}

.imgmeta-raw-icon span {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.imgmeta-file-meta {
  padding: 16px;
}

.imgmeta-file-meta h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 12px;
  word-break: break-all;
}

.imgmeta-file-meta p {
  font-size: 0.85rem;
  margin: 6px 0;
  color: var(--text-main);
}

.imgmeta-file-meta p .label {
  color: var(--text-muted);
  font-weight: 500;
  display: inline-block;
  width: 70px;
}

.imgmeta-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.imgmeta-actions button {
  padding: 12px 16px;
  font-size: 0.9rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Data column */
.imgmeta-data-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.imgmeta-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.imgmeta-tabs {
  display: flex;
  background: var(--bg-app);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  gap: 2px;
  flex-wrap: wrap;
}

.imgmeta-tabs .tab-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.imgmeta-tabs .tab-btn:hover {
  color: var(--text-main);
}

.imgmeta-tabs .tab-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

html[data-theme="dark"] .imgmeta-tabs .tab-btn.active {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.imgmeta-search-wrapper {
  max-width: 240px;
  flex: 1;
}

.imgmeta-search-wrapper input {
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 8px;
  height: 36px;
}

/* Scrollable table */
.imgmeta-table-container {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-card);
  overflow: auto;
  max-height: 480px;
}

.imgmeta-table-container.scrollable {
  overflow: auto;
}

.imgmeta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
}

.imgmeta-table th,
.imgmeta-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.imgmeta-table th {
  background: var(--bg-app);
  color: var(--text-muted);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1.5px solid var(--border-color);
  white-space: nowrap;
}

.imgmeta-table tbody tr:last-child td {
  border-bottom: none;
}

.imgmeta-table tbody tr:hover td {
  background: rgba(79, 70, 229, 0.01);
}

.imgmeta-table td:first-child {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

.imgmeta-table td:nth-child(2) {
  color: var(--text-main);
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.imgmeta-table td:nth-child(3) {
  color: var(--text-muted);
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Camera-param grouped view */
.imgmeta-cam-view {
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  max-height: 520px;
  padding-right: 4px;
  padding-bottom: 24px;
}

.imgmeta-cam-view::-webkit-scrollbar {
  width: 6px;
}
.imgmeta-cam-view::-webkit-scrollbar-track {
  background: transparent;
}
.imgmeta-cam-view::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 3px;
}

.imgmeta-param-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  /* No overflow:hidden ??it would clip grid rows when flex child can't grow */
}

.imgmeta-param-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  /* Clip the top corners to match the card border-radius */
  border-radius: 12px 12px 0 0;
}

.imgmeta-param-group-header span.group-icon {
  font-size: 1rem;
  line-height: 1;
}

.imgmeta-param-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.imgmeta-stat-cell {
  flex: 1 1 180px;
  padding: 10px 16px;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  box-sizing: border-box;
}

.imgmeta-stat-cell:last-child {
  border-right: none;
}

/* remove bottom border from last row */
.imgmeta-stat-cell.no-bottom {
  border-bottom: none;
}

.imgmeta-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.imgmeta-stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;       /* force single line */
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Outfit', sans-serif;
}

.imgmeta-stat-value.not-available {
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
  font-size: 0.85rem;
  font-family: inherit;
}

.imgmeta-no-tags-cam {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.imgmeta-no-tags-msg {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 500;
}

/* ?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�
   Random Wheel Styles
   ?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?�?� */
.wheel-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 32px;
  width: 100%;
  align-items: start;
  margin-top: 12px;
}

@media (max-width: 1024px) {
  .wheel-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

.wheel-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px;
  min-height: 520px;
}

.wheel-title-pill {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 10px 36px;
  border-radius: 28px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin-bottom: 24px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  user-select: none;
  z-index: 5;
  letter-spacing: 0.03em;
}

.wheel-canvas-wrapper {
  position: relative;
  width: 420px;
  height: 420px;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.08);
  background: var(--bg-card);
  overflow: visible;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.wheel-canvas-wrapper:hover {
  transform: scale(1.01);
}

.wheel-canvas-wrapper canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.wheel-pointer {
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

.wheel-pointer svg {
  fill: #ef4444;
  width: 36px;
  height: 36px;
}

.wheel-spin-btn-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-app));
  border: 4px solid var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.wheel-spin-btn-center:hover {
  transform: translate(-50%, -50%) scale(1.08);
  background: var(--accent);
  color: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
}

.wheel-spin-btn-center:active {
  transform: translate(-50%, -50%) scale(0.96);
}

.wheel-result-banner {
  margin-top: 24px;
  width: 100%;
  max-width: 420px;
  background: var(--accent-light);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: bannerPopIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes bannerPopIn {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.result-banner-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.wheel-result-banner strong {
  font-size: 1.35rem;
  color: var(--accent);
  font-family: 'Outfit', sans-serif;
  flex-grow: 1;
  text-align: center;
  word-break: break-all;
}

.result-banner-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0 4px;
  line-height: 1;
}

.result-banner-close:hover {
  color: var(--text-main);
}

.wheel-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 24px;
}

.wheel-actions-row {
  display: flex;
  gap: 12px;
  width: 100%;
}

.wheel-actions-row button {
  flex: 1;
}

.btn-danger-custom {
  background: rgba(239, 68, 68, 0.08);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-danger-custom:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
  transform: translateY(-1px);
}

.btn-danger-custom:active {
  transform: translateY(0);
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin-top: 4px;
}

.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 24px;
  background-color: var(--border-color);
  border-radius: 24px;
  transition: background-color 0.25s ease;
  flex-shrink: 0;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 500;
}

.wheel-items-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  max-height: 150px;
  overflow-y: auto;
  min-height: 52px;
}

.wheel-item-chip {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wheel-item-chip.eliminated {
  background: rgba(148, 163, 184, 0.08) !important;
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
  text-decoration: line-through;
  opacity: 0.6;
}

.wheel-item-chip:nth-child(8n+1) { border-left: 3px solid #6366f1; }
.wheel-item-chip:nth-child(8n+2) { border-left: 3px solid #10b981; }
.wheel-item-chip:nth-child(8n+3) { border-left: 3px solid #f59e0b; }
.wheel-item-chip:nth-child(8n+4) { border-left: 3px solid #ec4899; }
.wheel-item-chip:nth-child(8n+5) { border-left: 3px solid #06b6d4; }
.wheel-item-chip:nth-child(8n+6) { border-left: 3px solid #8b5cf6; }
.wheel-item-chip:nth-child(8n+7) { border-left: 3px solid #f97316; }
.wheel-item-chip:nth-child(8n+8) { border-left: 3px solid #3b82f6; }

.keyboard-shortcuts-card {
  background: rgba(148, 163, 184, 0.03);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 16px;
  margin-top: 8px;
}

.keyboard-shortcuts-card h4 {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.keyboard-shortcuts-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.keyboard-shortcuts-card li {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.keyboard-shortcuts-card kbd {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
  color: var(--text-main);
  display: inline-block;
  font-family: inherit;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  font-size: 0.75rem;
}

.custom-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2), 0 10px 10px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-content h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-content p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 8px;
}

.btn-danger-confirm {
  background: #ef4444;
  color: #ffffff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
  transition: background-color 0.2s;
}

.btn-danger-confirm:hover {
  background: #dc2626;
}

.wheel-list-container {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-app);
  overflow: hidden;
  min-height: 280px;
  display: flex;
  flex-direction: column;
}

.wheel-list-view {
  padding: 16px;
  height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wheel-list-item {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 500;
  transition: all 0.2s;
  word-break: break-all;
  text-align: left;
}

.wheel-list-item.eliminated {
  background: rgba(148, 163, 184, 0.05) !important;
  border-color: var(--border-color) !important;
  color: var(--text-muted) !important;
  text-decoration: line-through;
  opacity: 0.65;
}

.wheel-text-input {
  padding: 16px;
  height: 280px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.wheel-options-footer {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.btn-secondary-sm {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-secondary-sm:hover {
  background: var(--bg-app);
  border-color: var(--border-hover);
  color: var(--accent);
}

.btn-secondary-sm:active {
  background: var(--border-color);
}

/* Shiny Footer Styles */
.shiny-footer {
  position: relative;
  margin-top: auto;
  z-index: 90;
  width: calc(100% + 96px);
  margin-left: -48px;
  margin-right: -48px;
  margin-bottom: 0;
  padding: 24px 48px;
  background: var(--bg-footer);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-color);
  border-bottom: none;
  border-left: none;
  border-right: none;
  border-radius: 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.02);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Glowing top border sweep */
.shiny-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--accent), #f43f5e, var(--accent), transparent);
  background-size: 200% 100%;
  animation: shine-sweep 8s linear infinite;
  opacity: 0.8;
}

.shiny-footer-content {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-brand-name {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #f43f5e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-copyright {
  color: var(--text-muted);
}

/* Interactive hover effects */
.shiny-footer:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 -6px 24px rgba(99, 102, 241, 0.06);
}

@keyframes shine-sweep {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 200% 50%;
  }
}

@media (max-width: 900px) {
  .shiny-footer {
    width: calc(100% + 64px);
    margin-left: -32px;
    margin-right: -32px;
    padding: 20px 32px;
  }
}

@media (max-width: 768px) {
  .shiny-footer {
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
    padding: 20px 20px;
  }
}

/* Sidebar Tooltip (JS managed) */
.sidebar-tooltip {
  position: fixed;
  background: var(--bg-card);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(10px);
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.sidebar-tooltip.visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* Home Page Utility Grid Styles */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.home-card:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.08);
  transform: translateY(-4px);
}

.home-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.home-card:hover .home-card-icon {
  background: var(--accent);
  color: #ffffff;
}

.home-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.home-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}


