:root {
  color-scheme: light;
  --blue: #2457e8;
  --ink: #192b46;
  --muted: #647187;
  --line: #e3e9f2;
  --green: #078263;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #f6f8fc; font-size: 16px; line-height: 1.6; word-break: keep-all; overflow-wrap: break-word; }
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, .maze:focus-visible { outline: 3px solid var(--blue); outline-offset: 5px; }
button:disabled { cursor: default; opacity: .42; }
svg { display: block; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-inner { max-width: 1000px; padding: 18px 32px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: 21px; font-weight: 800; letter-spacing: -.7px; }
.brand-icon { width: 36px; height: 36px; color: var(--blue); }
.brand-dot { color: var(--blue); }
.course-label { font-size: 14px; color: var(--muted); }
.page { max-width: 1000px; margin: auto; padding: 28px 32px 22px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--blue); font-size: 12px; font-weight: 750; letter-spacing: 1.8px; }
h1 { margin: 0; font-size: clamp(26px, 3.2vw, 34px); line-height: 1.4; letter-spacing: -1.1px; font-weight: 750; }
.intro { margin: 8px 0 0; color: var(--muted); }
.map-label { flex-shrink: 0; align-self: flex-end; padding-bottom: 4px; font-size: 12px; letter-spacing: 1px; font-weight: 650; color: var(--muted); }
.map-label span { margin: 0 9px; color: #adb8ca; }
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 278px; gap: 28px; align-items: start; }
.board-card { min-width: 0; padding: 25px 30px 22px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 8px 30px #24375a04; }
.board-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.board-heading h2 { margin: 0; font-size: 17px; font-weight: 700; }
.board-hint { color: var(--muted); font-size: 14px; }
.maze-frame { padding: 12px; border: 1px solid #dce4f0; border-radius: 15px; background: #f0f4fa; }
.maze { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); grid-template-rows: repeat(13, minmax(0, 1fr)); aspect-ratio: 1; gap: 2px; border-radius: 5px; transition: box-shadow .2s; }
.cell { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; border-radius: 3px; }
.wall { background: #233e61; box-shadow: inset 0 2px 0 #ffffff08; }
.path { background: #fff; }
.start::after { content: ""; width: 21%; height: 21%; border: 1.5px solid #9aaecb; border-radius: 50%; }
.goal { color: var(--green); background: #daf3e9; }
.goal .icon { width: 62%; height: 62%; stroke-width: 2; }
.player::before { content: ""; position: absolute; width: 65%; height: 65%; border-radius: 50%; background: var(--blue); border: 2px solid #fff; box-shadow: 0 0 0 2px #2457e827, 0 2px 5px #2457e832; z-index: 1; }
.player::after { content: ""; position: absolute; width: 14%; height: 14%; background: white; border: 0; border-radius: 50%; z-index: 2; }
.maze.is-complete { box-shadow: 0 0 0 4px #12a17b25; }
.maze.is-complete .player::before { background: var(--green); }
.maze.is-complete .player::after { display: none; }
.maze.is-complete .player .icon { position: relative; z-index: 2; color: white; width: 42%; height: 42%; }
.board-footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 26px; margin-top: 21px; color: var(--muted); font-size: 14px; }
.board-footer > span { display: flex; align-items: center; gap: 8px; }
.board-footer i { display: inline-grid; place-items: center; width: 15px; height: 15px; }
.legend-player { border-radius: 50%; background: var(--blue); border: 2px solid white; box-shadow: 0 0 0 1px #2457e849; }
.legend-goal { color: var(--green); }
.legend-goal .icon { width: 17px; height: 17px; }
.legend-wall { background: #233e61; border-radius: 3px; }
.play-panel { min-width: 0; }
.mission-card { position: relative; padding: 24px; border-radius: 18px; color: #fff; background: var(--blue); }
.mission-card .eyebrow { color: #d3deff; margin-bottom: 11px; }
.mission-card h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -.5px; }
.mission-card > p:last-child { margin: 9px 0 0; color: #e7edff; font-size: 15px; line-height: 1.75; }
.mission-icon { position: absolute; top: 20px; right: 20px; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #ffffff45; border-radius: 9px; }
.mission-icon .icon { width: 17px; height: 17px; }
.steps-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 3px 12px; border-bottom: 1px solid var(--line); }
.steps-card > span { font-size: 14px; color: var(--muted); }
.steps-card > div { display: flex; align-items: baseline; gap: 7px; }
#step-count { font-size: 35px; line-height: 1.25; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -1.5px; }
.step-unit { color: var(--muted); font-size: 14px; }
.game-status { display: flex; flex-direction: column; gap: 4px; margin-top: 17px; min-height: 68px; font-size: 14px; color: var(--muted); }
.status-title { font-weight: 650; color: var(--ink); font-size: 15px; }
.game-status.is-blocked .status-title { color: #a34f0e; }
.game-status.is-complete { padding: 13px 14px; border-radius: 12px; background: #e2f5ed; color: #12634e; }
.game-status.is-complete .status-title { color: #076a4e; }
.controls { margin-top: 13px; text-align: center; }
.controls h2 { margin: 0; font-size: 15px; font-weight: 650; }
.controls > p { margin: 3px 0 14px; color: var(--muted); font-size: 14px; }
.direction-pad { display: grid; grid-template: repeat(2, 46px) / repeat(3, 52px); gap: 6px; justify-content: center; }
.direction-button { display: grid; place-items: center; color: var(--ink); background: #fff; border: 1px solid #d9e1ee; border-bottom-width: 3px; border-radius: 10px; touch-action: manipulation; transition: background .12s, transform .12s; }
.direction-button:not(:disabled):active { transform: translateY(2px); border-bottom-width: 1px; background: #e6edff; }
.up { grid-area: 1 / 2; }
.left { grid-area: 2 / 1; }
.left .icon { transform: rotate(-90deg); }
.right { grid-area: 2 / 3; }
.right .icon { transform: rotate(90deg); }
.down { grid-area: 2 / 2; }
.down .icon { transform: rotate(180deg); }
.pad-center { display: none; }
.pad-center span { width: 6px; height: 6px; background: #b6c4dc; border-radius: 50%; }
.restart-button { margin-top: 23px; width: 100%; min-height: 49px; display: flex; align-items: center; justify-content: center; gap: 9px; border-radius: 11px; border: 1px solid #cdd9f4; color: var(--blue); background: #eaf0ff; font-size: 15px; font-weight: 650; touch-action: manipulation; }
.restart-button .icon { width: 18px; height: 18px; }
.restart-note { text-align: center; color: var(--muted); font-size: 12px; margin: 9px 0 0; }
.page-footer { margin-top: 30px; display: flex; justify-content: space-between; gap: 18px; color: #738198; font-size: 12px; }
.page-footer > span:first-child { font-weight: 750; letter-spacing: 1px; }
.noscript-message { color: #a34f0e; }

@media (hover: hover) {
  .direction-button:not(:disabled):hover { border-color: #a9bbed; background: #f0f4ff; }
  .restart-button:hover { background: #dce6ff; border-color: #a9bbed; }
}

@media (min-width: 721px) and (max-height: 820px) {
  .page { padding-top: 20px; }
  .page-heading { margin-bottom: 20px; }
  .maze-frame { max-width: max(310px, calc(100svh - 320px)); margin-inline: auto; }
  .mission-card { padding: 17px 21px; }
  .mission-card .eyebrow { margin-bottom: 6px; }
  .mission-card > p:last-child { margin-top: 5px; font-size: 14px; line-height: 1.6; }
  .steps-card { padding-top: 12px; padding-bottom: 9px; }
  .game-status { margin-top: 12px; min-height: 64px; }
  .controls { margin-top: 7px; }
  .controls > p { margin-bottom: 10px; }
  .restart-button { margin-top: 16px; min-height: 44px; }
  .page-footer { margin-top: 20px; }
}

@media (max-width: 900px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 245px; gap: 20px; }
  .board-card { padding: 20px 18px; }
  .board-heading { flex-wrap: wrap; gap: 3px; margin-bottom: 16px; }
  .mission-card { padding: 21px; }
  .maze-frame { padding: 9px; }
}

@media (max-width: 720px) {
  .header-inner { padding: 17px 20px; }
  .brand { font-size: 18px; gap: 9px; }
  .brand-icon { width: 31px; height: 31px; }
  .course-label { max-width: 132px; text-align: right; font-size: 12px; }
  .page { max-width: 560px; padding: 25px 18px 20px; }
  .page-heading { margin-bottom: 21px; }
  .intro { font-size: 15px; max-width: 300px; }
  .map-label { display: none; }
  .game-layout { grid-template-columns: 1fr; gap: 20px; }
  .board-card { padding: 17px 14px; border-radius: 16px; }
  .board-heading { justify-content: space-between; margin-bottom: 13px; }
  .board-heading h2 { font-size: 16px; }
  .board-hint { font-size: 12px; }
  .maze-frame { padding: 8px; border-radius: 10px; }
  .maze { gap: 2px; }
  .cell { border-radius: 2px; }
  .board-footer { margin-top: 17px; gap: 23px; font-size: 12px; }
  .play-panel { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; align-items: start; }
  .mission-card { display: none; }
  .steps-card { grid-column: 1; padding: 0 0 12px; margin-top: 5px; }
  .game-status { grid-column: 1; grid-row: 2; margin-top: 12px; font-size: 14px; }
  .controls { grid-column: 2; grid-row: 1 / span 3; margin: 0; }
  .controls > p { font-size: 12px; margin-bottom: 12px; }
  .direction-pad { grid-template: repeat(2, 45px) / repeat(3, 45px); gap: 4px; }
  .restart-button { grid-column: 1; margin-top: 17px; }
  .restart-note { grid-column: 1 / -1; margin-top: 17px; }
  .page-footer { margin-top: 25px; flex-wrap: wrap; gap: 5px; }
}

@media (max-width: 360px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .header-inner { padding-left: 14px; padding-right: 14px; }
  .play-panel { column-gap: 12px; }
  .direction-pad { grid-template-columns: repeat(3, 42px); }
}

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