/* ───────────── Reset & base ───────────── */
[v-cloak] {
    display: none
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

:root {
    --bg: #0f0e17;
    --surface: #1a1a2e;
    --surface2: #232346;
    --primary: #e53170;
    --secondary: #7f5af0;
    --gold: #ffd803;
    --text: #fffffe;
    --text-dim: #94a1b2;
    --success: #2cb67d;
    --danger: #e53170;
    --radius: 10px;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh
}

a {
    color: var(--secondary)
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: .95rem;
    font-weight: 600;
    transition: all .15s
}

button:active {
    transform: scale(.97)
}

input, select {
    font-family: inherit;
    border: 2px solid var(--surface2);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    outline: none
}

input:focus {
    border-color: var(--secondary)
}

h1, h2, h3 {
    font-weight: 700
}

.btn-primary {
    background: var(--primary);
    color: #fff
}

.btn-primary:hover {
    background: #c4285e
}

.btn-secondary {
    background: var(--secondary);
    color: #fff
}

.btn-secondary:hover {
    background: #6944d8
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 2px solid var(--danger)
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff
}

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border: 2px solid var(--surface2)
}

.btn-ghost:hover {
    border-color: var(--text-dim)
}

.btn-sm {
    padding: 6px 12px;
    font-size: .82rem
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1.15rem
}

/* ───────────── Layout helpers ───────────── */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px
}

.flex {
    display: flex;
    align-items: center;
    gap: 12px
}

.flex-wrap {
    flex-wrap: wrap
}

.gap-sm {
    gap: 8px
}

.gap-lg {
    gap: 20px
}

.mt {
    margin-top: 16px
}

.mb {
    margin-bottom: 16px
}

.text-center {
    text-align: center
}

/* ───────────── Toast notification ───────────── */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    z-index: 1000;
    animation: slideIn .3s ease;
    max-width: 380px
}

.toast-success {
    background: var(--success);
    color: #fff
}

.toast-error {
    background: var(--danger);
    color: #fff
}

.toast-info {
    background: var(--secondary);
    color: #fff
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(40px)
    }
    to {
        opacity: 1;
        transform: translateX(0)
    }
}

/* ───────────── Home view ───────────── */
.home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 90vh;
    gap: 40px
}

.home h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text
}

.home-cards {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: center
}

.home-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 36px 32px;
    width: 320px;
    text-align: center;
    border: 2px solid var(--surface2);
    transition: border-color .2s
}

.home-card:hover {
    border-color: var(--secondary)
}

.home-card h2 {
    margin-bottom: 8px;
    font-size: 1.3rem
}

.home-card p {
    color: var(--text-dim);
    font-size: .9rem;
    margin-bottom: 20px
}

.home-card .field {
    display: flex;
    gap: 8px;
    margin-bottom: 12px
}

.home-card .field input {
    flex: 1;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-align: center;
    font-size: 1.1rem
}

/* ───────────── Header bar ───────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--surface);
    border-bottom: 1px solid var(--surface2)
}

.topbar h2 {
    font-size: 1.15rem
}

/* ───────────── Bingo board ───────────── */
.board-wrap {
    background: linear-gradient(145deg, #1b1464, #1a1a4e);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
    display: inline-block
}

.board-header {
    display: grid;
    grid-template-columns:repeat(5, 1fr);
    gap: 5px;
    margin-bottom: 5px
}

.board-header span {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    padding: 6px 0;
    color: var(--gold);
    letter-spacing: 2px
}

.board-grid {
    display: grid;
    grid-template-columns:repeat(5, 1fr);
    gap: 5px
}

.board-cell {
    position: relative;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fffde7;
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #1a1a2e;
    cursor: pointer;
    user-select: none;
    transition: all .12s
}

.board-cell:hover {
    background: #fff9c4
}

.board-cell.free {
    background: #d1c4e9;
    cursor: pointer
}

.board-cell.stamped .stamp-mark {
    display: flex
}

.stamp-mark {
    display: none;
    position: absolute;
    inset: 6%;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 2.6rem;
    line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .3))
}

.board-cell.stamped .cell-num {
    opacity: .45
}

/* ── Stamp shape picker ── */
.stamp-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap
}

.stamp-picker span.label {
    font-size: .85rem;
    color: var(--text-dim);
    margin-right: 2px
}

.stamp-option {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    border-radius: 8px;
    cursor: pointer;
    background: var(--surface2);
    border: 2px solid transparent;
    transition: all .15s
}

.stamp-option:hover {
    border-color: var(--text-dim)
}

.stamp-option.active {
    border-color: var(--gold);
    background: var(--surface)
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all .15s
}

.color-swatch:hover {
    transform: scale(1.15)
}

.color-swatch.active {
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(255, 216, 3, .5)
}

/* ── Stamp opacity slider ── */
.opacity-slider {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center
}

.opacity-slider span.label {
    font-size: .85rem;
    color: var(--text-dim)
}

.opacity-slider input[type=range] {
    width: 120px;
    accent-color: var(--gold);
    cursor: pointer
}

.opacity-slider .opacity-val {
    font-size: .8rem;
    color: var(--text-dim);
    min-width: 32px;
    text-align: center
}

/* ───────────── Player layout ───────────── */
.player-body {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    padding: 24px;
    justify-content: center
}

.player-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px
}

.player-right {
    flex: 1;
    min-width: 300px;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 20px
}

/* ───────────── Called numbers grid ───────────── */
.numbers-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px
}

.numbers-panel h3 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: var(--text-dim)
}

