/* ChipRail — a dim home card room.
   Espresso page, deep forest felt, warm brass, ivory chip text.
   Display: Fraunces. UI + chip counts: Inter with tabular figures. */

:root {
  --espresso:      #161210;
  --espresso-2:    #1f1814;
  --felt:          #14352a;
  --felt-light:    #245a44;
  --felt-edge:     #0d2319;
  --rail:          #3a2417;
  --rail-light:    #5a3a24;
  --brass:         #c9a227;
  --brass-bright:  #e7c252;
  --ivory:         #f4ecd8;
  --muted:         #93a99a;
  --brick:         #c0473f;
  --panel:         #11231b;
  --panel-edge:    #1f3b2e;
  --radius:        14px;
  --shadow:        0 12px 32px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, sans-serif;
  font-feature-settings: "tnum" 1, "cv05" 1;
  color: var(--ivory);
  background:
    radial-gradient(1200px 600px at 50% -10%, #221a14 0%, transparent 60%),
    var(--espresso);
  line-height: 1.45;
}

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 18px 22px;
  border-bottom: 1px solid #2a2018;
  flex-wrap: wrap;
}
.brand {
  font-family: "Fraunces", serif;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: .01em;
  color: var(--ivory);
  text-decoration: none;
}
.brand-suit { color: var(--brass); }
.brand-tag {
  color: var(--muted);
  font-size: .82rem;
  font-style: italic;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 26px 18px 64px; }

