@font-face { font-family: DM Sans; src: url(assets/dm-sans-500.ttf); font-weight: 500; font-display: swap; }
@font-face { font-family: DM Sans; src: url(assets/dm-sans-700.ttf); font-weight: 700; font-display: swap; }
@font-face { font-family: Manrope; src: url(assets/manrope-800.ttf); font-weight: 800; font-display: swap; }

:root {
  color-scheme: light;
  font: 500 16px/1.45 "DM Sans", system-ui, sans-serif;
  color: #20284b;
  background: #edf0ff;
  --ink: #20284b;
  --muted: #535d83;
  --accent: #4151d1;
  --strong: "Manrope", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 18% 8%, #e2dcff, transparent 48%), radial-gradient(ellipse at 92% 40%, #dceefa, transparent 55%); }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid #645cdb; outline-offset: 3px; }
.app { width: min(100%, 920px); margin: 0 auto; padding: clamp(12px, 3vw, 28px); }
.app:has(.round:not([hidden])), .app:has(.result:not([hidden])) { max-width: 558px; }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 0 15px 3px; }
.brand img { border-radius: 13px; box-shadow: 0 3px 7px #28305625; }
.brand strong { display: block; font: 800 1.1rem/1.25 var(--strong); }
.brand span { font-size: .84rem; color: var(--muted); }
.screen { background: #fbfbff; border: 1px solid #fff; border-radius: 26px; box-shadow: 0 16px 45px #343c8220, 0 3px 8px #343c8210; }
.welcome { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.intro-art { background: #111734 url(assets/duel-cover.jpg) center/cover no-repeat; min-height: 375px; }
.intro { display: flex; flex-direction: column; justify-content: center; padding: clamp(20px, 4vw, 42px); }
h1, p { margin: 0; }
h1 { font: 800 clamp(1.65rem, 4.8vw, 2.5rem)/1.12 var(--strong); letter-spacing: -.035em; }
.intro h1 { font-size: clamp(2rem, 5vw, 3.25rem); max-width: 320px; }
h1 em { color: var(--accent); font-style: normal; white-space: nowrap; }
.intro > p, .result > p { margin-top: 9px; color: var(--muted); }
.lineup, .splits { list-style: none; padding: 0; }
.lineup { display: flex; flex-wrap: wrap; gap: 7px; margin: 17px 0 22px; }
.lineup li { display: flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 700; background: #edf0ff; border-radius: 9px; padding: 4px 7px 4px 4px; }
.lineup img, .splits img { border-radius: 7px; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: .6em; min-height: 48px; padding: 8px 16px; border: 0; border-radius: 13px; font-weight: 700; text-decoration: none; text-align: center; }
.primary { color: white; background: #4353d3; box-shadow: 0 3px 0 #303fae; }
.primary:hover { background: #3848c0; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #303fae; }
.secondary { color: var(--accent); background: #e9edff; }
.secondary:hover { background: #dce3ff; }
.round, .result { padding: clamp(12px, 3vw, 24px); }
.round-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.round-header h1 { font-size: clamp(1.45rem, 6vw, 2.1rem); }
.round-label { color: var(--accent); font-weight: 700; font-size: .82rem; margin-bottom: 4px; }
.clock { flex: 0 0 auto; display: grid; min-width: 73px; text-align: center; padding: 5px 9px; border-radius: 11px; background: #e8ecff; }
.clock span, .times span { color: var(--muted); font-size: .75rem; }
.clock strong, .times strong, .split-time { font-variant-numeric: tabular-nums; }
.clock strong { font: 800 1.15rem/1.25 var(--strong); font-variant-numeric: tabular-nums; }
.progress { display: flex; margin: 10px 0; gap: 5px; }
.progress i { flex: 1; height: 4px; border-radius: 8px; background: #e0e4f4; }
.progress .complete { background: #56aa93; }
.progress .current { background: #5363db; }
.instruction { min-height: 2lh; margin: 0 0 10px; color: var(--muted); font-size: .91rem; }
#board-area, .puzzle-controls { max-width: 430px; margin-inline: auto; }
.board { position: relative; isolation: isolate; width: 100%; aspect-ratio: 1; border-radius: 13px; }
.path-board, .cars-board { touch-action: none; user-select: none; }
.path-board { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; padding: 3px; background: #dce2f6; overflow: clip; }
.path-cell { display: grid; place-items: center; border: 0; padding: 0; background: #f9faff; border-radius: 4px; position: relative; color: white; outline-offset: -3px; min-width: 0; min-height: 0; }
.path-cell:focus-visible { z-index: 1; outline-offset: -3px; }
.path-cell.filled { background: color-mix(in srgb, var(--route) 13%, #fafbff); }
.path-cell .path-leg { position: absolute; display: none; background: var(--route); pointer-events: none; }
.path-leg.n, .path-leg.s { width: 23%; height: 53%; left: 38.5%; }
.path-leg.e, .path-leg.w { height: 23%; width: 53%; top: 38.5%; }
.path-leg.n { top: -2%; }
.path-leg.s { bottom: -2%; }
.path-leg.e { right: -2%; }
.path-leg.w { left: -2%; }
.path-cell[data-legs~="n"] .n, .path-cell[data-legs~="e"] .e, .path-cell[data-legs~="s"] .s, .path-cell[data-legs~="w"] .w { display: block; }
.dot { display: grid; place-items: center; position: relative; z-index: 1; width: 60%; aspect-ratio: 1; border: 2px solid #ffffffd9; border-radius: 50%; background: var(--route); box-shadow: 0 2px 4px #20284b42; font-size: clamp(.7rem, 3vw, .97rem); font-weight: 700; pointer-events: none; }
.path-cell.active .dot { box-shadow: 0 0 0 2px #20284b, 0 2px 4px #20284b42; }
.route-end { position: relative; border-radius: 50%; background: var(--route); width: 23%; aspect-ratio: 1; pointer-events: none; }
.cars-board { background: #273456; --grid: calc(100% / 6); }
.parking-spots { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: repeat(6, 1fr); position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.parking-spots i { border: 1px solid #5964836b; }
.parking-spots .exit-row { background: #5374624d; }
.exit { color: #294b3c; background: #adf5c8; border: 1px solid #73c095; width: 25px; padding: 2px 0; right: -5px; position: absolute; z-index: 1; text-align: center; font-size: .86rem; border-radius: 6px; pointer-events: none; }
.car { display: grid; place-items: center; position: absolute; margin: 0; padding: 0; border: 1px solid #ffffffe0; border-radius: 10px; background: var(--paint); color: white; box-shadow: inset 0 -3px 0 #15204533, 0 2px 5px #17234375; touch-action: none; }
.car.selected { outline: 2px solid #fff; outline-offset: -2px; z-index: 2; }
.car:focus-visible { outline: 3px solid #fff; outline-offset: 2px; z-index: 3; }
.car .glass { display: grid; place-items: center; width: 56%; height: 66%; border-radius: 5px; border-inline: 4px solid #ffffff70; background: #202945a1; pointer-events: none; }
.car.vertical .glass { width: 66%; height: 56%; border: 0; border-block: 4px solid #ffffff70; }
.car b { font-weight: 800; font-size: clamp(.84rem, 3vw, 1.3rem); }
.sudoku-board { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); overflow: hidden; border: 2px solid #8c99c5; max-width: min(100%, 360px); margin-inline: auto; }
.sudoku-cell { background: #f9faff; color: #4353d3; position: relative; min-width: 0; min-height: 0; border: 0; border-right: 1px solid #c7d0eb; border-bottom: 1px solid #c7d0eb; padding: 0; border-radius: 0; font: 800 clamp(1.35rem, 7.5vw, 2.15rem)/1 var(--strong); }
.sudoku-cell:nth-child(4n+2) { border-right: 2px solid #8c99c5; }
.sudoku-cell:nth-child(n+5):nth-child(-n+8) { border-bottom: 2px solid #8c99c5; }
.sudoku-cell.given { background: #e9edfc; color: #303857; }
.sudoku-cell.selected { background: #d6defe; }
.sudoku-cell:focus-visible { outline-offset: -4px; }
.sudoku-cell.conflict { color: #a92943; background: #ffe3eb; }
.puzzle-controls { display: flex; justify-content: center; gap: 7px; }
.puzzle-controls:not(:empty) { margin-top: 9px; }
.tile-key { background: #e9edff; color: var(--accent); border: 0; border-radius: 9px; min-height: 44px; min-width: 44px; padding: 0 9px; font-weight: 700; }
.tile-key:hover:not(:disabled) { background: #dfe5ff; }
.tile-key:disabled { color: #697393; opacity: .65; }
.status { min-height: 1.45em; margin: 7px auto 0; text-align: center; color: var(--muted); font-size: .83rem; }
.round-tools { display: flex; justify-content: center; }
.quiet { min-height: 44px; padding: 0 14px; color: #4b5580; border: 0; border-radius: 8px; background: transparent; font-size: .84rem; }
.quiet:hover { background: #edf0ff; }
.countdown { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; background: #141d4cc2; }
.countdown strong { min-width: 136px; text-align: center; padding: 12px; color: white; font: 800 clamp(3.5rem, 14vw, 7.8rem)/1.2 var(--strong); text-shadow: 0 3px 15px #121b44; }
.result { text-align: center; }
.result-icon img { border-radius: 19px; box-shadow: 0 4px 12px #242c5f38; margin: 5px 0 12px; }
.times { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 19px 0; }
.times div { display: grid; gap: 2px; padding: 10px 5px; border-radius: 12px; background: #ebefff; }
.times div:first-child { background: #e5e9ff; }
.times strong { font: 800 clamp(1.3rem, 6vw, 1.8rem)/1.2 var(--strong); font-variant-numeric: tabular-nums; }
.splits { display: grid; gap: 6px; margin: 0 0 18px; }
.splits li { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; text-align: left; gap: 9px; border-radius: 8px; padding: 5px 10px; background: #f1f3fe; font-size: .9rem; }
.split-time { font-weight: 700; }
.result-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 9px; }
.result .store-note { font-size: .83rem; margin-bottom: 2px; }
@media (max-width: 680px) {
  .welcome { grid-template-columns: 1fr; }
  .intro-art { min-height: unset; aspect-ratio: 2 / 1; }
  .intro h1 { max-width: unset; }
}
@media (max-width: 360px) {
  .app { padding-inline: 7px; }
  .round, .result { padding-inline: 9px; }
  .instruction { font-size: .85rem; }
  .result-actions { grid-template-columns: 1fr; }
}
