/* ─────────────────────────────────────────────
   Color Token Studio
   Font: Geist + Geist Mono
   ───────────────────────────────────────────── */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap");

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

[hidden] { display: none !important; }

:root {
  --white: #ffffff;
  --off-white: #f7f6f3;
  --surface: #f0efeb;
  --border: #e2e0d9;
  --border-strong: #c8c5bb;
  --text-primary: #1a1a18;
  --text-muted: #6b6960;
  --text-hint: #9e9b91;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --transition: 0.15s ease;
  --font-sans: "Geist", system-ui, sans-serif;
  --font-mono: "Geist Mono", monospace;
  color-scheme: light;
}

html {
  font-size: 16px;
}

body.dark {
  color-scheme: dark;
  --white: #1e1e1c;
  --off-white: #161614;
  --surface: #252522;
  --border: #2e2e2b;
  --border-strong: #44443f;
  --text-primary: #f0efe9;
  --text-muted: #9e9b91;
  --text-hint: #5a5a54;
}

body {
  font-family: "Geist", system-ui, sans-serif;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--off-white);
  line-height: 1.6;
  padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem);
  min-height: 100vh;
}

/* ── Layout ── */
.wrap {
  width: 100%;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  margin-left: calc(-1 * clamp(1rem, 4vw, 2.5rem));
  margin-right: calc(-1 * clamp(1rem, 4vw, 2.5rem));
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: clamp(1rem, 4vw, 2.5rem);
  padding-right: clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 246, 243, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0;
}

.header__icon {
  width: 20px;
  height: 20px;
  display: block;
  margin-right: 8px;
  flex-shrink: 0;
}

.header-divider {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  margin: 0 12px;
  flex-shrink: 0;
}

body.dark .header {
  background: rgba(22, 22, 20, 0.92);
}

/* ── Color Blindness Simulation ── */
body.vision-deuteranopia  { filter: url(#filter-deuteranopia); }
body.vision-protanopia    { filter: url(#filter-protanopia); }
body.vision-tritanopia    { filter: url(#filter-tritanopia); }
body.vision-achromatopsia { filter: url(#filter-achromatopsia); }

.vision-dropdown {
  position: relative;
  order: 0;
  padding-right: 10px;
  margin-right: 0;
  border-right: 1px solid var(--border);
}

.vision-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: "Geist", sans-serif;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.vision-trigger:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.vision-trigger.active {
  background: var(--text-primary);
  color: var(--white);
  border-color: var(--text-primary);
}

.vision-trigger.active svg {
  stroke: var(--white);
}

.vision-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 300;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10), 0 1px 4px rgba(0, 0, 0, 0.06);
  min-width: 200px;
  overflow: hidden;
}

.vision-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}

.vision-option:hover {
  background: var(--surface);
}

.vision-option--active {
  background: var(--surface);
}

.vision-option__term {
  font-family: "Geist", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}


.vision-option__desc {
  font-family: "Geist", sans-serif;
  font-size: 0.6875rem;
  color: var(--text-hint);
  line-height: 1.2;
}

.header__title {
  font-family: "Geist", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

.header__sub {
  display: none;
}

/* ── Client Field ── */
.client-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.client-field__label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

.client-field:has(.client-field__input:not(:placeholder-shown)) .client-field__label {
  display: none;
}

.client-field__input {
  font-family: "Geist", sans-serif;
  font-size: 1rem;
  font-weight: 400;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  width: 180px;
}

.client-field__input:hover {
  border-color: var(--border);
}

.client-field__input:focus {
  border-color: var(--border-strong);
  background: var(--white);
}

.client-field__input::placeholder {
  color: var(--text-hint);
}

/* ── Color Controls ── */
.controls {
  display: flex;
  gap: 0;
  align-items: center;
  order: 1;
}

.svg-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 500;
  font-family: "Geist", sans-serif;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.svg-copy-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  flex-shrink: 0;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.icon-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.header-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  order: 2;
  padding-left: 10px;
  margin-left: 10px;
  border-left: 1px solid var(--border);
}

.color-control {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 10px;
  min-width: 0;
  border-right: 1px solid var(--border);
}

.color-control:last-child {
  border-right: none;
  padding-right: 0;
}

.color-control__label {
  display: none;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-preview-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  cursor: pointer;
}

.color-preview-wrap:hover .color-preview {
  box-shadow: 0 0 0 3px var(--border-strong);
}

.color-preview {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  pointer-events: none;
  transition:
    background var(--transition),
    box-shadow var(--transition);
}

.color-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

.hex-input {
  flex: 1;
  font-family: "Geist Mono", monospace;
  font-size: 1rem;
  font-weight: 500;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--off-white);
  color: var(--text-primary);
  outline: none;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  letter-spacing: 0.04em;
  width: 90px;
}

.hex-input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(26, 112, 136, 0.12);
}

/* ── Tabs ── */
.tabs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 1.5rem;
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  padding: 4px;
  border-radius: var(--radius-pill);
  width: fit-content;
}

.tab-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

#wcag-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab {
  font-family: "Geist", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition);
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  background: var(--white);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ── Tab Panels ── */
.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* ── Section title ── */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.section-title__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* ── Scales ── */
.scales-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.scales-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.scale-tiles {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
}

.scale-tile:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.scale-tile:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.scale-tile {
  position: relative;
  padding: 10px;
  min-height: 88px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  z-index: 0;
}

.scale-tile:hover {
  transform: scale(1.08);
  z-index: 2;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.14),
    0 10px 20px -4px rgba(0, 0, 0, 0.10);
}

