.board { background: url('/assets/turtle_race/board/board.webp') center / 100% 100% no-repeat; perspective: 900px; }
.finish-line { display: none !important; }
.position-marker { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #c73535; border: 1px solid #7e1d1d; box-shadow: 0 1px 3px #3b171799; z-index: 4; cursor: grab; touch-action: none; }
.position-marker { display: none !important; }
.position-marker:active { cursor: grabbing; }
.piece-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); font-size: 12px; }
#game .piece-controls { display: none; }
.piece-controls-title { font-weight: 800; margin-right: 2px; }
.piece-controls label { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.piece-controls input[type="range"] { width: 105px; accent-color: var(--accent); }
.piece-controls output { min-width: 34px; color: var(--ink); font-variant-numeric: tabular-nums; }
.piece-controls button { padding: 6px 10px; font-size: 12px; }
.lobby-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.game-state { margin: 14px 0 0; padding: 10px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #f5f5ed; color: var(--ink); font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }
.turtle { --piece-depth: 12px; --piece-angle: 0deg; --piece-yaw: 0deg; isolation: isolate; transform-style: preserve-3d; width: 54px; height: 162px; border: 0; border-radius: 42%; overflow: visible; background-color: transparent; background-size: contain; background-repeat: no-repeat; background-position: center; transform-origin: 50% 50%; transition: left .35s ease, top .35s ease, transform .35s ease, filter .35s ease; filter: none; box-shadow: none; }
.turtle:before { display: none; }
.turtle:after { display: none; }
.turtle { border-radius: 42%; overflow: visible; background-size: cover; }
.turtle { background-image: url('/assets/turtle_race/turtle-pieces.webp'); background-size: 500% 100%; background-repeat: no-repeat; }
.turtle.green { background-position: 100% 50%; }
.turtle.yellow { background-position: 25% 50%; }
.turtle.blue { background-position: 75% 50%; }
.turtle.red { background-position: 0 50%; }
.turtle.purple { background-position: 50% 50%; }
.turtle.green { --piece-side-light: #52ad61; --piece-side-dark: #216036; }
.turtle.yellow { --piece-side-light: #f4ce38; --piece-side-dark: #9a6816; }
.turtle.blue { --piece-side-light: #369bd0; --piece-side-dark: #1d5079; }
.turtle.red { --piece-side-light: #f34d4b; --piece-side-dark: #8e252a; }
.turtle.purple { --piece-side-light: #b65fd1; --piece-side-dark: #5c2e74; }
.login[hidden], #login[hidden], #lobby[hidden], #game[hidden] { display: none !important; }
.waiting-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 0 16px; }
.game-action-error { flex-basis: 100%; color: #a33125; font-size: 13px; }
.waiting-controls .waiting-copy { color: var(--muted); font-size: 13px; margin-right: auto; }
.dot.unknown { background: #aeb8a8; }
.dot.online { background: #3aa65c; }
.dot.offline { background: #d65752; }
#turtleWaitingPlayers .dot.turtle-random-dot { display: inline-grid; place-items: center; flex: 0 0 14.4px; width: 14.4px; height: 14.4px; margin-right: 0; border-radius: 50%; background: #929292; color: #fff; font-size: 9px; font-weight: 900; line-height: 1; }
#turtleWaitingPlayers .dot.turtle-random-dot::after { content: "?"; }
#players .dot.turtle-random-dot { display: none; }
.games .game-card { background: var(--paper); border: 1px solid var(--line); box-shadow: 0 12px 34px #56634812; padding: 22px; }
.my-turtle-card { display: flex; width: 78px; height: 78px; margin: 0 0 14px 2px; border: 2px solid white; border-radius: 8px; background-size: 100% 100%; background-position: center; background-repeat: no-repeat; box-shadow: 3px 4px 0 #d9ddce; }
.hand-layout { display: flex; align-items: flex-start; gap: 14px; }
.hand-layout .hand { margin-top: 0; }
.personal-layout { display: flex; align-items: flex-start; gap: 22px; }
.me-section { flex: 0 0 82px; }
.me-section h3, .my-hand-section h3 { margin: 0 0 14px; }
.my-hand-section { min-width: 0; flex: 1; }
.below { grid-template-columns: minmax(110px, .55fr) minmax(0, 3fr) minmax(260px, 1.25fr); }
.game-state-panel { padding: 20px; }
#gameStatePanel { display: none !important; }
.me-panel .my-turtle-card { margin: 14px auto 0; }
@media (max-width: 900px) { .below { grid-template-columns: 1fr 1fr; } .below .log-panel { grid-column: 1 / -1; } }
@media (max-width: 700px) { .below { display: block; } .below > * + * { margin-top: 16px; } }
.turtle-reveal { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; background: #26332ccf; }
.turtle-reveal[hidden] { display: none; }
.turtle-reveal p { margin: 0; color: white; font-weight: 800; font-size: 18px; }
.turtle-reveal-card, .turtle-card { width: 150px; height: 210px; border: 4px solid white; border-radius: 14px; background-color: #dff04c; background-size: cover; background-position: center; box-shadow: 0 18px 42px #0008; }
.turtle-reveal-card.red, .turtle-card.red, .my-turtle-card.red { background-image: url('/assets/turtle_race/cards/turtle-red.webp'); }
.turtle-reveal-card.yellow, .turtle-card.yellow, .my-turtle-card.yellow { background-image: url('/assets/turtle_race/cards/turtle-yellow.webp'); }
.turtle-reveal-card.green, .turtle-card.green, .my-turtle-card.green { background-image: url('/assets/turtle_race/cards/turtle-green.webp'); }
.turtle-reveal-card.blue, .turtle-card.blue, .my-turtle-card.blue { background-image: url('/assets/turtle_race/cards/turtle-blue.webp'); }
.turtle-reveal-card.purple, .turtle-card.purple, .my-turtle-card.purple { background-image: url('/assets/turtle_race/cards/turtle-purple.webp'); }
.turtle-chooser { position: fixed; z-index: 21; display: block; background: transparent; }
.turtle-chooser[hidden] { display: none; }
.finish-modal { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 18px; background: #26332ccc; }
.finish-modal[hidden] { display: none; }
.finish-modal-panel { position: relative; width: min(520px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; padding: 28px; border-radius: 20px; background: var(--paper); box-shadow: 0 18px 50px #0008; }
.finish-modal-panel h2 { margin: 0 0 18px; text-align: center; }
.finish-close { position: absolute; top: 9px; right: 12px; padding: 2px 8px; border: 0; background: transparent; color: var(--muted); font-size: 27px; line-height: 1; }
.finish-ranks { display: grid; gap: 7px; margin-bottom: 20px; }
.finish-rank { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; background: #f3f4e9; }
.finish-rank.place-1 { background: #fff1c8; }.finish-rank.place-2 { background: #edf0f2; }.finish-rank.place-3 { background: #f5e6da; }
.finish-rank.mine { background: #e4f0a8; outline: 3px solid var(--accent); font-weight: 900; }
.finish-place { min-width: 40px; font-weight: 900; }
.finish-player-icon { width: 42px; height: 42px; flex: 0 0 42px; padding: 0; border-radius: 0; background: transparent; object-fit: contain; box-shadow: none; }
.finish-turtle-color { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; background: #fff; box-shadow: 2px 2px 0 #d9ddce; }
.finish-player-details { display: grid; gap: 2px; min-width: 0; }.finish-player-details strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.finish-player-details span { color: var(--muted); font-size: 11px; text-transform: capitalize; }
.finish-rank .finish-points { flex: 0 0 auto; margin-left: auto; color: #526c18; font-size: 13px; white-space: nowrap; }.finish-score-note { margin: 0 0 9px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.last-played-card { position: absolute; right: 12px; bottom: 12px; z-index: 8; display: flex; align-items: center; gap: 7px; padding: 7px; border-radius: 10px; background: #26332ccc; box-shadow: 0 4px 12px #0006; }
.last-played-card[hidden] { display: none; }
.last-played-label { color: white; font-size: 10px; font-weight: 800; writing-mode: vertical-rl; transform: rotate(180deg); }
.last-played-label { display: none; }
.last-played-art { width: 58px; height: 78px; border: 2px solid white; border-radius: 8px; background-size: cover; background-position: center; box-shadow: 2px 3px 0 #0005; }
.last-played-art { height:90px; background-size:100% 100%; }
.live-play-card { flex:0 0 68px; width:68px; height:106px; background-size:100% 100%; background-repeat:no-repeat; background-position:center; }
.finish-actions { display:flex; justify-content:center; gap:10px; flex-wrap:wrap; }
.finish-rematch { min-width:160px; }
.test-end-game { font-size:12px; padding:8px 10px; border-color:#d89a4a; color:#8a5618; }
.finish-ok { display:block; min-width:88px; margin:0; }
.turtle-chooser-panel { width: min(560px, calc(100vw - 32px)); padding: 24px; border-radius: 20px; background: var(--paper); box-shadow: 0 18px 50px #0008; }
.turtle-chooser-panel h3 { margin: 0 0 18px; text-align: center; }
.turtle-choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.turtle-choice { min-width: 0; padding: 10px 6px; color: var(--ink); background: white; border: 2px solid var(--line); }
.turtle-choice:hover { border-color: var(--ink); }
.turtle-choice:disabled { opacity: .35; cursor: not-allowed; transform: none; }
.turtle-choice-card { display: block; width: 100%; aspect-ratio: 3 / 4; border-radius: 8px; background-size: cover; background-position: center; margin-bottom: 7px; }
.turtle-choice-label { display: block; font-size: 11px; font-weight: 800; }
.turtle-choice-card.red { background-image: url('/assets/turtle_race/cards/turtle-red.webp'); }
.turtle-choice-card.yellow { background-image: url('/assets/turtle_race/cards/turtle-yellow.webp'); }
.turtle-choice-card.green { background-image: url('/assets/turtle_race/cards/turtle-green.webp'); }
.turtle-choice-card.blue { background-image: url('/assets/turtle_race/cards/turtle-blue.webp'); }
.turtle-choice-card.purple { background-image: url('/assets/turtle_race/cards/turtle-purple.webp'); }
@media (max-width: 520px) { .turtle-choices { gap: 5px; } .turtle-choice { padding: 6px 3px; } }


.board:after { display: none !important; }
.finish-cabbage { position: absolute; left: 92.8%; top: 44%; z-index: 2; display: block; width: 6.5%; height: auto; transform: translate(-50%,-50%); pointer-events: none; user-select: none; }
.finish-cabbage.eaten { animation: cabbage-eaten .75s ease-in forwards; }
.finish-cabbage[hidden] { display: none !important; }
@keyframes cabbage-eaten { 0% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 28% { transform: translate(-50%,-58%) scale(1.12); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(.05); } }
.game-type-label { display:block; margin-bottom:5px; color:var(--green); font-size:10px; font-weight:800; letter-spacing:.1em; text-transform:uppercase; }
.lobby-actions select { font:inherit; border:1px solid var(--line); border-radius:12px; padding:12px 15px; background:#fff; color:var(--ink); }
