:root {
  --gold: #c9a227;
  --gold-bright: #f6e3ae;
  --ink: #0c0a0a;
  --ink-2: #171212;
  --ink-3: #221b1b;
  --text: #e8dcc4;
  --dim: #9b8c76;
  --fire: #ff7a2f;
  --water: #3d9fe0;
  --air: #74d3bd;
  --earth: #a5813c;
  --light: #f0cf62;
  --dark: #7a59c6;
  --ok: #6fbf73;
  --warn: #e0a03f;
  --bad: #d95a4e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 50% 0%, #1b1414 0%, #0b0909 70%);
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  min-height: 100%;
}

/* ---------------------------------------------------------------- lobby */

.lobby {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}

.lobby-card {
  width: 100%;
  max-width: 420px;
  margin: auto;
  display: grid;
  grid-template-columns: 1fr;
  background: linear-gradient(180deg, #1a1313 0%, #120e0e 100%);
  border: 1px solid #3a2f22;
  border-radius: 16px;
  padding: 18px 18px 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}

/* On a wide window the reference card sits beside the form, so the Create
   table button is never pushed off the bottom. */
@media (min-width: 880px) {
  .lobby-card {
    grid-template-columns: 330px 300px;
    column-gap: 30px;
    max-width: 700px;
    align-items: start;
  }

  .lobby-brand { grid-column: 1; grid-row: 1; }
  .rule-card { grid-column: 1; grid-row: 2; margin-top: 16px; }
  .lobby-form { grid-column: 2; grid-row: 1 / span 2; }
  .lobby-card .ver { grid-column: 1 / -1; }
}

.lobby-card h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 5px;
  color: var(--gold-bright);
  text-align: center;
}

.lobby-card .logo {
  display: block;
  width: 100%;
  max-width: 312px;
  height: auto;
  margin: 0 auto 2px;
}

.lobby-card .sub {
  margin: 4px 0 16px;
  text-align: center;
  color: var(--dim);
  font-size: 14px;
  font-style: italic;
}

.lobby .wheel { display: flex; justify-content: center; margin-bottom: 18px; }
.lobby .wheel svg { width: 220px; height: 220px; }

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }

.tab {
  flex: 1;
  padding: 10px;
  background: #221b1b;
  border: 1px solid #3a2f22;
  color: var(--dim);
  border-radius: 9px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.tab.active { background: #2e2418; color: var(--gold-bright); border-color: var(--gold); }

.panel { display: none; }
.panel.active { display: block; }

label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--dim);
  letter-spacing: .5px;
}