.scale-tile__step {
  font-family: "Geist", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  opacity: 0.9;
}

.scale-tile__hex {
  font-family: "Geist Mono", monospace;
  font-size: 1rem;
  opacity: 0.7;
  letter-spacing: 0.02em;
}

.scale-tile__copy {
  position: absolute;
  top: 7px;
  right: 7px;
  background: transparent;
  border: none;
  padding: 2px;
  cursor: pointer;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.12s;
}

.scale-tile:hover .scale-tile__copy {
  opacity: 0.75;
}

.scale-tile__copy:hover {
  opacity: 1 !important;
}

/* ── WCAG Matrix ── */
.matrix-wrap {
  overflow-x: auto;
  margin-bottom: 3rem;
  padding: 8px;
  margin: -8px -8px 3rem;
}

.matrix-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.6875rem;
  width: 100%;
}


.matrix-family-header {
  font-family: "Geist", sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  padding: 8px 0 0;
  letter-spacing: -0.01em;
}

.matrix-head {
  padding: 4px 3px;
  text-align: center;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 68px;
}

.matrix-head span,
.matrix-row-label span {
  font-size: 0.5rem;
  display: block;
  margin-top: 3px;
  color: var(--text-hint);
}

.matrix-swatch {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid var(--border);
  margin: 0 auto;
}

.matrix-row-label {
  padding: 3px 10px 3px 0;
  text-align: right;
  white-space: nowrap;
  vertical-align: middle;
}

.matrix-row-label .matrix-swatch {
  margin: 0 0 2px auto;
}

.matrix-divider td {
  height: 20px;
  background: var(--off-white);
  font-family: "Geist", sans-serif;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 10px 0 0;
  text-align: right;
  white-space: nowrap;
  border-top: 1px solid var(--border);
}

/* Matrix cells */
.matrix-cell {
  width: 68px;
  min-width: 68px;
  height: 68px;
  padding: 8px 12px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid rgba(0, 0, 0, 0.05);
  cursor: default;
  position: relative;
  transition:
    transform 0.12s ease,
    box-shadow 0.12s ease,
    opacity 0.25s ease;
  z-index: 0;
}

.matrix-cell:not(.matrix-cell--diagonal):hover {
  transform: scale(1.25);
  z-index: 10;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.12),
    0 10px 20px -4px rgba(0, 0, 0, 0.10);
}

.matrix-cell:not(.matrix-cell--diagonal):hover::after {
  content: attr(data-coords);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--white);
  font-family: "Geist Mono", monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  letter-spacing: 0.02em;
}

.matrix-cell--diagonal {
  opacity: 0.2;
}

/* Fokus-Modus: alles außer empfohlenen Zellen ausblenden */
.matrix-focus .matrix-cell {
  opacity: 0.1;
}

.matrix-focus .matrix-cell--recommended {
  opacity: 1;
}

.matrix-focus .matrix-cell--diagonal {
  opacity: 0.04;
}

.mc-sample {
  display: block;
  font-family: "Geist", sans-serif;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  margin-bottom: 1px;
}

.mc-ratio {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.9;
  margin-bottom: 2px;
}

/* Badge always readable: fixed dark/light based on bg luminance via JS */
.mc-badge {
  display: inline-block;
  font-size: 0.5625rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}

.mc-badge--aaa {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.mc-badge--pass {
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
}
.mc-badge--large {
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
}
.mc-badge--fail {
  background: rgba(255, 255, 255, 0.55);
  color: #000;
}

/* ── Token Table ── */
.token-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}

.token-table thead tr {
  background: var(--surface);
}

