:root {
  --paper: #f3efe6; --card: #fffdf8; --ink: #23201b; --muted: #7a7268; --line: #ddd5c6;
  --accent: #2b5d8a; --accent-ink: #fff; --ok: #2f9e5b; --warn: #c98a12;
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); min-height: 100vh; }
h1 { font-size: 22px; margin: 0 0 6px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-size: 13px; }

.top { height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 18px;
  border-bottom: 1px solid var(--line); background: var(--card); }
.brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.room-info { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: #eee6d6; color: var(--muted); }
.pill[data-s="connected"] { background: #dcefe2; color: #1f6b3d; }
.pill[data-s^="reconnecting"] { background: #f6e7c8; color: #8a5a00; }

button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; }
button:hover { border-color: #c7bca8; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.big { font-size: 17px; padding: 12px 28px; border-radius: 10px; }
button.small { padding: 4px 10px; font-size: 13px; }
button.link { border: 0; background: none; padding: 0 2px; color: var(--accent); font-size: 12px; text-decoration: underline; }
input { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
input:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.card.narrow { max-width: 380px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

.room { display: grid; grid-template-columns: 1fr 340px; gap: 14px; padding: 14px; height: calc(100vh - 52px); }
.table { border: 1px dashed var(--line); border-radius: 14px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; background: #ece6d9; }
.side { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.card.grow { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.players { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.players li { display: flex; align-items: center; gap: 8px; }
.players li.off .pname { color: var(--muted); }
.swatch { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.25); flex: none; }
.pname { font-weight: 600; }
.dot { margin-left: auto; width: 9px; height: 9px; border-radius: 50%; background: #cfc6b5; }
.players li.on .dot { background: var(--ok); }

.log { list-style: none; margin: 8px 0; padding: 0; flex: 1; overflow-y: auto; font-size: 14px; }
.log li { padding: 3px 0; border-bottom: 1px solid #f0eadf; overflow-wrap: anywhere; }
.log li.sys { color: var(--muted); font-style: italic; }
.chat { display: flex; gap: 6px; }
.chat input { flex: 1; min-width: 0; }

.dice-area { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.dice { display: flex; gap: 16px; }
.die { width: 72px; height: 72px; background: #fff; border-radius: 14px; padding: 10px; display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr); box-shadow: 0 2px 0 #cbbfa9, 0 6px 14px rgba(60,45,20,.12); }
.die.blank { opacity: .5; }
.die span { border-radius: 50%; margin: 3px; }
.die .pip { background: var(--ink); }
.dice.rolled .die { animation: tumble .45s ease-out; }
.dice.rolled .die:nth-child(2) { animation-delay: .06s; }
@keyframes tumble { 0% { transform: translateY(-14px) rotate(-25deg) scale(.9); } 60% { transform: translateY(3px) rotate(8deg); } 100% { transform: none; } }
.dice-text { margin: 0; font-size: 16px; min-height: 1.45em; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
