/* Last 100 — board-game inspired auction table */

:root {
    --wood-1: #6b4a2a;
    --wood-2: #4a321b;
    --felt-1: #215140;
    --felt-2: #163a2d;
    --felt-edge: #0d241c;
    --cream: #f7edd6;
    --cream-2: #e7d7b4;
    --ink: #2c2216;
    --gold: #e0a53b;
    --gold-bright: #ffd479;
    --you: #4fb98a;
    --rival: #c4544c;
    --burn: #b0653a;
    --panel: #1d1810;
    --panel-2: #2a2318;
    --line: rgba(255, 233, 190, 0.16);
    --text: #f2e6cc;
    --muted: #b9a883;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    background:
        radial-gradient(120% 90% at 50% -10%, #2c2318 0%, #17120b 55%, #0d0a06 100%);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    overscroll-behavior: none;
}

#app {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.hidden { display: none !important; }

/* ================================================================ HUD */
.hud {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(#241c11, #17110a);
    border-bottom: 2px solid #000;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    z-index: 6;
}

.hud-player {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.hud-player.rival { justify-content: flex-end; }

.hud-tag {
    font-size: 10px;
    letter-spacing: 2px;
    font-weight: 800;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 3px 7px;
}

.hud-player.you .hud-tag { color: var(--you); border-color: rgba(79, 185, 138, 0.45); }
.hud-player.rival .hud-tag { color: var(--rival); border-color: rgba(196, 84, 76, 0.45); }

.hud-cash {
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    font-weight: 800;
    color: #eddfbc;
    display: flex;
    align-items: baseline;
    gap: 1px;
}

.hud-cash i { font-style: normal; font-size: 14px; color: var(--muted); }
.hud-cash.bump { animation: cashbump 0.4s ease; }
@keyframes cashbump { 0% { transform: scale(1); } 40% { transform: scale(1.18); color: var(--gold-bright); } 100% { transform: scale(1); } }

.hud-mid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 120px;
}

.hud-round {
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--muted);
    font-weight: 700;
}

.hud-round b { color: var(--gold-bright); }

.timebar {
    width: min(42vw, 240px);
    height: 6px;
    border-radius: 99px;
    background: rgba(0, 0, 0, 0.5);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.6);
}

.timebar i {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
    transition: width 0.18s linear;
}

