:root {
  color-scheme: dark;
  --bg: #171b18;
  --surface: #222824;
  --tile: #f3f1e8;
  --tile-text: #171a17;
  --muted: #9da69e;
  --line: #465048;
  --accent: #c8f970;
  --accent-ink: #16200d;
  --accent-2: #ff8264;
  --yellow: #f7d35c;
  --green: #77b65d;
  --blue: #5587ef;
  --purple: #a264b1;
  --focus: #c8f970;
  --tile-size: 116px;
}

* { box-sizing: border-box; }

html,
body { width: 100%; height: 100%; }

body {
  margin: 0;
  min-width: 320px;
  overflow: hidden;
  background: var(--bg);
  color: #f7f7f4;
  font-family: "Avenir Next", Avenir, Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

a { color: #b9ccff; }

.privacy-link {
  position: fixed;
  top: 18px;
  right: 20px;
  z-index: 20;
  color: #8b8b87;
  font-size: .66rem;
  text-decoration: none;
}

.privacy-link:hover,
.privacy-link:focus-visible { color: #f7f7f4; }

button,
input,
textarea { font: inherit; }

button { cursor: pointer; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.drop-zone:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.masthead {
  position: fixed;
  top: clamp(18px, 4vh, 40px);
  left: 50%;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
  transition:
    top 420ms cubic-bezier(.2,.8,.2,1),
    left 420ms cubic-bezier(.2,.8,.2,1),
    transform 420ms cubic-bezier(.2,.8,.2,1);
}

.masthead-copy {
  opacity: 1;
  transform: translateX(0) scale(1);
  transform-origin: left center;
  visibility: visible;
  transition:
    opacity 180ms ease,
    transform 300ms cubic-bezier(.2,.8,.2,1),
    visibility 0s linear;
}

body.is-workspace-active .masthead {
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  transform: translate3d(0, 0, 0);
}

body.is-workspace-active .masthead-copy {
  opacity: 0;
  transform: translateX(-8px) scale(.96);
  visibility: hidden;
  transition:
    opacity 150ms ease,
    transform 240ms cubic-bezier(.2,.8,.2,1),
    visibility 0s linear 240ms;
}

.solver-mark {
  width: 29px;
  height: 29px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  transform: rotate(0) scale(1);
  transition: transform 420ms cubic-bezier(.2,.8,.2,1);
}

body.is-workspace-active .masthead .solver-mark { transform: rotate(-4deg) scale(.92); }

.solver-mark i {
  display: block;
  border: 1px solid rgba(240,245,239,.2);
  border-radius: 2px;
  background: rgba(240,245,239,.045);
}

.solver-mark i:nth-child(1),
.solver-mark i:nth-child(2),
.solver-mark i:nth-child(5),
.solver-mark i:nth-child(8) {
  border-color: var(--accent);
  background: var(--accent);
}

.solver-mark i:nth-child(9) {
  border-color: var(--accent-2);
  background: var(--accent-2);
}

.masthead h1 {
  margin: 0;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 750;
  letter-spacing: -0.055em;
}

.masthead p {
  max-width: 260px;
  margin: 2px 0 0;
  overflow: hidden;
  color: #758078;
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
}

.canvas {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background:
    radial-gradient(circle at 50% 44%, rgba(200,249,112,.035), transparent 46%),
    var(--bg);
}

.canvas-hint {
  position: absolute;
  left: 50%;
  bottom: 102px;
  margin: 0;
  transform: translateX(-50%);
  color: #696969;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.canvas-hint.is-hidden { opacity: 0; }

.tile {
  width: var(--tile-size);
  height: var(--tile-size);
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  border: 0;
  border-radius: 9px;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--tile);
  color: var(--tile-text);
  box-shadow: 0 1px 0 rgba(255,255,255,.28) inset, 0 3px 12px rgba(0,0,0,.18);
  font-size: clamp(0.63rem, 1.2vw, 0.88rem);
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: 0.01em;
  text-align: center;
  text-transform: uppercase;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  backface-visibility: hidden;
  transform-origin: top left;
  contain: layout style;
  will-change: transform;
  cursor: grab;
  transition: box-shadow 130ms ease, filter 130ms ease;
}

@media (hover: hover) {
  .tile:hover { filter: brightness(1.025); }
}
.tile:active,
.tile.is-dragging { cursor: grabbing; }
.tile.is-dragging { z-index: 50; box-shadow: 0 18px 45px rgba(0,0,0,.46); transition: none; }
.tile.is-selected { box-shadow: 0 0 0 4px var(--focus), 0 15px 34px rgba(0,0,0,.33); }
.tile[data-group="yellow"] { background: var(--yellow); }
.tile[data-group="green"] { background: var(--green); }
.tile[data-group="blue"] { background: var(--blue); color: #fff; }
.tile[data-group="purple"] { background: var(--purple); color: #fff; }

.tile.has-visual {
  padding: 0;
  background: var(--tile);
}

.tile-crop {
  position: relative;
  display: block;
  flex: 0 0 auto;
  overflow: hidden;
  pointer-events: none;
}

.tile-crop img {
  max-width: none;
  position: absolute;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.tile.has-visual[data-group="yellow"] { background: var(--yellow); box-shadow: 0 0 0 4px var(--yellow), 0 3px 12px rgba(0,0,0,.18); }
.tile.has-visual[data-group="green"] { background: var(--green); box-shadow: 0 0 0 4px var(--green), 0 3px 12px rgba(0,0,0,.18); }
.tile.has-visual[data-group="blue"] { background: var(--blue); box-shadow: 0 0 0 4px var(--blue), 0 3px 12px rgba(0,0,0,.18); }
.tile.has-visual[data-group="purple"] { background: var(--purple); box-shadow: 0 0 0 4px var(--purple), 0 3px 12px rgba(0,0,0,.18); }
.tile.has-visual.is-selected { box-shadow: 0 0 0 4px var(--focus), 0 15px 34px rgba(0,0,0,.33); }
.tile.has-visual.is-dragging { box-shadow: 0 18px 45px rgba(0,0,0,.46); }
.tile.is-hint-focus { animation: hint-pulse 1.7s ease-in-out infinite; }

@keyframes hint-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(200,249,112,.35), 0 3px 12px rgba(0,0,0,.18); }
  50% { box-shadow: 0 0 0 8px rgba(200,249,112,.78), 0 16px 38px rgba(0,0,0,.4); }
}

.tile[data-has-note="true"]::after {
  content: "";
  width: 7px;
  height: 7px;
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: .52;
}

.toolbar {
  max-width: calc(100% - 24px);
  min-height: 66px;
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 100;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  transform: translateX(-50%);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 18px;
  background: rgba(31,37,33,.92);
  box-shadow: 0 18px 55px rgba(0,0,0,.46);
  backdrop-filter: blur(18px);
  scrollbar-width: none;
}

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

.tool {
  min-width: 58px;
  height: 48px;
  padding: 4px 10px;
  border: 0;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  color: #d9d8d3;
  font-size: 0.61rem;
  font-weight: 750;
}

.tool:hover:not(:disabled) { background: rgba(255,255,255,.07); }
.tool.primary { background: var(--accent); color: var(--accent-ink); }
.tool.primary:hover { background: #d7ff8f; }
.tool:disabled { opacity: .3; cursor: default; }
.tool-icon { font-size: 1.1rem; line-height: 1; }
.solve-icon { color: var(--accent); }
.tool.icon-only { min-width: 48px; font-size: .9rem; letter-spacing: .08em; }

.zoom-tools {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #4c4c4c;
  border-radius: 11px;
  background: rgba(0,0,0,.16);
}

.zoom-tools button {
  width: 36px;
  height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #f1f0e8;
  font-size: 1.2rem;
  font-weight: 650;
  line-height: 1;
}

.zoom-tools button:active:not(:disabled) { background: rgba(255,255,255,.1); }
.zoom-tools button:disabled { opacity: .3; cursor: default; }

.zoom-tools output {
  min-width: 42px;
  color: #9c9b96;
  font-size: .58rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: center;
}

.toolbar-rule {
  width: 1px;
  height: 34px;
  flex: 0 0 1px;
  margin: 0 3px;
  background: #494949;
}

.color-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 7px;
}

.color-tools button {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--tile);
}

.color-tools button[data-group="yellow"] { background: var(--yellow); }
.color-tools button[data-group="green"] { background: var(--green); }
.color-tools button[data-group="blue"] { background: var(--blue); }
.color-tools button[data-group="purple"] { background: var(--purple); }
.color-tools button:disabled { opacity: .24; cursor: default; }
.color-tools button.is-active { border-color: #fff; box-shadow: 0 0 0 2px #222; }

dialog {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100dvh - 130px);
  inset: auto 12px 92px;
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #4b574e;
  border-radius: 18px;
  background: var(--surface);
  color: #fff;
  box-shadow: 0 30px 90px rgba(0,0,0,.62);
}

dialog::backdrop { background: rgba(0,0,0,.46); backdrop-filter: blur(3px); }
.upload-sheet {
  width: min(620px, calc(100% - 24px));
  max-height: calc(100dvh - 48px);
  bottom: 24px;
}
.solve-sheet { width: min(680px, calc(100% - 24px)); }
.sheet-shell { padding: 25px; }

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.sheet-header h2 { margin: 6px 0 0; font-size: 1.45rem; letter-spacing: -0.04em; }
.eyebrow { margin: 0; color: var(--muted); font-size: .62rem; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }

.close-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: 1px solid #525252;
  border-radius: 50%;
  background: transparent;
  color: #ddd;
  font-size: 1.35rem;
}

.drop-zone {
  min-height: 250px;
  border: 1px dashed #626262;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #1c1c1c;
  text-align: center;
  cursor: pointer;
}

.drop-zone.is-over { border-color: var(--focus); background: #252f24; }
.drop-zone img { width: 100%; max-height: 330px; object-fit: contain; }
.upload-prompt strong { display: block; margin-bottom: 7px; }
.upload-prompt small { color: var(--muted); }

.paste-controls {
  margin-top: 10px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
}

.paste-target {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #535353;
  border-radius: 9px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #222;
  color: #aaa;
  font-size: .7rem;
  line-height: 1.3;
  white-space: nowrap;
  cursor: text;
}

.paste-target:empty::before { content: attr(data-placeholder); }
.paste-target:focus { border-color: var(--focus); color: #ddd; }

.import-mode {
  margin: 14px 0 0;
  padding: 0;
  border: 0;
}

.import-mode legend {
  margin-bottom: 7px;
  color: #aaa9a4;
  font-size: .66rem;
  font-weight: 750;
}

.import-mode-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

.mode-toggle {
  padding: 3px;
  border: 1px solid #505050;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #1c1c1c;
}

.mode-choice { position: relative; }
.mode-choice input { position: absolute; opacity: 0; pointer-events: none; }

.mode-choice span {
  min-height: 36px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #aaa9a4;
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
}

.mode-choice input:checked + span { background: var(--accent); color: var(--accent-ink); }
.mode-choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

.info-button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #565656;
  border-radius: 50%;
  background: #292929;
  color: #bbb;
  font-family: Georgia, serif;
  font-size: .86rem;
  font-weight: 700;
}

.rebus-help {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #202020;
  color: #aaa9a4;
  font-size: .68rem;
  line-height: 1.45;
}

.sheet-status {
  min-height: 46px;
  margin: 0;
  padding: 13px 2px;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.4;
}

.sheet-status.is-error { color: #ff9d90; }
.sheet-status.is-working { color: var(--accent); }

.turnstile-container { min-height: 0; margin: -2px 0 14px; }

.upload-privacy {
  margin: -3px 0 16px;
  padding: 11px 12px;
  border: 1px solid #454545;
  border-radius: 9px;
  background: #222;
  color: #aaa9a4;
  font-size: .66rem;
  line-height: 1.5;
}

.upload-privacy a { white-space: nowrap; }

.solve-panel { display: grid; gap: 14px; }

.solve-intro {
  padding: 18px;
  border: 1px solid #4a554c;
  border-radius: 12px;
  background: #1c211e;
}

.solve-intro strong { display: block; color: #f4f4ef; font-size: .95rem; }
.solve-intro p { margin: 7px 0 0; color: #aaa9a4; font-size: .75rem; line-height: 1.55; }

.solve-confidence {
  padding: 17px 18px;
  border: 1px solid rgba(200,249,112,.34);
  border-radius: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 14px;
  background: rgba(200,249,112,.055);
}

.solve-confidence > strong {
  grid-row: 1 / 3;
  color: var(--accent);
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.06em;
}

.solve-confidence > span:not(.confidence-meter) { color: #c6c6bf; font-size: .7rem; line-height: 1.35; }

.confidence-meter {
  height: 4px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: #424942;
}

.confidence-meter i {
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  border-radius: inherit;
  background: var(--accent);
}

.solve-summary { margin: 0 2px; color: #d2d1cb; font-size: .77rem; line-height: 1.5; }
.ai-request-usage,
.hint-usage {
  margin: -7px 2px 0;
  color: #89968c;
  font-size: .62rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.solve-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.solve-answer-details {
  overflow: hidden;
  border: 1px solid #4a554c;
  border-radius: 11px;
  background: #1c211e;
}

.solve-answer-details > summary {
  min-height: 48px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #e9e8e2;
  font-size: .74rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.solve-answer-details > summary::-webkit-details-marker { display: none; }
.solve-answer-details > summary::after { content: "+"; color: var(--accent); font-size: 1.1rem; }
.solve-answer-details[open] > summary::after { content: "−"; }
.solve-answer-details[open] > summary { border-bottom: 1px solid #424b44; }
.solve-answer-details .solve-groups { padding: 10px; }

.solve-group {
  min-width: 0;
  padding: 14px;
  border: 1px solid #484f49;
  border-radius: 11px;
  background: #1c211e;
}

.solve-group-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.solve-group h3 { margin: 0; color: #f3f2ed; font-size: .8rem; line-height: 1.25; }
.solve-group-header > span { color: #a6b49f; font-size: .65rem; font-weight: 800; }
.solve-group p { margin: 10px 0 0; color: #9d9c97; font-size: .68rem; line-height: 1.45; }

.solve-chips { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }

.solve-chips span {
  max-width: 100%;
  padding: 4px 7px;
  overflow: hidden;
  border-radius: 6px;
  background: #333a35;
  color: #e1e0db;
  font-size: .61rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.solve-group:nth-child(1) { border-top-color: var(--yellow); }
.solve-group:nth-child(2) { border-top-color: var(--green); }
.solve-group:nth-child(3) { border-top-color: var(--blue); }
.solve-group:nth-child(4) { border-top-color: var(--purple); }
.solve-status { min-height: 38px; padding-bottom: 8px; }

.solve-privacy {
  margin: 0 0 16px;
  color: #858982;
  font-size: .63rem;
  line-height: 1.5;
}

.coach-launcher {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 82px);
  z-index: 95;
  min-height: 50px;
  padding: 7px 13px 7px 8px;
  border: 1px solid rgba(200,249,112,.34);
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(28,33,30,.96);
  color: #f2f2ed;
  box-shadow: 0 14px 38px rgba(0,0,0,.42);
  backdrop-filter: blur(18px);
}

.coach-launcher > span:last-child { display: grid; gap: 1px; text-align: left; }
.coach-launcher strong { font-size: .7rem; }
.coach-launcher small { color: #99a098; font-size: .57rem; }

.coach-avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: .9rem;
  font-weight: 900;
}

.coach-panel {
  width: min(350px, calc(100% - 24px));
  max-height: min(480px, calc(100dvh - 125px));
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 82px);
  z-index: 95;
  overflow: hidden;
  border: 1px solid rgba(200,249,112,.3);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  background: rgba(28,33,30,.96);
  box-shadow: 0 22px 60px rgba(0,0,0,.48);
  backdrop-filter: blur(18px);
}

.coach-header {
  padding: 11px;
  border-bottom: 1px solid #414a43;
  display: flex;
  align-items: center;
  gap: 9px;
}

.coach-header .coach-avatar { width: 31px; height: 31px; border-radius: 10px; }
.coach-header div { min-width: 0; flex: 1; }
.coach-header h2 { margin: 0; font-size: .78rem; }
.coach-header p { margin: 2px 0 0; color: #8e968f; font-size: .56rem; }

.coach-close {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid #505751;
  border-radius: 50%;
  background: transparent;
  color: #b8bdb8;
  font-size: 1.05rem;
}

.coach-messages {
  min-height: 120px;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.coach-message {
  width: fit-content;
  max-width: 88%;
  padding: 9px 11px;
  border-radius: 13px 13px 13px 4px;
  background: #29302b;
  color: #e3e3dc;
  font-size: .68rem;
  line-height: 1.48;
}

.coach-message.is-user {
  align-self: flex-end;
  border-radius: 13px 13px 4px 13px;
  background: #d9f6a6;
  color: #1b2317;
}

.coach-message p { margin: 0; }
.coach-message button {
  margin-top: 7px;
  padding: 4px 7px;
  border: 1px solid #556258;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font-size: .57rem;
  font-weight: 750;
}

.coach-message.is-typing { color: #a9b0a9; font-style: italic; }

.coach-prompts {
  padding: 0 12px 9px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
}

.coach-prompts button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid #4d5850;
  border-radius: 999px;
  flex: 0 0 auto;
  background: transparent;
  color: #cdd3cd;
  font-size: .59rem;
}

.coach-status { min-height: 0; margin: 0; padding: 0 13px 7px; color: #9ba29c; font-size: .58rem; }
.coach-status:empty { display: none; }
.coach-status.is-error { color: #ff9d90; }

.coach-form {
  padding: 9px;
  border-top: 1px solid #414a43;
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(20,24,21,.68);
}

.coach-form input {
  min-width: 0;
  height: 38px;
  flex: 1;
  padding: 0 11px;
  border: 1px solid #4a534c;
  border-radius: 10px;
  background: #202521;
  color: #f1f1ec;
  font-size: .68rem;
}

.coach-form button {
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1rem;
  font-weight: 900;
}

.coach-form button:disabled { opacity: .35; cursor: default; }

.ai-usage-summary {
  margin: 2px 0 16px;
  padding: 12px;
  border: 1px solid #454b46;
  border-radius: 10px;
  display: grid;
  gap: 8px;
  background: #202421;
  font-size: .66rem;
  font-variant-numeric: tabular-nums;
}

.ai-usage-summary > strong { color: #e5e5df; font-size: .72rem; }
.ai-usage-summary > div { display: flex; justify-content: space-between; gap: 16px; color: #929891; }
.ai-usage-summary > div > span:last-child { text-align: right; }
.ai-usage-summary .ai-usage-total {
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px solid #3d433e;
  color: #c8f970;
}

.privacy-page {
  height: auto;
  min-height: 100%;
  overflow: auto;
  overscroll-behavior: auto;
}

.privacy-shell {
  width: min(720px, calc(100% - 40px));
  margin: 0 auto;
  padding: 56px 0 90px;
}

.privacy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 52px;
}

.privacy-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  font-weight: 850;
  letter-spacing: -.03em;
  text-decoration: none;
}

.privacy-header > a:last-child { color: #aaa9a4; font-size: .75rem; }
.privacy-content h1 { margin: 0 0 10px; font-size: clamp(2rem, 7vw, 3.6rem); letter-spacing: -.065em; }
.privacy-updated { margin: 0 0 42px; color: #777; font-size: .7rem; }
.privacy-content h2 { margin: 36px 0 10px; font-size: 1.05rem; }
.privacy-content p,
.privacy-content li { color: #c2c1bc; font-size: .88rem; line-height: 1.7; }
.privacy-content ul { padding-left: 1.25rem; }
.privacy-callout { padding: 16px 18px; border: 1px solid #555; border-radius: 10px; background: #252525; }

.sheet-actions,
.board-utilities {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: .75rem;
  font-weight: 800;
}

.button.primary { background: var(--accent); color: var(--accent-ink); }
.button.secondary { border-color: #535353; background: #333; color: #e7e6e1; }
.button.danger { border-color: #6a4545; background: transparent; color: #f1a6a0; }

.field {
  display: block;
  margin: 0 0 18px;
  color: #c5c4bf;
  font-size: .69rem;
  font-weight: 750;
}

.field input,
.field textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid #505050;
  border-radius: 8px;
  background: #1c1c1c;
  color: #fff;
}

.field input { height: 42px; padding: 0 11px; }
.field textarea { padding: 11px; resize: vertical; line-height: 1.4; }
.field-help { margin: -10px 0 18px; color: #8f8e89; font-size: .66rem; line-height: 1.4; }

.color-field { margin: 0 0 18px; padding: 0; border: 0; }
.color-field legend { margin-bottom: 8px; color: #c5c4bf; font-size: .69rem; font-weight: 750; }
.editor-colors { display: flex; flex-wrap: wrap; gap: 7px; }

.editor-colors button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid #505050;
  border-radius: 7px;
  background: #333;
  color: #ddd;
  font-size: .68rem;
}

.editor-colors button.is-active { border-color: #fff; box-shadow: 0 0 0 1px #fff inset; }

.dimensions {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 9px;
  align-items: end;
  margin-bottom: 18px;
}

.dimensions .field { margin: 0; }
.dimensions > span { padding-bottom: 12px; color: #777; }
.board-utilities { justify-content: space-between; padding-top: 3px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 102px;
  z-index: 200;
  transform: translateX(-50%);
  padding: 11px 15px;
  border: 1px solid #565656;
  border-radius: 9px;
  background: #0f0f0f;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,.35);
  font-size: .75rem;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .masthead { top: 16px; }
  .masthead p { display: none; }
  .canvas-hint { bottom: 96px; }
  .toolbar { min-height: 62px; border-radius: 16px; }
  .tool { min-width: 52px; height: 44px; }
  .color-tools { gap: 6px; padding-inline: 4px; }
  .color-tools button { width: 21px; height: 21px; }
  dialog { bottom: 86px; }
  .upload-sheet { bottom: 16px; max-height: calc(100dvh - 32px); }
  .solve-sheet { bottom: 16px; max-height: calc(100dvh - 32px); }
  .sheet-shell { padding: 20px; }
  .drop-zone { min-height: 210px; }
  .paste-controls { grid-template-columns: 1fr; }
  .paste-controls .button { width: 100%; }
  .paste-target { justify-content: center; text-align: center; }
  .privacy-link { top: 20px; right: 14px; }
  .privacy-shell { width: min(100% - 30px, 720px); padding-top: 32px; }
  .privacy-header { margin-bottom: 38px; }
  .solve-groups { grid-template-columns: 1fr; }
  .solve-actions { flex-wrap: wrap; }
  .coach-launcher,
  .coach-panel { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 74px); }
  .coach-launcher { right: 10px; }
  .coach-panel { right: 8px; width: calc(100% - 16px); max-height: min(460px, calc(100dvh - 105px)); }
}

@media (pointer: coarse), (max-width: 700px) {
  .zoom-tools { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  .tile.is-hint-focus { animation: none; box-shadow: 0 0 0 5px var(--focus), 0 15px 34px rgba(0,0,0,.33); }
}
