:root {
  --felt: #0d5c2e;
  --felt-dark: #083d1f;
  --gold: #d4a017;
  --card-bg: #fffdf7;
  --ink: #1c1c1c;
  --red: #c0392b;
  --muted: #6b7280;
  --row-bg: rgba(255,255,255,0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--felt-dark);
  color: #f5f5f5;
  min-height: 100vh;
}
#app { max-width: 900px; margin: 0 auto; padding: 12px 12px 60px; }
.hidden { display: none !important; }

/* header */
header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 4px; border-bottom: 2px solid var(--gold); margin-bottom: 12px;
}
header.topbar h1 { font-size: 1.15rem; margin: 0; }
header.topbar .who { font-size: 0.85rem; color: #e8e8e8; }
header.topbar button { margin-left: 8px; }

/* tabs */
nav.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
nav.tabs button {
  flex: 1; padding: 10px 4px; font-size: 0.95rem; cursor: pointer;
  background: var(--row-bg); color: #fff; border: 1px solid #ffffff33; border-radius: 8px;
}
nav.tabs button.active { background: var(--gold); color: #1c1c1c; font-weight: 700; border-color: var(--gold); }

/* generic */
button, input[type=submit] {
  background: var(--gold); color: #1c1c1c; border: none; border-radius: 8px;
  padding: 9px 14px; font-size: 0.95rem; cursor: pointer; font-weight: 600;
}
button.secondary { background: #ffffff22; color: #fff; border: 1px solid #ffffff44; }
button.danger { background: #a93226; color: #fff; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
input[type=text], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid #ffffff44;
  background: #ffffff14; color: #fff; font-size: 1rem; margin: 4px 0 10px;
}
input::placeholder, textarea::placeholder { color: #bbbbbb; }
label { font-size: 0.85rem; color: #ddd; display: block; margin-top: 6px; }
.card-panel { background: var(--row-bg); border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.error { color: #ff9d8a; margin: 8px 0; }
.success { color: #9fe6a0; margin: 8px 0; }
.muted { color: var(--muted); font-size: 0.85rem; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 14px 0 6px; }

/* game lists */
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 6px; }
.section-head a { color: var(--gold); font-size: 0.85rem; }
.game-row {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--row-bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 6px;
  cursor: pointer;
}
.game-row:hover { background: #ffffff1c; }
.game-row .meta { font-size: 0.85rem; color: #ddd; }
.game-row .note { font-size: 0.8rem; color: #bbb; font-style: italic; }
.game-row .score { font-weight: 700; }
.pos { color: #9fe6a0; } .neg { color: #ff9d8a; }

/* cards */
.card {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; height: 72px; border-radius: 8px; background: var(--card-bg); color: var(--ink);
  font-weight: 700; font-size: 1.05rem; margin: 3px; cursor: default;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4); user-select: none; line-height: 1.1;
}
.card .suit { font-size: 1.25rem; }
.card.red { color: var(--red); }
.card.small { width: 40px; height: 56px; font-size: 0.85rem; }
.card.small .suit { font-size: 1rem; }
.card.facedown { background: repeating-linear-gradient(45deg, #274b73, #274b73 6px, #1d3a5c 6px, #1d3a5c 12px); color: transparent; }
.card.selectable { cursor: pointer; }
.card.selectable:hover { transform: translateY(-4px); }
.card.selected { outline: 3px solid var(--gold); transform: translateY(-4px); }

/* board rows */
.prow {
  border: 2px dashed #ffffff44; border-radius: 10px; min-height: 92px;
  padding: 6px; margin-bottom: 8px; background: rgba(0,0,0,0.18);
}
.prow .row-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: #cfe3d4; margin: 0 0 2px 4px; display:flex; justify-content: space-between;}
.prow.target { border-color: var(--gold); background: rgba(212,160,23,0.12); cursor: pointer; }
.prow.full { border-style: solid; }
.foul-warn { color: #ffb3a7; font-weight: 700; margin: 8px 0; }
.turn-banner { background: var(--gold); color: #1c1c1c; font-weight: 700; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; text-align: center; }
.wait-banner { background: #ffffff1c; border-radius: 8px; padding: 8px 12px; margin-bottom: 10px; text-align: center; }

table.scores { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.scores th, table.scores td { padding: 6px 8px; text-align: left; border-bottom: 1px solid #ffffff22; }
table.scores th { color: #cfe3d4; font-weight: 600; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; background: #ffffff22; }
.pill.fl { background: #7b4fd0; color: #fff; }
.pill.foul { background: #a93226; color: #fff; }

#update-banner { background: var(--gold); color: #1c1c1c; text-align: center; padding: 8px; font-weight: 600; }
#update-banner button { margin-left: 8px; padding: 4px 10px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin: 12px 0; }
.lobby-players { margin: 8px 0; }
.lobby-players .p { padding: 6px 0; border-bottom: 1px solid #ffffff1a; }
details.hand { margin-bottom: 8px; }
details.hand summary { cursor: pointer; padding: 8px; background: var(--row-bg); border-radius: 8px; }
