* { box-sizing: border-box; }

body[data-game="guesshue"] { margin: 0; min-height: 100vh; background: var(--slate-50); color: var(--slate-700); }
.hue-page { width: min(calc(100% - 40px), 920px); margin: 0 auto; padding: 34px 0 72px; }
.hue-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 24px; }
.hue-heading h1 { margin: 5px 0 7px; color: var(--slate-900); font-size: clamp(36px, 6vw, 52px); line-height: 1; letter-spacing: -.045em; }
.hue-heading p { max-width: 600px; margin: 0; color: var(--slate-600); }
.heading-actions { display: flex; gap: 8px; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; padding: 0; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: white; color: var(--slate-600); box-shadow: var(--shadow-xs); cursor: pointer; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.hue-card { overflow: hidden; border: 1px solid var(--slate-200); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-sm); }
.score-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--slate-200); background: var(--slate-50); }
.score-strip div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-right: 1px solid var(--slate-200); }
.score-strip div:last-child { border-right: 0; }
.score-strip span { color: var(--slate-500); font-size: 13px; }
.score-strip strong { color: var(--slate-800); font-size: 15px; }
.play-stage { min-height: 590px; display: grid; place-items: center; padding: clamp(24px, 5vw, 52px); }

.start-panel { max-width: 560px; text-align: center; }
.start-panel h2 { margin: 7px 0 10px; color: var(--slate-900); font-size: clamp(28px, 5vw, 40px); letter-spacing: -.035em; }
.start-panel > p { max-width: 470px; margin: 0 auto 22px; color: var(--slate-600); line-height: 1.6; }
.start-panel > small { display: block; margin-top: 13px; color: var(--slate-500); }
.preview-grid { width: 148px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0 auto 24px; padding: 9px; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: var(--slate-50); }
.preview-grid i { aspect-ratio: 1; border-radius: 6px; background: hsl(202 69% 57%); }
.preview-grid i.odd { background: hsl(218 69% 57%); }

.primary-button { min-height: 46px; padding: 10px 18px; border: 1px solid var(--cobalt-600); border-radius: var(--radius-md); background: var(--cobalt-600); color: white; font: 700 14px/1 var(--font-body); cursor: pointer; }
.primary-button:hover { background: var(--cobalt-700); }
.primary-button span { margin-left: 8px; }
.text-button { width: 100%; margin-top: 8px; padding: 10px; border: 0; background: transparent; color: var(--slate-500); cursor: pointer; }

