.crossing-game {
  --cx-ink: #263b3d;
  --cx-muted: #546766;
  --cx-paper: #faf7ec;
  --cx-edge: #879d91;
  --cx-green: #d9e4c9;
  --cx-water: #b8dce0;
  --cx-road: #a9b5b2;
  color: var(--cx-ink);
  font: 500 1rem/1.45 system-ui, sans-serif;
}
.crossing-game *, .crossing-game *::before, .crossing-game *::after { box-sizing: border-box; }
.cx-shell { max-width: 1120px; margin: 0 auto; padding: clamp(.7rem, 2vw, 1.4rem); border: 1px solid #cbd5c7; border-radius: 20px; background: var(--cx-paper); box-shadow: 0 9px 24px #263b3d14; }
.cx-heading, .cx-toolbar, .cx-readouts, .cx-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .7rem; }
.cx-heading, .cx-toolbar { justify-content: space-between; }
.cx-heading { margin-bottom: .35rem; }
.cx-heading h2 { margin: 0; color: var(--cx-ink); font: 700 clamp(1.35rem, 2.5vw, 2rem)/1.15 Georgia, serif; }
.cx-kicker { margin: 0 0 .25rem; color: #496a5e; font-size: .75rem; font-weight: 800; letter-spacing: .12em; }
.cx-stamp { padding: .35rem .65rem; border: 1px solid #bc9870; border-radius: 99px; color: #715033; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.cx-instructions, .cx-reload-note { margin: .65rem 0; color: var(--cx-muted); }
.cx-toolbar { margin: .7rem 0; }
.cx-readouts { gap: .55rem 1rem; color: var(--cx-muted); }
.cx-readouts strong { color: var(--cx-ink); font-variant-numeric: tabular-nums; }
.crossing-game button { min-width: 44px; min-height: 44px; border: 1px solid #73887e; border-radius: 10px; background: #fffdf5; color: var(--cx-ink); font: 700 1rem/1.1 system-ui, sans-serif; cursor: pointer; touch-action: manipulation; }
.crossing-game button:hover:not(:disabled) { background: #e4efdd; color: #20383a; }
.crossing-game button:disabled { cursor: default; opacity: .62; }
.crossing-game button:focus-visible { outline: 3px solid #b05232; outline-offset: 2px; position: relative; z-index: 4; }
.crossing-game select { min-height: 44px; padding: .45rem .65rem; border: 1px solid #73887e; border-radius: 10px; background: #fffdf5; color: var(--cx-ink); font: 700 1rem system-ui, sans-serif; }
.crossing-game select:focus-visible { outline: 3px solid #b05232; outline-offset: 2px; }
.cx-tier-label { display: flex; align-items: center; gap: .4rem; color: var(--cx-ink); font-weight: 700; }
.cx-layout { display: flex; align-items: flex-start; gap: clamp(1rem, 3vw, 2rem); }
.cx-board-frame { flex: none; padding: 8px; border: 2px solid #78917f; border-radius: 14px; background: #ecf0dd; box-shadow: inset 0 1px 4px #17302c24; }
.cx-board { position: relative; display: grid; width: min(373.34px, max(233.34px, calc((100vh - 320px) * .7778))); height: auto; max-width: 100%; min-width: 0; aspect-ratio: 7 / 9; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(9, 1fr); overflow: hidden; border: 1px solid #627c72; border-radius: 8px; isolation: isolate; touch-action: none; }
.cx-cell { position: relative; z-index: 0; min-width: 0 !important; min-height: 0 !important; padding: 0; border: 1px solid #ffffff68 !important; border-radius: 0 !important; color: var(--cx-ink); }
.cx-row-0, .cx-row-1, .cx-row-5, .cx-row-8 { background: repeating-linear-gradient(90deg, #dae5ce 0 14px, #d2dfc5 14px 17px) !important; }
.cx-row-2, .cx-row-4 { background: repeating-linear-gradient(0deg, #b8dce0 0 12px, #a6d1d7 12px 15px) !important; }
.cx-row-3 { background: repeating-linear-gradient(0deg, #c1e0e0 0 12px, #add4d9 12px 15px) !important; }
.cx-row-6, .cx-row-7 { background: repeating-linear-gradient(90deg, #98a5a3 0 22px, #edf0e8 22px 26px) !important; }
.cx-cell:hover:not(:disabled) { filter: brightness(1.06); }
.cx-cell:focus-visible { outline: 3px solid #b05232 !important; outline-offset: -3px !important; }
.cx-bay-mark { display: grid; place-items: center; position: absolute; inset: 11%; border: 2px dashed #75522f; border-radius: 50%; background: #fff2c9; color: #503b22; font-size: clamp(.8rem, 2vw, 1.25rem); font-weight: 900; }
.cx-bay-mark:empty { display: none; }
.cx-bay-mark.is-delivered { border-style: solid; background: #c7e5cb; color: #174b37; }
.cx-cell.is-delivered { box-shadow: inset 0 0 0 3px #246b4b; }
.cx-hazards { position: absolute; z-index: 1; inset: 0; pointer-events: none; overflow: hidden; }
.cx-hazard { position: absolute; display: grid; place-items: center; overflow: hidden; border: 2px solid #263d3c; border-radius: 8px; color: #fffdf3; font-size: clamp(.8rem, 2vw, 1.3rem); font-weight: 900; line-height: 1; text-shadow: 0 1px 2px #172d2e; }
.cx-vehicle { background: repeating-linear-gradient(90deg, #3b5862 0 12px, #597580 12px 18px); box-shadow: inset 0 -4px #d8bc69; }
.cx-raft { border-color: #44685d; border-radius: 6px; background: repeating-linear-gradient(0deg, #92683e 0 7px, #c09157 7px 12px); color: #183e45; text-shadow: 0 1px #fff9d9; box-shadow: inset 0 3px #e0bb79, inset 0 -3px #624a32; }
.cx-player { position: absolute; z-index: 2; display: grid; place-items: center; width: calc(100% / 7); height: calc(100% / 9); transform: translate(-50%, -50%); border: 2px solid #243f43; border-radius: 50%; background: #fff8e8; font-size: clamp(1rem, 2.8vw, 1.75rem); line-height: 1; pointer-events: none; transition: left .08s linear, top .08s linear; }
.cx-side { flex: 1 1 210px; min-width: 190px; max-width: 290px; }
.cx-pad { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 48px); justify-content: center; gap: 5px; }
.cx-pad [data-direction="up"] { grid-column: 2; grid-row: 1; }
.cx-pad [data-direction="left"] { grid-column: 1; grid-row: 2; }
.cx-pad [data-direction="down"] { grid-column: 2; grid-row: 2; }
.cx-pad [data-direction="right"] { grid-column: 3; grid-row: 2; }
.cx-legend { display: grid; gap: .45rem; margin: 1rem 0; padding: 0; color: var(--cx-ink); font-size: .95rem; }
.cx-legend span { display: flex; align-items: center; gap: .55rem; }
.cx-legend i { display: inline-grid; place-items: center; width: 2rem; height: 1.5rem; border: 1px solid #415954; border-radius: 5px; font-style: normal; font-weight: 900; }
.cx-legend-road { background: #3b5862; color: white; }
.cx-legend-raft { background: repeating-linear-gradient(0deg, #92683e 0 5px, #c09157 5px 8px); color: #183e45; }
.cx-legend-home { background: #fff2c9; color: #503b22; }
.cx-help, .cx-status, .cx-reward { color: var(--cx-ink); }
.cx-help { margin: 1rem 0; font-size: .9rem; }
.cx-status { min-height: 3.2em; margin: .8rem 0; font-weight: 750; }
.cx-status.is-success { color: #216548; }
.cx-status.is-paused { color: #865920; }
.cx-reward { min-height: 2.8em; margin: .5rem 0; font-size: .9rem; }
.cx-reload-note { font-size: .85rem; }
.cx-dialog { width: min(92vw, 30rem); padding: 1.25rem; border: 1px solid #879d91; border-radius: 16px; background: var(--cx-paper); color: var(--cx-ink); box-shadow: 0 16px 56px #172d2e55; }
.cx-dialog::backdrop { background: #172d2e99; }
.cx-dialog h3 { margin: 0 0 .5rem; color: var(--cx-ink); font: 700 1.35rem/1.2 Georgia, serif; }
.cx-dialog p { margin: .5rem 0 1rem; color: #293f43; }
.cx-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; }

@media (max-width: 720px) {
  .cx-layout { width: 100%; min-width: 0; flex-wrap: wrap; justify-content: center; gap: .5rem; }
  .cx-board-frame { box-sizing: border-box; flex: 0 1 100%; width: 100%; max-width: 100%; }
  .cx-board { width: min(100%, 373.34px); max-width: 100%; }
  .cx-side { display: grid; grid-template-columns: minmax(0, 154px) minmax(0, 1fr); gap: .4rem .6rem; width: 100%; max-width: none; min-width: 0; }
  .cx-pad { grid-row: span 2; align-self: center; width: 100%; }
  .cx-legend { grid-column: 2; margin: .2rem 0; }
  .cx-help, .cx-status, .cx-reward { grid-column: 1 / -1; margin: .35rem 0; }
}
@media (max-width: 360px) {
  .cx-side { grid-template-columns: minmax(0, 1fr); }
  .cx-pad { grid-row: auto; justify-self: center; width: min(100%, 154px); }
  .cx-legend { grid-column: 1; }
}
@media (max-height: 800px) {
  .cx-shell { padding: .55rem; }
  .cx-heading { display: none; }
  .cx-instructions, .cx-reload-note { margin: .3rem 0; font-size: .85rem; }
  .cx-toolbar { margin: .35rem 0; gap: .4rem; }
  .cx-readouts { gap: .35rem .7rem; }
  .cx-board-frame { padding: 5px; }
  .cx-help { margin: .45rem 0; font-size: .82rem; }
  .cx-status { min-height: 2.4em; margin: .4rem 0; }
  .cx-reward { min-height: 2em; margin: .3rem 0; font-size: .82rem; }
}
@media (prefers-reduced-motion: reduce) { .cx-player { transition: none; } }

/* Camden's course has painted lane markings and recognizable, layered movers. */
.cx-row-0, .cx-row-1, .cx-row-5, .cx-row-8 {
  background-color: #d7e4c8 !important;
  background-image: radial-gradient(ellipse at 18% 80%, #73916d 0 2%, transparent 2.5%),
    radial-gradient(ellipse at 78% 20%, #829c72 0 2.5%, transparent 3%),
    repeating-linear-gradient(90deg, #dce7d1 0 15px, #cbdcbf 15px 18px) !important;
}
.cx-row-1::before, .cx-row-5::before, .cx-row-8::before {
  position: absolute; inset: 0; pointer-events: none; content: "";
  background: repeating-linear-gradient(90deg, transparent 0 15px, #84997544 15px 17px);
}
.cx-row-2, .cx-row-4 { background: repeating-linear-gradient(165deg, #b8dce0 0 10px, #9ccbd2 10px 12px, #c5e5e5 12px 23px) !important; }
.cx-row-3 { background: repeating-linear-gradient(15deg, #c3e2e1 0 9px, #a7d2d7 9px 11px, #d0e9e6 11px 22px) !important; }
.cx-row-2::before, .cx-row-3::before, .cx-row-4::before {
  position: absolute; inset: 0; pointer-events: none; content: "";
  background: repeating-linear-gradient(90deg, transparent 0 18px, #f5ffff4c 18px 20px);
}
.cx-row-6, .cx-row-7 {
  background: linear-gradient(180deg, #82908f, #657775 50%, #899895) !important;
}
.cx-row-6::before, .cx-row-7::before {
  position: absolute; inset: 46% 0; pointer-events: none; content: "";
  border-top: 2px dashed #f6edc68c;
}
.cx-hazard { border-width: 1px; }
.cx-vehicle {
  overflow: visible; border-color: #243d43; border-radius: 9px 12px 7px 7px;
  background: linear-gradient(180deg, #718d90 0 20%, #315560 21% 74%, #b84f37 75% 88%, #384b50 89%);
  box-shadow: inset 0 2px #d9c587, inset 0 -2px #263b42, 0 2px 2px #122d3055;
}
.cx-vehicle-road-lower { background: linear-gradient(180deg, #d8c17c 0 16%, #c67442 17% 72%, #f0dbac 73% 85%, #384b50 86%); }
.cx-vehicle::before {
  position: absolute; left: 16%; right: 16%; top: 17%; height: 30%; content: "";
  border: 1px solid #cadfdb; border-radius: 7px 7px 2px 2px;
  background: linear-gradient(135deg, #b6d3d1, #698d94 72%);
}
.cx-wheel { position: absolute; z-index: 1; bottom: -2px; width: 18%; height: 19%; border: 1px solid #16272c; border-radius: 50%; background: #29383b; }
.cx-wheel-front { right: 13%; }
.cx-wheel-back { left: 13%; }
.cx-window { display: none; }
.cx-hazard-arrow { position: absolute; z-index: 2; right: 2%; top: 19%; color: #fff8d8; font: 900 1rem/1 system-ui, sans-serif; text-shadow: 0 1px 2px #10282d; }
.cx-raft {
  display: flex; align-items: center; justify-content: space-evenly; gap: 2%; overflow: visible;
  border: 1px solid #654b32; border-radius: 7px; padding: 5% 3%;
  background: linear-gradient(180deg, #e0bd7b 0 13%, #986c42 14% 83%, #63482e 84%);
  box-shadow: inset 0 2px #f0d394, 0 2px 2px #193c4055;
}
.cx-raft-log { flex: 1; height: 69%; border: 1px solid #74502f; border-radius: 999px; background: repeating-linear-gradient(90deg, #d5a867 0 8px, #bd8b50 8px 10px); box-shadow: inset 0 1px #f0cb86; }
.cx-raft-log:nth-child(2) { transform: translateY(-16%); }
.cx-hazard-arrow { right: 5%; }
.cx-player { transition: left .06s linear, top .06s linear; box-shadow: 0 2px 3px #233f4055; }
@media (prefers-reduced-motion: reduce) {
  .cx-player { transition: none; }
  .cx-row-2, .cx-row-3, .cx-row-4 { background-image: none !important; }
}