label .opt { color: #6b5f4d; font-size: 11px; }

input[type=text], input[type=password] {
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  background: #0e0b0b;
  border: 1px solid #3a2f22;
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
}

input:focus { outline: none; border-color: var(--gold); }

label.check { display: flex; align-items: center; gap: 9px; }
label.check input { width: 18px; height: 18px; margin: 0; }

button.primary {
  width: 100%;
  margin-top: 6px;
  padding: 13px;
  background: linear-gradient(180deg, #d8b23c 0%, #9d7a1c 100%);
  border: none;
  border-radius: 9px;
  color: #1a1409;
  font-family: inherit;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
}

button.primary:disabled { opacity: .5; cursor: default; }

.err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 12px 0 0; }

/* ---------------------------------------------------------------- table */

body.table {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.hud {
  position: relative;
  z-index: 20;
  flex: 0 0 auto;
  background: linear-gradient(180deg, #141010 0%, #0d0a0a 100%);
  border-bottom: 1px solid #33291d;
  padding: 8px 10px;
}

.hud-row {
  display: flex;
  gap: 6px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.hud-cell { display: flex; flex-direction: column; align-items: center; min-width: 52px; }
.hud-cell .k { font-size: 9px; letter-spacing: 1.4px; color: #6b5f4d; text-transform: uppercase; }
.hud-cell .v { font-size: 16px; color: var(--gold-bright); }

.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.hud-logo {
  display: block;
  width: 140px;
  height: auto;
}

.ver {
  margin: 0;
  font-size: 10px;
  color: #5a4c38;
  letter-spacing: .6px;
}

.lobby-card .ver { margin-top: 12px; text-align: center; }

.hud-row.lives { margin-top: 7px; gap: 8px; }

.life {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 92px;
  padding: 5px 8px;
  background: #171212;
  border: 1px solid #33291d;
  border-radius: 9px;
}

.life .who { font-size: 12px; color: var(--dim); letter-spacing: .6px; }
.life .pool { font-size: 24px; color: var(--text); line-height: 1.05; }
.life .sub { font-size: 10px; color: #6b5f4d; }
.life-me { border-color: #4d3c22; }
.life-opp { opacity: .82; }

.turn {
  flex: 1;
  text-align: center;
  font-size: 13px;
  padding: 7px 8px;
  border-radius: 9px;
  background: #221b1b;
  border: 1px solid #33291d;
  color: var(--dim);
  letter-spacing: .5px;
}

.turn.yours { background: #2f2517; border-color: var(--gold); color: var(--gold-bright); }
.turn.done { background: #2a1c1c; border-color: #6b3a34; color: #e0a09a; }

#board {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 0;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.zone-label {
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #6b5f4d;
  margin-bottom: 4px;
}

.opponent-zone, .my-zone {
  background: rgba(23, 18, 18, .55);
  border: 1px solid #2a221b;
  border-radius: 11px;
  padding: 8px;
}

.table-zone {
  background: rgba(30, 24, 20, .5);
  border: 1px solid #3a2f22;
  border-radius: 11px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Keep the natural height: the board scrolls, so a tall table never
     squeezes the played cards out of the zone. */
  flex: 0 0 auto;
}

.reserves { display: flex; gap: 10px; align-items: flex-start; }
.reserve { display: flex; flex-direction: column; gap: 3px; }
.reserve .rl { font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; color: #6b5f4d; }
.reserve .rv { font-size: 18px; color: var(--text); }
.reserve-cards { display: flex; flex-wrap: wrap; gap: 3px; max-width: 210px; }

.mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 26px;
  padding: 0 5px;
  border-radius: 5px;
  background: #0e0b0b;
  border: 1px solid #3a2f22;
  font-size: 11px;
  letter-spacing: .3px;
}

.mini.fire { color: var(--fire); border-color: #6b2f10; }
.mini.water { color: var(--water); border-color: #1d4a70; }
.mini.air { color: var(--air); border-color: #245b50; }
.mini.earth { color: var(--earth); border-color: #4d3c1c; }
.mini.light { color: var(--light); border-color: #6b5a1e; }
.mini.dark { color: var(--dark); border-color: #3f2a70; }

.opp-hand { display: flex; gap: 3px; margin-bottom: 7px; flex-wrap: wrap; }

.cardback {
  width: 26px;
  height: auto;
  border-radius: 4px;
  display: block;
}

.piles { display: flex; gap: 14px; justify-content: center; flex: 0 0 auto; }
.pile { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pile .rl { font-size: 9px; letter-spacing: 1.2px; text-transform: uppercase; color: #6b5f4d; }
.pile .rv { font-size: 15px; color: var(--text); }

.pile-stack {
  width: 44px;
  height: 62px;
  border-radius: 5px;
  border: 1px solid #453561;
  background:
    radial-gradient(circle at 50% 42%, #3a2f55 0 14%, transparent 15%),
    linear-gradient(160deg, #241a2c 0%, #0a0810 100%);
  overflow: hidden;
}

.pile-stack.back { border: none; background: none; }

.pile-stack.back img {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 5px;
}

.voidstack {
  border-color: #4a2a24;
  background: linear-gradient(160deg, #2a1a16 0%, #0d0807 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2px;
}

.void-top {
  width: 38px;
  line-height: 0;
}

.void-top img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.played {
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: flex-end;
  align-content: flex-end;
  flex-wrap: wrap;
  flex: 0 0 auto;
  overflow: hidden;
  /* Room above the cards for the lift a selected card gets. Without it the
     overflow above clips the top few pixels off the card you picked. */
  padding-top: 10px;
}
.pcard {
  position: relative;
  width: 58px;
  border-radius: 7px;
  background: #120e0e;
  border: 1px solid #3a2f22;
  overflow: hidden;
  text-align: center;
  flex: 0 0 auto;
}

.pcard svg, .pcard img { width: 100%; height: auto; display: block; }
.pcard .badge {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--gold-bright);
  text-shadow: 0 1px 3px #000;
}
.pcard.attack { border-color: var(--gold); }
.pcard.defense { border-color: #5b6a8c; }
/* Eligible means the card can be captured. It used to carry a green ring,
   which competed with the ring on a selected card and made the two look the
   same. The ring now belongs to the selected card alone. */
.pcard.eligible { cursor: pointer; }
.pcard.eligible:hover { transform: translateY(-3px); }
.pcard.picked {
  box-shadow: 0 0 0 3px var(--gold-bright), 0 0 14px rgba(246, 227, 174, .35);
  transform: translateY(-6px);
}
.pcard.dim { opacity: .45; }
/* A card that cannot be captured, a trump, goes to the Void. Fading it says
   so without needing another outline. */
.pcard.locked { opacity: .5; cursor: default; }
.pcard .badge.yours {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  color: var(--gold-bright);
  text-shadow: 0 1px 3px #000;
  letter-spacing: .3px;
}

.reveal-card { text-align: center; }

.reveal-head {
  margin: 0 0 2px;
  font-size: 22px;
  letter-spacing: 1px;
  color: var(--gold-bright);
}

.reveal-cards {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 16px 0 10px;
}

.reveal-cards .pcard { width: 84px; }

.reveal-reason {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--dim);
  font-style: italic;
}

.my-zone { flex: 0 0 auto; }

.hand {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: nowrap;
  margin-top: 10px;
}

.hcard {
  width: 68px;
  border-radius: 7px;
  overflow: hidden;
  background: #120e0e;
  border: 1px solid #3a2f22;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  position: relative;
}

.hcard svg, .hcard img { width: 100%; height: auto; display: block; }
.hcard:hover { transform: translateY(-6px); }
.hcard.picked { box-shadow: 0 0 0 3px var(--gold-bright); transform: translateY(-8px); }
.hcard.dim { opacity: .35; }
.hcard .note {
  position: absolute;
  bottom: 3px;
  left: 0;
  right: 0;
  text-align: center;
  background: rgba(0, 0, 0, .78);
  color: var(--gold-bright);
  font-size: 9px;
  padding: 1px 2px;
  border-radius: 4px;
  letter-spacing: .2px;
}

.actionbar {
  flex: 0 0 auto;
  z-index: 15;
  background: linear-gradient(180deg, rgba(13, 10, 10, .94) 0%, #0a0808 100%);
  border-top: 1px solid #33291d;
  padding: 8px 10px 10px;
  margin-top: 8px;
}

.prompt { font-size: 13px; color: var(--gold-bright); min-height: 18px; text-align: center; }
.sel { font-size: 12px; color: var(--dim); text-align: center; min-height: 16px; }
.buttons { display: flex; gap: 8px; justify-content: center; margin-top: 6px; flex-wrap: wrap; }

.buttons button {
  padding: 11px 18px;
  background: #2a2018;
  border: 1px solid var(--gold);
  color: var(--gold-bright);
  border-radius: 9px;
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}

.buttons button.ghost { border-color: #4a3f2e; color: var(--dim); }
.buttons button:disabled { opacity: .4; cursor: default; }

.log-panel {
  position: fixed;
  right: 8px;
  bottom: 96px;
  width: 260px;
  z-index: 10;
}

#victory-overlay { z-index: 60; }

.victory-card { text-align: center; }

.victory-head {
  margin: 0 0 6px;
  font-size: 26px;
  letter-spacing: 2px;
  color: var(--gold-bright);
}

.victory-reason {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--dim);
  font-style: italic;
}

.victory-buttons { display: flex; flex-direction: column; gap: 8px; }

.victory-buttons .primary { margin-top: 0; }

.victory-buttons .ghost {
  width: 100%;
  padding: 11px;
  font-family: inherit;
  font-size: 14px;
  color: var(--dim);
  background: transparent;
  border: 1px solid #4a3f2e;
  border-radius: 9px;
  cursor: pointer;
}

.victory-buttons .ghost:hover { color: var(--gold-bright); border-color: var(--gold); }

.rule-card {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.rule-card img {
  width: 100%;
  max-width: 282px;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .65);
}

.elements-open {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.elements-open img {
  width: 100%;
  max-width: 210px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .6);
}

.elements-card { text-align: center; }

.elements-card img {
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.elements-card .primary { margin-top: 12px; }

.music-bar {
  position: fixed;
  left: 10px;
  bottom: 10px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(20, 16, 16, .92);
  border: 1px solid #33291d;
  border-radius: 9px;
}

/* On the table page the bar sits inside the action bar, under the buttons, so
   it never floats over the prompt text or the cards. */
/* On the table page the control sits in the top bar, next to the logo, so it
   never floats over the cards, the prompt text or the buttons. */
.hud-brand .music-bar {
  position: static;
  margin: 0 0 0 auto;
  padding: 4px 8px;
  background: rgba(0, 0, 0, .22);
}

.hud-brand .music-vol { width: 64px; }

/* Fallback for a table page with no top bar. */
.actionbar .music-bar {
  position: static;
  width: fit-content;
  margin: 7px auto 0;
}

.music-mute {
  padding: 3px 8px;
  font-family: inherit;
  font-size: 10px;
  letter-spacing: .6px;
  color: var(--gold-bright);
  background: #1d1712;
  border: 1px solid #3a2f22;
  border-radius: 6px;
  cursor: pointer;
}

.music-mute:hover { background: #2a2018; border-color: var(--gold); }
.music-mute.off { color: var(--dim); }

.music-vol {
  width: 92px;
  height: 16px;
  accent-color: var(--gold);
  cursor: pointer;
}

.invite-line {
  background: rgba(20, 16, 16, .92);
  border: 1px solid #33291d;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 10px;
  color: #6b5f4d;
  word-break: break-all;
  line-height: 1.4;
}

.copy-link {
  width: 100%;
  padding: 6px 8px;
  font-size: 10px;
  letter-spacing: .6px;
  font-family: inherit;
  color: var(--gold-bright);
  background: #1d1712;
  border: 1px solid #3a2f22;
  border-radius: 6px;
  cursor: pointer;
}

.copy-link:hover { background: #2a2018; border-color: var(--gold); }

.copy-status {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  color: var(--gold);
}

.invite-note { color: #6b5f4d; font-size: 10px; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 6, 6, .92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.overlay.hidden { display: none; }

.overlay-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, #1a1313 0%, #120e0e 100%);
  border: 1px solid #3a2f22;
  border-radius: 16px;
  padding: 22px 20px 24px;
}

.overlay-card h2 {
  margin: 0 0 16px;
  font-size: 21px;
  letter-spacing: 2px;
  color: var(--gold-bright);
  text-align: center;
}

.log-panel details {
  background: rgba(20, 16, 16, .92);
  border: 1px solid #33291d;
  border-radius: 9px;
  margin-bottom: 6px;
  font-size: 12px;
}

.log-panel summary { padding: 7px 10px; cursor: pointer; color: var(--dim); letter-spacing: .8px; }
.log-panel ul { margin: 0; padding: 0 10px 10px 22px; color: #b3a58d; max-height: 280px; overflow: auto; }
.log-panel li.exchange { color: var(--text); }
.wheel.small { padding: 8px; }
.wheel.small svg { width: 190px; height: 190px; display: block; margin: 0 auto; }

@media (min-width: 820px) {
  #board { max-width: 860px; }
  .hcard { width: 100px; }
  .pcard { width: 88px; }
}

/* Phone width: the hand has to fit five cards in 352px of usable width.
   The cards give up a little width so the gap between them can breathe. */
@media (max-width: 520px) {
  .log-panel { display: none; }
  .hand { gap: 5px; }
  .hcard { width: 66px; }
  .pcard { width: 66px; }
}