.token-table th {
  text-align: left;
  font-weight: 500;
  font-size: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.token-table td {
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.token-table tr:last-child td {
  border-bottom: none;
}
.token-name {
  font-family: "Geist Mono", monospace;
  font-size: 1rem;
  color: var(--text-muted);
}
.token-value {
  font-family: "Geist Mono", monospace;
  font-weight: 500;
  color: var(--text-primary);
}

.token-family-header td {
  background: var(--surface);
  padding: 8px 14px;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.token-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  vertical-align: middle;
}

/* ── Export ── */
.export-row {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
}

.export-btn {
  font-family: "Geist", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--white);
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--transition);
}

.export-btn:hover {
  background: var(--surface);
}
.export-btn:active {
  transform: scale(0.98);
}

.btn-flash,
.svg-copy-btn.btn-flash,
.export-btn.btn-flash {
  color: var(--text-primary) !important;
  border-color: var(--border-strong) !important;
}

/* ── Placeholder State ── */
.placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4rem 2rem;
  color: var(--text-hint);
  text-align: center;
}

.placeholder-state__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
}

.placeholder-state__desc {
  font-size: 1rem;
  color: var(--text-hint);
  max-width: 400px;
  line-height: 1.6;
}

/* ── Inspiration ── */
.inspiration-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.25rem;
}

.inspiration-toolbar__label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.inspiration-toolbar__slider {
  flex: 1;
  max-width: 220px;
  accent-color: var(--text-primary);
  cursor: pointer;
}

.inspiration-toolbar__value {
  font-family: "Geist Mono", monospace;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 28px;
}

.inspiration-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.inspiration-section__header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1rem;
}

.inspiration-section__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.inspiration-section__label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.inspiration-layout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: start;
}

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

.inspiration-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.inspiration-palette {
}

.inspiration-palette__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 6px;
}

.inspiration-palette__name {
  font-family: "Geist", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.inspiration-palette__varies {
  font-family: "Geist Mono", monospace;
  font-size: 0.6875rem;
  color: var(--text-hint);
  white-space: nowrap;
}

.inspiration-swatches {
  display: flex;
  height: 72px;
}

.inspiration-swatches .inspiration-swatch:first-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.inspiration-swatches .inspiration-swatch:last-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.inspiration-swatch {
  flex: 1;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  position: relative;
  z-index: 0;
}


.inspiration-swatch:hover {
  transform: scale(1.1);
  z-index: 1;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.12),
    0 10px 20px -4px rgba(0, 0, 0, 0.10);
}

.inspiration-swatch:hover::after {
  content: attr(data-hex);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--white);
  font-family: "Geist Mono", monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  pointer-events: none;
  letter-spacing: 0.02em;
  z-index: 10;
}

/* ── UI Preview ── */
.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 800px) {
  .preview-grid {
    grid-template-columns: 1fr;
  }
}

.preview-screen {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.preview-screen__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.preview-screen__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.15);
}

.preview-screen__label {
  font-size: 0.6875rem;
  margin-left: 4px;
  opacity: 0.5;
}

.preview-screen__body {
  padding: 20px;
}

/* ── Info Modal ── */
.info-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.info-modal.visible {
  opacity: 1;
  pointer-events: all;
}

.info-modal__panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 540px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(6px);
  transition: transform 0.2s ease;
}

.info-modal.visible .info-modal__panel {
  transform: translateY(0);
}

.info-modal__footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.info-modal__cache-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "Geist", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.info-modal__cache-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.info-modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-hint);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.info-modal__close:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.info-modal__title {
  font-family: "Geist", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  padding-right: 2rem;
}

.info-modal__intro {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.info-modal__sections {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.info-modal__section-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-hint);
  margin-bottom: 0.35rem;
}

