/* Game Night. Card-table green, cream cards, one hand on a phone. */
:root {
  --felt: #1e5a3c;
  --felt-dark: #143f2a;
  --felt-light: #2a7350;
  --ink: #1b1b1b;
  --cream: #fbf7ec;
  --gold: #e3b341;
  --red: #c0262d;
  --muted: #cfe3d6;
  --line: rgba(255, 255, 255, .22);
  --good: #7ee2a4;
  --bad: #ffb3b3;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: radial-gradient(ellipse at top, var(--felt-light), var(--felt) 55%, var(--felt-dark));
  color: #fff; font: 1.0625rem/1.5 var(--body); padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }
a { color: var(--gold); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.2; }
h1 { font-size: 1.9rem; letter-spacing: .01em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  min-height: 3.25rem; padding: env(safe-area-inset-top) 1rem 0; background: rgba(0, 0, 0, .35); backdrop-filter: blur(6px);
}
.brand { font-weight: 800; font-size: 1.25rem; color: #fff; text-decoration: none; }
.brand span { color: var(--gold); }
.bar .code { font-weight: 700; letter-spacing: .12em; background: rgba(255, 255, 255, .12); border-radius: 999px; padding: .15rem .7rem; }
main { max-width: 40rem; margin: 0 auto; padding: 1rem 1rem 3rem; }

/* buttons, fields, messages */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .5rem 1.1rem;
  background: var(--gold); color: #1b1b1b; border: 2px solid var(--gold); border-radius: 999px;
  font: 700 1rem/1.2 var(--body); cursor: pointer; text-decoration: none; text-align: center;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: #fff; border-color: var(--line); }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.btn.wide { width: 100%; }
.link { background: none; border: 0; padding: .5rem 0; font: inherit; color: var(--gold); text-decoration: underline; cursor: pointer; min-height: 44px; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.actions .btn { flex: 1 1 auto; }
.stack { display: grid; gap: .6rem; }
label { font-weight: 600; }
input, select {
  width: 100%; min-height: 48px; padding: .5rem .8rem; font: 1.05rem var(--body); color: var(--ink);
  background: var(--cream); border: 2px solid transparent; border-radius: 12px;
}
input[type=range] { padding: 0; min-height: 40px; background: transparent; accent-color: var(--gold); }
.msg { padding: .55rem .8rem; border-radius: 10px; font-weight: 600; margin: .5rem 0; }
.msg.bad { background: rgba(192, 38, 45, .25); color: var(--bad); }
.msg.info { background: rgba(255, 255, 255, .1); }
.panel { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; margin-bottom: 1rem; }
.prompt { font-weight: 700; font-size: 1.1rem; padding: .6rem .9rem; border-radius: 12px; background: rgba(0, 0, 0, .3); margin: 0 0 .75rem; }
.prompt.mine { background: var(--gold); color: #1b1b1b; }
.toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  width: max-content; max-width: calc(100vw - 2rem); background: #111; color: #fff; font-weight: 600;
  padding: .7rem 1.1rem; border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .4);
}

/* players around the table */
.seats { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .5rem; }
.seat { background: rgba(0, 0, 0, .25); border: 2px solid transparent; border-radius: 12px; padding: .45rem .6rem; font-size: .95rem; }
.seat.turn { border-color: var(--gold); }
.seat.you { background: rgba(227, 179, 65, .18); }
.seat.out { opacity: .5; }
.seat .who { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .info { color: var(--muted); font-size: .85rem; }

/* cards */
.hand { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0; }
.hand.center { justify-content: center; }
.card {
  position: relative; display: inline-flex; width: 3.4rem; height: 4.8rem; flex: none; border-radius: 8px; background: var(--cream);
  color: var(--ink); border: 1px solid rgba(0, 0, 0, .25); box-shadow: 0 2px 6px rgba(0, 0, 0, .35); font: 700 1rem/1 var(--body); padding: 0;
}
.card.red { color: var(--red); }
.card .corner { position: absolute; top: .25rem; left: .3rem; text-align: center; font-size: .95rem; line-height: 1.05; }
.card .pip { position: absolute; right: .3rem; bottom: .15rem; font-size: 1.7rem; line-height: 1; }
.card.small { width: 2.5rem; height: 3.5rem; }
.card.small .corner { font-size: .8rem; }
.card.small .pip { font-size: 1.15rem; }
.card.back { background: repeating-linear-gradient(45deg, #8c1d22 0 6px, #a8262c 6px 12px); border: 3px solid var(--cream); }
button.card { cursor: pointer; }
button.card:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.card.playable:not(:disabled) { outline: 2px solid var(--gold); outline-offset: 1px; }
.card.selected { transform: translateY(-.6rem); outline: 3px solid var(--gold); }

/* dice */
.dice { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0; }
.die {
  display: inline-grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 3.2rem; height: 3.2rem;
  padding: .4rem; border-radius: 10px; background: var(--cream); border: 2px solid transparent; box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.die .dot { width: .55rem; height: .55rem; border-radius: 50%; place-self: center; }
.die .dot.on { background: var(--ink); }
.die.small { width: 2.2rem; height: 2.2rem; padding: .25rem; }
.die.small .dot { width: .38rem; height: .38rem; }
button.die { cursor: pointer; }
.die.selected { border-color: var(--gold); transform: translateY(-.35rem); }
.die.held { opacity: .55; }

/* game log */
.log { list-style: none; margin: .5rem 0 0; padding: .5rem .75rem; background: rgba(0, 0, 0, .2); border-radius: 12px; font-size: .9rem; color: var(--muted); }
.log li + li { margin-top: .15rem; }
.log li:last-child { color: #fff; }

/* lobby and home */
.code-big { font-size: 2.6rem; font-weight: 800; letter-spacing: .2em; text-align: center; margin: .25rem 0 .5rem; }
.games { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.game-pick { width: 100%; text-align: left; display: grid; gap: .15rem; padding: .8rem 1rem; background: rgba(0, 0, 0, .25);
  color: #fff; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; font: inherit; }
.game-pick[aria-pressed="true"] { border-color: var(--gold); background: rgba(227, 179, 65, .15); }
.game-pick b { font-size: 1.1rem; }
.rules { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
details.howto { margin-top: 1rem; }
details.howto summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }

/* standings tables (game nights, tournaments) */
.standings { width: 100%; border-collapse: collapse; font-size: .95rem; }
.standings th, .standings td { padding: .4rem .35rem; text-align: left; border-bottom: 1px solid var(--line); }
.standings th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.standings td:first-child { width: 2rem; color: var(--muted); }
.standings tr.you td { color: var(--gold); font-weight: 700; }
.standings tr.out td { opacity: .6; }
.champion { text-align: center; border-color: var(--gold); }
.round + .round { margin-top: .75rem; }
.rules li.mine { color: var(--gold); font-weight: 600; }

/* language switch, the "⋯" menu button, sheets (menus, report form), chat */
.bar .lang { background: transparent; color: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; min-height: 36px; font: 600 .9rem var(--body); cursor: pointer; }
#bar-right { margin-left: auto; }
.more { background: transparent; color: var(--muted); border: 0; font: 700 1.3rem/1 var(--body); min-width: 44px; min-height: 44px; cursor: pointer; float: right; margin: -.6rem -.4rem 0 0; }
.more:hover, .more:focus-visible { color: #fff; }
.sheet-back { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, .55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 32rem; max-height: 90vh; overflow: auto; background: var(--felt-dark); border: 1px solid var(--line); border-radius: 18px 18px 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); display: grid; gap: .6rem; box-shadow: 0 -8px 30px rgba(0, 0, 0, .45); }
.sheet fieldset { border: 0; margin: 0; padding: 0; }
.sheet legend { font-weight: 700; margin-bottom: .3rem; }
.radio { display: flex; align-items: center; gap: .5rem; min-height: 44px; font-weight: 500; }
.radio input { width: 1.3rem; min-height: 1.3rem; accent-color: var(--gold); }
textarea { width: 100%; padding: .5rem .8rem; font: 1rem var(--body); color: var(--ink); background: var(--cream); border: 2px solid transparent; border-radius: 12px; resize: vertical; }
.quote { background: rgba(255, 255, 255, .08); border-left: 3px solid var(--gold); padding: .45rem .7rem; border-radius: 8px; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#chat-dock { max-width: 38rem; margin: 0 auto 2rem; width: calc(100% - 2rem); }
#chat-dock summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.chat-list { list-style: none; margin: .25rem 0 .6rem; padding: 0; max-height: 16rem; overflow-y: auto; display: grid; gap: .4rem; }
.chat-list li { background: rgba(0, 0, 0, .2); border-radius: 10px; padding: .35rem .6rem; overflow-wrap: anywhere; }
.chat-list li.mine { background: rgba(227, 179, 65, .14); }
.chat-meta { display: block; }
.chat-form { display: flex; gap: .5rem; }
.chat-form input { flex: 1; min-width: 0; }
.people summary { cursor: pointer; }
.report h3 { margin-bottom: .25rem; }
