* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    line-height: 1.5;
    font-size: 16px;
}
.wrap {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px 12px 60px;
}
header {
    text-align: center;
    margin-bottom: 20px;
}
header h1 {
    font-size: 1.45rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 14px;
}
.game-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.game-row label {
    font-size: 0.9rem;
    color: #94a3b8;
}
.game-row select {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 1rem;
    min-width: 160px;
    min-height: 44px;
}
.panel {
    background: #1e293b;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.35);
}
.panel.hidden {
    display: none;
}
.balance-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 18px;
    color: white;
}
.balance-card .label {
    font-size: 0.8rem;
    opacity: 0.9;
    display: block;
    margin-bottom: 2px;
}
.balance-card .value {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover,
.btn-icon:active {
    background: rgba(255,255,255,0.35);
}
.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 18px;
    background: #0f172a;
    padding: 4px;
    border-radius: 12px;
}
.tab {
    flex: 1 1 22%;
    min-width: 70px;
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 12px 6px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 44px;
    text-align: center;
}
.tab.active {
    background: #334155;
    color: #f8fafc;
}
.tab:hover:not(.active),
.tab:active:not(.active) {
    color: #e2e8f0;
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}
.info {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: #0f172a;
    border-radius: 10px;
    line-height: 1.45;
}
.info small {
    display: block;
    margin-top: 4px;
    opacity: 0.85;
}
.field {
    margin-bottom: 16px;
}
.field label {
    display: block;
    font-size: 0.88rem;
    color: #94a3b8;
    margin-bottom: 7px;
    font-weight: 500;
}
.req {
    color: #f87171;
}
.field input {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 13px 14px;
    color: #f1f5f9;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    min-height: 48px;
}
.field input:focus {
    border-color: #38bdf8;
}
.field input[readonly] {
    opacity: 0.75;
    cursor: default;
}
.row {
    display: flex;
    gap: 8px;
}
.row input {
    flex: 1;
    min-width: 0;
}
.btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 15px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, opacity 0.15s;
    margin-top: 6px;
    min-height: 52px;
}
.btn:active {
    transform: scale(0.97);
}
.btn.primary {
    background: #0ea5e9;
    color: white;
}
.btn.primary:hover,
.btn.primary:active {
    background: #0284c7;
}
.btn.danger {
    background: #ef4444;
    color: white;
}
.btn.danger:hover,
.btn.danger:active {
    background: #dc2626;
}
.btn.success {
    background: #22c55e;
    color: white;
}
.btn.success:hover,
.btn.success:active {
    background: #16a34a;
}
.btn-sm {
    background: #334155;
    color: #e2e8f0;
    border: none;
    border-radius: 10px;
    padding: 0 16px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-height: 48px;
    min-width: 80px;
}
.btn-sm:hover,
.btn-sm:active {
    background: #475569;
}
.msg {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.92rem;
    display: none;
    line-height: 1.4;
}
.msg.ok {
    display: block;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}
.msg.err {
    display: block;
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.hint {
    font-size: 0.82rem;
    margin-top: 7px;
    min-height: 1.3em;
    line-height: 1.35;
}
.hint.ok {
    color: #4ade80;
}
.hint.err {
    color: #f87171;
}
.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.logout-btn {
    display: inline-block;
    background: #334155;
    color: #f87171;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 40px;
    line-height: 24px;
}
.logout-btn:hover,
.logout-btn:active {
    background: #475569;
    color: #fca5a5;
}
.login-form {
    max-width: 320px;
    margin: 0 auto;
}
@media (max-width: 420px) {
    .wrap {
        padding: 12px 10px 50px;
    }
    header h1 {
        font-size: 1.3rem;
    }
    .balance-card {
        padding: 14px 14px;
    }
    .balance-card .value {
        font-size: 1.35rem;
    }
    .tab {
        font-size: 0.82rem;
        padding: 11px 6px;
        min-width: 68px;
    }
    .btn {
        font-size: 1rem;
        padding: 14px;
    }
}
@supports (padding: max(0px)) {
    .wrap {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
        padding-bottom: max(50px, env(safe-area-inset-bottom));
    }
}
