:root {
    --bg: #080a10;
    --bg-2: #0d1019;
    --panel: #131725;
    --panel-2: #1a2031;
    --panel-glass: rgba(19, 23, 37, 0.88);
    --line: rgba(230, 235, 255, 0.09);
    --line-strong: rgba(230, 235, 255, 0.15);
    --text: #f0f2f8;
    --muted: #939bad;
    --crimson: #ed4d53;
    --crimson-soft: rgba(229, 72, 77, 0.16);
    --gold: #f2c14e;
    --cyan: #3ec6e0;
    --green: #46c07a;
    --shadow: 0 22px 64px rgba(0, 0, 0, 0.5);
    --glow: 0 0 0 1px rgba(237, 77, 83, 0.12), 0 18px 55px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background:
        radial-gradient(circle at 74% -15%, rgba(57, 74, 126, 0.2), transparent 42%),
        radial-gradient(circle at 8% 90%, rgba(114, 31, 38, 0.12), transparent 36%),
        linear-gradient(145deg, var(--bg-2), var(--bg) 62%);
    color: var(--text);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
}

.app {
    position: fixed;
    inset: 0;
    width: min(1280px, calc(100vw - 40px));
    height: min(980px, calc(100vh - 40px));
    margin: auto;
    z-index: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(126, 164, 214, 0.14);
    border-radius: 20px;
    background: linear-gradient(160deg, rgba(13, 20, 33, 0.96), rgba(6, 11, 20, 0.98));
    box-shadow: 0 44px 120px rgba(0, 0, 0, 0.62), inset 0 1px rgba(255, 255, 255, 0.04);
}

@media (max-width: 760px) {
    .app {
        width: 100%;
        height: 100%;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
}

.app::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    background-image: radial-gradient(rgba(255, 255, 255, 0.22) 0.5px, transparent 0.5px);
    background-size: 5px 5px;
    mask-image: linear-gradient(to bottom, black, transparent 70%);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: max(10px, env(safe-area-inset-top)) 20px 10px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    background: rgba(8, 10, 16, 0.68);
    backdrop-filter: blur(18px);
    z-index: 3;
}

.brand { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; min-width: 0; }
.brand-mark { width: 17px; height: 17px; flex: 0 0 auto; filter: drop-shadow(0 0 12px rgba(237, 77, 83, 0.5)); }
.brand-name { font-weight: 800; letter-spacing: 0.18em; font-size: 15px; white-space: nowrap; }

.me { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; min-width: 0; }
.me-info { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; line-height: 1.15; }
.me-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; }
.me-sub { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.me-coins {
    flex: 0 0 auto;
    white-space: nowrap;
    font-weight: 700;
    font-size: 13px;
    color: var(--gold);
    background: rgba(242, 193, 78, 0.12);
    border: 1px solid rgba(242, 193, 78, 0.28);
    padding: 5px 10px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

.me-coins::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 5px;
    vertical-align: -2px;
    background: url('assets/icon-coin.svg') center / contain no-repeat;
}

.tabs {
    display: flex;
    gap: 6px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    overflow-x: auto;
    background: rgba(8, 10, 16, 0.5);
    backdrop-filter: blur(18px);
    z-index: 2;
    scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
    flex: 1;
    min-width: max-content;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.tab { position: relative; }
.tab.has-badge::after { content: ''; position: absolute; top: 5px; right: 6px; width: 8px; height: 8px; border: 2px solid #050b13; border-radius: 50%; background: #8a6cf0; box-shadow: 0 0 8px rgba(138, 108, 240, .6); }
.tab img { width: 17px; height: 17px; margin-right: 7px; vertical-align: -4px; opacity: 0.7; }
.tab.is-active img { opacity: 1; filter: drop-shadow(0 0 8px rgba(62, 198, 224, 0.24)); }

.tab.is-active {
    color: var(--text);
    background: linear-gradient(180deg, rgba(35, 43, 67, 0.96), rgba(26, 32, 49, 0.96));
    border-color: var(--line-strong);
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.035), 0 6px 20px rgba(0, 0, 0, 0.16);
}

.views { position: relative; flex: 1; overflow: hidden; }

.view {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px;
    display: none;
}

.view.is-active { display: block; }
#view-game.is-active { display: flex; }

.btn {
    appearance: none;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    padding: 11px 18px;
    border-radius: 12px;
    cursor: pointer;
    min-height: 42px;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.04);
    transition: transform 0.08s, background 0.15s, border-color 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.btn:hover:not(:disabled) { border-color: var(--line-strong); background: #222a40; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #f15a5f, #dc3f45); border-color: rgba(255, 118, 123, 0.5); color: #fff; box-shadow: 0 8px 24px rgba(229, 72, 77, 0.2), inset 0 1px rgba(255, 255, 255, 0.2); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #fa666b, #e4454b); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #1a1206; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

.boot {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background:
        radial-gradient(circle at 50% 40%, rgba(35, 43, 72, 0.92) 0%, rgba(11, 13, 21, 0.96) 48%, var(--bg) 78%),
        var(--bg);
    z-index: 20;
    text-align: center;
    padding: 24px;
    isolation: isolate;
}

.boot::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -2;
    background: linear-gradient(135deg,rgba(38,111,179,.2),transparent 40%),linear-gradient(315deg,rgba(126,82,190,.18),transparent 42%);
    opacity: 1;
}

.boot::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 50% 45%, rgba(9, 12, 20, 0.38), rgba(8, 10, 16, 0.9) 58%, var(--bg) 82%);
}

