:root {
  --ink: #23172f;
  --muted: #665c70;
  --paper: #fffaf0;
  --paper-deep: #f2e5cd;
  --purple: #6e3ca2;
  --purple-dark: #321a50;
  --pink: #d84587;
  --gold: #e5a927;
  --green: #438c5a;
  --teal: #15838d;
  --absent: #5d5862;
  --line: rgba(50, 26, 80, .18);
  --shadow: 0 18px 50px rgba(40, 22, 55, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: radial-gradient(circle at 15% 0%, #efe2fb 0, transparent 28rem), linear-gradient(180deg, #fbf6ff, #fffaf0 38rem); font-family: Inter, Montserrat, ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, a:focus-visible { outline: 4px solid #1598a5; outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .7rem 1rem; background: white; border-radius: .6rem; color: var(--purple-dark); font-weight: 900; }
.skip-link:focus { top: 1rem; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem); color: white; background: rgba(36, 17, 58, .96); box-shadow: 0 4px 20px rgba(20, 8, 30, .2); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: .75rem; padding: 0; color: white; border: 0; background: transparent; text-align: left; cursor: pointer; }
.brand-logo { display: block; width: 3.35rem; height: 2.65rem; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand small { color: #d8cbe2; font-size: .74rem; }
.topbar nav { display: flex; gap: .4rem; }
.topbar nav button { border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: .55rem .85rem; color: white; background: transparent; font-weight: 800; cursor: pointer; }
.topbar nav button:hover { background: rgba(255,255,255,.12); }

main { min-height: 80vh; }
.screen { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.5rem, 4vw, 4rem) 0; }
.eyebrow { margin: 0 0 .4rem; color: var(--purple); font-size: .78rem; font-weight: 950; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 1rem; font-size: clamp(2rem, 5vw, 4.5rem); line-height: 1.02; letter-spacing: -.045em; }
h2 { font-size: clamp(1.55rem, 3vw, 2.4rem); line-height: 1.15; }
h3 { line-height: 1.2; }
.content-header h1:focus, .monster-panel h1:focus, .reveal-heading h2:focus { outline: none; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 3rem; border: 2px solid transparent; border-radius: .8rem; padding: .75rem 1.1rem; font-weight: 950; cursor: pointer; }
.button-primary { color: white; background: var(--purple); box-shadow: 0 7px 0 var(--purple-dark); }
.button-primary:hover { transform: translateY(2px); box-shadow: 0 5px 0 var(--purple-dark); }
.button-secondary { border-color: var(--purple); color: var(--purple-dark); background: white; }
.button-secondary:hover { background: #f4eafa; }
.button-wide { width: 100%; }
.back-link, .text-button { border: 0; padding: .55rem 0; color: var(--purple-dark); background: transparent; font-weight: 900; text-decoration: underline; text-underline-offset: .22em; cursor: pointer; }

.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(220px, .65fr); align-items: center; overflow: hidden; min-height: 34rem; border: 1px solid var(--line); border-radius: 2rem; background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(246,231,255,.94)); box-shadow: var(--shadow); }
.hero-copy { padding: clamp(2rem, 5vw, 5rem); }
.hero-lead { max-width: 47rem; font-size: clamp(1.05rem, 2vw, 1.3rem); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin: 2rem 0 1rem; }
.hero-milo { width: min(100%, 460px); align-self: end; justify-self: center; filter: drop-shadow(0 22px 20px rgba(35,23,47,.18)); }
.launch-note { margin: 1.2rem 0 0; color: var(--muted); font-weight: 750; }
.section-heading { max-width: 48rem; margin: 4rem 0 1.5rem; }
.guide-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.guide-card { display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 1.25rem; overflow: hidden; min-height: 16rem; border: 1px solid var(--line); border-radius: 1.4rem; padding: 1.2rem; background: white; box-shadow: 0 12px 30px rgba(40,22,55,.09); }
.guide-card img { width: 100%; max-height: 15rem; object-fit: contain; border-radius: 1rem; }
.barry-card img { background: #eadcf2; }
.guide-chip { display: inline-block; margin-bottom: .65rem; border-radius: 999px; padding: .25rem .65rem; color: white; background: var(--purple); font-size: .78rem; font-weight: 950; text-transform: uppercase; }
.month-promise { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 2rem; }
.month-promise div { border-left: 5px solid var(--gold); border-radius: .5rem; padding: 1rem; background: rgba(255,255,255,.72); }
.month-promise strong, .month-promise span { display: block; }
.month-promise span { color: var(--muted); }

.content-screen { max-width: 1050px; }
.content-header { margin: 1.4rem 0 2rem; }
.content-header h1 { font-size: clamp(2.2rem, 5vw, 4rem); }
.tutorial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.tutorial-grid article { position: relative; border: 1px solid var(--line); border-radius: 1.2rem; padding: 1.4rem; background: white; box-shadow: 0 9px 24px rgba(40,22,55,.08); }
.step-number { display: grid; place-items: center; width: 2.3rem; aspect-ratio: 1; margin-bottom: 1rem; border-radius: 50%; color: white; background: var(--purple); font-weight: 950; }
.example-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .25rem; }
.example-row span, .mini-tile { display: inline-grid; place-items: center; width: 2.4rem; aspect-ratio: 1; border: 2px solid #867d8c; border-radius: .3rem; background: white; font-weight: 950; }
.tile-key { display: grid; gap: .7rem; padding: 0; list-style: none; }
.tile-key li { display: flex; align-items: center; gap: .7rem; }
.mini-tile.correct { color: white; border-color: var(--green); background: var(--green); }
.mini-tile.present { color: #241500; border-color: var(--gold); background: var(--gold); }
.mini-tile.absent { color: white; border-color: var(--absent); background: var(--absent); }
.permission-note { margin: 1.5rem 0; border: 2px dashed #c6a2dc; border-radius: 1rem; padding: 1.2rem; background: #f7ecff; }
.permission-note p { margin-bottom: 0; }
.center-actions { text-align: center; }

.calendar-key { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; color: var(--muted); font-size: .9rem; font-weight: 800; }
.calendar-key span { display: flex; align-items: center; gap: .4rem; }
.dot { width: .8rem; aspect-ratio: 1; border-radius: 50%; background: #aaa; }
.dot.available { background: var(--purple); }.dot.complete { background: var(--green); }.dot.locked { background: #b8b2bc; }
.calendar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; }
.day-card { position: relative; min-height: 9.4rem; border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; text-align: left; background: white; box-shadow: 0 6px 18px rgba(40,22,55,.07); cursor: pointer; }
.day-card:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 25px rgba(40,22,55,.13); }
.day-card:disabled { color: #77707a; background: #efebf0; cursor: not-allowed; box-shadow: none; }
.day-card .day-number { display: block; color: var(--purple); font-size: 1.4rem; font-weight: 1000; }
.day-card strong { display: block; margin: .35rem 0; line-height: 1.2; }
.day-card small { display: block; color: var(--muted); }
.day-card .status-pill { position: absolute; right: .65rem; top: .65rem; border-radius: 999px; padding: .2rem .5rem; color: white; background: var(--purple); font-size: .68rem; font-weight: 950; text-transform: uppercase; }
.day-card.is-complete { border-color: var(--green); background: #eef9f0; }
.day-card.is-complete .status-pill { background: var(--green); }
.day-card.is-today { outline: 3px solid var(--gold); outline-offset: 2px; }

.game-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.game-layout { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(430px, 1.25fr); gap: 1.25rem; align-items: start; }
.monster-panel, .puzzle-panel { border: 1px solid var(--line); border-radius: 1.4rem; padding: clamp(1rem, 3vw, 1.7rem); background: white; box-shadow: var(--shadow); }
.monster-panel { position: sticky; top: 6rem; }
.monster-panel h1 { font-size: clamp(1.7rem, 3.3vw, 2.8rem); }
.profile-zoom-trigger { position: relative; display: block; width: 100%; margin: 0 0 1rem; border: 0; border-radius: .9rem; padding: 0; overflow: hidden; background: #21172a; cursor: zoom-in; }
.profile-zoom-trigger img { display: block; width: 100%; max-height: 28rem; object-fit: contain; }
.profile-zoom-label { position: absolute; right: .65rem; bottom: .65rem; border-radius: 999px; padding: .42rem .7rem; color: white; background: rgba(35, 23, 47, .92); box-shadow: 0 3px 12px rgba(0,0,0,.3); font-size: .78rem; font-weight: 900; }
.profile-zoom-trigger:hover .profile-zoom-label { background: var(--purple); }
.profile-dialog { width: min(96vw, 1500px); height: min(94vh, 1100px); max-width: none; max-height: none; border: 0; border-radius: 1.2rem; padding: 0; color: var(--ink); background: #17101e; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.profile-dialog::backdrop { background: rgba(20, 10, 29, .86); backdrop-filter: blur(4px); }
.profile-dialog-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1rem; color: white; background: var(--purple-dark); }
.profile-dialog-bar h2 { margin: 0; font-size: clamp(1rem, 2.5vw, 1.45rem); }
.profile-zoom-controls { display: flex; align-items: center; gap: .35rem; }
.profile-zoom-controls button { display: grid; place-items: center; width: 2.65rem; height: 2.65rem; border: 2px solid rgba(255,255,255,.75); border-radius: .65rem; color: white; background: rgba(255,255,255,.08); font-size: 1.5rem; font-weight: 900; cursor: pointer; }
.profile-zoom-controls button:disabled { opacity: .4; cursor: not-allowed; }
.profile-zoom-controls output { min-width: 3.2rem; color: white; text-align: center; font-size: .78rem; font-weight: 900; }
.profile-dialog-close { min-height: 2.65rem; border: 2px solid white; border-radius: .7rem; padding: .35rem .8rem; color: white; background: transparent; font-weight: 900; cursor: pointer; }
.profile-dialog-close:hover { color: var(--purple-dark); background: white; }
.profile-dialog-image-wrap { display: grid; place-items: center; height: calc(100% - 7.3rem); overflow: auto; padding: .75rem; }
.profile-dialog-image-wrap img { display: block; width: auto; max-width: 100%; height: auto; max-height: 100%; object-fit: contain; }
.profile-dialog-image-wrap img.is-zoomed { max-width: none; max-height: none; }
.profile-dialog-help { margin: 0; padding: .55rem 1rem; color: #efe7f4; background: #17101e; text-align: center; font-size: .82rem; }
.hint-box { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: .7rem; margin-top: .8rem; border-radius: .8rem; padding: .7rem; background: #f4ecfa; }
.hint-box img { width: 100%; }
.hint-box p { margin: 0; }
.puzzle-panel { text-align: center; }
.puzzle-panel h2 { margin-bottom: .3rem; }
.game-status { min-height: 1.6rem; margin-bottom: 1rem; color: var(--muted); font-weight: 850; }
.board { display: grid; grid-template-rows: repeat(6, 1fr); gap: .35rem; width: min(100%, 360px); margin: 0 auto 1.2rem; }
.board-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; }
.tile { position: relative; display: grid; place-items: center; aspect-ratio: 1; border: 2px solid #a9a1ad; border-radius: .35rem; background: #fffdf9; font-size: clamp(1.35rem, 4vw, 2rem); font-weight: 1000; text-transform: uppercase; }
.tile.filled { border-color: var(--purple-dark); }
.tile.correct { color: white; border-color: var(--green); background: var(--green); }
.tile.present { color: #231700; border-color: var(--gold); background: var(--gold); }
.tile.absent { color: white; border-color: var(--absent); background: var(--absent); }
.tile.correct::after, .tile.present::after { position: absolute; right: .2rem; bottom: .05rem; font-size: .65rem; }
.tile.correct::after { content: "✓"; }.tile.present::after { content: "◆"; }
.keyboard { display: grid; gap: .35rem; margin: 0 auto; max-width: 620px; }
.key-row { display: flex; justify-content: center; gap: .28rem; }
.key { min-width: 2.15rem; height: 3.2rem; border: 0; border-radius: .38rem; padding: 0 .42rem; background: #ddd6df; font-size: .92rem; font-weight: 950; cursor: pointer; }
.key.wide { min-width: 4rem; font-size: .75rem; }
.key.correct { color: white; background: var(--green); }.key.present { color: #241500; background: var(--gold); }.key.absent { color: white; background: var(--absent); }
.barry-says { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 1rem; margin-top: 1.4rem; border: 2px solid #c4a0da; border-radius: 1rem; padding: .8rem; text-align: left; background: #f7edfc; }
.barry-says img { width: 92px; aspect-ratio: 1; border-radius: .8rem; object-fit: cover; }
.barry-says blockquote { margin: 0; font-size: 1.03rem; font-weight: 760; }
.reveal-panel { margin-top: 1.25rem; border: 1px solid var(--line); border-radius: 1.4rem; padding: clamp(1.2rem, 4vw, 2.5rem); background: white; box-shadow: var(--shadow); }
.reveal-heading h2 { margin-bottom: .35rem; font-size: clamp(2rem, 5vw, 3.4rem); letter-spacing: .08em; }
.reveal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.reveal-grid article { border-radius: 1rem; padding: 1.2rem; background: #f7f1fa; }
.boundary-copy { margin-bottom: 0; color: var(--muted); font-size: .9rem; }
.music-card { background: #fff5d9 !important; }
.music-link { display: block; margin-top: .65rem; border: 1px solid #b5871a; border-radius: .7rem; padding: .65rem; color: #3b2900; background: white; font-weight: 850; text-decoration: none; }
.music-link small { display: block; color: #725a22; }
.reveal-actions { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: flex-end; margin-top: 1rem; }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.5rem clamp(1rem, 4vw, 3rem); color: #d9cce4; background: var(--purple-dark); font-size: .82rem; }
footer p { margin: 0; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-milo { max-width: 300px; }
  .guide-grid, .game-layout { grid-template-columns: 1fr; }
  .monster-panel { position: static; }
  .profile-zoom-trigger img { max-height: 22rem; }
  .calendar-grid { grid-template-columns: repeat(4, 1fr); }
  .tutorial-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
  .topbar { align-items: flex-start; }
  .brand small { display: none; }
  .topbar nav { flex-direction: column; }
  .topbar nav button { padding: .35rem .65rem; font-size: .78rem; }
  .screen { width: min(100% - 1rem, 1180px); padding-top: 1rem; }
  .hero { min-height: 0; border-radius: 1.2rem; }
  .hero-copy { padding: 1.35rem; }
  .hero-actions { display: grid; }
  .guide-card { grid-template-columns: 100px 1fr; padding: .8rem; }
  .profile-zoom-trigger img { max-height: 14rem; }
  .profile-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .profile-dialog-bar { flex-wrap: wrap; }
  .profile-dialog-bar h2 { width: calc(100% - 6rem); }
  .profile-zoom-controls { order: 3; width: 100%; justify-content: center; }
  .profile-dialog-image-wrap { height: calc(100% - 10.6rem); }
  .month-promise { grid-template-columns: 1fr 1fr; }
  .calendar-grid { grid-template-columns: repeat(2, 1fr); }
  .day-card { min-height: 8.4rem; }
  .reveal-grid { grid-template-columns: 1fr; }
  .barry-says { grid-template-columns: 72px 1fr; }
  .barry-says img { width: 72px; }
  .key { min-width: 0; flex: 1; height: 3rem; padding: 0 .2rem; }
  .key.wide { flex: 1.55; min-width: 0; }
  footer { display: block; }
  footer p + p { margin-top: .45rem; }
}

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

@media (forced-colors: active) {
  .tile, .key, .day-card { forced-color-adjust: none; }
}