.timebar.low i { background: linear-gradient(90deg, #d6543f, #ff8a6b); }
.timebar.reveal i { background: linear-gradient(90deg, #5aa6ff, #a9d0ff); }

/* ============================================================== STAGE */
#stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

.felt {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 14px 12px 10px;
    background:
        radial-gradient(90% 70% at 50% 30%, var(--felt-1) 0%, var(--felt-2) 62%, var(--felt-edge) 100%);
    box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.25), inset 0 0 90px rgba(0, 0, 0, 0.55);
}

.felt::before {
    content: "";
    position: absolute;
    inset: 10px;
    border: 2px dashed rgba(255, 233, 190, 0.14);
    border-radius: 18px;
    pointer-events: none;
}

/* ============================================================= LOT */
.lot-wrap {
    flex: 0 0 auto;
    perspective: 900px;
    margin-top: 2px;
}

.lot-card {
    position: relative;
    width: min(78vw, 300px);
    border-radius: 16px;
    padding: 14px 16px 12px;
    text-align: center;
    background:
        radial-gradient(120% 120% at 50% 0%, #fff8e8 0%, var(--cream) 55%, var(--cream-2) 100%);
    color: var(--ink);
    border: 3px solid #cbb486;
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.5);
    transform: rotate(-1.2deg);
}

.lot-card.final {
    border-color: var(--gold);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.55), 0 0 26px rgba(224, 165, 59, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.lot-card.deal { animation: deal 0.42s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes deal {
    0% { transform: translateY(-26px) rotate(-8deg) scale(0.82); opacity: 0; }
    100% { transform: translateY(0) rotate(-1.2deg) scale(1); opacity: 1; }
}

.lot-index {
    font-size: 10px;
    letter-spacing: 2px;
    font-weight: 800;
    color: #9c7f47;
}

.lot-emoji {
    font-size: clamp(38px, 13vw, 56px);
    line-height: 1.05;
    margin: 2px 0;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.22));
}

.lot-name {
    font-size: clamp(16px, 4.6vw, 20px);
    font-weight: 800;
    line-height: 1.1;
}

.lot-value {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    margin-top: 6px;
    padding: 3px 12px;
    border-radius: 99px;
    background: linear-gradient(#3a2a14, #241809);
    color: var(--gold-bright);
    border: 2px solid #6f5223;
}

.lot-value b { font-size: 22px; }
.lot-value span { font-size: 11px; letter-spacing: 1px; color: #d8bd82; }

.lot-tag {
    margin-top: 6px;
    font-size: 11.5px;
    color: #6c5a3c;
    font-style: italic;
}

/* ============================================================= BID */
.bid-area {
    flex: 0 0 auto;
    width: min(94vw, 520px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.bid-head {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    letter-spacing: 2px;
    color: var(--muted);
    font-weight: 700;
    padding: 0 4px;
}

.bid-selected {
    color: var(--gold-bright);
    font-size: 15px;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    width: 100%;
    max-height: 30vh;
    overflow-y: auto;
    padding: 2px;
}

.chip-bid {
    font: inherit;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    font-size: 14px;
    color: #3a2c17;
    background: linear-gradient(#fff6e0, #e9d8b4);
    border: 2px solid #b59a66;
    border-radius: 10px;
    padding: 9px 12px;
    min-width: 52px;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 3px 0 #8a7346, 0 5px 10px rgba(0, 0, 0, 0.35);
    transition: transform 0.06s, box-shadow 0.06s, background 0.1s;
}

.chip-bid:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a7346, 0 2px 6px rgba(0, 0, 0, 0.4); }

.chip-bid.picked {
    background: linear-gradient(#ffd479, #e0a53b);
    border-color: #fff1c9;
    color: #241809;
    box-shadow: 0 3px 0 #8a5f1c, 0 0 16px rgba(255, 212, 121, 0.6);
}

.chip-bid.locked { opacity: 0.55; cursor: default; }
.chip-bid.picked.locked { opacity: 1; }
.chip-bid.allin { border-color: var(--rival); }

.btn {
    font: inherit;
    font-weight: 800;
    letter-spacing: 1.5px;
    font-size: 14px;
    color: var(--text);
    background: linear-gradient(#3a2f1e, #241c10);
    border: 2px solid #5e4a2b;
    border-radius: 12px;
    padding: 13px 22px;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 4px 0 #14100a, 0 8px 16px rgba(0, 0, 0, 0.4);
    transition: transform 0.07s, box-shadow 0.07s, filter 0.1s;
}

.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #14100a, 0 3px 8px rgba(0, 0, 0, 0.4); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
    background: linear-gradient(#ffd479, #e0a53b);
    color: #2a1c07;
    border-color: #fff1c9;
    box-shadow: 0 4px 0 #8a5f1c, 0 8px 18px rgba(0, 0, 0, 0.4);
}

.btn.lock { width: min(94vw, 320px); padding: 14px; font-size: 15px; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); box-shadow: none; }
.btn.tiny { font-size: 11px; padding: 8px 12px; border-width: 1px; }

.rival-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    letter-spacing: 1.5px;
    font-weight: 700;
    color: var(--muted);
}

.rival-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7d6f55;
    box-shadow: 0 0 0 0 rgba(196, 84, 76, 0.6);
    animation: pulse 1.3s infinite;
}

.rival-status.locked { color: var(--rival); }
.rival-status.locked .dot { background: var(--rival); animation: none; }
@keyframes pulse { 0% { transform: scale(0.9); opacity: 0.6; } 50% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(0.9); opacity: 0.6; } }

/* ============================================================ REVEAL */
.reveal {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(7, 5, 3, 0.72);
    backdrop-filter: blur(2px);
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
}

.reveal.show { opacity: 1; }
.reveal:not(.hidden) { pointer-events: auto; }

.reveal-banner {
    font-size: clamp(26px, 9vw, 44px);
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--gold-bright);
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.6);
}

.reveal-banner.you { color: var(--you); }
.reveal-banner.rival { color: var(--rival); }
.reveal-banner.burn { color: var(--burn); }
.reveal-banner.pop { animation: pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes pop { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.reveal-bids {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reveal-bid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 84px;
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(#fff6e0, #e4d2ac);
    color: var(--ink);
    border: 2px solid #b59a66;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
    animation: flipin 0.36s ease both;
}

.reveal-bid.you { border-color: var(--you); }
.reveal-bid.rival { border-color: var(--rival); animation-delay: 0.08s; }

@keyframes flipin { 0% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }

.reveal-bid .rb-tag { font-size: 10px; letter-spacing: 2px; font-weight: 800; color: #8a7346; }
.reveal-bid b { font-size: 24px; font-variant-numeric: tabular-nums; }
.reveal-vs { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: 2px; }
.reveal-sub { max-width: 90%; text-align: center; font-size: 13px; color: #e8dcc0; }

/* ============================================================ SHELVES */
.shelves {
    margin-top: auto;
    width: min(96vw, 620px);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.shelf {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 30px;
    padding: 6px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line);
    flex-wrap: wrap;
}

.shelf-item {
    font-size: 19px;
    line-height: 1;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
    animation: shelfin 0.4s ease both;
}

@keyframes shelfin { 0% { transform: scale(0) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }

.fx {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
}

/* =========================================================== OVERLAY */
.overlay {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: radial-gradient(90% 80% at 50% 0%, #2a2115 0%, #120d07 70%);
    overflow-y: auto;
}

.panel {
    width: min(94vw, 440px);
    max-height: 96vh;
    overflow-y: auto;
    background: linear-gradient(var(--panel-2), var(--panel));
    border: 2px solid #4c3d22;
    border-radius: 18px;
    padding: 22px 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 233, 190, 0.12);
    text-align: center;
    animation: panelin 0.3s ease both;
}

@keyframes panelin { 0% { transform: translateY(14px) scale(0.98); opacity: 0; } 100% { transform: none; opacity: 1; } }

.brand {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #f4e3b6;
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.5);
}

.brand span { color: var(--gold-bright); }
.brand.small { font-size: 22px; }

.tagline {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: 1px;
}

.howto {
    margin: 18px 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
    text-align: left;
}

.howto-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    color: #e6d9ba;
    line-height: 1.35;
}

.howto-row .chip {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 800;
    background: var(--gold);
    color: #2a1c07;
}

.howto-row b { color: var(--gold-bright); }
.howto-row b.burn { color: #ff9a6b; }

.howto-note {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

.lobby-hint { margin-top: 12px; font-size: 11.5px; color: var(--muted); }

.wait-title { margin-top: 10px; font-size: 16px; font-weight: 700; color: #f4e3b6; }
.wait-sub { font-size: 12px; color: var(--muted); margin-top: 2px; letter-spacing: 1px; }

.dots i { animation: blink 1.2s infinite; font-style: normal; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.2; } 30% { opacity: 1; } }

/* ========================================================== PRACTICE */
.practice {
    margin: 16px 0;
    padding: 12px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--line);
}

.practice-lot {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
    text-align: left;
}

.practice-emoji { font-size: 34px; }
.practice-name { font-weight: 800; font-size: 14px; color: #f0e2c2; }
.practice-value { font-size: 12px; color: var(--muted); }

.practice-chips { margin-top: 10px; max-height: none; }
.practice-chips .chip-bid { padding: 7px 10px; font-size: 13px; min-width: 46px; }

.practice-result { min-height: 18px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.practice-result.ok { color: var(--you); }
.practice-result.no { color: var(--rival); }
.practice-foot { margin-top: 4px; font-size: 11px; letter-spacing: 1px; color: var(--muted); }
.practice-foot b { color: var(--gold-bright); }

/* =========================================================== RESULTS */
.result-kicker { font-size: 11px; letter-spacing: 3px; color: var(--muted); font-weight: 800; }

.result-title {
    font-size: 28px;
    font-weight: 900;
    margin: 6px 0 12px;
    color: var(--gold-bright);
}
.result-title.win { color: var(--you); }
.result-title.lose { color: var(--rival); }

.result-scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.rs {
    padding: 10px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--line);
}
.rs span { display: block; font-size: 10px; letter-spacing: 2px; color: var(--muted); font-weight: 800; }
.rs b { font-size: 30px; color: #f4e3b6; font-variant-numeric: tabular-nums; }
.rs.you { border-color: rgba(79, 185, 138, 0.4); }
.rs.rival { border-color: rgba(196, 84, 76, 0.4); }

.breakdown {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
    text-align: left;
    font-size: 12.5px;
}

.bd-col { background: rgba(0, 0, 0, 0.22); border-radius: 10px; padding: 8px 10px; }
.bd-head { font-size: 10px; letter-spacing: 2px; color: var(--muted); font-weight: 800; margin-bottom: 4px; }
.bd-row { display: flex; justify-content: space-between; color: #dccdaa; padding: 1px 0; }
.bd-row b { color: var(--gold-bright); }

.result-line { color: var(--muted); font-size: 12.5px; margin-bottom: 16px; }

.result-actions { display: flex; flex-direction: column; gap: 10px; }
.result-wait { margin-top: 12px; font-size: 12px; color: var(--muted); }

.goodbye-msg { margin: 14px 0 18px; color: #e6d9ba; }

/* ============================================================ BANNERS */
.pause-banner {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 7;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 99px;
    background: rgba(18, 13, 7, 0.92);
    border: 1px solid var(--line);
    font-size: 12px;
    color: #e6d9ba;
    white-space: nowrap;
}

.pause-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--burn);
    animation: pulse 1.2s infinite;
}

.toast {
    position: absolute;
    bottom: 74px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9;
    background: rgba(18, 13, 7, 0.95);
    border: 1px solid var(--line);
    color: #f2e6cc;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 12.5px;
    max-width: 84vw;
    text-align: center;
}

/* =========================================================== CONTROLS */
.controls {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    background: linear-gradient(#17110a, #0f0b06);
    border-top: 2px solid #000;
    z-index: 6;
}

.reactions { display: flex; gap: 6px; flex-wrap: wrap; }

.reaction {
    font: inherit;
    font-size: 18px;
    line-height: 1;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(#2c2417, #1c1610);
    border: 1px solid var(--line);
    cursor: pointer;
    touch-action: manipulation;
}

.reaction:active { transform: translateY(2px); }

.controls-right { display: flex; align-items: center; gap: 8px; }

.emoji-float {
    position: absolute;
    z-index: 6;
    font-size: 34px;
    pointer-events: none;
    animation: floatup 1.5s ease-out forwards;
}

@keyframes floatup {
    0% { transform: translateY(0) scale(0.6); opacity: 0; }
    20% { opacity: 1; }
    100% { transform: translateY(-120px) scale(1.2); opacity: 0; }
}

/* ========================================================= RESPONSIVE */
@media (max-height: 640px) {
    .lot-emoji { font-size: 36px; }
    .lot-card { padding: 10px 14px; }
    .lot-tag { display: none; }
    .chips { max-height: 24vh; }
}

@media (min-width: 760px) {
    .felt { padding-top: 20px; }
    .lot-card { width: 320px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
