:root {
  --bg: #111315;
  --panel: #181b1e;
  --panel-2: #202428;
  --line: #34393e;
  --text: #f2f2f2;
  --muted: #9da3a8;
  --board: #2d5541;
  --wood: #594332;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 5px;
  padding: 9px 11px;
  cursor: pointer;
}

button:hover {
  background: #2a2f34;
}

button.selected,
button.primary {
  background: #f1f1f1;
  color: #111;
  border-color: #f1f1f1;
}

button.secondary {
  background: transparent;
}

button.danger {
  background: #472426;
  border-color: #673235;
  color: #ffd5d5;
}

input {
  border: 1px solid var(--line);
  background: #111315;
  color: var(--text);
  border-radius: 5px;
  padding: 10px;
  outline: none;
}

input:focus {
  border-color: #8f969c;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
}

h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #b4bac0;
  margin-bottom: 10px;
}

.muted {
  color: var(--muted);
}

.error {
  color: #ff8080;
  min-height: 20px;
}

.text-link {
  color: #b9c6d2;
  text-decoration: none;
}

.center-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(380px, 100%);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 24px;
}

.form-stack {
  display: grid;
  gap: 16px;
  margin: 22px 0;
}

.form-stack label {
  display: grid;
  gap: 7px;
  font-size: 14px;
}

.admin-box {
  width: min(980px, 100%);
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 24px;
}

.form-inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  max-width: 520px;
}

.admin-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.player-create {
  display: grid;
  grid-template-columns: 1fr 1fr 70px auto;
  gap: 8px;
  margin: 24px 0;
}

.admin-player-list {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.admin-player-row {
  display: grid;
  grid-template-columns: 1fr 1fr 70px auto auto;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.game-page {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.game-layout {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 290px;
}

.side-panel {
  background: var(--panel);
  padding: 18px;
  min-height: 0;
}

.left-panel {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.right-panel {
  border-left: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.player-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 18px;
}

.color-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: white;
  flex: none;
}

.dice-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.dice-grid button {
  padding: 8px 5px;
}

.quantity {
  display: grid;
  grid-template-columns: 1fr 34px 50px 34px;
  gap: 6px;
  align-items: center;
  margin-top: 12px;
  font-size: 13px;
}

.quantity input {
  padding: 7px 4px;
  text-align: center;
}

.small-button {
  padding: 6px 0;
  font-size: 18px;
}

.notation {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
}

.online-section {
  min-height: 0;
}

.online-list {
  display: grid;
  gap: 7px;
}

.online-row {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
  padding: 5px 0;
}

.left-actions {
  margin-top: auto;
  display: grid;
  gap: 7px;
}

.board-area {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #0e1011;
  overflow: hidden;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#board.dragging {
  cursor: grabbing;
}

.board-help {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: #15181bcc;
  border: 1px solid var(--line);
  color: #c6c9cc;
  padding: 7px 10px;
  font-size: 12px;
  pointer-events: none;
}

.drag-line {
  display: none;
  position: fixed;
  z-index: 30;
  height: 2px;
  background: white;
  transform-origin: left center;
  pointer-events: none;
}

.drag-line::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid white;
  border-top: 2px solid white;
  transform: rotate(45deg);
}

.results-list {
  overflow-y: auto;
  display: grid;
  gap: 10px;
  padding-right: 3px;
}

.result-card {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.result-card:first-child {
  border-top: 0;
  padding-top: 0;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.result-player {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.result-notation {
  color: var(--muted);
  white-space: nowrap;
}

.result-total {
  font-size: 32px;
  font-weight: 700;
  margin: 8px 0 4px;
}

.result-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.result-value {
  border: 1px solid var(--line);
  padding: 4px 7px;
  border-radius: 4px;
  font-size: 13px;
}

.pending {
  color: var(--muted);
  font-size: 13px;
  margin-top: 8px;
}

@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 190px minmax(0, 1fr) 230px;
  }
}

@media (max-width: 700px) {
  .game-page {
    overflow: auto;
  }

  .game-layout {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
    grid-template-rows: auto 65vh auto;
  }

  .left-panel,
  .right-panel {
    border: 0;
  }

  .left-panel {
    border-bottom: 1px solid var(--line);
  }

  .right-panel {
    border-top: 1px solid var(--line);
  }

  .player-create,
  .admin-player-row,
  .form-inline {
    grid-template-columns: 1fr;
  }
}
