* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #06090f; color: #e8edf5; font-family: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; background: #182233; border: 1px solid #2c3b55; border-radius: 10px; padding: 10px 14px; cursor: pointer; }
button:hover { background: #22304a; }
button.big { background: #e0303a; border-color: #ff5560; font-weight: 800; font-size: 20px; padding: 12px 26px; }
button.big:hover { background: #f03a45; }

#hud { position: fixed; inset: 0; pointer-events: none; }
#hud button { pointer-events: auto; }
#mute, #quit { position: absolute; top: calc(10px + env(safe-area-inset-top)); width: 42px; height: 42px; padding: 0; background: #0d1420cc; }
#mute { right: 60px; }
#quit { right: 10px; }
#ticker { position: absolute; left: calc(12px + env(safe-area-inset-left)); top: calc(10px + env(safe-area-inset-top)); font: 700 15px ui-monospace, Menlo, monospace; background: #0d1420cc; padding: 6px 10px; border-radius: 8px; border: 1px solid #1d2a40; }
#ticker .dn { color: #19d27a; }
#ticker .up { color: #ff4b55; }
#ticker small { color: #8a97ad; font-weight: 400; }
#score { position: absolute; right: 112px; top: calc(10px + env(safe-area-inset-top)); text-align: right; text-shadow: 0 2px 6px #000; }
#score b { font: 900 30px ui-monospace, Menlo, monospace; display: block; line-height: 1; }
#combo { font-size: 14px; color: #ffd84a; }
#live { position: absolute; left: calc(12px + env(safe-area-inset-left)); top: calc(52px + env(safe-area-inset-top)); font-size: 13px; color: #9fb0c8; }
#hint { position: absolute; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); text-align: center; color: #b9c6da; font-size: 14px; text-shadow: 0 1px 4px #000; transition: opacity 1s; }

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #05080dd9; overflow-y: auto; padding: 16px; z-index: 5; }
.card { width: min(720px, 100%); background: #0b111c; border: 1px solid #1e2b42; border-radius: 16px; padding: 18px 20px; max-height: 100%; overflow-y: auto; }
h1 { margin: 0; font-size: 30px; letter-spacing: 1px; }
/* header shared with the main game (議場大亂鬥 #select .select-heading): title, live line, ☰ with cross-links */
.sk-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; margin-bottom: 4px; background: linear-gradient(90deg, transparent, #e8c46a66 20%, #e8c46a66 80%, transparent) bottom/100% 2px no-repeat; }
.sk-title { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; min-width: 0; }
.played-line { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 12px; font-weight: 800; color: #9bffe3; white-space: nowrap; }
.played-line i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #4fdc8f; box-shadow: 0 0 0 0 #4fdc8f88; animation: played-dot 2s ease-out infinite; }
@keyframes played-dot { 0% { box-shadow: 0 0 0 0 #4fdc8f88; } 70% { box-shadow: 0 0 0 7px #4fdc8f00; } 100% { box-shadow: 0 0 0 0 #4fdc8f00; } }
@media (prefers-reduced-motion: reduce) { .played-line i { animation: none; } }
.sk-menu { position: relative; flex: none; }
.menu-toggle { min-height: 44px; min-width: 44px; padding: 9px 15px; font-size: 16px; border-radius: 8px; border: 1px solid #e8c46a88; background: linear-gradient(180deg, #123744, #0a2430); font-weight: 800; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 9; display: flex; flex-direction: column; gap: 6px; min-width: 190px; padding: 8px; border-radius: 12px; border: 1px solid #e8c46a66; background: #0a1d25f5; box-shadow: 0 12px 30px #000a; }
.menu-list[hidden] { display: none; }
.menu-list a, .menu-list button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 18px; border-radius: 8px; border: 1px solid #e8c46a88; background: linear-gradient(180deg, #123744, #0a2430); color: #f4ead0; font-size: 14px; font-weight: 800; text-decoration: none; }
.menu-list .out { font-size: 13px; opacity: .85; }
.help { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: #121b2a; font-size: 13px; line-height: 1.5; color: #c9d6ea; }
.help p { margin: 0 0 4px; }
.help b { display: inline-block; min-width: 34px; }
.hp { color: #ffd84a; } .hb { color: #ffb02e; } .hj { color: #ff7a82; } .hk { color: #8a97ad; font-size: 12px; }
h1 small { font-size: 14px; color: #8a97ad; font-weight: 400; }
h2 { font-size: 14px; color: #8a97ad; margin: 16px 0 8px; font-weight: 600; }
.sub { margin: 6px 0 0; font-size: 16px; }
.sub .dn { color: #19d27a; font-weight: 800; }
#cast { display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px; }
.hero { position: relative; height: 92px; padding: 0; border-radius: 10px; background-color: #121b2a; background-repeat: no-repeat; background-size: 500% auto; background-position: 0 30%; }
.hero span { position: absolute; left: 0; right: 0; bottom: 2px; font-size: 11px; text-align: center; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.hero.on { outline: 3px solid #ffd84a; background-color: #24324a; }
.hero.white { box-shadow: inset 0 -4px 0 #4bd3d0; }
.hero.blue { box-shadow: inset 0 -4px 0 #3d7cff; }
.hero.green { box-shadow: inset 0 -4px 0 #2fbf5b; }
#levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.lv-group { grid-column: 1 / -1; font-size: 12px; font-weight: 800; color: #9fb0c8; margin-top: 4px; }
@media (max-width: 520px) { #levels { grid-template-columns: repeat(3, 1fr); } }
.lv { padding: 8px 4px; text-align: center; }
.lv b { display: block; font-size: 18px; }
.lv small { display: block; font-size: 11px; color: #8a97ad; }
.lv.on { outline: 3px solid #ffd84a; background: #24324a; }
.row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.room { text-align: center; font-size: 13px; color: #9fb0c8; margin: 10px 0 0; }
.room a, .foot a { color: #7fb2ff; }
.foot { font-size: 11px; color: #64728a; text-align: center; margin: 12px 0 0; }
#stats-old { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
#stats div { background: #121b2a; border-radius: 10px; padding: 8px 10px; }
#stats b { display: block; font: 800 22px ui-monospace, Menlo, monospace; }
#stats small { color: #8a97ad; }
#top { margin: 0; padding-left: 26px; font-size: 14px; }
#top li { padding: 3px 0; }
#top li.me { color: #ffd84a; }
#top .s { font-family: ui-monospace, Menlo, monospace; float: right; }
@media (max-height: 520px) { .card { padding: 10px 14px; } h2 { margin: 8px 0 4px; } .hero { height: 70px; } #cast { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); } }
#menu .row { position: sticky; bottom: -18px; background: linear-gradient(transparent, #0b111c 30%); padding: 14px 0 6px; margin-top: 8px; }
@media (max-width: 520px) { #score { right: auto; left: calc(12px + env(safe-area-inset-left)); top: calc(78px + env(safe-area-inset-top)); text-align: left; } #score b { font-size: 24px; } #ticker { font-size: 12px; } }
#hud #stop { position: absolute; top: auto; bottom: calc(52px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: auto; height: auto; padding: 12px 22px; background: #0f5132; border-color: #19d27a; font-weight: 800; font-size: 17px; }

/* controls: three big thumbs-reach buttons */
#pad { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; padding: 0 calc(12px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(12px + env(safe-area-inset-left)); pointer-events: none; }
.pb { pointer-events: auto; position: relative; width: 132px; height: 108px; border-radius: 22px; background: #0d1420b3; border: 2px solid #2c3b55; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; touch-action: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.pb b { font-size: 28px; line-height: 1; }
.pb small { font-size: 11px; color: #9fb0c8; line-height: 1.25; text-align: center; }
.pb kbd { position: absolute; top: 6px; right: 8px; font: 10px ui-monospace, Menlo, monospace; color: #6b7a94; border: 1px solid #2c3b55; border-radius: 4px; padding: 0 3px; }
#b-jump { border-color: #ff5560; }
#b-jump b { color: #ff7a82; }
#b-pump { border-color: #ffd84a; }
#b-pump b { color: #ffd84a; }
.pb.held { transform: scale(.94); background: #22304ae6; }
#b-boost { width: 112px; height: 112px; border-radius: 50%; margin-bottom: 4px; overflow: hidden; border-color: #3a4a66; }
#b-boost img { width: 52px; height: 52px; object-fit: contain; filter: grayscale(1) brightness(.6); }
#b-boost b { font-size: 13px; }
#b-boost small { font-size: 10px; }
#boost-ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(#ffb02e calc(var(--q, 0) * 1turn), transparent 0); opacity: .35; }
#b-boost.ready { border-color: #ffb02e; box-shadow: 0 0 0 3px #ffb02e55, 0 0 24px #ffb02e88; animation: ready 0.9s ease-in-out infinite; }
#b-boost.ready img { filter: none; }
#b-boost.empty img { opacity: .5; }
#b-boost.ready small { color: #ffd27a; }
@keyframes ready { 50% { box-shadow: 0 0 0 6px #ffb02e33, 0 0 36px #ffb02eaa; } }
.pb.nudge { animation: nudge 0.6s ease-in-out 4; }
@keyframes nudge { 50% { transform: scale(1.12); box-shadow: 0 0 0 6px #ffd84a66; } }
#hint { bottom: calc(128px + env(safe-area-inset-bottom)); }
@media (pointer: coarse) { #hint { display: none; } .pb kbd { display: none; } }
@media (max-width: 520px) { .pb { width: 104px; height: 96px; } .pb b { font-size: 24px; } #b-boost { width: 92px; height: 92px; } #b-boost img { width: 40px; height: 40px; } #b-boost small { display: none; } }
@media (max-height: 460px) { .pb { width: 116px; height: 78px; border-radius: 18px; } .pb small { display: none; } #b-boost { width: 80px; height: 80px; } #b-boost img { width: 34px; height: 34px; } #hud #stop { bottom: calc(96px + env(safe-area-inset-bottom)); } }
#hud #stop { bottom: calc(130px + env(safe-area-inset-bottom)); }
#coach { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -58%); width: min(640px, 92vw); background: #0b111cf0; border: 1px solid #2c3b55; border-radius: 16px; padding: 14px 16px; pointer-events: none; text-align: center; }
.c-title { margin: 0 0 8px; font-weight: 800; font-size: 18px; }
.c-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: 13px; line-height: 1.45; text-align: left; color: #c9d6ea; }
.c-row b { display: block; font-size: 15px; margin-bottom: 2px; }
.c-l b { color: #ffd84a; } .c-m b { color: #ffb02e; } .c-r b { color: #ff7a82; }
.c-foot { margin: 8px 0 0; font-size: 12px; color: #8a97ad; }
@media (max-width: 520px) { .c-row { grid-template-columns: 1fr; } }
@media (max-height: 460px) { #coach { transform: translate(-50%, -70%); padding: 8px 12px; } .c-row { font-size: 11px; } }

/* results: the newspaper and its actions */
.done-wrap { display: grid; grid-template-columns: minmax(0, 520px) minmax(240px, 320px); gap: 22px; align-items: center; width: min(900px, 100%); max-height: 100%; }
#paper { width: 100%; height: auto; max-height: calc(100dvh - 40px); object-fit: contain; border-radius: 6px; }
.done-side { background: #0b111c; border: 1px solid #1e2b42; border-radius: 16px; padding: 14px 16px; max-height: calc(100dvh - 40px); overflow-y: auto; }
.done-side h1 { font-size: 24px; }
#rankline { margin: 6px 0 10px; font-size: 16px; color: #ffd84a; font-weight: 700; min-height: 1.2em; }
.done-side #share { width: 100%; }
.done-side .row { justify-content: stretch; margin-top: 8px; }
.done-side .row button { flex: 1 1 40%; }
#share-status { font-size: 12px; color: #9fd0ff; margin: 6px 0 0; min-height: 1em; }
@media (max-width: 700px) and (orientation: portrait) { .done-wrap { grid-template-columns: 1fr; gap: 10px; align-content: start; } #paper { max-height: 52dvh; } .done-side { max-height: none; } #done { align-items: flex-start; } }
@media (max-height: 520px) and (orientation: landscape) { .done-wrap { grid-template-columns: auto minmax(220px, 300px); } #paper { max-height: calc(100dvh - 24px); width: auto; } }
/* select cards: the main game's own portrait crop (select.js) and camp accent */
.hero { background-size: cover; background-position: center top; box-shadow: inset 0 -4px 0 var(--camp, #8a97ad) !important; }
