:root {
  --bg: #20242b;
  --panel: #292d36;
  --btn: #424956;
  --btn-hover: #545d6e;
  --btn-off: #33373f;
  --text: #e6e6eb;
  --dim: #9a9eaa;
  --accent: #e89e38;
  --black: #17171c;
  --white: #f5f2e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  display: flex;
  height: 100%;
}

#board-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

#toast {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16, 18, 22, 0.92);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: 6px;
  white-space: nowrap;
}

#panel {
  width: 330px;
  flex-shrink: 0;
  background: var(--panel);
  padding: 18px 20px;
  overflow-y: auto;
}

header { display: flex; align-items: baseline; gap: 12px; }
h1 { margin: 0; font-size: 40px; letter-spacing: 3px; }

section { margin-top: 16px; }
label { display: block; color: var(--dim); margin: 10px 0 5px; }
.dim { color: var(--dim); }
.small { font-size: 13px; }
.accent { color: var(--accent); min-height: 1.4em; }
p { margin: 0 0 8px; }
#rules { font-size: 14px; }

#score .row { display: flex; align-items: center; gap: 10px; font-size: 26px; }
.spacer { flex: 1; }
.stone { width: 22px; height: 22px; border-radius: 50%; display: inline-block; }
.stone.black { background: var(--black); box-shadow: 0 0 0 1px #000; }
.stone.white { background: var(--white); box-shadow: 0 0 0 1px #888; }
#count-black.turn, #count-white.turn { border-bottom: 3px solid var(--accent); }

#bar { position: relative; height: 10px; background: #4c505a; margin: 10px 0 12px; }
#bar-black { position: absolute; left: 0; top: 0; bottom: 0; background: var(--black); }
#bar-white { position: absolute; right: 0; top: 0; bottom: 0; background: var(--white); }
#bar-mid { position: absolute; left: calc(50% - 1px); top: -3px; bottom: -3px; width: 2px; background: var(--accent); }
#status { font-size: 20px; }

button {
  background: var(--btn);
  color: var(--text);
  border: 0;
  border-radius: 4px;
  padding: 7px 8px;
  font: inherit;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--btn-hover); }
button:disabled { background: var(--btn-off); color: #6c7079; cursor: default; }
button.on { background: var(--accent); color: #18181c; }
button.wide { width: 100%; }
kbd { font: inherit; font-size: 12px; opacity: 0.6; }

.buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.buttons .wide { grid-column: span 2; }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; }

#room-line { display: flex; gap: 8px; align-items: center; }
#room-line code { flex: 1; background: #1c1f25; padding: 6px 8px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; }
#seat-info { margin: 8px 0; }
.row-input { display: flex; gap: 6px; margin-top: 10px; }
.row-input input {
  flex: 1;
  min-width: 0;
  background: #1c1f25;
  border: 1px solid #444a56;
  color: var(--text);
  border-radius: 4px;
  padding: 6px 8px;
  font: inherit;
}

@media (max-width: 760px) {
  main { flex-direction: column; height: auto; }
  #board-wrap { height: 100vw; max-height: 80vh; }
  #panel { width: 100%; }
}
