:root {
    --bg: #0a0a0a;
    --bg2: #121212;
    --bg3: #1a1a1a;
    --text: #f0f0f0;
    --muted: #888;
    --accent: #ff9000;
    --accent2: #ff5500;
    --danger: #e53935;
    --success: #43a047;
    --border: #2a2a2a;
    --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    padding-bottom: 72px;
    -webkit-font-smoothing: antialiased;
}

/* ===== GATE ===== */
.gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: radial-gradient(ellipse at top, #1a0a00 0%, #0a0a0a 60%);
}
.gate-inner {
    width: 100%;
    max-width: 340px;
    text-align: center;
}
.gate-logo { font-size: 4rem; margin-bottom: 12px; }
.gate h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: 1px; }
.agree-box {
    text-align: left;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.agree-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    cursor: pointer;
}
.agree-item:last-child { margin-bottom: 0; }
.agree-item a { color: var(--accent); }
.auth-code {
    font-family: monospace;
    font-size: 1.4rem;
    letter-spacing: 3px;
    color: var(--accent);
    margin: 12px 0;
}

/* ===== HEADER ===== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}
.avatar-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}
.hearts-balance {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    color: var(--accent);
    cursor: pointer;
}
.heart-icon {
    display: inline-block;
    transition: transform 0.4s ease;
}
.heart-icon.flip {
    transform: rotateY(180deg);
}

/* ===== SCREENS ===== */
.screen { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.section-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 10px;
}

/* ===== SERVERS ===== */
.server-list { display: flex; flex-direction: column; gap: 8px; }
.server-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.server-card:hover, .server-card.mine {
    border-color: var(--accent);
    background: #1a1208;
}
.server-card .icon { font-size: 1.6rem; }
.server-card .info { flex: 1; min-width: 0; }
.server-card .name { font-weight: 600; }
.server-card .game { font-size: 0.8rem; color: var(--muted); }
.status-dot {
    width: 8px; height: 8px; border-radius: 50%;
}
.status-dot.online { background: var(--success); }
.status-dot.offline { background: var(--muted); }
.status-dot.maintenance { background: var(--danger); }

/* ===== HISTORY ===== */
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg2);
    border-radius: 8px;
    font-size: 0.9rem;
}
.history-item .plus { color: var(--success); }
.history-item .minus { color: var(--danger); }
.history-item .meta { font-size: 0.75rem; color: var(--muted); }

/* ===== PACKAGES ===== */
.pkg-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s;
}
.pkg-card:hover { border-color: var(--accent); }
.pkg-card .price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent);
}
.pkg-card .old-price {
    text-decoration: line-through;
    color: var(--muted);
    font-size: 0.9rem;
}
.pkg-card .stars {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 4px;
}

/* ===== BOTTOM NAV ===== */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 50;
    display: flex;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    padding: 6px 0 env(safe-area-inset-bottom);
}
.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 0.7rem;
    padding: 6px 0;
    cursor: pointer;
}
.nav-btn i { font-size: 1.2rem; }
.nav-btn.active { color: var(--accent); }

/* ===== BTN OVERRIDES ===== */
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    border: none;
    font-weight: 600;
}
.btn-primary:disabled {
    opacity: 0.4;
    background: #444;
}
.btn-outline-danger {
    border-color: var(--danger);
    color: var(--danger);
}
.btn-outline-danger:hover {
    background: var(--danger);
    color: #fff;
}

/* ===== MISC ===== */
.card { background: var(--bg2); }
.text-muted { color: var(--muted) !important; }
.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}
.modal-content { border: 1px solid var(--border); }
.modal-body h3 { font-size: 1rem; margin-top: 1rem; color: var(--accent); }
.modal-body ul { padding-left: 1.2rem; }
.modal-body a { color: var(--accent); }

/* Gate subtitle */
.gate-subtitle {
    font-size: 0.85rem;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin-top: -4px;
    margin-bottom: 8px;
}

/* Login label */
.login-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--muted);
    line-height: 1;
}
.login-value {
    font-size: 1.05rem;
    letter-spacing: 0.3px;
}

