/* ============================================================
   Sortudos · app.css
   Design system portado do mockup React aprovado
   ============================================================ */

:root {
    --bg: #0a0b10;
    --bg-soft: #12131a;
    --surface: #171822;
    --surface-2: #1e2030;
    --surface-3: #262938;
    --border: #2a2d40;
    --border-soft: #1e2030;

    --text: #eef0f5;
    --text-dim: #8a8fa3;
    --text-faint: #555a6e;

    --gold: #ffc947;
    --gold-soft: #ffe08a;
    --gold-dim: #c89a3a;

    --green: #12c77a;
    --red: #ff5a5a;
    --blue: #5c9bff;
    --purple: #9b7cff;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(600px 400px at 10% 0%, rgba(255, 201, 71, 0.06), transparent 60%),
        radial-gradient(500px 400px at 90% 100%, rgba(92, 155, 255, 0.05), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: .03;
    z-index: 1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.app-root {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Tipografia ────────────────────────────────────────────── */
.fd { font-family: 'Bricolage Grotesque', system-ui, serif; letter-spacing: -0.02em; }
.fb { font-family: 'Manrope', system-ui, sans-serif; }
.fm { font-family: 'JetBrains Mono', ui-monospace, monospace; }

h1, h2, h3, h4 {
    font-family: 'Bricolage Grotesque', system-ui, serif;
    letter-spacing: -0.02em;
    margin: 0 0 12px;
    font-weight: 700;
}

h1 { font-size: 26px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

.text-dim { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-blue { color: var(--blue); }

.shine-gold {
    background: linear-gradient(135deg, #ffe08a 0%, #ffc947 35%, #c89a3a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.num-big { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 700; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 20px;
}
.container-narrow { max-width: 480px; }
.container-medium { max-width: 720px; }

.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 8px; }
.stack-lg > * + * { margin-top: 24px; }

.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

@media (max-width: 640px) {
    .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

.hairline { border: 0; height: 1px; background: var(--border-soft); margin: 12px 0; }

/* ─── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    line-height: 1;
}
.btn:hover { background: var(--surface); border-color: #3a3d52; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(180deg, var(--gold-soft) 0%, var(--gold) 100%);
    color: #1a1606;
    border-color: var(--gold);
    box-shadow: 0 4px 14px rgba(255, 201, 71, 0.25);
}
.btn-primary:hover { filter: brightness(1.05); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-soft); }

.btn-outline { background: transparent; border-color: var(--border); }
.btn-outline:hover { background: var(--surface-2); }

.btn-danger { color: var(--red); border-color: #3a1e20; background: transparent; }
.btn-danger:hover { background: #3a1e20; }

.btn-block { width: 100%; }
.btn-lg { padding: 13px 18px; font-size: 15px; }
.btn-sm { padding: 7px 10px; font-size: 12px; }

/* ─── Cards ────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    padding: 16px;
}
.card-lg { padding: 22px; }
.card-hover { transition: border-color .15s ease; }
.card-hover:hover { border-color: var(--border); }

.card-gold {
    background: linear-gradient(135deg, rgba(255, 201, 71, 0.10), rgba(255, 201, 71, 0.02));
    border: 1px solid rgba(255, 201, 71, 0.25);
}

.card-green {
    background: linear-gradient(135deg, rgba(18, 199, 122, 0.08), transparent);
    border: 1px solid rgba(18, 199, 122, 0.2);
}

/* ─── Forms ────────────────────────────────────────────────── */
.label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.input, .select, .textarea {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--border-soft);
    font: inherit;
    outline: none;
    transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); }

.textarea { resize: vertical; min-height: 100px; }

.input-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; letter-spacing: 0.06em; }

.form-group { margin-bottom: 16px; }
.form-hint { font-size: 11px; color: var(--text-faint); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 6px; }

/* ─── Pills / Tags / Badges ───────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.pill-gold { background: rgba(255, 201, 71, 0.15); color: var(--gold); }
.pill-green { background: rgba(18, 199, 122, 0.12); color: var(--green); }
.pill-blue { background: rgba(92, 155, 255, 0.12); color: var(--blue); }
.pill-purple { background: rgba(155, 124, 255, 0.12); color: var(--purple); }
.pill-red { background: rgba(255, 90, 90, 0.12); color: var(--red); }

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: var(--surface-2);
    color: var(--text-dim);
    text-transform: uppercase;
}

/* ─── Bolinhas de loteria ─────────────────────────────────── */
.ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-weight: 700;
    font-size: 12px;
    background: radial-gradient(circle at 30% 25%, #3a3d52, #1a1c2a);
    border: 1px solid #2d3046;
    color: var(--text);
    flex-shrink: 0;
    cursor: default;
}
.ball-sm { width: 26px; height: 26px; font-size: 10px; }
.ball-lg { width: 42px; height: 42px; font-size: 14px; }

.ball.hit {
    background: radial-gradient(circle at 30% 25%, #ffd469, #c8901a);
    border-color: #ffe08a;
    color: #1a1606;
    box-shadow: 0 0 0 2px rgba(255, 201, 71, 0.15);
}
.ball.drawn {
    background: radial-gradient(circle at 30% 25%, #2cdd8e, #0a8a56);
    border-color: #3eea9b;
    color: #052517;
}
.ball.selected {
    background: radial-gradient(circle at 30% 25%, #ffd469, #c8901a);
    border-color: #ffe08a;
    color: #1a1606;
    transform: scale(1.05);
}

.balls-row { display: flex; flex-wrap: wrap; gap: 6px; }
.balls-row-sm { display: flex; flex-wrap: wrap; gap: 4px; }

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(10, 11, 16, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-family: 'Bricolage Grotesque', serif;
    font-weight: 700;
    font-size: 17px;
    text-decoration: none;
}
.topbar-brand:hover { text-decoration: none; }

.brand-ball {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, #ffe08a, #c8901a);
    border: 1px solid #ffd469;
    display: inline-block;
}

.topbar-nav { display: flex; align-items: center; gap: 6px; }
.topbar-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 8px;
    color: var(--text-dim);
    transition: all .12s;
}
.topbar-link:hover { background: var(--surface); color: var(--text); text-decoration: none; }

.topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffe08a, #c8901a);
    color: #1a1606;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 12px;
}

/* ─── Flash messages / Toasts ─────────────────────────────── */
.flash-container {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(500px, 92vw);
}
.flash {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 40px 12px 14px;
    font-size: 13px;
    position: relative;
    animation: flashIn .25s ease;
}
.flash-success { border-color: rgba(18, 199, 122, 0.4); background: rgba(18, 199, 122, 0.08); color: #d0f5e6; }
.flash-error { border-color: rgba(255, 90, 90, 0.4); background: rgba(255, 90, 90, 0.08); color: #ffd0d0; }
.flash-warning { border-color: rgba(255, 201, 71, 0.4); background: rgba(255, 201, 71, 0.08); color: #fff0c8; }
.flash-info { border-color: rgba(92, 155, 255, 0.4); background: rgba(92, 155, 255, 0.08); color: #d0e0ff; }

.flash-close {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    padding: 4px 8px;
}
.flash-close:hover { opacity: 1; }

@keyframes flashIn {
    from { opacity: 0; transform: translate(-50%, -8px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

/* ─── Landing (público) ───────────────────────────────────── */
.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
}

.hero {
    padding: 32px 20px 48px;
    max-width: 720px;
    margin: 0 auto;
}
.hero h1 {
    font-size: 40px;
    font-weight: 800;
    line-height: 1.05;
    margin: 0 0 20px;
    letter-spacing: -0.03em;
}
.hero .lede {
    font-size: 16px;
    color: var(--text-dim);
    line-height: 1.55;
    margin: 0 0 32px;
    max-width: 540px;
}
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (min-width: 768px) {
    .hero { padding: 60px 20px 80px; }
    .hero h1 { font-size: 56px; }
    .hero .lede { font-size: 17px; }
}

.stats-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: var(--border-soft);
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    max-width: 1160px;
    margin: 0 20px;
}
.stat-cell {
    background: var(--bg);
    padding: 18px 16px;
}
.stat-n { font-family: 'Bricolage Grotesque', serif; font-size: 22px; font-weight: 800; }
.stat-l { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; margin-top: 2px; }

@media (min-width: 768px) {
    .stats-strip { grid-template-columns: repeat(4, 1fr); margin: 0 auto; }
}

/* ─── Auth (login / cadastro / convite) ───────────────────── */
.auth-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}
.auth-box {
    width: 100%;
    max-width: 420px;
}
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}
.auth-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: rgba(255, 201, 71, 0.1);
    border: 1px solid rgba(255, 201, 71, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    color: var(--gold);
}
.auth-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 6px;
}
.auth-subtitle {
    font-size: 14px;
    color: var(--text-dim);
    margin: 0;
}

/* ─── Utility ─────────────────────────────────────────────── */
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }

.text-center { text-align: center; }
.text-right { text-align: right; }

.hidden { display: none; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0;
    margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}