.info-modal__section p {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.info-modal__dl {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.info-modal__dl-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 12px;
  background: var(--surface);
}

.info-modal__dl-row:nth-child(odd) {
  background: var(--white);
}

.info-modal__dl-row dt {
  font-size: 1rem;
  font-weight: 600;
  font-family: "Geist", sans-serif;
  color: var(--text-primary);
  white-space: nowrap;
  min-width: 80px;
}

.info-modal__dl-row dd {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.info-modal__dl-dt--aaa { color: #084a2b !important; }
.info-modal__dl-dt--aa  { color: #0d5c38 !important; }
.info-modal__dl-dt--large { color: #7a5100 !important; }
.info-modal__dl-dt--fail  { color: #8b2a10 !important; }

.info-modal__section code {
  font-family: "Geist Mono", monospace;
  font-size: 1rem;
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-primary);
}

/* ── Footer ── */
.footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  color: var(--text-hint);
  text-align: center;
}

.footer__link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition);
}

.footer__link:hover {
  color: var(--text-primary);
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text-primary);
  color: var(--white);
  font-size: 1rem;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 999;
}

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


/* ── Score Card ── */
.score-card {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 1.5rem;
}

.score-grade {
  font-family: "Geist", sans-serif;
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  flex-shrink: 0;
  width: 56px;
  text-align: center;
  padding-top: 4px;
}

.score-body {
  flex: 1;
  min-width: 0;
}

.score-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.score-title {
  font-family: "Geist", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.score-desc {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.score-stats {
  display: flex;
  gap: 20px;
  flex-shrink: 0;
}

.score-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.score-stat__val {
  font-family: "Geist", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1;
}

.score-stat__label {
  font-size: 1rem;
  color: var(--text-hint);
  white-space: nowrap;
}

.score-bar {
  display: flex;
  height: 28px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.score-method {
  font-size: 1rem;
  color: var(--text-hint);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}


.matrix-focus-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  font-family: "Geist", sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.matrix-focus-btn:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.matrix-focus-btn.active {
  background: var(--text-primary);
  color: var(--white);
  border-color: var(--text-primary);
}

.matrix-focus-btn.active svg {
  stroke: var(--white);
}

/* ── Matrix Nav ── */
.matrix-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.matrix-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
}

.matrix-nav-btn:hover:not(:disabled) {
  background: var(--surface);
  color: var(--text-primary);
}

.matrix-nav-btn:disabled {
  opacity: 0.3;
  cursor: default;
}


/* ═══════════════════════════════════════════
   Responsive
═══════════════════════════════════════════ */

@media (max-width: 768px) {
  /* Header: stack vertically, sticky stays on mobile too */
  .header {
    flex-direction: column;
    position: sticky;
    gap: 0.75rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
    margin-bottom: 1.25rem;
  }

  /* Left group: stack title + client vertically */
  .header-left {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .header-divider {
    display: none;
  }

  .header__title {
    font-size: 1rem;
  }

  .client-field {
    width: 100%;
  }

  .client-field__input {
    flex: 1;
    width: auto;
  }

  /* Right side: just the tools row now (controls moved to taskbar) */
  .header-right {
    flex-direction: row;
    align-items: center;
    width: auto;
    gap: 0;
  }

  .header-tools {
    order: 1;
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }

  /* Color pickers: fixed bottom taskbar */
  .controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    display: flex;
    flex-direction: row;
    gap: 0;
    width: auto;
    order: unset;
    padding: 10px 16px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: rgba(247, 246, 243, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }

  .color-control {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0 14px;
    min-width: 0;
    border-right: 1px solid var(--border);
    display: block;
  }

  .color-control:first-child {
    padding-left: 0;
  }

  .color-control:last-child {
    border-right: none;
    padding-right: 0;
  }

  .color-control__label {
    display: block;
    font-size: 1rem;
    letter-spacing: 0.02em;
    margin-bottom: 6px;
  }

  .hex-input {
    width: 100%;
    min-width: 0;
    font-size: 1rem;
    padding: 5px;
    letter-spacing: 0;
  }

  /* Body padding so content isn't hidden behind taskbar */
  body {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }

  /* Tabs: scrollable row */
  .tabs-row {
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 1.25rem;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin-bottom: 0;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  /* Scales: horizontal scroll on small screens */
  .scale-tiles {
    overflow-x: auto;
    border-radius: 0;
  }

  .scale-tile {
    min-width: 64px;
  }

  /* Score card: stack vertically */
  .score-card {
    flex-direction: column;
    gap: 12px;
    padding: 16px;
  }

  .score-grade {
    width: auto;
    font-size: 2.5rem;
    padding-top: 0;
  }

  .score-top {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
  }

  .score-stats {
    flex-direction: row;
    gap: 20px;
  }

  .score-stat {
    align-items: flex-start;
  }

  /* Export buttons: wrap */
  .export-row {
    flex-wrap: wrap;
  }

  .export-btn {
    flex: 1 1 140px;
    text-align: center;
  }

  /* Token table: horizontal scroll */
  #tab-tokens {
    overflow-x: auto;
  }

  .footer {
    margin-top: 2.5rem;
  }
}

@media (max-width: 768px) {
  body.dark .controls {
    background: rgba(22, 22, 20, 0.96);
  }
}

/* Info modal: bottom sheet on mobile */
@media (max-width: 560px) {
  .info-modal {
    align-items: flex-end;
    padding: 0;
  }

  .info-modal__panel {
    max-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 85vh;
    padding: 1.5rem 1.25rem;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .tab {
    padding: 7px 13px;
    font-size: 1rem;
  }

  .matrix-head,
  .matrix-cell {
    min-width: 58px;
    width: 58px;
    height: 58px;
  }
}
