:root {
  --bg: #eef0e8;
  --surface: #fffdf7;
  --ink: #17324d;
  --muted: #526474;
  --accent: #e16a45;
  --accent-dark: #a63c22;
  --goal: #f1c453;
  --path: #dce9ef;
  --line: #b8c1bd;
  --wall: #445866;
  --shadow: 0 10px 26px rgba(23,50,77,.13);
  font-family: ui-rounded, "Arial Rounded MT Bold", "Aptos", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: radial-gradient(circle at 20% 0%, #fff 0, transparent 34rem), var(--bg); color: var(--ink); -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 30; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; }
.skip-link:focus { top: 12px; }
.app-shell { width: min(100%, 560px); min-height: 100dvh; margin: 0 auto; padding: env(safe-area-inset-top) 18px calc(24px + env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 72px; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.24rem; font-weight: 900; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--ink); color: #fff; font-size: 1.6rem; }
.icon-button { display: grid; place-items: center; width: 52px; height: 52px; border: 2px solid var(--line); border-radius: 17px; background: var(--surface); font-size: 1.45rem; font-weight: 900; box-shadow: 0 4px 12px rgba(23,50,77,.07); cursor: pointer; }
.difficulty-card { margin: 6px 0 18px; padding: 14px 16px 16px; border: 3px solid var(--ink); border-radius: 19px; background: var(--surface); box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 22%, transparent); }
.difficulty-card label { display: block; margin-bottom: 8px; font-size: .82rem; font-weight: 950; letter-spacing: .08em; text-transform: uppercase; }
.difficulty-card select { width: 100%; min-height: 54px; padding: 10px 42px 10px 13px; border: 2px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 1rem; font-weight: 850; cursor: pointer; }
.level-jump { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
.level-jump button { min-height: 58px; padding: 9px 10px; border: 3px solid var(--ink); border-radius: 17px; background: var(--surface); color: var(--ink); font-size: .92rem; font-weight: 900; cursor: pointer; }
.level-jump button span { display: block; font-size: 1.2rem; line-height: 1; }
.level-jump button:disabled { opacity: .38; cursor: default; }
.level-jump .tier-start-button { grid-column: 1 / -1; }
.level-jump .tier-start-button span { display: inline; margin-right: 7px; }
.endless-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; margin: 0 0 18px; padding: 11px 16px; border: 3px solid var(--ink); border-radius: 18px; background: var(--goal); color: var(--ink); font-size: 1.02rem; font-weight: 950; box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 28%, transparent); cursor: pointer; }
.endless-button span { font-size: 1.65rem; line-height: 1; }
.endless-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 18px; }
.endless-actions button { min-height: 58px; padding: 9px 10px; border: 3px solid var(--ink); border-radius: 17px; background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 900; cursor: pointer; }
.endless-actions button:first-child { background: var(--goal); }
.endless-actions span { display: inline; margin-right: 5px; }
.endless-badge { display: grid; place-items: center; width: 45px; height: 34px; border-radius: 14px; background: var(--accent); color: #fff; font-size: 1.55rem; font-weight: 950; }
[hidden] { display: none !important; }
.level-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 12px 2px 16px; }
.eyebrow { margin: 0 0 5px; color: var(--accent-dark); font-size: .77rem; font-weight: 900; letter-spacing: .15em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.65rem, 7vw, 2.2rem); line-height: 1.05; letter-spacing: -.04em; }
h2 { margin-bottom: 12px; font-size: 1.95rem; line-height: 1.1; letter-spacing: -.035em; }
.level-dots { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; max-width: 120px; padding-bottom: 4px; }
.level-dots i { width: 9px; height: 9px; border: 2px solid var(--muted); border-radius: 50%; }
.level-dots i.done { background: var(--ink); border-color: var(--ink); }
.level-dots i.current { width: 21px; border-radius: 9px; background: var(--accent); border-color: var(--accent); }
.task-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 19px; background: rgba(255,253,247,.82); }
.task-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 14px; background: var(--goal); color: #172b3c; font-size: 1.8rem; font-weight: 900; }
.task-card p { margin: 2px 0 0; color: var(--muted); line-height: 1.35; }
.board-section { padding: 20px 0 6px; }
.board { --cols: 3; --cell: min(24vw, 105px); display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); justify-content: center; gap: 7px; }
.board.four { --cell: min(20vw, 91px); }
.board.five { --cell: min(16vw, 72px); gap: 5px; }
.board.five .cell { border-width: 2px; border-radius: 13px; }
.board.five .step-number { font-size: .85rem; }
.board.six { --cell: min(13.4vw, 59px); gap: 4px; }
.board.six .cell { border-width: 2px; border-radius: 11px; }
.board.six .step-number { width: 22px; height: 22px; font-size: .72rem; }
.board.six .checkpoint-marker { width: 38px; height: 38px; border-radius: 11px; font-size: 1.05rem; }
.board.six .player-marker { padding: 5px 7px; font-size: .64rem; }
.cell { position: relative; display: grid; place-items: center; width: var(--cell); aspect-ratio: 1; border: 3px solid var(--ink); border-radius: 17px; background: var(--surface); overflow: hidden; }
.cell.wall { background: repeating-linear-gradient(135deg, var(--wall) 0 9px, color-mix(in srgb, var(--wall) 70%, #fff) 9px 17px); color: #fff; }
.cell.wall::after { content: "×"; font-size: 2.5rem; font-weight: 900; }
.cell.goal { background: color-mix(in srgb, var(--goal) 42%, var(--surface)); border-style: dashed; }
.cell.checkpoint { background: color-mix(in srgb, #65b9a1 30%, var(--surface)); border-style: dashed; }
.cell.checkpoint.visited { background: color-mix(in srgb, #65b9a1 62%, var(--surface)); }
.goal-marker, .player-marker { display: grid; place-items: center; width: 62%; aspect-ratio: 1; border-radius: 50%; font-weight: 950; }
.goal-marker { background: var(--goal); color: #172b3c; font-size: 1.9rem; }
.checkpoint-marker { display: grid; place-items: center; width: 62%; aspect-ratio: 1; border-radius: 15px; background: #2b806b; color: #fff; font-size: 1.25rem; font-weight: 950; }
.player-marker { z-index: 3; background: var(--ink); color: #fff; font-size: clamp(.62rem, 2.5vw, .82rem); box-shadow: 0 0 0 5px var(--surface); }
.used-start-marker { position: relative; z-index: 2; color: #c32020; font-size: clamp(1.35rem, 5vw, 2rem); font-weight: 1000; line-height: 1; }
.cell.used-start { background: color-mix(in srgb, #c32020 7%, var(--surface)); }
.cell.planned { background: var(--path); }
.step-number { position: absolute; z-index: 2; top: 5px; right: 5px; display: grid; place-items: center; width: 38%; aspect-ratio: 1; border-radius: 50%; background: var(--accent); color: #fff; font-size: 1rem; font-weight: 950; }
.cell.current-plan { outline: 5px solid var(--accent); outline-offset: -6px; }
.cell.blocked { animation: shake .28s ease; outline: 5px solid #c32020; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 12px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-style: normal; font-size: .6rem; font-weight: 950; }
.legend-you { background: var(--ink); color: #fff; }
.legend-goal { background: var(--goal); color: #172b3c; font-size: 1rem !important; }
.legend-checkpoint { background: #2b806b; color: #fff; font-size: .85rem !important; }
.legend-wall { background: var(--wall); color: #fff; font-size: 1rem !important; }
.plan-card { margin: 6px 0 16px; padding: 14px; border: 2px solid var(--line); border-radius: 20px; background: rgba(255,253,247,.78); }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plan-head span { display: block; color: var(--muted); font-size: .7rem; font-weight: 900; letter-spacing: .12em; }
.plan-head strong { display: block; margin-top: 2px; }
.plan-head button { min-height: 44px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 13px; background: var(--surface); font-weight: 850; cursor: pointer; }
.plan-head button:disabled { opacity: .42; cursor: default; }
.route-strip { display: flex; gap: 7px; min-height: 43px; margin-top: 11px; overflow-x: auto; scrollbar-width: thin; }
.route-step { display: grid; place-items: center; flex: 0 0 39px; height: 39px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 1.35rem; font-weight: 900; }
.empty-route { align-self: center; color: var(--muted); font-size: .9rem; }
.route-message { min-height: 22px; margin: 9px 0 0; color: var(--muted); line-height: 1.35; }
.route-message.warning { color: #a22116; font-weight: 850; }
.route-message.ready { color: #176642; font-weight: 850; }
.controls { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-areas: ". up ." "left center right" ". down ."; gap: 8px; width: min(100%, 350px); margin: 8px auto 12px; }
.direction { min-height: 66px; padding: 7px 4px; border: 3px solid var(--ink); border-radius: 17px; background: var(--surface); box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 28%, transparent); cursor: pointer; }
.direction:active { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--ink) 28%, transparent); }
.direction b, .direction span { display: block; }
.direction b { font-size: 1.8rem; line-height: 1; }
.direction span { margin-top: 3px; font-size: .78rem; font-weight: 850; }
.direction:disabled { opacity: .4; cursor: default; }
.up { grid-area: up; } .left { grid-area: left; } .right { grid-area: right; } .down { grid-area: down; }
.control-center { grid-area: center; display: grid; place-items: center; color: var(--line); font-size: 2.5rem; font-weight: 900; }
.primary-button { width: 100%; min-height: 63px; padding: 13px 20px; border: 0; border-radius: 19px; background: var(--accent); color: #fff; font-size: 1.12rem; font-weight: 900; box-shadow: 0 7px 0 var(--accent-dark); cursor: pointer; }
.primary-button:disabled { opacity: .42; box-shadow: none; cursor: default; }
.save-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 60px; margin-top: 18px; padding: 12px 18px; border: 3px solid var(--ink); border-radius: 18px; background: var(--ink); color: #fff; font-size: 1.05rem; font-weight: 950; box-shadow: 0 6px 0 color-mix(in srgb, var(--ink) 48%, transparent); cursor: pointer; }
.save-button:active { transform: translateY(3px); box-shadow: 0 3px 0 color-mix(in srgb, var(--ink) 48%, transparent); }
.clear-save-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; margin-top: 13px; padding: 11px 18px; border: 3px solid #a82f1c; border-radius: 18px; background: #fff2ef; color: #852313; font-size: 1rem; font-weight: 950; cursor: pointer; }
.clear-save-button:active { transform: translateY(2px); }
.clear-save-button span { font-size: 1.35rem; line-height: 1; }
.restart-level-button { width: 100%; margin: 16px 0 12px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-weight: 900; }
.restart-level-button span { display: inline; margin-right: 7px; font-size: 1.25em; }
.save-status { margin: 11px 4px 0; color: var(--muted); text-align: center; font-size: .88rem; font-weight: 750; }
.home-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 56px; margin-top: 18px; padding: 12px 18px; border: 3px solid var(--ink); border-radius: 18px; background: var(--surface); color: var(--ink); font-weight: 900; cursor: pointer; }
.home-button span { font-size: 1.35rem; }
.home-button:disabled { opacity: .65; cursor: default; }
.share-card { margin-top: 20px; padding: 18px; border: 2px solid var(--line); border-radius: 20px; background: var(--surface); }
.share-card h2 { margin: 0 0 6px; font-size: 1.2rem; }
.share-card p { margin: 0 0 14px; color: var(--muted); font-size: .94rem; font-weight: 700; }
.share-actions { display: grid; grid-template-columns: 1fr; gap: 11px; }
.share-button { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 11px 16px; border: 3px solid var(--ink); border-radius: 17px; color: var(--ink); font-size: 1rem; font-weight: 950; text-align: center; text-decoration: none; }
.share-button span { font-size: 1.3rem; line-height: 1; }
.email-share { background: #eef6fb; }
.whatsapp-share { border-color: #176f42; background: #dff8e9; color: #0d5b34; }
.share-button:active { transform: translateY(2px); }
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible + span { outline: 5px solid #2b85d3; outline-offset: 4px; }
.modal { width: min(calc(100% - 28px), 500px); max-height: calc(100dvh - 28px); padding: 0; border: 0; border-radius: 27px; background: var(--surface); color: var(--ink); box-shadow: 0 28px 70px rgba(4,20,32,.34); }
.modal::backdrop { background: rgba(6,19,29,.66); backdrop-filter: blur(4px); }
.modal-content { padding: 29px 25px calc(25px + env(safe-area-inset-bottom)); text-align: center; }
.modal-content > p:not(.eyebrow):not(.install-help) { color: var(--muted); font-size: 1.06rem; line-height: 1.52; }
.welcome-mark { display: grid; place-items: center; width: 82px; height: 82px; margin: 0 auto 19px; border-radius: 25px; background: var(--ink); color: #fff; font-size: 2.5rem; font-weight: 900; transform: rotate(-5deg); }
.welcome-mark.success { background: var(--goal); color: #172b3c; transform: none; }
.demo-route { display: flex; align-items: center; justify-content: center; gap: 7px; margin: 22px 0; }
.demo-route i, .demo-route b { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; font-style: normal; }
.demo-route i { background: var(--ink); color: #fff; font-size: .7rem; font-weight: 900; }
.demo-route i:last-child { background: var(--goal); color: #172b3c; font-size: 1.4rem; }
.demo-route b { background: var(--path); color: var(--ink); }
.text-button { min-height: 50px; margin-top: 14px; padding: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 800; text-decoration: underline; cursor: pointer; }
.settings-content { text-align: left; }
.modal-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-heading h2 { margin: 0; }
.close-button { font-size: 2rem; line-height: 1; }
fieldset { margin: 0 0 19px; padding: 0; border: 0; }
legend { margin-bottom: 8px; font-size: .8rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.choice { display: flex; align-items: center; min-height: 55px; margin-top: 8px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 15px; cursor: pointer; }
.choice input { width: 24px; height: 24px; margin: 0 13px 0 0; accent-color: var(--accent-dark); }
.choice span { font-weight: 800; }
.secondary-button { width: 100%; min-height: 55px; margin-top: 9px; border: 2px solid var(--line); border-radius: 16px; background: var(--surface); font-weight: 850; cursor: pointer; }
.install-help { margin: 12px 2px 0; color: var(--muted); line-height: 1.45; }
.legal-footer { margin-top: 34px; padding: 24px 8px 8px; border-top: 2px solid var(--line); color: var(--muted); text-align: center; font-size: .88rem; line-height: 1.55; }
.legal-footer nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 9px; }
.legal-footer button, .legal-footer a { min-height: 44px; padding: 8px 4px; border: 0; background: transparent; color: var(--ink); font-weight: 850; text-decoration: underline; cursor: pointer; }
.legal-footer p { margin: 9px 0 0; }
.legal-footer p a { display: inline; min-height: 0; padding: 0; }
.legal-modal { overflow: hidden; }
.legal-content { max-height: calc(100dvh - 28px); overflow-y: auto; text-align: left; }
.legal-content h3 { margin: 23px 0 7px; font-size: 1.05rem; }
.legal-content .modal-heading + h3 { margin-top: 0; }
.legal-content p { margin-bottom: 10px; color: var(--muted); line-height: 1.5; }
.legal-content a { color: var(--ink); font-weight: 800; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: 22px; width: max-content; max-width: calc(100% - 30px); padding: 13px 17px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 850; transform: translate(-50%, 130%); opacity: 0; transition: .24s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
body.theme-high { --bg:#000; --surface:#101010; --ink:#ffd900; --muted:#fff; --accent:#fff; --accent-dark:#ffd900; --goal:#ffd900; --path:#252525; --line:#ffd900; --wall:#fff; --shadow:none; color-scheme:dark; }
body.theme-high .primary-button { color:#000; }
body.theme-high .save-button { background:#ffd900; color:#000; }
body.theme-high .clear-save-button { border-color:#ffd900; background:#000; color:#fff; }
body.theme-high .share-card, body.theme-high .share-button { border-color:#ffd900; background:#000; color:#fff; }
body.theme-high .player-marker { color:#000; box-shadow:0 0 0 5px #000; }
body.theme-high .wall { color:#000; }
body.theme-light { --bg:#fff; --surface:#fff; --ink:#111; --muted:#333; --accent:#c44023; --accent-dark:#8c210d; --goal:#ffd34e; --path:#e4eef4; --line:#555; --wall:#333; }
body.scale-extra { font-size:112.5%; }
body.scale-extra .app-shell { padding-left:12px; padding-right:12px; }
@keyframes shake { 0%,100%{transform:translateX(0)} 33%{transform:translateX(-6px)} 66%{transform:translateX(6px)} }
@media (max-width:370px) { .app-shell{padding-left:11px;padding-right:11px}.board{--cell:min(25vw,93px)}.board.four{--cell:min(20vw,75px)}.board.five{--cell:min(16vw,58px)}.board.six{--cell:min(13.2vw,47px);gap:3px}.direction{min-height:61px}.legend{gap:7px} }
@media (prefers-reduced-motion:reduce) { *,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important} }

.legal-footer .version-line { font-size: .8rem; }