/* ---- flashes ---- */
.flashes { max-width: 1100px; margin: 14px auto 0; padding: 0 18px; }
.flash {
  padding: 10px 14px; border-radius: 10px; margin-bottom: 8px;
  font-size: .9rem; border: 1px solid transparent;
}
.flash-success { background: #143226; border-color: #2c5e46; color: #bfe6cf; }
.flash-error   { background: #3a1a18; border-color: #6e2f2a; color: #f0c4bf; }
.flash-info    { background: #1d2620; border-color: #36473d; color: var(--muted); }

/* ---- generic type ---- */
h1, h2, h3 { font-family: "Fraunces", serif; font-weight: 600; margin: 0 0 .4em; }
h1 { font-size: 2rem; }
.lede { color: var(--muted); margin-top: -.2em; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .72rem; font-weight: 600; color: var(--brass);
}

/* ---- buttons ---- */
.btn {
  font: inherit; font-weight: 600;
  border: 1px solid #3a4d42; border-radius: 10px;
  background: #1a2c23; color: var(--ivory);
  padding: 9px 14px; cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: #21392d; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--brass-bright); outline-offset: 2px; }
.btn-brass {
  background: linear-gradient(180deg, var(--brass-bright), var(--brass));
  color: #2a1f08; border-color: #8c6f15;
}
.btn-brass:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--brass-bright), var(--brass)); }
.btn-ghost { background: transparent; }
.btn-danger { color: #f0c4bf; border-color: #6e2f2a; background: #2a1614; }
.btn-danger:hover { background: #3a1d1a; }
.btn-sm { padding: 6px 10px; font-size: .82rem; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: #1a2c23; }

input[type="text"], input[type="number"] {
  font: inherit; color: var(--ivory);
  background: #0e1813; border: 1px solid #33453b;
  border-radius: 9px; padding: 9px 11px; width: 100%;
}
input:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
label { font-size: .82rem; color: var(--muted); display: block; margin-bottom: 5px; }

/* ====================================================================
   HOME
   ==================================================================== */
.home-grid { display: grid; gap: 26px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .home-grid { grid-template-columns: 1.1fr 1fr; } }

.card {
  background: var(--espresso-2);
  border: 1px solid #2c2219;
  border-radius: var(--radius);
  padding: 22px;
}
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.game-list { list-style: none; margin: 0; padding: 0; }
.game-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 4px; border-bottom: 1px solid #261d16;
}
.game-list li:last-child { border-bottom: 0; }
.game-list .gl-name { font-family: "Fraunces", serif; font-size: 1.1rem; }
.game-list .gl-meta { color: var(--muted); font-size: .82rem; }
.empty { color: var(--muted); font-style: italic; padding: 8px 0; }

/* ====================================================================
   FELT TABLE
   ==================================================================== */
.table-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.table-head h1 { margin: 0; }
.table-stats { display: flex; gap: 18px; color: var(--muted); font-size: .9rem; }
.table-stats b { color: var(--ivory); font-weight: 600; }
.head-links { display: flex; gap: 10px; }

.felt {
  position: relative;
  border-radius: 220px / 120px;
  padding: 46px 34px 38px;
  background:
    radial-gradient(120% 90% at 50% 32%, var(--felt-light) 0%, var(--felt) 46%, var(--felt-edge) 100%);
  border: 14px solid var(--rail);
  box-shadow:
    inset 0 0 0 2px rgba(0,0,0,.35),
    inset 0 0 60px rgba(0,0,0,.45),
    var(--shadow);
}
.felt::before {
  /* thin brass betting line */
  content: "";
  position: absolute; inset: 30px;
  border: 1px dashed rgba(201,162,39,.28);
  border-radius: 200px / 110px;
  pointer-events: none;
}

/* ---- the pot ---- */
.pot { text-align: center; position: relative; z-index: 1; margin-bottom: 30px; }
.pot-label {
  text-transform: uppercase; letter-spacing: .26em;
  font-size: .72rem; color: var(--brass); font-weight: 600;
}
.pot-amount {
  font-family: "Fraunces", serif;
  font-size: clamp(3rem, 12vw, 5.2rem);
  font-weight: 600; line-height: 1; color: var(--brass-bright);
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  display: inline-flex; align-items: center; gap: .25em;
}
.pot-amount .chip-mark {
  width: .5em; height: .5em; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--brass-bright), #9c7c12);
  box-shadow: 0 0 0 .12em rgba(231,194,82,.22);
}
.pot-sub { color: var(--ivory); opacity: .82; font-size: .92rem; margin-top: 6px; }
.pot-sub b { color: var(--brass-bright); }

/* ---- seats ---- */
.seats {
  position: relative; z-index: 1;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
}

.seat {
  background: linear-gradient(180deg, var(--panel), #0d1c15);
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 6px 16px rgba(0,0,0,.3);
}
.seat.is-folded { opacity: .5; }
.seat.is-allin { border-color: var(--brass); box-shadow: 0 0 0 1px rgba(201,162,39,.4); }

.seat-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.seat-name { font-family: "Fraunces", serif; font-size: 1.12rem; font-weight: 600; }
.badges { display: flex; gap: 5px; }
.badge {
  font-size: .62rem; font-weight: 700; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 999px; line-height: 1.4;
}
.badge-d  { background: var(--ivory); color: #1a1a1a; }
.badge-sb { background: #2c4a3b; color: #cde7d8; border: 1px solid #3f6552; }
.badge-bb { background: #3a3320; color: #e7d18a; border: 1px solid #5e5128; }
.badge-allin { background: var(--brass); color: #2a1f08; }
.badge-folded { background: #2a1614; color: #d98f88; }

.seat-stack {
  font-size: 2rem; font-weight: 700; line-height: 1.1; margin: 8px 0 2px;
  font-feature-settings: "tnum" 1;
}
.seat-stack small { font-size: .7rem; color: var(--muted); font-weight: 500; letter-spacing: .1em; }
.seat-bet { font-size: .85rem; color: var(--muted); min-height: 1.2em; }
.seat-bet b { color: var(--brass-bright); }

.seat-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.seat-actions form { display: contents; }
.bet-inline { display: flex; gap: 6px; flex: 1 1 100%; }
.bet-inline input { width: 100%; }
.bet-inline .btn { white-space: nowrap; }
.seat-rebuy { margin-top: 9px; }
.seat-rebuy summary {
  cursor: pointer; color: var(--muted); font-size: .78rem; list-style: none;
}
.seat-rebuy summary::-webkit-details-marker { display: none; }
.seat-rebuy .bet-inline { margin-top: 8px; }
.seat-waiting { color: var(--muted); font-size: .85rem; font-style: italic; margin-top: 12px; }

/* ---- round controls ---- */
.controls {
  margin-top: 22px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}
.controls .spacer { flex: 1; }

.award {
  margin-top: 18px; background: var(--espresso-2);
  border: 1px solid #2c2219; border-radius: var(--radius); padding: 18px;
}
.award h3 { margin-bottom: 12px; }
.winner-pick { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.winner-opt {
  display: inline-flex; align-items: center; gap: 8px;
  background: #14241c; border: 1px solid #2c4030; border-radius: 999px;
  padding: 7px 13px; cursor: pointer; font-size: .9rem;
}
.winner-opt input { accent-color: var(--brass); width: auto; }

.hand-over {
  margin-top: 22px; text-align: center; padding: 26px;
  background: var(--espresso-2); border: 1px dashed #3a2c1c; border-radius: var(--radius);
}
.hand-over p { color: var(--muted); margin-top: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ====================================================================
   v2 additions: nav, auth, chip stacks, leaderboard, net
   ==================================================================== */

/* ---- top nav ---- */
.topnav { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .92rem; }
.topnav a:hover { color: var(--ivory); }
.logout-form { display: inline; margin: 0; }
.linkbtn {
  font: inherit; font-weight: 600; font-size: .92rem;
  background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0;
}
.linkbtn:hover { color: var(--brick); }

/* ---- select ---- */
.select {
  font: inherit; color: var(--ivory); background: #0e1813;
  border: 1px solid #33453b; border-radius: 9px; padding: 9px 11px; width: 100%;
}
.select:focus-visible { outline: 2px solid var(--brass); }

/* ---- landing hero ---- */
.hero {
  display: grid; gap: 36px; align-items: center; padding: 30px 0;
  grid-template-columns: 1fr;
}
@media (min-width: 860px) { .hero { grid-template-columns: 1.15fr .85fr; } }
.hero-title {
  font-family: "Fraunces", serif; font-weight: 600; line-height: 1.04;
  font-size: clamp(2.4rem, 6vw, 4rem); margin: .1em 0 .3em;
}
.hero .lede { font-size: 1.08rem; max-width: 46ch; }
.signin { margin-top: 26px; }
.btn-google {
  display: inline-flex; align-items: center; gap: 11px;
  background: var(--ivory); color: #1d1b16; border: 1px solid #d8cfb6;
  font-weight: 600; padding: 12px 20px; border-radius: 11px;
  text-decoration: none; font-size: 1rem;
}
.btn-google:hover { filter: brightness(.97); }
.g-mark {
  display: inline-grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: conic-gradient(from -45deg,#ea4335,#fbbc05,#34a853,#4285f4,#ea4335);
  color: #fff; font-weight: 800; font-size: .8rem;
}
.signin-alt { color: var(--muted); margin-top: 14px; font-size: .92rem; }
.signin-alt a { color: var(--brass-bright); text-decoration: none; }
.signin-alt a:hover { text-decoration: underline; }
.signin-note { color: var(--muted); font-size: .8rem; margin-top: 12px; max-width: 42ch; font-style: italic; }

.hero-art { display: flex; justify-content: center; }
.art-pot {
  position: relative; width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, var(--felt-light), var(--felt) 60%, var(--felt-edge));
  border: 12px solid var(--rail);
  box-shadow: inset 0 0 40px rgba(0,0,0,.5), var(--shadow);
  display: grid; place-items: center;
}
.art-pot-label {
  position: absolute; bottom: 30px; letter-spacing: .26em; font-size: .7rem;
  color: var(--brass); font-weight: 700;
}
.art-chip {
  position: absolute; width: 66px; height: 66px; border-radius: 50%;
  border: 3px dashed rgba(255,255,255,.5);
  box-shadow: 0 4px 10px rgba(0,0,0,.4);
}
.art-chip.c1 { background: #c0473f; top: 64px; left: 70px; }
.art-chip.c2 { background: #2f8f63; top: 58px; left: 96px; }
.art-chip.c3 { background: #efe9da; top: 52px; left: 84px; }
.art-chip.c4 { background: #3b4a5a; top: 46px; left: 90px; }

/* ---- auth pages (allauth) ---- */
.auth-wrap { max-width: 460px; }
.auth-card {
  background: var(--espresso-2); border: 1px solid #2c2219;
  border-radius: var(--radius); padding: 26px;
}
.auth-card h1 { font-size: 1.5rem; }
.auth-card form { margin-top: 8px; }
.auth-card p { color: var(--muted); }
.auth-card label { color: var(--muted); }
.auth-card input[type=text], .auth-card input[type=email],
.auth-card input[type=password] {
  display: block; width: 100%; margin-bottom: 12px;
  font: inherit; color: var(--ivory); background: #0e1813;
  border: 1px solid #33453b; border-radius: 9px; padding: 10px 12px;
}
.auth-card input:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
.auth-card button, .auth-card input[type=submit] {
  font: inherit; font-weight: 600; cursor: pointer;
  background: linear-gradient(180deg, var(--brass-bright), var(--brass));
  color: #2a1f08; border: 1px solid #8c6f15; border-radius: 10px; padding: 10px 16px;
}
.auth-card a { color: var(--brass-bright); }
.auth-card ul { padding-left: 18px; }

/* ---- chip stacks (the pile grows with the bet) ---- */
.chip-stack {
  display: flex; flex-direction: column-reverse; align-items: center;
  min-height: 8px;
}
.chip {
  width: 38px; height: 13px; border-radius: 50%/40%;
  margin-top: -8px; /* overlap so they read as a stack */
  border: 1px solid rgba(0,0,0,.45);
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 2px 3px rgba(0,0,0,.35);
  position: relative;
  animation: chip-drop .22s ease both;
  animation-delay: calc(var(--i, 0) * .035s);
}
.chip::after {
  content: ""; position: absolute; inset: 2px 6px; border-radius: 50%/40%;
  border: 1px dashed rgba(255,255,255,.45);
}
.chip.c1   { background: linear-gradient(180deg,#f3eddd,#d9d1bc); }
.chip.c5   { background: linear-gradient(180deg,#cf564d,#a5352e); }
.chip.c25  { background: linear-gradient(180deg,#37a576,#236f4e); }
.chip.c100 { background: linear-gradient(180deg,#465a6e,#2c3a48); }
.chip.c100::after, .chip.c25::after { border-color: rgba(255,255,255,.55); }
.pot-stack { margin: 8px auto 2px; }
.pot-stack .chip { width: 52px; height: 17px; margin-top: -10px; }

@keyframes chip-drop {
  from { opacity: 0; transform: translateY(-10px) scaleX(.85); }
  to   { opacity: 1; transform: translateY(0) scaleX(1); }
}

.bet-area { min-height: 26px; margin-top: 6px; }
.seat-net { font-size: .78rem; font-weight: 600; color: var(--muted); margin-top: 2px; letter-spacing: .02em; }
.seat-net.up { color: #6fd29a; }
.seat-net.down { color: #e08079; }

/* ---- leaderboard ---- */
.board { width: 100%; border-collapse: collapse; }
.board th, .board td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #261d16; }
.board th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 600; }
.board td.num, .board th.num { text-align: right; font-variant-numeric: tabular-nums; }
.board .rank { color: var(--muted); width: 2.5em; }
.board .who { font-family: "Fraunces", serif; font-size: 1.05rem; }
.board .net { font-weight: 700; }
.board .net.up { color: #6fd29a; }
.board .net.down { color: #e08079; }
.board .muted { color: var(--muted); }

.settle-row { margin-top: 14px; }

/* ---- chip value rate input ---- */
.rate-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rate-row input[type=number] { width: 90px; }
.rate-row .cur { width: 56px; text-align: center; }
.rate-eq { color: var(--muted); font-size: .9rem; white-space: nowrap; }

/* ---- settle-up payments ---- */
.settle-up { margin-top: 16px; }
.payments { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.payments li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #0e1813; border: 1px solid #25332b; border-radius: 11px;
  padding: 11px 14px;
}
.pay-from { font-weight: 600; color: #e08079; }
.pay-arrow { color: var(--muted); font-size: .9rem; }
.pay-to { font-weight: 600; color: #6fd29a; }
.pay-amt {
  margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--brass-bright);
}

/* ---- buy-in / top up ---- */
.seat-buyin { font-size: .72rem; color: var(--muted); margin-top: 2px; letter-spacing: .02em; }
.seat-rebuy .full-stack { width: 100%; margin-bottom: 8px; }
.buyin-custom { flex-wrap: wrap; }
.buyin-custom input[type=number] { flex: 1 1 100%; min-width: 0; margin-bottom: 6px; }
.buyin-custom .unit-sel { flex: 1 1 auto; width: auto; padding: 6px 8px; }
.buyin-custom .btn { flex: 0 0 auto; }

/* ---- brand mark (chip icon in the header) ---- */
.brand-mark {
  height: 28px; width: 28px; border-radius: 7px; vertical-align: -8px;
  margin-right: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
