:root {
  --bg: #1b1d24;
  --panel: #24262f;
  --ink: #e9e7e0;
  --light: #f4e4c1;
  --dark: #3a3a42;
  --accent: #f5b301;
  --green: #2ea043;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

[hidden] {
  display: none !important;
}

/* ---------------- Setup ---------------- */
#setup-screen {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.setup-card {
  background: var(--panel);
  border-radius: 18px;
  padding: 28px;
  width: min(440px, 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}
.setup-card h1 {
  margin: 0;
  font-size: 2.4rem;
  text-align: center;
}
.tagline {
  text-align: center;
  margin: 4px 0 20px;
  opacity: 0.7;
}
.side-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.side {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1c1e25;
  border-radius: 12px;
  padding: 10px;
}
.side .swatch {
  font-size: 1.4rem;
}
.side input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 2px solid #444;
  color: var(--ink);
  font-size: 1rem;
  padding: 4px 2px;
}
.side input:focus {
  outline: none;
  border-color: var(--accent);
}
.vs {
  opacity: 0.6;
}
.expansions {
  border: 1px solid #3a3d48;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 18px;
}
.expansions legend {
  padding: 0 6px;
  opacity: 0.8;
}
.expansions label {
  display: block;
  padding: 6px 0;
  font-size: 1.05rem;
  cursor: pointer;
}
.hint,
.footnote {
  font-size: 0.82rem;
  opacity: 0.6;
}
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--accent);
  color: #1b1d24;
  font-weight: 600;
}
#resume-btn {
  background: #3a3d48;
  color: var(--ink);
}

/* ---------------- Game ---------------- */
#game-screen {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  transition: opacity 0.2s, box-shadow 0.2s;
}
#tray-1 {
  transform: rotate(180deg); /* faces the player on the far side of the table */
}
.tray.dark {
  background: #202028;
}
.tray.inactive {
  opacity: 0.4;
}
.tray.active {
  box-shadow: inset 0 0 0 3px var(--accent);
}
.tray-group {
  position: relative;
  display: flex;
  align-items: center;
  padding: 4px 8px 4px 4px;
  background: #15151b;
  border-radius: 10px;
  cursor: grab;
}
.tray.dark .tray-group {
  background: #0e0e13;
}
.tray-group .stack {
  display: flex;
}
.tray-group .chip {
  font-size: 1.7rem;
  margin-left: -10px;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}
.tray-group .chip:first-child {
  margin-left: 0;
}
.tray-group .count {
  font-size: 0.8rem;
  margin-left: 4px;
  opacity: 0.8;
}

#board-wrap {
  position: relative;
  overflow: hidden;
}
#board {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
#board text {
  pointer-events: none;
}

#status {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.55);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  white-space: nowrap;
}
#status[data-player="0"] {
  box-shadow: inset 0 0 0 2px var(--light);
}
#status[data-player="1"] {
  box-shadow: inset 0 0 0 2px #8b8b96;
}
#recenter {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--ink);
  font-size: 0.85rem;
  padding: 8px 12px;
}

#game-over {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  background: rgba(10, 10, 14, 0.78);
}
#game-over p {
  font-size: 1.6rem;
  margin: 0;
}

#info-panel {
  position: absolute;
  left: 10px;
  bottom: 10px;
  right: 10px;
  max-width: 360px;
  background: var(--panel);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
#info-panel h3 {
  margin: 0 0 8px;
}
#info-panel p {
  margin: 6px 0;
  font-size: 0.92rem;
  line-height: 1.4;
}
#info-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  color: var(--ink);
  padding: 4px 8px;
}

/* dragged piece following the pointer */
#drag-ghost {
  position: fixed;
  z-index: 50;
  font-size: 2.6rem;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6));
}