.numbers-cols {
    display: grid;
    grid-template-columns:repeat(5, 1fr);
    gap: 4px
}

.numbers-col-header {
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
    padding: 4px 0;
    color: var(--gold)
}

.num-cell {
    text-align: center;
    padding: 4px 0;
    font-size: .85rem;
    border-radius: 4px;
    color: var(--text-dim)
}

.num-cell.called {
    background: var(--gold);
    color: #1a1a2e;
    font-weight: 700
}

/* ───────────── Pattern display (mini) ───────────── */
.patterns-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px
}

.patterns-panel h3 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: var(--text-dim)
}

.pattern-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px
}

.pattern-card {
    text-align: center
}

.pattern-card span {
    display: block;
    font-size: .8rem;
    margin-bottom: 4px;
    color: var(--text)
}

.pattern-mini {
    display: grid;
    grid-template-columns:repeat(5, 1fr);
    gap: 2px
}

.pattern-mini-cell {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: var(--surface2)
}

.pattern-mini-cell.on {
    background: var(--gold)
}

/* ───────────── Winner banner ───────────── */
.winner-banner {
    background: linear-gradient(135deg, var(--gold), #ff9800);
    color: #1a1a2e;
    text-align: center;
    padding: 20px;
    border-radius: var(--radius);
    font-size: 1.6rem;
    font-weight: 800;
    animation: pulse 1s infinite alternate
}

@keyframes pulse {
    from {
        transform: scale(1)
    }
    to {
        transform: scale(1.03)
    }
}

/* ───────────── Admin login ───────────── */
.admin-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    gap: 16px
}

.admin-login .box {
    background: var(--surface);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    width: 360px;
    border: 2px solid var(--surface2)
}

.admin-login .box h2 {
    margin-bottom: 6px
}

.admin-login .box p {
    color: var(--text-dim);
    margin-bottom: 20px;
    font-size: .9rem
}

.admin-login .box input {
    width: 100%;
    margin-bottom: 12px
}

.admin-login .box .btns {
    display: flex;
    gap: 8px;
    justify-content: center
}

.error-msg {
    color: var(--danger);
    font-size: .85rem;
    margin-top: 8px
}

/* ───────────── Admin dashboard ───────────── */
.admin-tabs {
    display: flex;
    gap: 4px;
    background: var(--surface);
    padding: 6px;
    border-radius: var(--radius);
    margin: 20px 24px 0
}

.admin-tabs button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    font-weight: 600
}

.admin-tabs button.active {
    background: var(--secondary);
    color: #fff
}

.tab-body {
    padding: 24px
}

/* Admin cards */
.cards-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px
}

.cards-toolbar input[type=number] {
    width: 80px
}

.cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.card-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--surface2);
    padding: 8px 12px;
    border-radius: 8px;
    font-family: monospace;
    font-size: .95rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s
}

.card-chip:hover {
    border-color: var(--secondary)
}

.card-chip .del {
    color: var(--danger);
    font-weight: 700;
    cursor: pointer;
    margin-left: 4px;
    font-size: 1.1rem
}

.card-chip .del:hover {
    color: #fff
}

/* Card preview modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500
}

.modal-box {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    max-width: 440px;
    width: 90%
}

.modal-box h3 {
    margin-bottom: 12px
}

/* Admin patterns */
.pattern-editor {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px
}

.pattern-editor-grid {
    display: grid;
    grid-template-columns:repeat(5, 1fr);
    gap: 4px;
    width: fit-content;
    margin: 12px auto
}

.pattern-editor-cell {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background: var(--surface2);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .12s
}

.pattern-editor-cell.on {
    background: var(--gold);
    border-color: var(--gold)
}

.pattern-editor-cell:hover {
    border-color: var(--text-dim)
}

.pattern-editor .field {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    justify-content: center
}

.pattern-editor .btns {
    text-align: center;
    margin-top: 12px
}

.saved-patterns {
    display: flex;
    flex-wrap: wrap;
    gap: 12px
}

.saved-pattern {
    background: var(--surface);
    border: 2px solid var(--surface2);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    position: relative
}

.saved-pattern span {
    display: block;
    font-size: .85rem;
    margin-bottom: 6px
}

.saved-pattern .del {
    position: absolute;
    top: 4px;
    right: 8px;
    color: var(--danger);
    cursor: pointer;
    font-weight: 700
}

/* Admin game */
.game-setup {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px
}

.game-setup h3 {
    margin-bottom: 12px
}

.pattern-checks {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px
}

.pattern-check {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface2);
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color .15s
}

.pattern-check.selected {
    border-color: var(--gold)
}

.pattern-check input {
    display: none
}

.pattern-check .dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--text-dim)
}

.pattern-check.selected .dot {
    background: var(--gold);
    border-color: var(--gold)
}

.game-active {
    display: flex;
    flex-direction: column;
    gap: 20px
}

.draw-area {
    text-align: center
}

.last-drawn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--surface);
    border-radius: 16px;
    padding: 20px 36px;
    margin-top: 12px;
    border: 3px solid var(--gold)
}

.last-drawn .letter {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--gold)
}

.last-drawn .number {
    font-size: 3rem;
    font-weight: 800
}

.winners-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px
}

.winners-panel h3 {
    color: var(--gold);
    margin-bottom: 8px
}

.winner-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.winner-chip {
    background: linear-gradient(135deg, var(--gold), #ff9800);
    color: #1a1a2e;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-family: monospace
}

.no-game-msg {
    text-align: center;
    color: var(--text-dim);
    padding: 40px
}

