:root {
  --felt: #0e2a20; --felt-2: #153a2c; --felt-3: #1d4a39; --line: #2b5b48;
  --ink: #f4ecd9; --muted: #a9bcae; --gold: #dcb75f; --up: #6bd596; --down: #f0786c;
  --card: #f6eedc; --card-ink: #1b1b1b; --card-red: #c0392b;
  --radius: 14px; --tap: 48px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--felt); color: var(--ink); font: 16px/1.45 var(--sans);
  min-height: 100dvh; padding-bottom: calc(76px + env(safe-area-inset-bottom));
  background-image: radial-gradient(ellipse at top, #18402f 0%, var(--felt) 60%);
  background-attachment: fixed;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: .01em; }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; color: var(--gold); }
a { color: var(--gold); }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: .85rem; }
.up { color: var(--up); } .down { color: var(--down); }
.num { font-variant-numeric: tabular-nums; }

#top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(14, 42, 32, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
#top h1 { font-size: 1.2rem; flex: 1; }
#top h1 span { color: var(--gold); }
.envtag { background: var(--gold); color: #1b1b1b; font: 700 .7rem var(--sans); padding: 2px 8px; border-radius: 99px; letter-spacing: .08em; }
.iconbtn { background: none; border: 0; padding: 0; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--ink); font: inherit; }

main { max-width: 640px; margin: 0 auto; padding: 16px; display: grid; gap: 14px; }

#tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr);
  background: #0b2219; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
#tabs[hidden] { display: none; }
#tabs a { display: grid; justify-items: center; gap: 2px; padding: 9px 0 8px; color: var(--muted); text-decoration: none; font-size: .72rem; }
#tabs a b { font-size: 1.25rem; font-weight: 400; line-height: 1; }
#tabs a.on { color: var(--gold); }

.panel { background: var(--felt-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 10px; }
.panel > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hero { text-align: center; padding: 18px 14px; }
.hero .pot { font: 600 2.8rem/1 var(--serif); color: var(--gold); }
.hero .meta { color: var(--muted); font-size: .9rem; }

button, .btn {
  font: 600 1rem var(--sans); min-height: var(--tap); padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--felt-3); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button.primary, .btn.primary { background: var(--gold); border-color: var(--gold); color: #1b1b1b; }
button.danger { border-color: var(--down); color: var(--down); background: transparent; }
button.ghost { background: transparent; }
button.sm, .btn.sm { min-height: 36px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
button:disabled { opacity: .5; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; } .row > * { flex: 1; }
.stack { display: grid; gap: 10px; }

label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
input, select, textarea {
  font: 1rem var(--sans); min-height: var(--tap); padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0b2219; color: var(--ink); width: 100%;
}
textarea { min-height: 110px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
input[type=checkbox] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--gold); }

.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .sub { color: var(--muted); font-size: .82rem; }
.list .amt { font: 600 1.05rem var(--sans); font-variant-numeric: tabular-nums; text-align: right; }
li.tap { cursor: pointer; }
.tag { font-size: .68rem; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; white-space: nowrap; }
.tag.gold { border-color: var(--gold); color: var(--gold); }
.tag.ok { border-color: var(--up); color: var(--up); }
.tag.warn { border-color: var(--down); color: var(--down); }

/* playing-card avatar */
.pc {
  flex: none; width: 34px; height: 46px; border-radius: 6px; background: var(--card); color: var(--card-ink);
  display: inline-grid; place-items: center; align-content: center; font: 700 .95rem/1 var(--serif); box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.pc i { font-style: normal; font-size: 1rem; line-height: 1; }
.pc.red { color: var(--card-red); }
.pc.sm { width: 26px; height: 35px; font-size: .75rem; border-radius: 5px; } .pc.sm i { font-size: .8rem; }
.pc.lg { width: 60px; height: 82px; font-size: 1.6rem; border-radius: 9px; } .pc.lg i { font-size: 1.7rem; }
.cardgrid { display: grid; grid-template-columns: repeat(13, 1fr); gap: 4px; }
.cardgrid button { min-height: 0; padding: 0; border: 2px solid transparent; background: none; border-radius: 7px; }
.cardgrid button .pc { width: 100%; height: auto; aspect-ratio: 3/4; font-size: .62rem; border-radius: 4px; } .cardgrid button .pc i { font-size: .7rem; }
.cardgrid button.on { border-color: var(--gold); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: right; color: var(--muted); font-weight: 500; font-size: .75rem; padding: 4px 4px; }
td { padding: 8px 4px; border-top: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); font-size: 1rem; cursor: pointer; }
.switch input { appearance: none; width: 50px; min-height: 30px; height: 30px; border-radius: 99px; background: #0b2219; border: 1px solid var(--line); position: relative; padding: 0; transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--muted); transition: transform .15s; }
.switch input:checked { background: var(--gold); } .switch input:checked::after { transform: translateX(20px); background: #1b1b1b; }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; overflow-x: auto; padding-top: 6px; }
.bars div { flex: 1; min-width: 14px; max-width: 40px; background: var(--gold); border-radius: 4px 4px 0 0; position: relative; }
.transfer { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.transfer:first-of-type { border-top: 0; }
.transfer .who { flex: 1; } .transfer .who b { font-weight: 600; }
.monthnav { display: flex; align-items: center; justify-content: space-between; }
.monthnav button { min-height: 40px; width: 44px; padding: 0; }
.problems { margin: 0; padding-left: 18px; color: var(--down); }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pick label { flex-direction: row; display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: .95rem; background: #0b2219; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.rsvp button { min-height: 38px; width: 44px; padding: 0; font-size: 1.1rem; }
.rsvp button.on { background: var(--gold); border-color: var(--gold); }

dialog { border: 1px solid var(--line); border-radius: 18px 18px 0 0; background: var(--felt-2); color: var(--ink); padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  width: 100%; max-width: 640px; margin: auto auto 0; max-height: 88dvh; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog .stack { gap: 12px; }
#toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: #000c; color: #fff; padding: 10px 16px; border-radius: 99px; font-size: .9rem; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 20; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }
@media (min-width: 700px) { dialog { border-radius: 18px; margin: auto; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
