/* ===========================
   Base theme & variables
   =========================== */

:root {
    --primary: #2e7fcc;       /* main accent */
    --primary-light: #e7f2ff;
    --bg: #020617;
    --bg-elevated: #0b1120;
    --bg-deep: #0f172a;
    --card-bg: #020617;
    --cell-bg: #020617;
    --cell-border: #1f2937;
    --cell-open: #2e7fcc;
    --cell-hover: #1e293b;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --danger: #ef4444;
    --success: #22c55e;

    --legendary: #f97316;
    --gold: #eab308;
    --silver: #9ca3af;
    --bronze: #b45309;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top, #1e293b, #020617);
    color: var(--text-main);
    min-height: 100vh;
}

a {
    color: inherit;
}

/* ===========================
   Layout: main, footer, container
   =========================== */

main {
    min-height: 70vh;
}

footer {
    border-top: 1px solid rgba(148, 163, 184, 0.25);
    padding: 16px 0;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #020617;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ===========================
   Buttons
   =========================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 999px;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.1s ease;
}

.btn-primary {
    background: var(--primary);
    border-color: rgba(46, 127, 204, 0.7);
    color: #f9fafb;
}

.btn-primary:hover {
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border-color: rgba(148, 163, 184, 0.6);
    color: var(--text-muted);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--text-main);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-reset {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.btn-reset:hover {
    border-color: var(--danger);
    color: #fecaca;
}

/* ===========================
   NAVBAR
   =========================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.9);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
}

/* Logo */
.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.logo-mark {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, #2e7fcc, #1d4ed8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.logo-text {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Right side: tickets + toggle */
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Tickets */
.nav-balance {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.35);
    font-size: 0.8rem;
}

.nav-balance-label {
    color: var(--text-muted);
}

.nav-badge {
    min-width: 40px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(46,127,204,0.2);
    color: #e5f0ff;
    text-align: right;
    font-weight: 600;
    font-size: 0.8rem;
    display: inline-block;
    transform-origin: center;
}

/* Badge animations */
@keyframes navBadgeFromBelow {
    0%   { transform: translateY(6px) scale(0.9); }
    70%  { transform: translateY(-1px) scale(1.05); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes navBadgeFromAbove {
    0%   { transform: translateY(-6px) scale(0.9); }
    70%  { transform: translateY(1px) scale(1.05); }
    100% { transform: translateY(0) scale(1); }
}

.nav-badge-animate-up {
    animation: navBadgeFromBelow 0.45s ease-out;
}

.nav-badge-animate-down {
    animation: navBadgeFromAbove 0.45s ease-out;
}

/* Hamburger */
.nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.5);
    background: rgba(15,23,42,0.9);
    cursor: pointer;
    padding: 0;
}

.nav-toggle-bar {
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: #e5e7eb;
    margin-inline: auto;
}

/* Menu container */
.nav-menu {
    border-top: 1px solid rgba(15, 23, 42, 0.9);
}

/* Main nav links */
.main-nav {
    display: flex;
    gap: 16px;
}

.main-nav .nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.9rem;
    transition: background 0.15s ease, color 0.15s ease;
}

.main-nav .nav-link:hover {
    background: rgba(15, 23, 42, 0.95);
    color: var(--text-main);
}

.main-nav .nav-link.active {
    background: rgba(46, 127, 204, 0.18);
    color: #e5f0ff;
}

/* Auth */
.nav-auth-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-user {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Mobile nav */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        flex-direction: column;
        gap: 8px;
        padding: 8px 16px 10px;
        background: rgba(15, 23, 42, 0.98);
    }

    .nav-menu.is-open {
        display: flex;
    }

    .main-nav {
        flex-direction: column;
        width: 100%;
    }

    .main-nav .nav-link {
        display: block;
        width: 100%;
        padding: 6px 0;
    }

    .nav-auth-menu {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 6px;
    }
}

/* Desktop nav */
@media (min-width: 769px) {
    .nav-menu {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 16px 10px;
    }

    .nav-toggle {
        display: none;
    }
}

/* ===========================
   Home: hero section
   =========================== */

.hero {
    padding: 48px 0 32px;
}

.hero-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: center;
    justify-content: space-between;
}

.hero-copy {
    flex: 1 1 320px;
}

.hero-title {
    font-size: 2.4rem;
    margin: 0 0 8px;
}

.hero-subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 480px;
}