/* Header balance + topup */
.header-balance-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}
.hearts-balance-lg {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
}
.heart-icon-lg {
    font-size: 1.8rem;
    display: inline-block;
    transition: transform 0.5s ease;
    line-height: 1;
}
.heart-icon-lg.flip {
    transform: rotateY(360deg);
}

/* Steam-like discount badge */
.discount-badge {
    display: inline-block;
    background: #4c6b22;
    color: #beee11;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 3px;
    margin-bottom: 4px;
}
.pkg-card {
    position: relative;
}
.pkg-card .discount-badge {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* Disabled bot link */
a.disabled {
    pointer-events: none;
    opacity: 0.4;
}


/* Profile contrast */
#screen-profile .card-body,
#screen-profile .card-body * {
    color: #f0f0f0;
}
#screen-profile .text-muted,
#screen-profile .small {
    color: #aaa !important;
}
#screen-profile .login-label {
    color: #888 !important;
}
#screen-profile .login-value {
    color: #fff !important;
}

/* Single topup button */
.btn-topup-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff9000, #ff5500);
    border: none;
    color: #fff !important;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
}
.btn-topup-main .heart-spin {
    font-size: 1.35rem;
    display: inline-block;
    transition: transform 0.5s ease;
}
.btn-topup-main:hover .heart-spin {
    transform: rotateY(360deg);
}

/* History framed */
.history-frame {
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    overflow: hidden;
    background: #121212;
}
.history-frame .history-item {
    border-radius: 0;
    border-bottom: 1px solid #1f1f1f;
    margin: 0;
}
.history-frame .history-item.row-plus {
    background: rgba(67, 160, 71, 0.12);
}
.history-frame .history-item.row-minus {
    background: rgba(229, 57, 53, 0.12);
}

/* History separators more visible */
.history-frame .history-item {
    border-bottom: 1px solid #3a3a3a !important;
    padding: 12px 14px;
}
.history-frame .history-item:last-child {
    border-bottom: none !important;
}
.hist-op-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #ff9000;
    margin-bottom: 2px;
}

/* Steam button hover contrast */
#btn-steam.btn-outline-light {
    color: #f0f0f0;
    border-color: #888;
}
#btn-steam.btn-outline-light:hover,
#btn-steam.btn-outline-light:focus {
    background: #ff9000 !important;
    border-color: #ff9000 !important;
    color: #0a0a0a !important;
}

#heart-packages .pkg-card {
    min-height: 150px;
    height: 100%;
}
#heart-packages .col-6, #heart-packages .col-md-4 {
    margin-bottom: 0.5rem;
}

.pkg-card .price-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.pkg-card .old-price-diag {
    position: relative;
    color: #888;
    font-size: 0.9rem;
    display: inline-block;
}
.pkg-card .old-price-diag::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    background: #e53935;
    transform: rotate(-12deg);
    transform-origin: center;
}
.pkg-card .new-price {
    color: #ffb300;
    font-weight: 700;
    font-size: 1.05rem;
}
.overview-growth {
    color: #e0e0e0 !important;
}
.overview-growth b {
    color: #ff9000 !important;
}

/* Modal form system */
.tudn-modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75);
    z-index: 2000; display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.tudn-modal {
    background: #121212; border: 1px solid #333; border-radius: 12px;
    max-width: 480px; width: 100%; max-height: 90vh; overflow: auto;
    padding: 16px; color: #f0f0f0;
}
.tudn-modal h5 { color: #ff9000; }
.tudn-modal label { color: #aaa; font-size: 0.8rem; margin-top: 8px; display: block; }
.tudn-modal .form-control, .tudn-modal .form-select {
    background: #0a0a0a; color: #f0f0f0; border-color: #333;
}
.tudn-modal .modal-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

.btn-topup-main { font-size: 0.8rem !important; padding: 4px 10px !important; }
.profile-header .btn-topup-main { max-width: 48%; }
#app-footer a { color: #64b5f6; text-decoration: none; font-size: 0.85rem; }
.world-address { color: #ffb300; font-size: 0.9rem; margin-bottom: 10px; word-break: break-all; }
