:root {
  --bg: #171717;
  --panel: #222;
  --panel2: #2a2a2a;
  --text: #f4ead7;
  --muted: #b9ad99;
  --red: #b8342e;
  --cream: #e6d7b9;
  --line: #5d5549;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

main {
  max-width: 980px;
  margin: auto;
  padding: 18px;
}

h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: .04em;
}

.tagline {
  color: var(--muted);
  margin: 4px 0 2px;
}

.creator {
  color: var(--muted);
  margin: 0 0 18px;
  font-size: 13px;
}

.summary-row,
.actions,
.piles {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.summary-row .panel {
  flex: 1;
  min-width: 210px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

button {
  background: var(--cream);
  color: #181818;
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
}

button.secondary {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--line);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.status {
  margin: 14px 0;
  padding: 12px 14px;
  background: var(--panel);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  white-space: pre-line;
}

.board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 16px;
}

.player h2 {
  margin: 0 0 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 82px);
  gap: 9px;
  justify-content: center;
  margin-top: 10px;
}

.card {
  width: 82px;
  height: 108px;
  border-radius: 9px;
  border: 2px solid #111;
  background: #efe4cc;
  color: #171717;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  position: relative;
  padding: 0;
}

.card.back {
  background-image: url("RAT_RACE_BACK.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
  border-color: #d8c6a3;
}

.card.back::after {
  content: none;
}

.card-face-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 7px;
}

.card.rat {
  font-size: 16px;
  text-align: center;
}

.card.selectable {
  outline: 3px solid #dca63d;
  outline-offset: 2px;
}

.piles {
  justify-content: center;
  margin: 16px 0;
}

.pilebox {
  min-width: 120px;
  text-align: center;
}

.pilecard {
  margin: 7px auto 0;
}

.small {
  font-size: 13px;
  color: var(--muted);
}

.scoreline {
  font-size: 15px;
  margin-top: 5px;
}

.held-card {
  margin-top: 12px;
}

.hidden {
  display: none !important;
}

.rules {
  margin-top: 14px;
  line-height: 1.45;
}

.rules h3 {
  margin-bottom: 5px;
}

footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 760px) {
  .board { grid-template-columns: 1fr; }
}
