:root {
  color-scheme: light;
  --ink: #203c38;
  --muted: #48605c;
  --deep: #275a52;
  --cream: #fffcf3;
  --line: #d4ddd0;
  --green: #e6efdc;
  --yellow: #f9d47e;
  --lavender: #e5d6ed;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--cream); color: var(--ink); font: 500 1rem/1.52 system-ui, sans-serif; }
button, select, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button:not(:disabled):hover { filter: brightness(.95); }
a { color: inherit; text-underline-offset: 4px; }
:focus-visible { outline: 3px solid #75548a; outline-offset: 4px; }
.skip { position: absolute; top: 8px; left: 12px; z-index: 2; padding: 8px 12px; background: white; transform: translateY(-180%); }
.skip:focus { transform: none; }
.wrap { width: min(1120px, calc(100% - 60px)); margin-inline: auto; }
.top { display: flex; justify-content: space-between; align-items: center; min-height: 76px; padding: 7px 0; gap: 10px; }
.top img { width: 74px; height: auto; }
.top a { font-size: .9rem; font-weight: 760; }
.hero { min-height: 185px; overflow: hidden; background: #dce9d0; border-radius: 30px; display: grid; grid-template-columns: 1fr minmax(230px, 44%); align-items: center; }
.hero-copy { position: relative; z-index: 1; padding: 24px 0 24px clamp(20px, 5vw, 55px); }
.hero img { display: block; width: 100%; height: 228px; object-fit: cover; object-position: center 53%; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { line-height: 1.04; letter-spacing: -.05em; }
h1 { font-size: clamp(2.35rem, 6.2vw, 5.2rem); font-weight: 870; }
.hero p { margin-top: 11px; font-weight: 710; font-size: clamp(.92rem, 2.4vw, 1.16rem); }
.game { margin: 20px 0 16px; background: #fff; border: 1px solid var(--line); border-radius: 25px; padding: clamp(15px, 3.6vw, 37px); }
h2 { font-size: clamp(1.65rem, 4vw, 3rem); }
h3 { font-size: clamp(1.36rem, 3vw, 1.76rem); }
.game {
  --terrain: #bfd5af;
  --floor: #f0f3d5;
  --floor-alt: #e6f0ce;
  --panel: #ecf3e6;
  --obstacle: #bad1a3;
  --outline: #718f65;
}
.game[data-place="market"] {
  --terrain: #d8bca6;
  --floor: #fff4df;
  --floor-alt: #f7e5cd;
  --panel: #fbede3;
  --obstacle: #e9c3a9;
  --outline: #9b7057;
}
.game[data-place="school"] {
  --terrain: #c3bada;
  --floor: #f6f2ff;
  --floor-alt: #e8e0f6;
  --panel: #f0ebf8;
  --obstacle: #d7c9e7;
  --outline: #87719b;
}
.worlds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-bottom: 21px; }
.worlds button {
  display: grid; justify-items: start; gap: 2px; min-height: 70px; padding: 9px clamp(8px, 2vw, 16px);
  border: 2px solid transparent; border-radius: 13px; background: #e8f0df; color: var(--ink); text-align: left;
}
.worlds button[data-place="market"] { background: #fae8da; }
.worlds button[data-place="school"] { background: #efe5f5; }
.worlds button[aria-current] { border-color: var(--deep); box-shadow: 0 3px 0 var(--deep); }
.worlds strong { line-height: 1.2; font-size: clamp(.88rem, 2.6vw, 1.12rem); overflow-wrap: anywhere; }
.worlds strong span { margin-right: 2px; }
.world-range { font-size: .78rem; color: var(--muted); font-weight: 670; }
.mission-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.game-level { width: fit-content; border-radius: 20px; padding: 4px 10px; background: var(--panel); color: var(--ink); font-size: .88rem; font-weight: 800; }
.mission-selector { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px; max-width: 100%; }
.mission-selector label { font-size: .88rem; font-weight: 750; }
select {
  appearance: none; border: 1px solid #8da397; border-radius: 10px; color: var(--ink); min-height: 44px; max-width: 100%;
  padding: 6px 31px 6px 10px; background: linear-gradient(45deg, transparent 50%, #275a52 50%) right 14px center / 5px 5px no-repeat,
  linear-gradient(135deg, #275a52 50%, transparent 50%) right 9px center / 5px 5px no-repeat white;
}
.mission-text { margin-top: 8px; color: var(--muted); }
.play { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; gap: clamp(14px, 3vw, 34px); padding-top: 19px; }
.map-panel { background: var(--panel); border-radius: 21px; padding: clamp(7px, 1.75vw, 16px); }
.map-header { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 2px 4px 9px; }
.map-header h3 { font-size: 1.05rem; letter-spacing: -.015em; }
.level-progress { font-size: .83rem; font-weight: 700; color: var(--muted); }
.map { display: grid; grid-template-columns: repeat(var(--width, 4), minmax(0, 1fr)); padding: 6px; gap: 4px; background: var(--terrain); border-radius: 15px; container-type: inline-size; }
.cell {
  position: relative; display: grid; place-items: center; border: 1px solid #233f3426; border-radius: clamp(4px, 1vw, 9px);
  background: var(--floor); aspect-ratio: 1.28; min-width: 0; font-size: clamp(1rem, 3.5vw, 2.5rem);
  font-size: clamp(1rem, calc(55cqw / var(--width)), 2.5rem); line-height: 1.15;
}
.cell.alternate { background: var(--floor-alt); }
.cell.blocked { background: var(--obstacle); border-color: var(--outline); }
.cell.special { background: #c6e4eb; border-color: #668993; }
.cell.open-gate { background: #dcefd8; border-color: #719871; }
.cell.goal { color: #5a471e; background: conic-gradient(#fff5cc 25%,#f9db91 0 50%,#fff5cc 0 75%,#f9db91 0) 0 0 / 30px 30px; border: 2px solid #8a6825; }
.cell.start { border: 2px dashed #466e5d; }
.cell.trail::after { content: ""; position: absolute; bottom: 7%; width: 24%; height: 4px; border-radius: 90px; background: #6f9171; }
.cell.piece { box-shadow: inset 0 0 0 2px #275a52; }
.cell.has-hint { outline: 3px solid #765081; outline-offset: -3px; }
.cell.bumped { outline: 3px dashed #a25234; outline-offset: -4px; }
.cell .icon { position: relative; z-index: 1; }
.cell .under-piece { position: absolute; bottom: 2px; right: 2px; border-radius: 50%; background: white; z-index: 2; font-size: .47em; padding: 2px; }
.cell.piece .icon { text-shadow: 0 1px 1px #3252465e; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; list-style: none; margin: 9px 4px 0; padding: 0; font-size: .86rem; font-weight: 730; }
.description { margin: 4px 4px 0; color: var(--deep); font-size: .85rem; }
.description summary, .guide summary { cursor: pointer; width: fit-content; font-weight: 780; }
.description p { margin-top: 4px; }
.route-panel { background: #faf7ef; padding: clamp(12px, 2.2vw, 22px); border: 1px solid #e9e2d3; border-radius: 21px; }
.checklist { margin-bottom: 15px; padding-bottom: 13px; border-bottom: 1px solid #e5decd; }
.checklist h3 { font-size: 1.05rem; letter-spacing: -.01em; margin-bottom: 7px; }
.items { margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px; list-style: none; }
.items li { padding: 4px 8px; border-radius: 8px; border: 1px solid #d7d5c9; background: #fff; font-size: .88rem; font-weight: 680; }
.items li.item-next { border-color: #765081; background: #f1e9f7; }
.items li.collected { border-color: #81a58d; background: #e3f0e5; }
.item-number { background: #e9dbef; border-radius: 5px; padding: 1px 4px; margin-right: 4px; }
.item-check { margin-left: 5px; color: var(--deep); }
.sub { color: var(--muted); margin-top: 5px; }
.arrows { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; margin-top: 11px; }
.arrows button { color: var(--ink); display: grid; justify-items: center; padding: 5px 1px; border: 1px solid #9aaea4; background: white; border-radius: 10px; font-weight: 750; font-size: clamp(.65rem, 1.38vw, .88rem); min-height: 56px; }
.arrows strong { line-height: 1; font-size: clamp(1.55rem, 3vw, 2.05rem); }
.extra-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.extra-actions button[aria-pressed="true"] { background: var(--lavender); border-color: #765081; color: var(--ink); }
.plan { border-radius: 13px; border: 1px dashed #a4b7ac; padding: 8px 10px 10px; margin: 10px 0 0; background: #fff; }
.plan-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.linkish { border: none; background: none; text-decoration: underline; color: var(--deep); min-height: 38px; padding: 5px; font-size: .88rem; font-weight: 760; }
.queue { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; padding: 0; margin: 0; }
.token { display: inline-grid; place-content: center; gap: 1px; line-height: 1.05; border: 1px solid #91b8a3; border-radius: 9px; min-width: 44px; min-height: 44px; padding: 4px; color: var(--ink); background: #e3f0e5; text-align: center; font-weight: 820; font-size: 1.18rem; }
.token-count { font-size: .64rem; font-weight: 700; }
.token.done { background: var(--lavender); opacity: 1; }
.token.failed { background: #f7d8c6; border-color: #915437; opacity: 1; }
.empty-plan { margin-top: 3px; color: var(--muted); font-size: .9rem; }
.feedback { background: #fff3d3; border: 1px solid #e0c881; border-radius: 10px; padding: 8px 10px; margin-top: 10px; font-size: .93rem; font-weight: 700; }
.feedback[data-empty="true"] { margin: 0; padding: 0; border: 0; }
.option { cursor: pointer; display: flex; align-items: center; gap: 7px; width: fit-content; margin-top: 7px; min-height: 40px; font-size: .9rem; font-weight: 700; }
.option input { width: 19px; height: 19px; accent-color: var(--deep); }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.primary, .outline { border: 1px solid var(--deep); min-height: 46px; border-radius: 11px; color: white; background: var(--deep); padding: 6px 13px; font-weight: 780; font-size: .93rem; }
.outline { background: #fff; color: var(--deep); }
.guide { border-radius: 17px; background: var(--lavender); padding: 14px 19px; }
.guide-body { max-width: 77ch; padding-top: 11px; }
.guide-body ol { padding-left: 22px; }
.guide-body li + li, .guide-body p + p { margin-top: 8px; }
.reference { font-size: .88rem; }
.footer { color: var(--muted); padding: 19px 0 29px; font-size: .9rem; }
@media (max-width: 720px) {
  .wrap { width: calc(100% - 26px); }
  .top { min-height: 62px; }
  .top img { width: 62px; }
  .hero { min-height: 132px; grid-template-columns: 1fr minmax(128px, 40%); border-radius: 20px; }
  .hero img { height: 143px; }
  .hero p { margin-top: 7px; }
  .game { border-radius: 18px; margin-top: 12px; }
  .play { grid-template-columns: 1fr; }
  .map-panel { width: 100%; max-width: 530px; margin-inline: auto; }
  .arrows button { font-size: .82rem; }
}
@media (max-width: 405px) {
  .worlds { gap: 5px; margin-bottom: 13px; }
  .worlds button { min-height: 65px; padding-inline: 6px; }
  .worlds strong span { display: block; margin: 0 0 3px; }
  .worlds strong { font-size: .81rem; }
  .world-range { font-size: .72rem; }
  .hero-copy { padding-left: 13px; }
  .hero h1 { font-size: 2.15rem; }
  .game { padding: 12px; }
}