.hero-cta {
    margin-top: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hero-note {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Home: hero grid preview */

.hero-grid-preview {
    flex: 0 1 320px;
    background: radial-gradient(circle at top left, #1f2937, #020617);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.grid-preview-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.grid-preview {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 10px;
}

.grid-preview-row {
    display: flex;
    gap: 3px;
}

.grid-preview-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: #020617;
    border: 1px solid #1f2937;
}

/* ===========================
   Sections / cards on home
   =========================== */

.section {
    padding: 32px 0;
}

.section-light {
    background: #020617;
}

.section-title {
    margin: 0 0 20px;
    font-size: 1.4rem;
}

.columns-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.feature-card {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    font-size: 0.95rem;
    color: var(--text-muted);
}

.feature-card h3 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.05rem;
    color: var(--text-main);
}

/* Host block */

.host-section {
    max-width: 780px;
}

.host-copy {
    background: radial-gradient(circle at top left, #1f2937, #020617);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.4);
}

.host-list {
    margin: 12px 0 20px;
    padding-left: 18px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ===========================
   Game card + grid (for /play)
   =========================== */

.card {
    background: radial-gradient(circle at top left, #1f2937, #020617);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.card-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.title-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.title {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(46, 127, 204, 0.15);
    border: 1px solid rgba(46, 127, 204, 0.4);
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--primary);
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.message {
    min-height: 22px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--primary-light);
}

/* Legend and progress */

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    align-items: center;
}

.grid-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.legend-legendary { background: var(--legendary); }
.legend-gold      { background: var(--gold); }
.legend-silver    { background: var(--silver); }
.legend-bronze    { background: var(--bronze); }

.legend-summary {
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.legend-box {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid var(--cell-border);
    background: var(--cell-bg);
}

.legend-box.opened {
    background: var(--cell-open);
    border-color: var(--cell-open);
}

.footer-note {
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Grid wrapper */

.grid-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Cube grid */

.cube-container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    padding-bottom: 8px;
}

.cube {
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    gap: 3px;
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

/* responsive grid for small screens */
@media (max-width: 600px) {
    .cube {
        grid-template-columns: repeat(15, minmax(20px, 1fr));
    }
}

/* Cells */

.cell {
    aspect-ratio: 1 / 1;
    border-radius: 6px;
    border: 1px solid #1f2937;
    background: radial-gradient(circle at top, #111827, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition:
        transform 0.1s ease,
        box-shadow 0.1s ease,
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}

.cell:not(.cell-opened) {
    border-color: rgba(46, 127, 204, 0.7);
    box-shadow: 0 0 0 1px rgba(46, 127, 204, 0.25);
}

.cell:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.8);
    background: var(--cell-hover);
}

.cell-opened {
    cursor: default;
}

.cell-opened:hover {
    transform: none;
    box-shadow: none;
}

/* Empty cells */

.cell-opened-empty {
    background: #52619e;
    border-color: #374151;
    color: #98b0d1;
}

.cell-empty-mark {
    font-size: 1rem;
    line-height: 1;
}

/* Prize cells */

.cell-value {
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1;
}

.cell-opened-prize {
    color: #f9fafb;
}

.cell-prize-legendary {
    background: radial-gradient(circle at top, #f97316, #7c2d12);
    border-color: #f97316;
}

.cell-prize-diamond {
    background: radial-gradient(circle at top, #e5e7eb, #1e293b);
    border-color: #e5e7eb;
}

.cell-prize-gold {
    background: radial-gradient(circle at top, #eab308, #713f12);
    border-color: #eab308;
}

.cell-prize-silver {
    background: radial-gradient(circle at top, #9ca3af, #4b5563);
    border-color: #9ca3af;
}

.cell-prize-bronze {
    background: radial-gradient(circle at top, #b45309, #451a03);
    border-color: #b45309;
}

.cell-opened-empty:hover,
.cell-opened-prize:hover {
    transform: none;
    box-shadow: none;
}

.cell-icon {
    font-size: 0.9rem;
    line-height: 1;
}

/* Cell pop animation */

@keyframes cellPop {
    0% {
        transform: scale(0.4);
        opacity: 0;
    }
    60% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cell-animate-open {
    animation: cellPop 0.35s ease-out;
}

/* ===========================
   Prize modal
   =========================== */

.prize-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out;
    z-index: 80;
}

.prize-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.prize-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
}

.prize-modal-content {
    position: relative;
    z-index: 81;
    background: #020617;
    border-radius: 18px;
    padding: 22px 20px 18px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8);
    max-width: 320px;
    width: 90%;
    text-align: center;
    animation: prizeModalPop 0.28s ease-out;
}

@keyframes prizeModalPop {
    0% {
        transform: translateY(10px) scale(0.9);
        opacity: 0;
    }
    60% {
        transform: translateY(-4px) scale(1.03);
        opacity: 1;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.prize-modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.prize-modal-amount {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.prize-modal-type {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.prize-modal-close {
    margin-top: 6px;
    font-size: 0.9rem;
}
.host-section {
    max-width: 780px;
}

.host-board-form {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.host-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.host-input {
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(148,163,184,0.5);
    background: rgba(15,23,42,0.8);
    color: var(--text-main);
    font-size: 0.95rem;
}

.host-input:focus {
    outline: none;
    border-color: var(--primary);
}

.host-help {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.host-message {
    min-height: 16px;
    font-size: 0.85rem;
}

.host-message.error {
    color: #fecaca;
}

.host-message.success {
    color: #bbf7d0;
}

.host-warning {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #fecaca;
}
/* Active boards list on home */

.active-boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.board-card {
    background: var(--bg-elevated);
    border-radius: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    font-size: 0.85rem;
}

.board-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
}

.board-card-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.board-card-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* Tiny non-playable preview grid */

.mini-grid {
    margin: 4px 0 8px;
}

.mini-grid-row {
    display: flex;
    gap: 2px;
}

.mini-cell {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: #020617;
    border: 1px solid #1f2937;
}

.mini-cell-opened {
    background: var(--primary);
    border-color: var(--primary);
}

/* Stats inside card */

.board-stats {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 6px;
}

.board-stat dt {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.board-stat dd {
    margin: 0;
    font-weight: 600;
    font-size: 0.8rem;
}

/* Link */

.board-card-link {
    font-size: 0.75rem;
    color: var(--primary);
    text-decoration: none;
}

.board-card-link:hover {
    text-decoration: underline;
}


/* ===========================
   Responsive tweaks
   =========================== */

@media (max-width: 768px) {
    .hero-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-grid-preview {
        order: -1;
    }

    .columns-3 {
        grid-template-columns: 1fr;
    }
}

/* Mobile tuning for game card */

@media (max-width: 600px) {
    .card {
        margin-left: -16px;
        margin-right: -16px;
        border-radius: 0;
        padding: 14px;
    }

    .cube {
        max-width: 100%;
        gap: 1px;
    }

    .grid-wrapper {
        gap: 6px;
    }

    .legend {
        font-size: 0.75rem;
    }
}
