html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--bg-2); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .home { color: var(--muted); text-decoration: none; font-size: 20px; padding: 4px 8px; border-radius: 6px; }
.brand .home:hover { background: var(--bg-3); color: var(--text); }
.brand .title { font-weight: 800; letter-spacing: .04em; text-transform: uppercase; font-size: 15px; color: var(--accent); }
.brand .sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tools { display: flex; align-items: center; gap: 6px; }
.tools .sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.panel-toggle { display: none; }
.layout { flex: 1 1 auto; display: flex; min-height: 0; }
.board-scroll { flex: 1 1 auto; overflow: auto; padding: 12px; background: #0a0e14 radial-gradient(circle at 30% 20%, #16202d 0, #0a0e14 60%); }
.board-main { width: 100%; max-width: 900px; margin: 0 auto; box-shadow: 0 10px 40px rgba(0,0,0,.6); border-radius: 6px; overflow: hidden; background: #fff; }
.board-main .rw-board { width: 100%; }
.board-main img { filter: brightness(.96); }
.side { flex: 0 0 380px; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg-2); min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font: inherit; font-weight: 600; padding: 10px 4px; cursor: pointer; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel { flex: 1 1 auto; overflow: auto; padding: 10px 12px 40px; font-size: 14px; }
.sec { margin-bottom: 14px; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); }
.sec h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sec p { margin: 6px 0; line-height: 1.4; }
.chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.chip { background: var(--bg-3); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; min-width: 0; }
.chip-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chip-value { font-weight: 700; font-size: 15px; }
.chip.bad .chip-value { color: var(--danger); }
.btn-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; }
.btn-row.wrap { flex-wrap: wrap; }
.die { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; background: #f4f6f8; color: #111; font-weight: 800; font-size: 20px; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); border: 0; }
.die.ok { background: var(--accent); }
.die.dim { opacity: .4; }
.die.big { width: 48px; height: 48px; font-size: 24px; cursor: pointer; }
.die.big.sel { background: var(--accent-2); }
.dice-line, .dice-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.assign { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.assign-row { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 8px; }
.good-text { color: var(--accent); font-weight: 700; }
.result { font-size: 22px; font-weight: 900; letter-spacing: .1em; text-align: center; padding: 8px; border-radius: 8px; }
.result.victory { background: rgba(125,242,74,.15); color: var(--accent); }
.result.defeat { background: rgba(255,92,92,.15); color: var(--danger); }
.log { list-style: none; margin: 0; padding: 0; font-size: 12.5px; max-height: 240px; overflow: auto; }
.log li { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.accordion details { border-bottom: 1px solid var(--line); padding: 4px 0; }
.accordion summary { cursor: pointer; font-weight: 600; }
.rules-img { width: 100%; height: auto; border-radius: 6px; background: #fff; }
.muted { color: var(--muted); }
@media (max-width: 900px) {
  .panel-toggle { display: inline-block; }
  .layout { flex-direction: column; }
  .side { flex: 0 0 auto; border-left: 0; border-top: 1px solid var(--line); max-height: 48vh; }
  body:not(.panel-open) .side { max-height: 44px; }
  body:not(.panel-open) .side .panel { display: none; }
  .brand .sub { display: none; }
}