.round-panel { width: min(100%, 570px); }
.round-copy { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.round-copy h2 { margin: 5px 0 0; color: var(--slate-900); font-size: clamp(23px, 4vw, 30px); letter-spacing: -.025em; }
.timer-number { min-width: 54px; color: var(--slate-800); font: 600 22px/1 var(--font-mono); text-align: right; }
.timer-number::after { content: "s"; color: var(--slate-400); font-size: 13px; }
.timer-track { height: 7px; overflow: hidden; margin-bottom: 18px; border-radius: 99px; background: var(--slate-200); }
.timer-track i { width: 100%; height: 100%; display: block; border-radius: inherit; background: var(--cobalt-500); transform-origin: left; will-change: transform; }
.timer-track i.urgent { background: var(--danger); }
.hue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(7px, 1.5vw, 12px); padding: clamp(8px, 1.5vw, 12px); border: 1px solid var(--slate-200); border-radius: var(--radius-lg); background: var(--slate-50); }
.hue-tile { position: relative; aspect-ratio: 1; min-width: 0; padding: 0; border: 0; border-radius: clamp(10px, 2vw, 17px); background: var(--tile-colour); box-shadow: inset 0 1px rgba(255,255,255,.24), 0 1px 2px rgba(20,25,40,.1); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.hue-tile:hover { transform: translateY(-2px); box-shadow: inset 0 1px rgba(255,255,255,.24), 0 5px 14px rgba(20,25,40,.14); }
.hue-tile:focus-visible { outline: 3px solid white; box-shadow: 0 0 0 5px var(--cobalt-600); }
.hue-tile.correct { animation: hue-correct .24s ease-out; }
.hue-tile.wrong { animation: hue-wrong .24s ease-in-out; }
.hue-tile.reveal::after { content: ""; position: absolute; inset: 8px; border: 3px solid rgba(255,255,255,.95); border-radius: calc(clamp(10px, 2vw, 17px) - 4px); box-shadow: 0 0 0 2px rgba(20,25,40,.42); }
.round-status { min-height: 22px; margin: 14px 0 0; color: var(--slate-500); font-size: 13px; text-align: center; }

.ad-card { height: 92px; display: grid; place-items: center; margin: 20px 0; border: 1px dashed var(--slate-300); border-radius: var(--radius-md); color: var(--slate-400); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.about-card { display: grid; grid-template-columns: .85fr 1.15fr; gap: 34px; padding: 28px; border: 1px solid var(--slate-100); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-sm); }
.about-card h2, .related-card h2 { margin: 5px 0 0; color: var(--slate-800); font-size: 23px; }
.about-card p { margin: 0; color: var(--slate-600); line-height: 1.65; }
.related-card { margin-top: 20px; padding: 24px 28px; border: 1px solid var(--slate-100); border-radius: var(--radius-lg); background: white; box-shadow: var(--shadow-sm); }
.related-card h2 { margin-bottom: 16px; }
.related-card a { display: inline-flex; gap: 12px; margin: 0 22px 6px 0; color: var(--cobalt-700); font-size: 14px; font-weight: 600; text-decoration: none; }

.dialog { width: min(calc(100% - 32px), 500px); padding: 28px; border: 1px solid var(--slate-200); border-radius: var(--radius-lg); background: white; color: var(--slate-600); box-shadow: var(--shadow-lg); }
.dialog::backdrop { background: rgba(20,25,40,.48); }
.dialog h2 { margin: 6px 0 18px; color: var(--slate-800); }
.dialog-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; background: transparent; color: var(--slate-500); font-size: 24px; cursor: pointer; }
.steps { margin: 0 0 18px; padding: 0; list-style: none; }
.steps li { display: flex; gap: 13px; padding: 12px 0; border-top: 1px solid var(--slate-200); }
.steps li > span { color: var(--cobalt-600); font-size: 12px; font-weight: 700; }
.steps p { margin: 3px 0 0; color: var(--slate-500); font-size: 13px; }
.result-dialog { text-align: center; }
.result-mark { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 14px; border: 1px solid var(--cobalt-100); border-radius: var(--radius-md); background: var(--cobalt-50); color: var(--cobalt-700); font-size: 20px; font-weight: 700; }
.result-note { margin: -8px 0 18px; color: var(--slate-500); font-size: 14px; }
.reveal-swatches { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 17px 0; border-top: 1px solid var(--slate-200); }
.reveal-swatches div i { height: 66px; display: block; border: 1px solid var(--slate-200); border-radius: var(--radius-sm); }
.reveal-swatches div span { display: block; margin-top: 5px; color: var(--slate-500); font-size: 12px; }
.reveal-swatches > strong { color: var(--slate-500); font: 600 12px/1 var(--font-mono); }
.result-grid, .record-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 18px; border-block: 1px solid var(--slate-200); }
.result-grid div, .record-grid div { padding: 13px 6px; border-right: 1px solid var(--slate-200); }
.result-grid div:last-child, .record-grid div:nth-child(2n) { border-right: 0; }
.result-grid strong, .result-grid span, .record-grid strong, .record-grid span { display: block; }
.result-grid span, .record-grid span { margin-top: 2px; color: var(--slate-500); font-size: 12px; }
.record-grid { grid-template-columns: 1fr 1fr; }
.record-grid div:nth-child(n+3) { border-top: 1px solid var(--slate-200); }
.recent-runs { display: flex; flex-wrap: wrap; gap: 7px; }
.recent-runs span { min-width: 32px; padding: 5px 8px; border-radius: var(--radius-sm); background: var(--slate-100); color: var(--slate-600); font: 600 12px/1.4 var(--font-mono); text-align: center; }
#snackbar { position: fixed; z-index: var(--global-toast-z); left: 50%; top: var(--global-toast-top); translate: -50% -18px; max-width: calc(100% - 32px); padding: 10px 14px; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: white; box-shadow: var(--shadow-md); color: var(--slate-700); opacity: 0; pointer-events: none; transition: .2s; }
#snackbar.show { translate: -50% 0; opacity: 1; }

@keyframes hue-correct { 50% { transform: scale(1.045); } }
@keyframes hue-wrong { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

@media (max-width: 700px) {
  .hue-page { width: min(calc(100% - 16px), 920px); padding-top: 22px; }
  .hue-heading { align-items: flex-start; }
  .hue-heading p { font-size: 14px; }
  .score-strip div { display: block; padding: 11px 12px; }
  .score-strip span, .score-strip strong { display: block; }
  .score-strip strong { margin-top: 2px; }
  .play-stage { min-height: 500px; padding: 24px 14px; }
  .round-copy h2 { font-size: 21px; }
  .about-card { grid-template-columns: 1fr; gap: 10px; padding: 22px; }
  .related-card { padding: 22px; }
  .related-card a { display: flex; justify-content: space-between; margin-right: 0; padding: 8px 0; border-top: 1px solid var(--slate-200); }
  .dialog { padding: 25px 18px; }
}

@media (max-width: 390px) {
  .hue-heading h1 { font-size: 34px; }
  .hue-heading p { max-width: 260px; }
  .heading-actions { gap: 5px; }
  .icon-button { width: 38px; height: 38px; }
  .play-stage { min-height: 460px; }
}

@media (prefers-reduced-motion: reduce) {
  .hue-tile { transition: none; }
}
