:root {
  --paper: #f4efe5;
  --paper-bright: #fffdf8;
  --navy: #18314e;
  --navy-soft: #304861;
  --sage: #607b65;
  --sage-pale: #dfe5d7;
  --coral: #ed665c;
  --muted: #6e786f;
  --line: rgba(24, 49, 78, 0.16);
  --shadow: 0 22px 65px rgba(57, 48, 34, 0.11);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -8%, rgba(151, 180, 142, 0.24), transparent 32rem),
    radial-gradient(circle at 95% 28%, rgba(237, 102, 92, 0.09), transparent 30rem),
    repeating-linear-gradient(0deg, rgba(24,49,78,.012) 0, rgba(24,49,78,.012) 1px, transparent 1px, transparent 4px),
    var(--paper);
  color: var(--navy);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.button { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 8px; background: var(--sage); color: white; font-weight: 800; text-decoration: none; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button-outline { border-color: var(--line); background: white; color: var(--navy); }
.hidden { display: none !important; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.site-shell { min-height: 100vh; padding: 0 28px 48px; }
.site-header {
  width: min(1240px, 100%);
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand-mark { display: inline-flex; align-items: center; gap: 11px; color: var(--navy); text-decoration: none; }
.brand-mark svg { width: 31px; height: 31px; color: var(--coral); stroke-width: 2.3; }
.brand-mark span { font-size: 27px; font-weight: 950; letter-spacing: .085em; }
.header-streak {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,253,248,.58);
  color: var(--muted);
  font-size: 12px;
}
.header-streak svg { width: 17px; color: var(--coral); fill: rgba(237,102,92,.15); }
.header-streak strong { color: var(--navy); font-size: 16px; }
.game-stage { width: min(980px, 100%); margin: 0 auto; padding-top: 29px; }
.stage-heading { margin-bottom: 15px; text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--sage); font-size: 11px; font-weight: 900; letter-spacing: .19em; }
.stage-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(41px, 6vw, 68px);
  line-height: .97;
  letter-spacing: -.05em;
}
.sponsor-card {
  position: relative;
  width: min(690px, 100%);
  min-height: 88px;
  margin: 0 auto 17px;
  padding: 12px 20px;
  display: grid;
  grid-template-columns: 76px 1fr auto;
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(24,49,78,.18);
  border-radius: 13px;
  background: rgba(255,253,248,.72);
  text-decoration: none;
  box-shadow: 0 9px 26px rgba(64,54,39,.04);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.sponsor-card:hover { transform: translateY(-2px); border-color: rgba(96,123,101,.6); box-shadow: 0 13px 32px rgba(64,54,39,.08); }
.sponsor-card > svg { width: 18px; color: var(--sage); }
.sponsor-logo { width: 64px; height: 60px; display: grid; place-items: center; border-right: 1px solid var(--line); }
.sponsor-logo img { width: 50px; height: 50px; object-fit: contain; }
.sponsor-logo > span { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 11px; background: var(--sage-pale); color: var(--sage); font-weight: 950; letter-spacing: .08em; }
.sponsor-copy { display: grid; gap: 3px; min-width: 0; }
.sponsor-copy small { color: var(--sage); font-size: 9px; font-style: normal; font-weight: 900; letter-spacing: .15em; }
.sponsor-copy strong { font-family: Georgia, "Times New Roman", serif; font-size: 19px; }
.sponsor-copy em { overflow: hidden; color: var(--muted); font-size: 12px; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.daily-label { width: max-content; max-width: 100%; margin: 0 auto 11px; padding: 7px 16px; border-radius: 5px; background: var(--sage-pale); color: #4b6953; font-size: 10px; font-weight: 950; letter-spacing: .17em; text-align: center; }
.daily-label span { padding: 0 5px; }
.clock { margin: 10px auto 8px; display: flex; align-items: baseline; justify-content: center; gap: 8px; color: var(--sage); }
.clock svg { width: 18px; align-self: center; }
.clock strong { color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: clamp(35px, 5vw, 54px); font-variant-numeric: tabular-nums; line-height: 1; }
.clock span { font-family: Georgia, "Times New Roman", serif; font-size: clamp(16px, 2.4vw, 24px); font-weight: 700; }
.puzzle-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8.5;
  overflow: hidden;
  border: 1px solid rgba(54, 55, 48, .3);
  border-radius: 12px;
  background: #0a0d12;
  box-shadow: var(--shadow), 0 0 0 6px rgba(255,255,255,.3);
}
.reveal-image-wrap, .reveal-canvas, .photo-mosaic { position: absolute; inset: 0; width: 100%; height: 100%; }
.reveal-image-wrap { overflow: hidden; background: #05070b; }
.reveal-image { width: 100%; height: 100%; display: block; object-fit: cover; transition: filter 70ms linear, transform 70ms linear; }
.scramble-reveal, .focus-reveal { position: absolute; inset: 0; overflow: hidden; background: #03050a; }
.scramble-reveal span { position: absolute; display: block; background-repeat: no-repeat; border: 1px solid rgba(255,255,255,.05); will-change: transform; }
.focus-reveal img { width: 100%; height: 100%; display: block; object-fit: cover; }
.focus-reveal-base, .focus-reveal-window { position: absolute; inset: 0; will-change: filter, transform, clip-path; }
.focus-reveal-window { filter: saturate(1.08) contrast(1.05); }
.mosaic-mask { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(24, 1fr); grid-template-rows: repeat(16, 1fr); gap: 1px; }
.mosaic-mask span { background: #070a10; border: 1px solid rgba(255,255,255,.025); transition: opacity 240ms ease, transform 240ms ease; }
.darkness-vignette { position: absolute; inset: 0; background: radial-gradient(circle at 50% 46%, transparent 0, rgba(0,0,0,.52) 42%, #000 100%); pointer-events: none; }
.photo-mosaic { display: grid; grid-template-columns: repeat(16, 1fr); grid-template-rows: repeat(10, 1fr); background: #05060d; }
.photo-cell { position: relative; overflow: hidden; background-position: center; background-size: cover; border: 1px solid rgba(5,6,13,.52); }
.photo-cell-target { position: absolute; inset: -1px; background-repeat: no-repeat; background-size: 1600% 1000%; transition: opacity 80ms linear; }
.frame-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.intro-overlay { padding: 30px; background: linear-gradient(180deg, rgba(7,15,23,.33), rgba(7,15,23,.84)); backdrop-filter: blur(4px); }
.round-icon { width: 48px; height: 48px; margin-bottom: 12px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.13); color: #fff; }
.round-icon svg { width: 25px; }
.intro-overlay p, .result-overlay p { margin: 0 0 9px; color: #c9d6bc; font-size: 11px; font-weight: 950; letter-spacing: .17em; }
.intro-overlay h2, .result-overlay h2 { max-width: 760px; margin: 0; color: #fffdf8; font-family: Georgia, "Times New Roman", serif; font-size: clamp(35px, 6vw, 69px); line-height: .98; letter-spacing: -.045em; }
.intro-overlay > span:not(.round-icon) { margin: 14px 0 23px; color: #d7dce4; font-size: 14px; }
.start-button, .share-button { min-height: 52px; padding-inline: 22px !important; border: 0 !important; border-radius: 10px !important; background: var(--sage) !important; color: white !important; font-weight: 900 !important; }
.start-button:hover, .share-button:hover { background: #708b74 !important; transform: translateY(-1px); }
.countdown-overlay { background: rgba(9,20,29,.52); backdrop-filter: blur(8px); }
.countdown-overlay span { color: #f2f6df; font-size: clamp(90px, 22vw, 210px); font-weight: 950; line-height: 1; }
.result-overlay { padding: 25px; background: linear-gradient(180deg, rgba(8,18,27,.25), rgba(8,18,27,.91)); backdrop-filter: blur(6px); }
.result-icon { width: 49px; height: 49px; margin-bottom: 12px; display: grid; place-items: center; border-radius: 50%; background: #e9efcb; color: var(--sage); }
.result-icon svg { width: 23px; }
.result-overlay h2 { font-size: clamp(34px, 5vw, 56px); }
.result-overlay > strong { margin-top: 8px; color: #e9efcb; font-size: clamp(38px, 7vw, 75px); font-variant-numeric: tabular-nums; line-height: 1; }
.result-overlay > span { margin-top: 6px; color: #c7a520; font-size: 12px; }
.failed-overlay .result-icon { background: #ffd4d0; color: var(--coral); }
.result-streak { margin-top: 12px; display: flex; align-items: center; gap: 7px; color: white; }
.result-streak svg { width: 18px; color: #ff887f; fill: rgba(237,102,92,.2); }
.result-streak small { padding-left: 8px; color: #bec6cf; border-left: 1px solid rgba(255,255,255,.2); }
.result-actions { margin-top: 15px; }
.share-status { margin-top: 7px; color: #d6dae1; }
.progress-track { position: absolute; z-index: 8; left: 20px; right: 20px; bottom: 17px; height: 4px; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.28); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: #e9efcb; transition: width 32ms linear; }
.game-controls { min-height: 89px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 22px; border-bottom: 1px solid var(--line); }
.mode-copy, .attempt-copy { display: flex; flex-direction: column; gap: 5px; }
.attempt-copy { align-items: end; }
.mode-copy span, .attempt-copy span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .14em; }
.mode-copy strong, .attempt-copy strong { font-size: 14px; }
.solve-button { min-width: 225px; min-height: 62px; border: 0 !important; border-radius: 9px !important; background: var(--coral) !important; color: white !important; font-size: 22px !important; font-weight: 950 !important; letter-spacing: .045em; box-shadow: 0 10px 26px rgba(220,82,73,.25); }
.solve-button:hover:not(:disabled) { background: #f27870 !important; transform: translateY(-2px); }
.solve-button:disabled { opacity: .28; box-shadow: none; }
.habit-card { width: min(660px, 100%); margin: 22px auto 0; padding: 16px 19px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,253,248,.5); }
.habit-card > svg { width: 24px; flex: none; color: var(--coral); fill: rgba(237,102,92,.16); }
.habit-card div { display: grid; gap: 4px; }
.habit-card strong { font-family: Georgia, "Times New Roman", serif; font-size: 16px; }
.habit-card span { color: var(--muted); font-size: 12px; }
.photo-credit { margin: 12px 2px 0; color: #7c827b; font-size: 10px; text-align: right; }
.photo-credit a { color: var(--sage); }
.inline-error { color: #a33d37; font-size: 13px; text-align: center; }
.site-footer { width: min(980px, 100%); margin: 32px auto 0; padding-top: 19px; display: grid; grid-template-columns: auto 1fr auto; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; }
.site-footer span:nth-child(2) { text-align: center; }
.site-footer a { color: var(--sage); }
.answer-dialog { width: min(500px, calc(100% - 28px)); padding: 25px; border: 1px solid var(--line) !important; border-radius: 16px !important; background: var(--paper-bright) !important; color: var(--navy) !important; box-shadow: 0 30px 90px rgba(54,45,32,.28) !important; }
.answer-dialog::backdrop { background: rgba(9,18,28,.62); backdrop-filter: blur(5px); }
.dialog-heading { margin-bottom: 15px; }
.dialog-heading p { margin: 6px 0 0; color: var(--muted); line-height: 1.6; }
.answer-dialog h2 { color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: 31px; letter-spacing: -.03em; }
.answer-dialog [data-slot="dialog-description"] { color: var(--muted); line-height: 1.6; }
.answer-form { display: grid; gap: 12px; margin-top: 7px; }
.answer-form input { min-height: 55px; border-color: var(--line); background: #f8f3e9; color: var(--navy); font-size: 17px; }
.answer-form button { min-height: 49px; background: var(--sage); color: white; font-weight: 900; }
.wrong-answer { display: grid; gap: 10px; }
.wrong-answer p { margin: 0; color: #a63f38; font-size: 13px; }
.wrong-answer button { background: var(--coral); }
.loading-screen { min-height: 100vh; padding: 30px; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--muted); }
.loading-screen .brand-mark { margin-bottom: 22px; }

/* Admin */
.admin-shell { min-height: 100vh; background: #eef1ec; }
.admin-topbar { min-height: 72px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #14283e; color: white; }
.admin-topbar .brand-mark { color: white; }
.admin-topbar .brand-mark svg { color: #ff8a80; }
.admin-topbar nav { display: flex; align-items: center; gap: 14px; font-size: 12px; }
.admin-topbar nav a { display: inline-flex; align-items: center; gap: 5px; color: #dce5dc; }
.admin-main { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 60px; }
.admin-heading { margin-bottom: 26px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.admin-heading p { margin: 0 0 5px; color: var(--sage); font-size: 10px; font-weight: 950; letter-spacing: .16em; }
.admin-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 5vw, 52px); letter-spacing: -.04em; }
.admin-heading span { color: var(--muted); font-size: 13px; }
.metrics-grid { margin-bottom: 25px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.metric-card { min-height: 112px; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 11px; background: white; }
.metric-card span { color: var(--muted); font-size: 9px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.metric-card strong { color: var(--navy); font-family: Georgia, "Times New Roman", serif; font-size: 31px; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr); gap: 20px; align-items: start; }
.admin-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: 0 10px 35px rgba(39,52,43,.05); }
.admin-panel-header { padding: 19px 21px; border-bottom: 1px solid var(--line); }
.admin-panel-header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 24px; }
.admin-panel-header p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.admin-form { padding: 21px; display: grid; gap: 17px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--navy-soft); font-size: 10px; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.field input, .field textarea, .field select { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid rgba(24,49,78,.2); border-radius: 8px; background: #fbfaf6; color: var(--navy); outline: none; }
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(96,123,101,.12); }
.field small { color: var(--muted); font-size: 10px; }
.upload-box { padding: 15px; border: 1px dashed rgba(24,49,78,.28); border-radius: 9px; background: #f7f8f3; }
.admin-submit { min-height: 50px; background: var(--coral) !important; color: white !important; font-weight: 950 !important; }
.admin-status { margin: 0; padding: 11px 13px; border-radius: 8px; background: var(--sage-pale); color: #3e6547; font-size: 12px; }
.admin-status.error { background: #ffe2df; color: #983a34; }
.preview-panel { position: sticky; top: 18px; }
.admin-preview { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #080b10; }
.admin-preview-empty { height: 100%; display: grid; place-items: center; color: #aeb7c0; text-align: center; }
.admin-preview .reveal-image-wrap, .admin-preview .reveal-canvas, .admin-preview .photo-mosaic { inset: 0; }
.preview-controls { padding: 17px; display: grid; gap: 11px; }
.preview-controls input[type="range"] { width: 100%; accent-color: var(--coral); }
.preview-readout { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.preview-readout strong { color: var(--navy); }
.schedule-list { margin-top: 20px; }
.schedule-items { display: grid; }
.schedule-item { padding: 14px 20px; display: grid; grid-template-columns: 86px 1fr auto; align-items: center; gap: 14px; border-top: 1px solid var(--line); }
.schedule-item:first-child { border-top: 0; }
.schedule-item time { color: var(--sage); font-size: 11px; font-weight: 900; }
.schedule-item div { display: grid; gap: 3px; }
.schedule-item strong { font-size: 13px; }
.schedule-item span { color: var(--muted); font-size: 10px; }
.schedule-item em { padding: 5px 8px; border-radius: 99px; background: var(--sage-pale); color: var(--sage); font-size: 9px; font-style: normal; font-weight: 900; }
.privacy-page { width: min(740px, calc(100% - 40px)); margin: 0 auto; padding: 50px 0 90px; }
.privacy-page h1 { font-family: Georgia, "Times New Roman", serif; font-size: 50px; letter-spacing: -.04em; }
.privacy-page h2 { margin-top: 30px; font-family: Georgia, "Times New Roman", serif; }
.privacy-page p, .privacy-page li { color: var(--navy-soft); line-height: 1.75; }
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -.12em; }
.admin-login { width: min(470px, calc(100% - 32px)); min-height: 100vh; margin: 0 auto; display: grid; place-content: center; }
.admin-login-card { padding: 27px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.admin-login-card h1 { margin: 16px 0 7px; font: 700 39px/1 Georgia,serif; letter-spacing: -.04em; }
.admin-login-card p { color: var(--muted); }
.admin-login-card form { display: grid; gap: 13px; }
.admin-login-card input { width: 100%; min-height: 47px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.login-error { padding: 10px 12px; border-radius: 8px; background: #ffe3df; color: #913b35 !important; font-size: 12px; }

@media (max-width: 980px) {
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
  .preview-panel { position: static; }
}

@media (max-width: 680px) {
  .site-shell { padding: 0 15px 35px; }
  .site-header { min-height: 65px; }
  .brand-mark span { font-size: 21px; }
  .brand-mark svg { width: 26px; }
  .header-streak { padding: 6px 10px; }
  .game-stage { padding-top: 23px; }
  .stage-heading h1 { font-size: 42px; }
  .eyebrow { font-size: 9px; }
  .sponsor-card { grid-template-columns: 56px 1fr auto; gap: 11px; padding: 11px 13px; }
  .sponsor-logo { width: 51px; }
  .sponsor-copy strong { font-size: 16px; }
  .sponsor-copy em { max-width: 215px; }
  .puzzle-frame { aspect-ratio: 4 / 5; }
  .intro-overlay { padding: 22px; }
  .intro-overlay h2 { font-size: 40px; }
  .result-overlay h2 { font-size: 37px; }
  .result-overlay > strong { font-size: 50px; }
  .result-streak { margin-top: 8px; }
  .game-controls { grid-template-columns: 1fr 1fr; padding: 15px 0; }
  .solve-button { grid-column: 1 / -1; grid-row: 1; min-width: 100%; }
  .attempt-copy { align-items: end; }
  .site-footer { grid-template-columns: 1fr; gap: 9px; text-align: center; }
  .site-footer span:nth-child(2) { text-align: center; }
  .admin-topbar { padding: 0 18px; }
  .admin-topbar nav span { display: none; }
  .admin-main { width: min(100% - 24px, 1240px); padding-top: 23px; }
  .admin-heading { align-items: start; flex-direction: column; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .field-grid { grid-template-columns: 1fr; }
  .schedule-item { grid-template-columns: 76px 1fr; }
  .schedule-item em { grid-column: 2; width: max-content; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
