:root {
  --bg: #141019;
  --panel: rgba(20, 16, 26, 0.9);
  --line: rgba(230, 190, 140, 0.24);
  --text: #f1e9dc;
  --muted: #a79a8a;
  --accent: #ffc45a;
  --t0: #4aa8ff;
  --t1: #ff6b5a;
  --bad: #ff6b6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "PingFang TC", "Noto Sans TC", sans-serif; overflow: hidden; user-select: none; }
#view { position: fixed; inset: 0; cursor: crosshair; }
#view canvas { display: block; }
#view .overlay { position: absolute; inset: 0; pointer-events: none; }
[hidden] { display: none !important; }
kbd { font: 11px ui-monospace, monospace; padding: 0 4px; border: 1px solid var(--line); border-radius: 3px; background: rgba(255,255,255,0.06); color: var(--muted); }
button { font: inherit; color: var(--text); background: rgba(255,255,255,0.07); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
button:hover { background: rgba(255,255,255,0.14); }
button.primary { background: #b3701c; border-color: #ffc45a; font-weight: 700; padding: 8px 22px; font-size: 16px; }
button.primary:hover { background: #cc8424; }
.t0 { color: var(--t0); }
.t1 { color: var(--t1); }

.screen { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(ellipse at 50% 30%, rgba(110, 70, 40, 0.5), rgba(10, 7, 14, 0.9)); z-index: 20; padding: 16px; }
.card { width: min(600px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px 26px; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.card h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: 2px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.ver { font-size: 13px; color: #d8c4a4; font-weight: 600; letter-spacing: 0; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; vertical-align: middle; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; color: var(--muted); font-size: 13px; }
.field select, .field input { font: inherit; color: var(--text); background: #1d1722; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; user-select: text; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help { margin-top: 14px; color: var(--muted); }
.help summary { cursor: pointer; color: var(--text); }
.help ul { padding-left: 18px; margin: 6px 0 0; }
.help li { margin: 3px 0; }
.help b { color: var(--accent); }

#top { position: fixed; top: 0; left: 0; right: 0; height: 46px; display: flex; align-items: center; gap: 14px; padding: 0 14px; background: linear-gradient(rgba(12, 9, 16, 0.92), rgba(12, 9, 16, 0.7)); border-bottom: 1px solid var(--line); z-index: 5; }
#top .brand { font-weight: 800; letter-spacing: 2px; color: var(--accent); }
#top .spacer { flex: 1; }
.score { display: flex; align-items: baseline; gap: 10px; }
.score b { font-size: 26px; font-weight: 800; min-width: 34px; text-align: center; line-height: 1; }
.score small { font-size: 13px; }
.score i { font-style: normal; color: var(--muted); font-size: 12px; padding: 0 6px; }
.score b.pop { animation: pop 0.35s; }
@keyframes pop { 40% { transform: scale(1.5); } }
#clock { color: var(--muted); font-variant-numeric: tabular-nums; }

#feed { position: fixed; top: 56px; right: 12px; width: min(340px, 40vw); margin: 0; padding: 0; list-style: none; z-index: 4; pointer-events: none; text-align: right; }
#feed li { display: inline-block; clear: both; float: right; background: rgba(12, 9, 16, 0.66); padding: 3px 10px; margin-bottom: 3px; border-radius: 4px; font-size: 13px; animation: feedIn 0.25s; }
#feed li.mine { outline: 1px solid var(--accent); }
#feed .how { color: var(--muted); padding: 0 6px; }
#feed .hs { color: #ff4a4a; font-weight: 800; }
@keyframes feedIn { from { opacity: 0; transform: translateX(12px); } }

#banner { position: fixed; top: 20%; left: 50%; transform: translateX(-50%); font-size: 34px; font-weight: 800; letter-spacing: 4px; color: #ff5a4a; text-shadow: 0 0 22px rgba(255, 70, 40, 0.75); z-index: 6; pointer-events: none; animation: bannerIn 0.35s; white-space: nowrap; }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -12px) scale(1.25); } }
#dead { position: fixed; top: 34%; left: 50%; transform: translateX(-50%); text-align: center; font-size: 20px; background: rgba(12, 9, 16, 0.72); border: 1px solid var(--line); border-radius: 10px; padding: 12px 26px; z-index: 6; pointer-events: none; }
#dead b { font-size: 30px; color: var(--accent); }

#bottom { position: fixed; left: 50%; bottom: 10px; transform: translateX(-50%); display: flex; align-items: flex-end; gap: 14px; z-index: 5; pointer-events: none; }
#me { width: 300px; }
.hpbar { position: relative; height: 22px; background: rgba(0,0,0,0.6); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(#6dff8a, #2fbf55); transition: width 0.12s; }
#hp-text { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 13px; text-shadow: 0 1px 2px #000; }
#kda { margin-top: 4px; text-align: center; color: var(--muted); font-size: 12px; text-shadow: 0 1px 2px #000; }
.skill { position: relative; width: 64px; height: 64px; border: 2px solid var(--accent); border-radius: 10px; background: rgba(12, 9, 16, 0.85); overflow: hidden; display: grid; place-items: center; }
.skill .icon { font-size: 30px; }
.skill .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0, 0, 0, 0.72); display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; overflow: hidden; }
.skill kbd { position: absolute; top: 3px; left: 3px; }
.skill .nm { position: absolute; bottom: 1px; right: 4px; font-size: 10px; color: var(--muted); }
.skill.armed { border-color: #fff; box-shadow: 0 0 12px #fff; transform: translateY(-4px); }
.skill.busy { border-color: var(--line); }
.skill.flash { animation: ready 0.3s; }
@keyframes ready { 50% { box-shadow: 0 0 18px var(--accent); } }

#board { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(560px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; z-index: 8; pointer-events: none; }
table.board { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
table.board th, table.board td { padding: 4px 6px; border-bottom: 1px solid var(--line); text-align: right; }
table.board th:first-child, table.board td:first-child { text-align: left; }
table.board tr.me td { color: #fff; font-weight: 700; }
table.board caption { text-align: left; font-weight: 800; padding-bottom: 2px; }
#end .card button { margin-right: 8px; }
.skill.plain { border-color: var(--line); }

.online { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; margin: 4px 0 14px; background: rgba(255, 196, 90, 0.06); }
.card h2 { font-size: 15px; margin: 0 0 8px; }
.join-row { display: flex; gap: 10px; }
.join-row input { flex: 1; font: inherit; color: var(--text); background: #1d1722; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; text-transform: uppercase; letter-spacing: 2px; user-select: text; }
.muted { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.solo { margin-bottom: 4px; }
.solo summary { cursor: pointer; margin-bottom: 10px; }
.card.wide { width: min(820px, 100%); }
.code { font-family: ui-monospace, monospace; color: var(--accent); letter-spacing: 3px; }
.card h1 button { font-size: 13px; letter-spacing: 0; vertical-align: middle; margin-left: 8px; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.members { list-style: none; padding: 0; margin: 0 0 12px; min-height: 40px; }
.members li { display: flex; justify-content: space-between; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 5px; }
.members li.bot { color: var(--muted); border-style: dashed; }
.members li.me { border-color: var(--accent); }
.members li .tag { font-size: 12px; color: var(--muted); }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
#lobby .card > button { margin-right: 8px; }

#net-banner { position: fixed; top: 54px; left: 50%; transform: translateX(-50%); background: rgba(90, 30, 20, 0.94); border: 1px solid #ff6b5a; padding: 6px 16px; border-radius: 6px; z-index: 9; }
#toast { position: fixed; bottom: 110px; left: 50%; transform: translateX(-50%); background: rgba(12, 9, 16, 0.9); border: 1px solid var(--line); padding: 5px 14px; border-radius: 6px; z-index: 7; pointer-events: none; }
.xpbar { position: relative; height: 12px; margin-top: 3px; background: rgba(0,0,0,0.6); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
#xp-fill { height: 100%; width: 0; background: linear-gradient(#c98bff, #8a4fd8); transition: width 0.2s; }
#xp-text { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10px; text-shadow: 0 1px 2px #000; }
.skill.off { opacity: 0.5; }

#shop { position: fixed; right: 10px; bottom: 10px; width: 292px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; z-index: 5; font-size: 12px; }
#shop h3 { margin: 2px 2px 6px; font-size: 13px; display: flex; justify-content: space-between; }
#shop h3 b { color: var(--accent); }
#shop .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 8px; }
#shop.min .items { display: none; }
#shop .items { display: flex; flex-direction: column; gap: 4px; }
#shop button { position: relative; text-align: left; padding: 4px 6px; line-height: 1.3; }
#shop .grid button { text-align: center; padding: 5px 2px; }
#shop button .lv { color: var(--accent); font-weight: 700; }
#shop button .cost { color: #ffd76a; float: right; }
#shop button .ds { display: block; color: var(--muted); font-size: 11px; }
#shop button.can { border-color: var(--accent); }
#shop button.max { opacity: 0.55; }
#shop button:disabled { cursor: default; }
#shop .grid button kbd { position: absolute; top: 1px; left: 2px; font-size: 9px; padding: 0 2px; }
@media (max-width: 1180px) { #shop { width: 240px; } #me { width: 220px; } }

.skills { display: flex; gap: 8px; }
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
#shop .grid { grid-template-columns: repeat(3, 1fr); }
.score .lead { color: var(--muted); font-size: 13px; }
.score .lead b { font-size: 18px; min-width: 0; }
#lb-all li .dot, #feed .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.skill.rooted { border-color: #e8f6ff; box-shadow: 0 0 10px #e8f6ff; }

/* 忍者對決 */
#me { width: 150px; text-align: center; background: rgba(12, 9, 16, 0.7); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
#alive { font-weight: 700; }
#dead small { font-size: 14px; color: var(--muted); }
#view { cursor: default; }
.cls-desc { color: var(--muted); font-size: 12px; }
.skill.on { border-color: #7a5cff; box-shadow: 0 0 14px #7a5cff; }
.skill.on .nm { color: #fff; }