.boot[hidden] { display: none; }
.boot-mark { width: 52px; height: 52px; animation: throb 2.2s ease-in-out infinite; filter: drop-shadow(0 0 20px rgba(237, 77, 83, 0.5)); }
.boot-title { font-weight: 800; letter-spacing: 0.3em; font-size: 20px; }
.boot-status { color: var(--muted); font-size: 14px; margin-top: 4px; }
.boot-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; width: min(360px, 88vw); padding:18px; border:1px solid var(--line); border-radius:18px; background:rgba(6,17,29,.84); box-shadow:0 24px 64px rgba(0,0,0,.32); }
.boot-actions[hidden] { display:none; }
.auth-local { display:flex; flex-direction:column; gap:12px; }
.auth-local[hidden] { display:none; }
.auth-switch { display:grid; grid-template-columns:1fr 1fr; gap:5px; padding:4px; border:1px solid var(--line); border-radius:11px; background:rgba(4,12,21,.72); }
.auth-switch button { min-height:36px; border:0; border-radius:8px; background:transparent; color:var(--muted); font-size:12px; font-weight:750; cursor:pointer; }
.auth-switch button.is-active { background:rgba(50,109,168,.42); color:var(--text); box-shadow:inset 0 0 0 1px rgba(96,155,212,.36); }
.auth-form { display:grid; gap:10px; }
.auth-form[hidden] { display:none; }
.auth-form label { display:grid; gap:5px; text-align:left; }
.auth-form label > span { padding-left:2px; color:var(--muted); font-size:11px; font-weight:650; }
.auth-note { margin:0; color:var(--muted); font-size:10px; line-height:1.45; }
.boot-input {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font-size: 15px;
    text-align: left;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.boot-input:focus { border-color: rgba(62, 198, 224, 0.5); box-shadow: 0 0 0 3px rgba(62, 198, 224, 0.1); }
.account-exit { width:30px; height:30px; flex:0 0 auto; border:1px solid var(--line); border-radius:9px; background:rgba(8,18,31,.72); color:var(--muted); cursor:pointer; }
.account-exit:hover { border-color:var(--line-strong); color:var(--text); }
.account-exit[hidden] { display:none; }

@keyframes throb { 0%, 100% { opacity: 0.55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }

.timer {
    font-weight: 800;
    font-size: 20px;
    font-variant-numeric: tabular-nums;
    color: var(--cyan);
}

.chat {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    min-height: 200px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; max-height: 320px; }
.chat-line { font-size: 13px; line-height: 1.4; }
.chat-line .who { font-weight: 700; color: var(--cyan); }
.chat-line.system { color: var(--muted); font-style: italic; }
.chat-line.team .who { color: #9b82df; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.send-btn { display: grid; place-items: center; min-width: 42px; padding: 8px; }
.send-btn img { width: 18px; height: 18px; }
.chat-input {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.chat-input:focus { border-color: rgba(62, 198, 224, 0.45); box-shadow: 0 0 0 3px rgba(62, 198, 224, 0.08); }

.center-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 40px 20px;
    text-align: center;
}
.center-cta h2 { margin: 0; font-size: 22px; }
.center-cta p { margin: 0; color: var(--muted); max-width: 34ch; line-height: 1.5; }

.result {
    text-align: center;
    padding: 18px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--panel);
}
.result.logic { border-color: rgba(78,157,235,.48); }
.result.intuition { border-color: rgba(164,116,224,.48); }
.result.draw { border-color: rgba(226,187,91,.42); }
.core-question { max-width:270px; margin:8px auto; color:var(--text); font-size:15px; font-weight:780; line-height:1.35; }
.quiz-options { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-top:12px; }.quiz-option { min-height:44px; display:flex; align-items:center; gap:9px; padding:8px 11px; border:1px solid var(--line-strong); border-radius:10px; background:rgba(6,20,34,.76); color:var(--text); font:inherit; font-size:11px; text-align:left; cursor:pointer; }.quiz-option span { width:24px; height:24px; display:grid; place-items:center; flex:0 0 auto; border-radius:7px; background:rgba(67,137,202,.18); color:#76b9f3; font-weight:850; }.quiz-option:hover,.quiz-option.is-selected { border-color:#579ddd; background:rgba(38,92,141,.3); }

.mole-mask { width:34px; height:34px; display:grid; place-items:center; flex:0 0 auto; border-radius:50%; background:rgba(242,156,78,.16); color:#f5b568; font-size:18px; }

.quiz-option.is-correct { border-color:rgba(70,192,122,.7); background:rgba(24,66,44,.4); box-shadow:inset 2px 0 rgba(70,192,122,.8); }
.quiz-option.is-correct span { background:rgba(70,192,122,.2); color:#7fdca6; }
.option-correct { margin-left:auto; padding:2px 7px; border-radius:999px; background:rgba(70,192,122,.22); color:#7fdca6; font-size:8px; font-weight:800; font-style:normal; letter-spacing:.06em; text-transform:uppercase; }
.quiz-option.is-yours { border-color:rgba(120,140,170,.55); }
.option-yours { margin-left:auto; padding:2px 7px; border-radius:999px; background:rgba(120,140,170,.2); color:#aebccf; font-size:8px; font-weight:800; font-style:normal; letter-spacing:.06em; text-transform:uppercase; }

.moles-reveal { display:grid; gap:6px; margin:14px 0 10px; text-align:left; }
.moles-reveal .section-kicker { color:var(--muted); font-size:9px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; }
.mole-reveal-row { display:grid; grid-template-columns:auto 1fr auto; grid-template-rows:auto auto; align-items:center; column-gap:9px; padding:8px 11px; border:1px solid rgba(242,156,78,.28); border-radius:10px; background:rgba(30,20,10,.5); }
.mole-reveal-row.is-exposed { border-color:rgba(120,132,148,.3); background:rgba(18,24,34,.55); }
.mole-reveal-row .mole-mask { grid-column:1; grid-row:1/3; width:26px; height:26px; font-size:14px; }
.mole-reveal-row b { grid-column:2; grid-row:1; font-size:12px; }
.mole-reveal-row small { grid-column:2; grid-row:2; color:var(--muted); font-size:8px; }
.mole-reveal-score { grid-column:3; grid-row:1/3; font-size:16px; font-weight:800; color:#f5b568; font-variant-numeric:tabular-nums; }
.result h2 { margin: 0 0 6px; }

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.14), inset 0 1px rgba(255, 255, 255, 0.02);
}
.card h3 { margin: 0 0 12px; font-size: 15px; }
.club-mark { display: inline-block; width: 19px; height: 19px; margin-right: 7px; vertical-align: -5px; background: url('assets/icon-club.svg') center / contain no-repeat; color: var(--cyan); }
.club-mark.small { width: 15px; height: 15px; margin-right: 5px; vertical-align: -3px; }
.coin-inline { display: inline-block; width: 14px; height: 14px; margin: 0 4px 0 2px; vertical-align: -2px; background: url('assets/icon-coin.svg') center / contain no-repeat; }
.trophy-inline { display: inline-block; width: 16px; height: 16px; margin-right: 5px; vertical-align: -3px; background: url('assets/icon-tournament.svg') center / contain no-repeat; }

.profile-hero { display: flex; align-items: center; gap: 16px; padding: 18px; margin-bottom: 14px; border: 1px solid var(--line-strong); border-radius: 18px; background: linear-gradient(110deg, rgba(31, 39, 62, .96), rgba(17, 21, 34, .96)); box-shadow: var(--shadow); }
.profile-avatar { width: 76px; height: 76px; flex: 0 0 auto; border-radius: 50%; overflow: hidden; border: 2px solid var(--cyan); box-shadow: 0 0 0 4px rgba(62, 198, 224, .1); }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-main { flex: 1; min-width: 0; }
.profile-main h2 { margin: 2px 0 3px; font-size: 23px; }
.profile-kicker { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.profile-meta { color: var(--muted); font-size: 13px; }
.profile-balance { color: var(--gold); font-size: 18px; font-weight: 800; white-space: nowrap; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.stat-tile { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 3px; }
.stat-tile span { color: var(--muted); font-size: 11px; }
.stat-tile b { font-size: 18px; font-variant-numeric: tabular-nums; }
.social-card { padding: 18px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title > img { width: 28px; height: 28px; }
.section-title h3 { margin: 0; }
.section-title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.social-picker { display: flex; align-items: center; gap: 10px; }
.social-picker label { color: var(--muted); font-size: 12px; }
.social-picker select { min-width: 0; flex: 1; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; outline: none; }
.social-picker select:focus { border-color: rgba(62, 198, 224, .5); }
.gift-target { margin-bottom: 12px; }
.gift-target label { flex: 0 0 auto; }
.union-card { display: flex; align-items: center; gap: 13px; padding: 13px; border-radius: 13px; background: rgba(237, 110, 134, .08); border: 1px solid rgba(237, 110, 134, .2); }
.union-card > img { width: 42px; height: 42px; }
.union-card > div { flex: 1; }
.union-card strong { font-size: 17px; }
.union-card p, .proposal { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.proposal { padding: 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); }
.proposal.waiting { color: var(--text); }
.action-row { display: flex; gap: 8px; margin-top: 10px; }
.empty.compact { padding: 12px 6px; }

.gift-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.gift-item { appearance: none; min-width: 0; padding: 12px 8px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(160deg, var(--panel-2), var(--panel)); color: var(--text); text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: transform .12s, border-color .15s, opacity .15s; }
.gift-item:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(242, 193, 78, .38); }
.gift-item:disabled { opacity: .4; cursor: default; }
.gift-name { font-size: 12px; font-weight: 800; }
.gift-desc { min-height: 28px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.gift-price { color: var(--gold); font-size: 12px; font-weight: 800; }
.achievement-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.achievement { display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.achievement.locked { opacity: .48; filter: grayscale(.8); }
.achievement.unlocked { border-color: rgba(242, 193, 78, .22); background: linear-gradient(120deg, rgba(242,193,78,.08), var(--panel)); }
.achievement.epic.unlocked { border-color: rgba(174, 108, 255, .3); }
.achievement.legendary.unlocked { border-color: rgba(242, 193, 78, .45); box-shadow: inset 0 0 24px rgba(242,193,78,.05); }
.achievement-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); }
.achievement-mark img { width: 31px; height: 31px; }
.achievement b { font-size: 13px; }
.achievement p { margin: 2px 0 3px; color: var(--muted); font-size: 11px; }
.achievement-reward { color: var(--gold); font-size: 10px; font-weight: 700; }
.gift-history { display: flex; flex-direction: column; gap: 3px; }
.gift-event { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.gift-event:nth-child(odd) { background: rgba(255,255,255,.018); }
.gift-event > div { flex: 1; }
.gift-event b { font-size: 12px; }
.gift-event p { margin: 1px 0 0; color: var(--muted); font-size: 11px; }
.gift-event time { color: var(--muted); font-size: 10px; }
.card-sub { color: var(--muted); font-size: 13px; margin: -6px 0 12px; }

.list { display: flex; flex-direction: column; gap: 2px; }
.lrow {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px;
    border-radius: 10px;
    font-size: 14px;
}
.lrow.me { background: rgba(62, 198, 224, 0.12); }
.lrow .rk { width: 30px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.lrow.top1 .rk { color: var(--gold); }
.lrow.top2 .rk { color: #cdd8e6; }
.lrow.top3 .rk { color: #d9a066; }
.lrow .nm { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .nm .tagchip { color: var(--muted); font-weight: 700; font-size: 12px; margin-right: 6px; }
.lrow .val { font-weight: 800; color: var(--cyan); font-variant-numeric: tabular-nums; }
.lrow .val.gold { color: var(--gold); }

.subtabs { display: flex; gap: 6px; margin-bottom: 12px; }
.subtab {
    flex: 1;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--panel);
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}
.subtab.is-active { color: var(--text); background: var(--panel-2); border-color: var(--line); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field textarea {
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}

.field input:focus, .field textarea:focus { border-color: rgba(62, 198, 224, 0.45); box-shadow: 0 0 0 3px rgba(62, 198, 224, 0.08); }
.row-inline { display: flex; gap: 10px; }
.row-inline .field { flex: 1; }

.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 14px; line-height: 1.5; }
.toast {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    background: var(--panel-2);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: var(--shadow);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.profile-hero {
    position: relative;
    display: block;
    padding: 0 22px 18px;
    overflow: hidden;
    border-radius: 20px;
    background: linear-gradient(145deg, rgba(28, 34, 52, .98), rgba(12, 15, 24, .98));
}
.profile-cover {
    height: 112px;
    margin: 0 -22px;
    background:
        linear-gradient(90deg, rgba(8, 10, 16, .18), rgba(8, 10, 16, .76)),
        linear-gradient(120deg,rgba(31,96,154,.28),rgba(90,61,145,.2));
    opacity: .82;
}
.profile-identity { display: flex; align-items: flex-end; gap: 16px; margin-top: -38px; position: relative; }
.profile-back { position: absolute; top: 12px; left: 14px; z-index: 3; min-height: 34px; padding: 6px 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; background: rgba(6,8,13,.72); backdrop-filter: blur(10px); color: white; font: inherit; font-size: 11px; font-weight: 750; cursor: pointer; }
.profile-avatar-wrap { position: relative; flex: 0 0 auto; }
.profile-avatar { width: 92px; height: 92px; border: 3px solid #111522; box-shadow: 0 0 0 2px var(--cyan), 0 14px 34px rgba(0,0,0,.42); position: relative; overflow: visible; }
.profile-avatar img { border-radius: 50%; }
.level-badge { position: absolute; right: -6px; bottom: -5px; min-width: 28px; height: 28px; padding: 0 6px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, #f1c45b, #bd7d22); color: #211404; border: 2px solid #111522; font-size: 12px; font-weight: 900; }
.avatar-stickers { position: absolute; z-index: 2; left: -12px; bottom: -12px; display: flex; align-items: flex-end; pointer-events: none; }
.avatar-stickers img { width: 56px; height: 56px; margin-left: -24px; object-fit: contain; filter: drop-shadow(0 7px 7px rgba(0,0,0,.56)); transform: translateY(calc(var(--n) * 4px)) rotate(calc((var(--n) - 1) * 8deg)); }
.avatar-stickers img:first-child { margin-left: 0; }
.profile-avatar-actions { position: absolute; z-index: 5; left: 50%; bottom: -28px; display: flex; align-items: center; gap: 5px; transform: translateX(-50%); }
.profile-avatar-actions button,.avatar-upload { min-height: 24px; display: inline-flex; align-items: center; justify-content: center; padding: 4px 8px; border: 1px solid rgba(88,157,220,.4); border-radius: 999px; background: rgba(5,16,28,.94); color: #dcebf7; font: inherit; font-size: 8px; font-weight: 750; white-space: nowrap; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.avatar-upload:hover,.profile-avatar-actions button:hover { border-color: rgba(88,157,220,.75); background: #10253a; }
.avatar-upload input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.profile-avatar-actions button:disabled { opacity: .45; cursor: wait; }
.profile-main { padding-bottom: 5px; }
.profile-main h2 { margin: 3px 0 7px; font-size: 26px; line-height: 1.05; }
.identity-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.identity-chip { padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: rgba(7,9,15,.58); color: #c5cbd8; font-size: 11px; font-weight: 700; }
.identity-chip.rating { color: var(--gold); }
.identity-chip.married { color: #ff9db0; border-color: rgba(255,117,148,.25); }
.profile-balance { align-self: center; margin-left: auto; padding: 9px 12px; border: 1px solid rgba(242,193,78,.22); border-radius: 13px; background: rgba(8,10,16,.66); }
.profile-balance small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 600; text-align: right; }
.level-progress { margin-top: 16px; }
.profile-identity:has(.profile-avatar-actions) + .level-progress { margin-top: 38px; }
.level-progress > div { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.level-progress i { display: block; height: 5px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.07); }
.level-progress b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), #78e7dd); box-shadow: 0 0 14px rgba(62,198,224,.35); }
.profile-highlights { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.profile-highlights span { padding: 9px; text-align: center; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 10px; }
.profile-highlights b { display: block; margin-bottom: 2px; color: var(--text); font-size: 15px; }

.profile-tabs { position: sticky; top: -1px; z-index: 4; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(10,13,21,.9); backdrop-filter: blur(16px); }
.profile-tab { min-height: 42px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 750; cursor: pointer; }
.profile-tab span { margin-right: 6px; color: var(--gold); }
.profile-tab.is-active { color: var(--text); border-color: var(--line-strong); background: linear-gradient(180deg, var(--panel-2), var(--panel)); box-shadow: 0 7px 18px rgba(0,0,0,.18); }
.stat-tile { min-height: 70px; justify-content: center; }

.relationship-card { overflow: hidden; }
.married-union { position: relative; padding: 18px; background: radial-gradient(circle at 15% 20%, rgba(239,77,101,.18), transparent 38%), linear-gradient(120deg, rgba(104,25,43,.28), rgba(28,22,40,.84)); border-color: rgba(255,117,148,.28); }
.couple-portraits { display: flex; align-items: center; flex: 0 0 auto; }
.couple-portraits span { width: 54px; height: 54px; overflow: hidden; border: 2px solid #d79a45; border-radius: 50%; box-shadow: 0 7px 18px rgba(0,0,0,.32); }
.couple-portraits span + span { margin-left: -9px; }
.couple-portraits img { width: 100%; height: 100%; object-fit: cover; }
.couple-portraits i { z-index: 1; display: grid; place-items: center; width: 25px; height: 25px; margin: 0 -7px; border-radius: 50%; background: #b72e4b; color: white; font-style: normal; font-size: 11px; }
.union-copy { flex: 1; min-width: 0; }
.danger-text { color: #d98b98; }
.proposal-card, .proposal-empty { display: grid; grid-template-columns: 150px minmax(0,1fr); align-items: center; gap: 18px; padding: 14px; border: 1px solid rgba(242,193,78,.18); border-radius: 15px; background: linear-gradient(115deg, rgba(242,193,78,.07), rgba(255,255,255,.018)); }
.proposal-card > img, .proposal-empty > img { width: 150px; aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 12px 18px rgba(0,0,0,.4)); }
.proposal-card h4, .proposal-empty h4 { margin: 4px 0; font-size: 20px; }
.proposal-card p, .proposal-empty p { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.proposal-card.waiting { opacity: .82; }
.wedding-btn { box-shadow: 0 10px 30px rgba(225,59,76,.28); }

.gift-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.gift-item { padding: 0; overflow: hidden; align-items: stretch; gap: 0; text-align: left; border-radius: 15px; }
.gift-visual { position: relative; display: block; aspect-ratio: 1.18 / 1; overflow: hidden; background: radial-gradient(circle at 50% 48%, rgba(242,193,78,.12), transparent 58%), linear-gradient(155deg, #20263a, #10131e); }
.gift-visual::after { content: ''; position: absolute; inset: 62% 0 0; background: linear-gradient(transparent, rgba(7,8,12,.62)); }
.gift-visual img { width: 100%; height: 100%; display: block; object-fit: contain; padding: 8px; transition: transform .25s ease; filter: drop-shadow(0 10px 9px rgba(0,0,0,.42)); }
.gift-item:hover:not(:disabled) .gift-visual img { transform: scale(1.035); }
.gift-price { position: absolute; z-index: 1; right: 8px; bottom: 8px; padding: 5px 8px; border: 1px solid rgba(242,193,78,.24); border-radius: 999px; background: rgba(8,9,13,.84); backdrop-filter: blur(8px); }
.gift-info { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.gift-name { font-size: 13px; }
.gift-desc { min-height: 0; font-size: 11px; }
.gift-item:disabled { opacity: .5; }
.gift-shelf { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.shelf-gift { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-2); }
.shelf-gift > img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; padding: 5px; background: radial-gradient(circle, rgba(242,193,78,.1), transparent 65%); }
.shelf-gift > div { padding: 8px; }
.shelf-gift b, .shelf-gift span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-gift b { font-size: 11px; }
.shelf-gift span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.gift-thumb { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 9px; object-fit: contain; }
.player-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
.player-card { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--text); text-align: left; cursor: pointer; }
.player-card:hover { border-color: rgba(62,198,224,.32); }
.player-avatar { width: 42px; height: 42px; flex: 0 0 auto; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 50%; }
.player-avatar img { width: 100%; height: 100%; object-fit: cover; }
.player-card > span:nth-child(2) { min-width: 0; flex: 1; }
.player-card b, .player-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-card b { font-size: 12px; }
.player-card small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.player-card i { color: var(--cyan); font-size: 20px; font-style: normal; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(3,4,7,.8); backdrop-filter: blur(12px); animation: fade-in .18s ease-out; }
.modal-panel { width: min(430px, 100%); max-height: min(720px, 92vh); overflow: auto; border: 1px solid var(--line-strong); border-radius: 22px; background: linear-gradient(150deg, #1a2031, #0e111b 72%); box-shadow: 0 34px 100px rgba(0,0,0,.68); }
.confirm-modal { padding: 22px; text-align: center; }
.confirm-art { width: min(220px, 68vw); aspect-ratio: 1; margin-bottom: 16px; object-fit: cover; border-radius: 16px; box-shadow: 0 16px 40px rgba(0,0,0,.42); }
.confirm-modal h2 { margin: 5px 0 7px; font-size: 22px; }
.confirm-modal > p { margin: 0; color: var(--muted); line-height: 1.5; }
.modal-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 9px; margin-top: 20px; }
.btn.danger { background: rgba(220,63,69,.15); border-color: rgba(237,77,83,.38); color: #ff9da1; }
.ceremonial { background: radial-gradient(circle at 50% 42%, rgba(125,28,48,.6), rgba(3,4,7,.94) 68%); }
.ceremonial .modal-panel { overflow: hidden; border-color: rgba(242,193,78,.42); background: radial-gradient(circle at 50% 22%, rgba(117,29,47,.34), transparent 44%), linear-gradient(155deg, #211722, #0b0d14 68%); }
.wedding-modal { position: relative; overflow: hidden; padding: 28px; text-align: center; isolation: isolate; }
.wedding-modal::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(circle at 50% 20%,rgba(104,78,174,.3),transparent 55%); opacity: .55; }
.wedding-kicker { color: var(--gold); font-size: 11px; font-weight: 900; letter-spacing: .22em; text-transform: uppercase; }
.wedding-ring { width: min(260px, 72vw); aspect-ratio: 1; margin: 14px 0 8px; object-fit: contain; filter: drop-shadow(0 18px 20px rgba(0,0,0,.55)); }
.wedding-names { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 17px; font-weight: 850; }
.wedding-names span { max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wedding-names b { color: #ff6d8c; }
.wedding-modal h2 { margin: 9px 0 6px; font-family: Georgia, serif; font-size: 27px; color: #f6d88a; }
.wedding-modal p { margin: 0 auto 18px; max-width: 34ch; color: #b8b0bd; font-size: 13px; line-height: 1.55; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { --x: calc((var(--i) * 37) % 100); position: absolute; top: -12px; left: calc(var(--x) * 1%); width: 6px; height: 11px; border-radius: 2px; background: hsl(calc(340 + var(--i) * 7), 78%, 62%); transform: rotate(calc(var(--i) * 21deg)); animation: confetti-fall calc(2.4s + (var(--i) % 5) * .25s) ease-in infinite; animation-delay: calc((var(--i) % 7) * -.33s); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes confetti-fall { to { transform: translateY(620px) rotate(540deg); opacity: .1; } }

.pill { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.pill.live { background: rgba(70, 192, 122, 0.16); color: var(--green); }
.pill.upcoming { background: rgba(138, 147, 168, 0.16); color: var(--muted); }
.pill.finished { background: rgba(242, 193, 78, 0.16); color: var(--gold); }

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

@media (min-width: 860px) {
    .tabs { padding-left: max(14px, calc((100vw - 900px) / 2)); padding-right: max(14px, calc((100vw - 900px) / 2)); }
    .view:not(#view-game) { padding-left: max(18px, calc((100vw - 760px) / 2)); padding-right: max(18px, calc((100vw - 760px) / 2)); }
    #view-profile { padding-left: max(18px, calc((100vw - 980px) / 2)); padding-right: max(18px, calc((100vw - 980px) / 2)); }
}

@media (max-width: 859px) {
    .view { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); }
    .chat-log { max-height: 260px; }
}

@media (max-width: 760px) {
    .topbar { flex-wrap:wrap; gap:7px 10px; padding:max(8px,env(safe-area-inset-top)) 12px 7px; }
    .brand { flex:0 0 auto; }
    .me { min-width:0; margin-left:auto; gap:7px; }
    .topbar-online { display:none; }
    .me-avatar { width:34px; height:34px; }
    .me-info { min-width:0; align-items:flex-start; }
    .me-name { max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; }
    .me-sub { max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:8px; }
    .me-coins { padding:5px 8px; font-size:10px; }
    .me-coins::before { width:12px; height:12px; margin-right:4px; }
    .account-exit { width:34px; height:34px; }
    .tabs { order:3; width:100%; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:3px; padding:3px; border:1px solid rgba(145,171,194,.1); border-radius:11px; background:rgba(5,14,23,.66); }
    .tab { min-width:0; min-height:42px; display:flex; align-items:center; justify-content:center; padding:6px 4px; border-radius:8px; font-size:10px; }
    .tab img { width:18px; height:18px; margin-right:5px; }
    .view { padding:10px 9px calc(14px + env(safe-area-inset-bottom)); }
}

@media (max-width: 480px) {
    .topbar { min-height: 51px; padding: max(8px, env(safe-area-inset-top)) 14px 8px; }
    .brand { gap: 6px; }
    .brand-mark { font-size: 13px; }
    .brand-name { font-size: 13px; letter-spacing: 0.14em; }
    .me { gap: 5px; }
    .me-info { display:none; }
    .me-coins { font-size: 11px; padding: 4px 7px; }
    .tabs { gap:3px; padding:3px; }
    .tab { min-width:0; min-height:40px; padding:7px 5px; border-radius:8px; font-size:12px; }
    .tab span { display: none; }
    .tab img { width: 19px; height: 19px; margin-right: 0; }
    .view { padding:8px 7px calc(14px + env(safe-area-inset-bottom)); }
    .timer { font-size: 18px; }
    .chat { min-height: 180px; }
    .chat-log { max-height: 230px; }
    .card { padding: 14px; }
    .lrow { gap: 8px; padding: 9px 6px; }
    .lrow .rk { width: 24px; }
    .row-inline { flex-direction: column; gap: 0; }
    .row-inline .field { max-width: none !important; }
    .profile-hero { padding: 13px; gap: 11px; }
    .profile-avatar { width: 60px; height: 60px; }
    .profile-main h2 { font-size: 19px; }
    .profile-balance { font-size: 15px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .social-card { padding: 14px; }
    .social-picker { align-items: stretch; flex-direction: column; }
    .social-picker label { margin-bottom: -4px; }
    .union-card { align-items: flex-start; flex-wrap: wrap; }
    .union-card .btn { width: 100%; }
    .gift-grid { grid-template-columns: repeat(2, 1fr); }
    .gift-item:last-child { grid-column: 1 / -1; }
    .achievement-grid { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
    .brand-name { letter-spacing: 0.08em; }
    .me-info { display: none; }
    .tab { font-size: 11px; }
    .tab span { display: none; }
    .tab img { width: 19px; height: 19px; margin-right: 0; }
    .view { padding-left: 10px; padding-right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .boot-mark { animation: none; }
    .confetti i { animation: none; display: none; }
}

@media (max-width: 760px) {
    .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
    .tab.has-badge::after { top: 4px; right: calc(50% - 17px); }
}

@media (max-width: 680px) {
    .profile-hero { padding: 0 14px 14px; }
    .profile-cover { height: 92px; margin: 0 -14px; }
    .profile-identity { margin-top: -32px; gap: 11px; align-items: center; }
    .profile-avatar { width: 72px; height: 72px; flex: 0 0 72px; }
    .avatar-stickers { bottom: -10px; left: -8px; }
    .avatar-stickers img { width: 46px; height: 46px; margin-left: -20px; }
    .profile-main { padding: 24px 0 0; }
    .profile-main h2 { font-size: 20px; }
    .profile-balance { margin-top: 24px; padding: 7px 9px; font-size: 14px; }
    .profile-highlights { grid-template-columns: repeat(2, 1fr); }
    .profile-tab { min-height: 40px; font-size: 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .proposal-card, .proposal-empty { grid-template-columns: 94px minmax(0,1fr); gap: 12px; padding: 11px; }
    .proposal-card > img, .proposal-empty > img { width: 94px; }
    .proposal-card h4, .proposal-empty h4 { font-size: 16px; }
    .proposal-empty .social-picker { grid-column: 1 / -1; }
    .married-union { align-items: center; }
    .couple-portraits span { width: 46px; height: 46px; }
    .union-copy { flex-basis: calc(100% - 105px); }
    .gift-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
    .gift-item:last-child { grid-column: auto; }
    .gift-visual { aspect-ratio: 1; }
    .gift-shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 390px) {
    .profile-main h2 { font-size: 18px; }
    .identity-chip { font-size: 9px; padding: 3px 6px; }
    .profile-balance small { display: none; }
    .profile-tabs { gap: 3px; padding: 6px; }
    .profile-tab span { margin-right: 3px; }
    .proposal-card, .proposal-empty { grid-template-columns: 76px minmax(0,1fr); }
    .proposal-card > img, .proposal-empty > img { width: 76px; }
    .action-row { flex-direction: column; }
    .action-row .btn { width: 100%; }
    .gift-info { padding: 8px 9px 10px; }
    .gift-name { font-size: 11px; }
    .gift-desc { font-size: 9px; }
}
