:root {
  color-scheme: light;
  --ink: #204f54;
  --muted: #658084;
  --teal: #168b99;
  --teal-dark: #126c78;
  --line: #43757a;
  --cream: #f6f2e9;
  --paper: #fffdf8;
  --yellow: #f5dc7b;
  --orange: #e98c62;
  --background-warm: #fff6d7;
  --background-cool: #dff4ef;
  --shadow: 0 14px 40px rgba(44, 89, 89, .11);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--cream); }
body { margin: 0; color: var(--ink); background: radial-gradient(circle at 5% 3%, var(--background-warm) 0, transparent 27rem), radial-gradient(circle at 92% 88%, var(--background-cool) 0, transparent 31rem), var(--cream); min-height: 100vh; }
/* Suppress accidental double-tap zoom while keeping scrolling and pinch zoom. */
button { font: inherit; cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .43; }
button:focus-visible { outline: 3px solid #ee8d5f; outline-offset: 3px; z-index: 2; }
img { max-width: 100%; }
h1, h2, p { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.page { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
.card { background: var(--paper); border: 1px solid #e6e5d9; border-radius: 30px; box-shadow: var(--shadow); }
.eyebrow { color: var(--teal-dark); font-size: .72rem; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; margin: 0 0 9px; }

.topbar { width: min(1120px, calc(100% - 40px)); height: 78px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 900; letter-spacing: .04em; white-space: nowrap; }
.topbar-brand img { width: 32px; height: 32px; }
.text-button, .icon-button { background: none; border: 0; color: var(--ink); font-weight: 800; }
.text-button { padding: 10px 6px; }
.text-button:hover { color: var(--teal); }
.icon-button { width: 40px; height: 40px; border-radius: 50%; background: #fffdf9; box-shadow: 0 3px 12px #547e7e1a; font-size: 1.2rem; }
.icon-button:hover { background: #edf7f3; }

.primary-button, .secondary-button, .danger-button { border-radius: 999px; min-height: 48px; padding: 11px 23px; font-weight: 900; transition: transform .18s ease, box-shadow .18s ease, background .18s ease; }
.primary-button { background: var(--teal); border: 2px solid var(--teal); color: white; box-shadow: 0 7px 0 #0e6472; }
.primary-button:hover { background: #0d7685; transform: translateY(-2px); box-shadow: 0 9px 0 #0e6472; }
.primary-button:active { transform: translateY(5px); box-shadow: 0 2px 0 #0e6472; }
.secondary-button { background: #fffefa; border: 2px solid #b4cbca; color: var(--ink); }
.secondary-button:hover { background: #eef7f4; }
.danger-button { background: #ba5548; border: 2px solid #ba5548; color: #fff; }
.danger-button:hover { background: #9e453a; }

.home-page { padding-top: 18px; }
.hero { min-height: 490px; display: grid; grid-template-columns: 1.12fr .88fr; overflow: hidden; position: relative; background: linear-gradient(130deg, #fffdf8 0%, #fffaf0 54%, #e8f6f3 100%); }
.hero::before { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: #fbe9b5; left: -80px; bottom: -90px; }
.hero-copy { position: relative; z-index: 1; padding: 74px 0 56px 68px; }
.hero h1 { font-size: clamp(2.5rem, 5vw, 4.4rem); line-height: 1.26; letter-spacing: .04em; margin: 0 0 23px; }
.hero h1 span { color: var(--teal); }
.lead { color: #526f72; max-width: 390px; line-height: 1.9; font-size: 1.02rem; margin-bottom: 30px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-progress { font-size: .82rem; color: var(--muted); font-weight: 700; margin: 23px 0 0; }
.hero-art { position: relative; display: flex; align-items: flex-end; justify-content: center; min-width: 0; }
.hero-art img { position: relative; width: min(89%, 370px); max-height: 440px; object-fit: contain; filter: drop-shadow(0 18px 12px #7db6b244); animation: float 4s ease-in-out infinite; }
.hero-halo { position: absolute; width: 390px; height: 390px; max-width: 93%; background: #d6f0e8; border-radius: 50%; right: -20px; top: 64px; box-shadow: 0 0 0 28px #e8f5e880; }
.home-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0 40px; }
.little-card { display: flex; align-items: center; gap: 18px; border: 1px solid #dfe8e0; background: #fffdf9; border-radius: 22px; padding: 19px 22px; box-shadow: 0 5px 18px #50767512; color: var(--ink); text-align: left; }
.little-card h2, .little-card strong { font-size: .98rem; margin: 0 0 4px; }
.little-card p, .little-card small { color: var(--muted); margin: 0; font-size: .83rem; line-height: 1.6; display: block; }
.little-link { width: 100%; justify-content: flex-start; }
.little-link:hover { border-color: var(--teal); background: #f4faf6; }
.little-link > span:last-child { margin-left: auto; font-size: 1.4rem; }
.little-icon { display: grid; place-items: center; width: 45px; height: 45px; flex: 0 0 45px; border-radius: 15px; color: #177d89; background: #dff3ee; font-size: 1.5rem; font-weight: 900; }
.weekly-feature { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 20px; padding: 26px 32px; background: linear-gradient(115deg, #fffdf8, #fff4d8); }
.weekly-feature h2 { margin-bottom: 8px; font-size: clamp(1.5rem, 2.5vw, 2rem); }
.weekly-feature p:not(.eyebrow) { margin-bottom: 7px; font-weight: 800; line-height: 1.6; }
.weekly-feature small { color: var(--muted); line-height: 1.6; }
.weekly-feature-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; flex: 0 0 auto; }

.section-heading { text-align: center; padding: 20px 0 30px; }
.section-heading h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin: 0 0 9px; }
.section-heading > p:last-child { color: var(--muted); line-height: 1.8; margin: 0; }
.rule-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.rule-card { background: var(--paper); border: 1px solid #e3e8df; border-radius: 24px; min-height: 250px; padding: 21px 20px; box-shadow: 0 8px 24px #4c79780f; }
.rule-number { color: #a4bbb9; font-size: .77rem; font-weight: 900; letter-spacing: .15em; }
.rule-symbol { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 20px; margin: 16px 0; color: var(--teal-dark); background: #e1f4ee; font-size: 2.2rem; font-weight: 900; }
.rule-card:nth-child(2) .rule-symbol { background: #fdf0d7; }
.rule-card:nth-child(3) .rule-symbol { background: #fae5e2; }
.rule-card:nth-child(4) .rule-symbol { background: #e8e9fb; }
.rule-card h2 { font-size: 1.04rem; margin: 0 0 8px; }
.rule-card p { color: var(--muted); font-size: .88rem; line-height: 1.75; margin: 0; }
.tutorial-note { width: min(700px, 100%); display: flex; gap: 13px; align-items: center; background: #fff8df; border: 1px solid #f0e4b5; border-radius: 20px; margin: 22px auto; padding: 14px 21px; }
.tutorial-note img { width: 55px; height: 55px; flex: 0 0 55px; }
.tutorial-note p { margin: 0; font-size: .9rem; line-height: 1.7; }
.center-actions { text-align: center; padding-bottom: 30px; }

.levels-page .section-heading > p:not(.eyebrow) { color: var(--muted); line-height: 1.8; margin: 0; }
.tier-switch { width: min(760px, 100%); display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0 auto 28px; }
.tier-choice { min-height: 110px; display: grid; align-content: center; gap: 4px; padding: 14px 18px; border: 2px solid #c9dcd6; border-radius: 20px; background: #fffefa; color: var(--ink); text-align: left; box-shadow: 0 5px 16px #4a75740e; transition: background .16s, border-color .16s, transform .16s; }
.tier-choice:hover { border-color: var(--teal); transform: translateY(-2px); }
.tier-choice strong { font-size: 1.3rem; line-height: 1.25; }
.tier-choice span { color: var(--muted); font-size: .82rem; }
.tier-choice small { color: var(--teal-dark); font-size: .75rem; font-weight: 800; }
.tier-choice.is-active { border-color: var(--teal); background: var(--teal); color: #fff; box-shadow: 0 7px 0 #0e6472; }
.tier-choice.is-active span, .tier-choice.is-active small { color: #fff; }
.tier-choice[data-tier="ex"] { background: #fff5df; border-color: #d8b877; }
.tier-choice[data-tier="ex"].is-active { background: #92643b; border-color: #92643b; color: #fff; box-shadow: 0 7px 0 #6b482c; }
.tier-choice[data-tier="weekly"] { background: #fff5df; border-color: #d8b877; }
.tier-choice[data-tier="weekly"].is-active { background: #92643b; border-color: #92643b; color: #fff; box-shadow: 0 7px 0 #6b482c; }
.weekly-date { color: var(--muted); font-size: .85rem; font-weight: 800; margin-bottom: 10px; }
.weekly-empty { background: #fffdf8; border: 1px solid #dfebe6; border-radius: 20px; padding: 24px; color: var(--muted); }
.weekly-archive { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-bottom: 40px; }
.weekly-archive .level-card { width: 100%; }
.level-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-bottom: 40px; }
.tier-heading { display: flex; align-items: baseline; gap: 13px; flex-wrap: wrap; border-bottom: 1px solid #dbe7e2; margin: 12px 0 18px; padding-bottom: 9px; }
.tier-heading h2 { margin: 0; font-size: 1.45rem; }
.tier-heading p { margin: 0; color: var(--muted); font-size: .85rem; }
.tier-section + .tier-section { margin-top: 8px; }
.level-card { min-height: 96px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px solid #dfebe6; border-radius: 20px; background: #fffefa; box-shadow: 0 5px 16px #4a75740e; color: var(--ink); padding-right: 12px; transition: transform .16s, border-color .16s, box-shadow .16s; }
.level-open { min-width: 0; width: 100%; min-height: 94px; display: grid; grid-template-columns: 54px minmax(0, 1fr) 30px; grid-template-rows: 1fr 1fr; align-items: center; column-gap: 12px; border: 0; border-radius: 20px; background: transparent; color: inherit; text-align: left; padding: 15px 8px 15px 18px; }
.level-open.is-ex { grid-template-columns: 84px minmax(0, 1fr) 30px; }
.level-card:hover { transform: translateY(-2px); border-color: var(--teal); box-shadow: 0 12px 23px #4a757425; }
.level-card.is-liked { border-color: #d6b26c; }
.level-open:hover .level-title { text-decoration: underline; }
.level-index { grid-row: 1 / 3; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: #e4f4ed; font-weight: 900; color: var(--teal-dark); }
.level-index.is-ex { width: 80px; font-size: .8rem; white-space: nowrap; }
.level-title { font-size: 1rem; font-weight: 900; align-self: end; }
.level-meta { color: var(--muted); font-size: .78rem; align-self: start; padding-top: 3px; }
.level-state { grid-column: 3; grid-row: 1 / 3; color: var(--teal); font-size: 1.5rem; text-align: center; }
.level-card.is-done { background: #f3fbf2; border-color: #b8dbbc; }
.level-card.is-done.is-liked { border-color: #d6b26c; }
.liked-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 7px 10px; border: 1px solid #b9ccc8; border-radius: 999px; background: #fffefa; color: var(--ink); font-size: .78rem; font-weight: 900; white-space: nowrap; }
.liked-button:hover { background: #fff4d5; border-color: #c89b41; }
.liked-button.is-liked { background: #fff0c0; border-color: #c89b41; color: #644b1c; }
.liked-button.is-heading { margin-top: 9px; }
.liked-check { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: 0 0 18px; border: 2px solid currentColor; border-radius: 5px; line-height: 1; }
.records-link { margin-top: 18px; }
.record-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; padding-bottom: 42px; }
.record-card { background: var(--paper); border: 1px solid #dfebe6; border-radius: 22px; padding: 18px; box-shadow: 0 5px 16px #4a75740e; }
.record-title { display: flex; align-items: center; gap: 12px; }
.record-title h2 { font-size: 1rem; margin: 0 0 3px; }
.record-title p { font-size: .8rem; color: var(--muted); margin: 0; }
.record-best { display: flex; justify-content: space-between; align-items: center; margin: 17px 0 10px; padding: 11px 14px; background: #eaf6ed; border-radius: 13px; font-weight: 800; }
.record-best strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.record-list { list-style: none; padding: 0; margin: 0; }
.record-list li { display: flex; justify-content: space-between; padding: 7px 4px; border-bottom: 1px solid #e8eeea; font-size: .84rem; font-variant-numeric: tabular-nums; }
.record-list time, .record-empty { color: var(--muted); }
.record-empty { margin: 12px 0 0; font-size: .84rem; }

.game-page { padding-top: 8px; padding-bottom: 42px; }
.game-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin: 0 0 18px; }
.game-heading h1 { font-size: clamp(1.7rem, 3.3vw, 2.6rem); margin: 0; }
.game-stats { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; max-width: 100%; gap: 9px; }
.timer-pill { display: flex; align-items: center; gap: 6px; background: #fffdf7; border: 1px solid #dbe9e5; border-radius: 999px; padding: 10px 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.timer-pill strong { min-width: 5.5ch; text-align: right; }
.timer-status { font-size: .7rem; font-weight: 800; color: var(--teal-dark); }
.pause-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 9px 14px; border: 1px solid #b4cbca; border-radius: 999px; background: #fffdf7; color: var(--teal-dark); font-weight: 900; white-space: nowrap; }
.pause-button:hover { background: #eaf6ed; }
.progress-pill { display: flex; align-items: center; gap: 5px; background: #fffdf7; border: 1px solid #dbe9e5; border-radius: 999px; padding: 6px 17px 6px 7px; white-space: nowrap; }
.progress-pill img { width: 33px; height: 33px; }
.progress-pill strong { font-size: 1.2rem; }
.progress-pill span { color: var(--muted); }
.game-layout { display: grid; grid-template-columns: minmax(0, 610px) minmax(270px, 1fr); align-items: start; gap: 26px; }
.board-panel { min-width: 0; }
.board-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .78rem; font-weight: 800; padding: 0 5px 8px; }
.mode-indicator { color: var(--teal-dark); white-space: nowrap; }
.board-frame { background: #fffdf7; border-radius: 23px; padding: 12px; box-shadow: var(--shadow); border: 1px solid #e8e6da; width: 100%; touch-action: manipulation; }
.board { width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(var(--board-size), 1fr); grid-template-rows: repeat(var(--board-size), 1fr); border-radius: 11px; overflow: hidden; }
.board.is-complete:focus-visible { outline: 3px solid #ee8d5f; outline-offset: 3px; }
.board.is-complete .board-cell:hover { filter: none; }
.pause-cover { width: 100%; aspect-ratio: 1; border-radius: 11px; background: radial-gradient(circle at 50% 35%, #def2e7, #fff6e4 78%); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 18px; }
.pause-cover img { width: 43%; max-width: 220px; height: auto; min-height: 0; object-fit: contain; }
.pause-cover h2 { margin: 0; font-size: clamp(1.1rem, 2.8vw, 1.65rem); }
.pause-cover p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.7; }
.pause-cover .primary-button { margin-top: 5px; }
.board-cell { position: relative; min-width: 0; min-height: 0; padding: 0; border-color: var(--line); border-style: solid; border-radius: 0; display: grid; place-items: center; transition: filter .12s, box-shadow .12s; }
.board-cell:hover { filter: brightness(1.05); }
.board-cell.is-related { filter: saturate(1.16) brightness(.985); }
.board-cell.is-near:not(.is-selected) { box-shadow: inset 0 0 0 999px #2a71700c; }
.board-cell.is-selected { box-shadow: inset 0 0 0 3px #f29a58, inset 0 0 0 6px #fff8dc; z-index: 1; }
.board-cell.is-conflict { box-shadow: inset 0 0 0 4px #d8504f; z-index: 1; }
.board-cell.is-hint { box-shadow: inset 0 0 0 4px #f2a033; z-index: 1; animation: hint-pulse 1.5s ease-in-out infinite; }
.board-cell.is-conflict.is-hint { box-shadow: inset 0 0 0 4px #d8504f; }
.region-A { background: #fce9dc; }.region-B { background: #e4eee0; }.region-C { background: #ddf0f2; }.region-D { background: #efe8f5; }
.region-E { background: #fff1d8; }.region-F { background: #f2e5df; }.region-G { background: #e8ecfa; }.region-H { background: #e5f3e9; }
.region-I { background: #f7e5ed; }.region-J { background: #e1eff8; }
.area-glyph { position: absolute; top: 1px; left: 3px; font-weight: 900; font-size: clamp(.45rem, 1.3vw, .63rem); opacity: .52; line-height: 1; }
.cell-token { width: 78%; height: 78%; object-fit: contain; filter: drop-shadow(0 2px 1px #2d73723c); }
.cell-note { color: #147c8b; font-size: clamp(1.3rem, 3.4vw, 2rem); font-weight: 900; line-height: 1; }
.fixed-dot { position: absolute; right: 3px; top: 3px; width: 6px; height: 6px; border-radius: 50%; background: #db714e; }
.board-message { display: flex; align-items: flex-start; gap: 9px; background: #eaf5ed; color: #256354; border-radius: 16px; padding: 12px 15px; margin: 14px 0 0; min-height: 50px; line-height: 1.55; font-size: .9rem; font-weight: 700; }
.board-message > span { font-size: 1.2rem; line-height: 1; }
.board-message.is-error { background: #fff0e7; color: #a34c3e; }
.game-sidebar { display: grid; gap: 16px; }
.control-card, .hint-card { background: #fffefa; border: 1px solid #e3e9df; border-radius: 24px; padding: 22px; box-shadow: 0 8px 22px #577e7c13; }
.control-card h2, .hint-card h2 { margin: 0 0 17px; font-size: 1rem; }
.mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-button { min-height: 50px; border: 2px solid #dce9e4; background: #f7faf5; border-radius: 15px; color: var(--ink); font-weight: 900; }
.mode-button.is-active { border-color: var(--teal); color: #fff; background: var(--teal); }
.utility-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.utility-buttons button { min-height: 43px; border: 1px solid #ccdeda; border-radius: 13px; background: #fff; color: var(--ink); font-weight: 800; }
.utility-buttons button:hover:not(:disabled) { background: #eff7f3; }
.subtle-button { display: block; margin: 14px auto 0; padding: 5px 8px; border: 0; color: var(--muted); background: none; text-decoration: underline; font-size: .78rem; }
.hint-card { background: #fff8e6; border-color: #f3e7be; }
.hint-heading { display: flex; align-items: center; gap: 9px; }
.hint-heading > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: #f7e5a9; font-size: 1.3rem; }
.hint-heading h2 { margin: 0; }
.hint-card p { color: #6d6652; line-height: 1.7; min-height: 50px; font-size: .87rem; margin: 12px 0; }
.hint-button { width: 100%; min-height: 42px; border: 1px solid #d4a943; color: #6f561d; background: #fff7dd; border-radius: 13px; font-weight: 900; }
.hint-button:hover { background: #ffefc1; }
.keyboard-help { color: var(--muted); font-size: .74rem; line-height: 1.7; padding: 0 7px; margin: 0; }

.complete-card { width: 100%; text-align: center; padding: 24px 18px 30px; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 23%, #e2f6ea 0, #fffdf8 52%); }
.complete-card .complete-portrait { width: min(140px, 45%); height: 145px; object-fit: contain; animation: float 3s ease-in-out infinite; }
.complete-card h2 { font-size: clamp(1.5rem, 2.7vw, 2rem); margin: 0 0 12px; }
.complete-card > p:not(.eyebrow) { color: var(--muted); line-height: 1.8; }
.discovery-note { margin: 18px auto; padding: 16px 18px; max-width: 520px; border: 1px solid #d8b877; border-radius: 18px; background: #fff7e4; text-align: left; }
.discovery-note h3 { font-size: 1rem; margin: 0 0 8px; }
.discovery-note p { color: var(--ink); font-size: .88rem; line-height: 1.8; margin: 0; }
.finish-times { display: flex; justify-content: center; gap: 13px; flex-wrap: wrap; }
.finish-times p { display: grid; gap: 2px; margin: 0; padding: 12px 18px; background: #eaf6ed; border-radius: 13px; font-size: .85rem; color: var(--teal-dark); }
.finish-times strong { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.complete-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 27px; }
.complete-actions button { flex: 1 1 155px; padding: 11px 12px; }
.confetti { position: absolute; width: 16px; height: 16px; border-radius: 5px; transform: rotate(20deg); }
.confetti-one { background: #f3d67a; left: 18%; top: 20%; }.confetti-two { background: #67c3ca; right: 18%; top: 35%; }.confetti-three { background: #eb9b78; left: 26%; top: 45%; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: #143c4588; display: grid; place-items: center; padding: 18px; }
.modal { width: min(420px, 100%); background: #fffdf8; border-radius: 24px; padding: 25px; box-shadow: 0 22px 55px #153c4540; }
.modal h2 { margin: 0 0 12px; font-size: 1.35rem; }
.modal p { color: var(--muted); line-height: 1.7; font-size: .9rem; }
.modal-title-row { display: flex; justify-content: space-between; align-items: center; }
.modal-title-row h2 { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 22px; }
.setting-row { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px; background: none; border: 0; border-top: 1px solid #e5ebe6; text-align: left; padding: 15px 0; color: var(--ink); }
.setting-row strong, .setting-row small { display: block; }
.setting-row small { color: var(--muted); margin-top: 4px; }
.switch { flex: 0 0 45px; width: 45px; height: 26px; border-radius: 99px; background: #c7d3cf; position: relative; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: left .18s; }
.switch.on { background: var(--teal); }.switch.on::after { left: 22px; }
.save-warning { position: fixed; left: 50%; bottom: 15px; z-index: 30; transform: translateX(-50%); width: min(92vw, 550px); background: #934935; color: white; border-radius: 14px; padding: 11px 15px; text-align: center; box-shadow: var(--shadow); font-size: .83rem; }
.site-footer { display: flex; flex-direction: column; align-items: center; gap: 9px; text-align: center; color: #829b98; font-size: .76rem; padding: 20px 10px 24px; }
.portal-link { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 6px 14px; border: 1px solid #b8c9c4; border-radius: 999px; background: rgba(255, 255, 255, .6); color: var(--muted); text-decoration: none; font-size: .78rem; font-weight: 700; line-height: 1.3; }
.portal-link:hover { background: #fff; color: var(--ink); border-color: #8da9a0; }
.portal-link:focus-visible { outline: 3px solid #ee8d5f; outline-offset: 3px; }
.footer-caption span { color: var(--orange); margin-left: 7px; }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes hint-pulse { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.14); } }

@media (max-width: 850px) {
  .hero-copy { padding: 58px 0 45px 42px; }
  .hero { min-height: 430px; }
  .rule-grid { grid-template-columns: repeat(2, 1fr); }
  .rule-card { min-height: 205px; }
  .game-layout { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .board-panel { width: min(100%, 610px); margin: auto; }
  .game-sidebar { grid-template-columns: 1fr 1fr; }
  .keyboard-help { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  .page, .topbar { width: min(100% - 24px, 1120px); }
  .topbar { height: 64px; }
  .topbar-brand { font-size: .75rem; gap: 3px; }
  .topbar-brand img { width: 25px; height: 25px; }
  .back-button { font-size: .75rem; }
  .hero { display: flex; flex-direction: column-reverse; min-height: 0; border-radius: 24px; }
  .hero-art { height: 220px; align-items: end; overflow: hidden; }
  .hero-art img { width: 200px; height: 225px; }
  .hero-halo { width: 270px; height: 270px; top: 16px; right: calc(50% - 135px); }
  .hero-copy { padding: 20px 25px 33px; }
  .hero h1 { font-size: clamp(2rem, 9vw, 3rem); margin-bottom: 15px; }
  .lead { font-size: .88rem; margin-bottom: 20px; }
  .hero-actions { gap: 9px; }
  .hero-actions button { width: 100%; }
  .home-bottom { grid-template-columns: 1fr; gap: 10px; margin: 12px 0 23px; }
  .weekly-feature { flex-direction: column; align-items: stretch; gap: 16px; padding: 22px; }
  .weekly-feature-actions { justify-content: stretch; }
  .weekly-feature-actions button { width: 100%; }
  .weekly-archive { grid-template-columns: 1fr; }
  .little-card { padding: 13px 16px; }
  .section-heading { padding: 15px 0 22px; }
  .rule-grid { gap: 10px; }
  .rule-card { padding: 14px; min-height: 183px; border-radius: 18px; }
  .rule-symbol { width: 45px; height: 45px; border-radius: 14px; font-size: 1.5rem; margin: 9px 0; }
  .rule-card h2 { font-size: .93rem; }
  .rule-card p { font-size: .78rem; }
  .tutorial-note { padding: 12px; }
  .tier-switch { grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: 9px; margin-bottom: 24px; }
  .tier-choice { min-height: 98px; padding: 12px; border-radius: 17px; }
  .tier-choice strong { font-size: 1.16rem; }
  .tier-choice span { font-size: .7rem; }
  .tier-choice small { font-size: .68rem; }
  .level-grid { grid-template-columns: 1fr; gap: 10px; }
  .record-grid { grid-template-columns: 1fr; gap: 10px; }
  .level-card { min-height: 85px; grid-template-columns: minmax(0, 1fr); padding-right: 0; }
  .level-open { min-height: 76px; }
  .liked-button.is-level { justify-self: end; min-height: 34px; margin: 0 14px 10px; }
  .game-heading { margin-bottom: 13px; flex-wrap: wrap; }
  .game-heading h1 { font-size: 1.6rem; }
  .game-stats { gap: 5px; margin-left: auto; }
  .timer-pill { font-size: .78rem; padding: 7px 8px; }
  .progress-pill { padding: 4px 8px 4px 4px; }
  .progress-pill img { width: 27px; height: 27px; }
  .progress-pill strong { font-size: 1rem; }
  .game-heading .eyebrow { font-size: .61rem; }
  .board-frame { padding: 8px; border-radius: 16px; }
  .pause-button { min-height: 38px; padding: 7px 10px; font-size: .78rem; }
  .pause-cover { padding: 12px; gap: 6px; }
  .pause-cover img { width: 35%; max-height: 170px; }
  .pause-cover h2 { font-size: 1.05rem; }
  .pause-cover p { font-size: .76rem; line-height: 1.5; }
  .pause-cover .primary-button { min-height: 40px; padding: 8px 18px; font-size: .8rem; }
  .game-sidebar { grid-template-columns: 1fr; gap: 12px; }
  .control-card, .hint-card { padding: 17px; border-radius: 18px; }
  .board-top { font-size: .67rem; }
  .keyboard-help { display: none; }
}
@media (max-width: 360px) {
  .topbar-brand { font-size: .66rem; }
  .game-heading h1 { font-size: 1.34rem; }
  .board-top { font-size: .61rem; }
  .area-glyph { font-size: .5rem; top: 0; left: 2px; }
  .board-cell.is-selected { box-shadow: inset 0 0 0 2px #f29a58; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
body.reduce-motion *, body.reduce-motion *::before, body.reduce-motion *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
