/* ================================================================
   Asobi Dashboard — Warm Dark Design System
   Dark surfaces + tanuki warm accents
   ================================================================ */

:root {
    /* Surface hierarchy — warm dark */
    --bg:                    #0F0E0D;
    --surface:               #1C1917;
    --surface-raised:        #231F1C;
    --surface-hover:         #292524;
    --surface-active:        #302C28;
    --surface-overlay:       rgba(15, 14, 13, 0.85);

    /* Text */
    --text:                  #F5F3F0;
    --text-secondary:        #A8A29E;
    --text-muted:            #78716C;
    --text-inverse:          #1C1917;

    /* Tanuki warm accent */
    --primary:               #C47A3A;
    --primary-hover:         #D48A4A;
    --primary-muted:         rgba(196, 122, 58, 0.12);
    --primary-border:        rgba(196, 122, 58, 0.25);
    --secondary:             #E8985A;

    /* Semantic */
    --success:               #059669;
    --success-muted:         rgba(5, 150, 105, 0.12);
    --danger:                #E85A3A;
    --danger-muted:          rgba(232, 90, 58, 0.12);
    --danger-border:         rgba(232, 90, 58, 0.3);
    --warning:               #D97706;
    --warning-muted:         rgba(217, 119, 6, 0.12);

    /* Structural */
    --border:                rgba(255, 255, 255, 0.06);
    --border-hover:          rgba(255, 255, 255, 0.12);
    --ring:                  rgba(196, 122, 58, 0.4);

    /* Spacing & radius */
    --radius:                10px;
    --radius-sm:             6px;
    --radius-lg:             14px;
    --radius-full:           9999px;

    /* Typography */
    --font:                  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:                  'JetBrains Mono', 'SF Mono', monospace;
}

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

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ---- Navigation ---- */
.nav {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 1.5rem;
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-logo {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: #fff;
}

.nav-links {
    display: flex;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-sm);
    padding: 1px;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.3rem 0.7rem;
    border-radius: 5px;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.15s ease;
    background: transparent;
}

.nav-links a:hover { color: var(--text-secondary); background: var(--surface-hover); }
.nav-links a.active { color: var(--text); background: var(--surface-raised); box-shadow: 0 1px 2px rgba(0,0,0,0.2); }

.nav-user { margin-left: auto; }

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.user-avatar {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.user-name { color: var(--text-secondary); font-weight: 500; }

.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    font-family: var(--font);
}

.btn-link:hover { color: var(--danger); background: var(--danger-muted); }

/* ---- Main Content ---- */
.main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ---- Cards ---- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.15s;
}

.card:hover { border-color: var(--border-hover); }

.card-title {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

/* ---- Stat Grid ---- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.stat:hover { border-color: var(--primary-border); }
.stat:hover::before { opacity: 1; }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ---- Tables ---- */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

tbody tr { transition: background 0.1s; }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.mono { font-family: var(--mono); font-size: 0.8rem; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-sm);
    font-weight: 550;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
    font-family: var(--font);
    letter-spacing: -0.005em;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(196,122,58,0.25); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface-hover); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger-border);
}
.btn-danger:hover { background: var(--danger-muted); }

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

/* ---- Forms ---- */
.form-group { margin-bottom: 0.9rem; }

.form-label {
    display: block;
    font-weight: 550;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.5rem 0.7rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.875rem;
    font-family: var(--font);
    transition: all 0.15s;
    outline: none;
}

.form-input:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--ring);
}

.form-input::placeholder { color: var(--text-muted); }

.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-active { background: var(--success-muted); color: var(--success); }
.badge-revoked { background: var(--danger-muted); color: var(--danger); }
.badge-plan { background: var(--primary-muted); color: var(--primary); }
.badge-free { background: var(--primary-muted); color: var(--primary); }

/* ---- Key Display ---- */
.key-display {
    font-family: var(--mono);
    font-size: 0.85rem;
    background: var(--bg);
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--success);
    margin: 0.5rem 0;
    word-break: break-all;
    color: var(--success);
}

.key-warning {
    font-size: 0.8rem;
    color: var(--warning);
    margin-top: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 1rem; font-size: 0.9rem; }

/* ---- Game Cards ---- */
.game-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.15rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    color: var(--text);
}

.game-card:hover {
    border-color: var(--primary-border);
    background: var(--surface-raised);
    transform: translateX(2px);
}

.game-card-info h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    letter-spacing: -0.01em;
}

.game-card-info .game-slug {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--mono);
}

.game-card-meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Sections ---- */
.section { margin-bottom: 2rem; }

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ---- Environment Tabs ---- */
.env-tabs {
    display: flex;
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius-sm);
    padding: 1px;
    width: fit-content;
    margin-bottom: 1rem;
}

.env-tab {
    padding: 0.35rem 0.7rem;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 550;
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    border: none;
    font-family: var(--font);
    transition: all 0.15s;
}

.env-tab:hover { color: var(--text-secondary); }
.env-tab.active { color: var(--text); background: var(--surface-raised); box-shadow: 0 1px 2px rgba(0,0,0,0.2); }

/* ---- Landing Page ---- */
.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 52px);
    text-align: center;
    padding: 2rem;
}

.landing-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 2rem;
    color: #fff;
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 32px rgba(196, 122, 58, 0.25);
}

.landing h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing p {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 440px;
    line-height: 1.7;
}

.btn-github {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.5rem;
    background: #fff;
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    font-family: var(--font);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.btn-github:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.2); }
.btn-github:active { transform: translateY(0); }

.btn-github svg { width: 20px; height: 20px; }

/* ---- Alerts ---- */
.alert {
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background: var(--success-muted);
    border: 1px solid rgba(5, 150, 105, 0.2);
    color: var(--success);
}

.alert-error {
    background: var(--danger-muted);
    border: 1px solid var(--danger-border);
    color: var(--danger);
}

/* ---- Settings ---- */
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}

.settings-row:last-child { border-bottom: none; }
.settings-label { font-size: 0.85rem; color: var(--text-muted); }
.settings-value { font-weight: 550; }

/* ---- Modal ---- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--surface-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.25rem;
}

/* ---- Utility ---- */
.text-primary { color: var(--primary); }
.text-accent { color: var(--secondary); }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ---- Selection ---- */
::selection { background: var(--primary-muted); color: var(--primary); }
