/* ═══════════════════════════════════════════════════════════
   HERO REALM — Dark Fantasy Design System
   Palette:
     --void        #0c0a10  (background terdalam)
     --panel       #17131f  (kad/panel)
     --panel-alt   #1f1a2b  (panel sekunder / hover)
     --rune        #35293f  (border, garis rune)
     --ember       #d9a441  (accent utama — gold/api)
     --ember-dim   #8a6a2c
     --blood       #a5333a  (HP/bahaya/boss)
     --arcane      #7c5cc4  (mana/mythic/rare)
     --leaf        #4f9d5c  (heal/positive)
     --parchment   #ece2c8  (teks utama)
     --parchment-dim #9a917d (teks sekunder)
   Signature: setiap panel dibingkai "rune corner" — sudut bercahaya
   halus yang meniru seal sihir, bukan border-radius generik semata.
   ═══════════════════════════════════════════════════════════ */

:root {
    --void: #0c0a10;
    --panel: #17131f;
    --panel-alt: #1f1a2b;
    --rune: #35293f;
    --ember: #d9a441;
    --ember-dim: #8a6a2c;
    --blood: #a5333a;
    --arcane: #7c5cc4;
    --leaf: #4f9d5c;
    --parchment: #ece2c8;
    --parchment-dim: #9a917d;

    --radius: 10px;
    --shadow-panel: 0 8px 24px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: radial-gradient(ellipse at top, #1c1626 0%, var(--void) 60%);
    color: var(--parchment);
    font-family: Georgia, 'Times New Roman', serif;
    min-height: 100vh;
}

h1, h2, h3, .display {
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 0.04em;
    color: var(--ember);
    text-shadow: 0 0 18px rgba(217,164,65,0.25);
    margin: 0 0 12px;
}

p, label, span, div { font-family: 'Segoe UI', Tahoma, sans-serif; }

a { color: var(--ember); }

/* ── Layout shell ─────────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--panel), var(--void));
    border-right: 1px solid var(--rune);
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar .brand {
    font-size: 20px;
    text-align: center;
    margin-bottom: 18px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--parchment-dim);
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 14px;
    background: none;
    text-align: left;
    width: 100%;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.nav-item:hover { background: var(--panel-alt); color: var(--parchment); }
.nav-item.active {
    background: var(--panel-alt);
    border-color: var(--ember-dim);
    color: var(--ember);
}

.main-content {
    flex: 1;
    padding: 24px 32px;
    max-width: 1100px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.gold-badge {
    background: var(--panel);
    border: 1px solid var(--ember-dim);
    border-radius: 999px;
    padding: 8px 18px;
    font-weight: bold;
    color: var(--ember);
}

/* ── Rune-corner panel (signature element) ───────────────── */
.panel {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--rune);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
    padding: 20px;
    margin-bottom: 20px;
}
.panel::before, .panel::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid var(--ember-dim);
    opacity: 0.7;
}
.panel::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.panel::after  { bottom: -1px; right: -1px; border-left: none; border-top: none; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    border: 1px solid var(--ember-dim);
    background: linear-gradient(180deg, #2a2138, #1a1522);
    color: var(--ember);
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(217,164,65,0.18); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.btn-danger { border-color: var(--blood); color: #f0a3a3; }
.btn.btn-block { width: 100%; }

/* ── Google Sign-In button (ikut spec rasmi Google: putih, border halus,
     ikon G 4-warna, teks Roboto-esque) ─────────────────────────────── */
.btn-google-signin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-family: 'Segoe UI', Roboto, Tahoma, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: box-shadow 0.15s ease, background 0.15s ease, transform 0.12s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.btn-google-signin:hover {
    background: #f7f8f8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.22);
    transform: translateY(-1px);
}
.btn-google-signin:active { transform: translateY(0); }
.btn-google-signin .google-icon {
    display: inline-flex;
    flex-shrink: 0;
}

.btn-ember {
    background: linear-gradient(180deg, #e6b04f, #b9822c);
    color: #1a1522;
    border: 1px solid #f0c877;
    text-shadow: none;
}
.btn-ember:hover { box-shadow: 0 6px 18px rgba(217,164,65,0.35); }

/* ── Auth page crest + polish ─────────────────────────────────────── */
.auth-crest {
    text-align: center;
    font-size: 34px;
    margin-bottom: 4px;
    filter: drop-shadow(0 0 12px rgba(217,164,65,0.5));
}
.auth-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 4px;
}
.auth-subtitle {
    font-size: 15px;
    text-align: center;
    color: var(--parchment-dim);
    font-weight: normal;
    margin-bottom: 16px;
}
.auth-card {
    animation: fadeUp 0.4s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--parchment-dim);
    font-size: 12px;
    margin: 16px 0;
    gap: 10px;
}
.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rune);
}

/* ── Forms ────────────────────────────────────────────────── */
input, select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--rune);
    background: var(--void);
    color: var(--parchment);
    font-size: 14px;
    margin-bottom: 12px;
}
input:focus, select:focus, .btn:focus, .nav-item:focus {
    outline: 2px solid var(--arcane);
    outline-offset: 1px;
}

/* ── HP bars ──────────────────────────────────────────────── */
.hp-bar-track {
    background: #241d2e;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    border: 1px solid var(--rune);
}
.hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blood), #d95555);
    transition: width 0.4s ease;
}
.hp-bar-fill.enemy { background: linear-gradient(90deg, #5a1f22, var(--blood)); }
.hp-bar-fill.ally { background: linear-gradient(90deg, var(--leaf), #7ccf88); }

/* ── Hero card ────────────────────────────────────────────── */
.hero-card {
    background: var(--panel-alt);
    border: 1px solid var(--rune);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
    position: relative;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.hero-card:hover {
    transform: translateY(-3px);
    border-color: var(--ember-dim);
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.hero-card .rarity-tag {
    font-size: 11px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 999px;
    display: inline-block;
    margin-bottom: 6px;
}
.rarity-Common { background: #3a3a3a; color: #ccc; }
.rarity-Uncommon { background: #204e2b; color: #7ccf88; }
.rarity-Rare { background: #1f2f5c; color: #8fb3ff; }
.rarity-Legendary { background: #5c3f10; color: var(--ember); }
.rarity-Mythic { background: #3a1f52; color: #c79bff; }
.rarity-Cosmic { background: #123f45; color: #6fe0ea; }
.rarity-Secret { background: #222; color: #fff; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 14px;
}

/* ── Battle log ───────────────────────────────────────────── */
.battle-log {
    background: var(--void);
    border: 1px solid var(--rune);
    border-radius: var(--radius);
    padding: 12px;
    height: 220px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.6;
}
.battle-log div { border-bottom: 1px dashed rgba(255,255,255,0.05); padding: 3px 0; }

/* ── Auth pages ───────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.auth-card {
    width: 100%;
    max-width: 380px;
}
.auth-toggle {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
    font-size: 13px;
    color: var(--parchment-dim);
}
.lang-toggle {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 16px;
}
.lang-toggle button {
    background: none;
    border: 1px solid var(--rune);
    color: var(--parchment-dim);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
}
.lang-toggle button.active { border-color: var(--ember); color: var(--ember); }

.divider {
    text-align: center;
    color: var(--parchment-dim);
    font-size: 12px;
    margin: 14px 0;
}

.error-text { color: #f0a3a3; font-size: 13px; margin-top: -6px; margin-bottom: 12px; }
.success-text { color: #9fd88a; font-size: 13px; margin-top: -6px; margin-bottom: 12px; }
.hint-text { color: var(--parchment-dim); font-size: 12px; }

@keyframes shimmer {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}
.pulse { animation: shimmer 1.6s ease-in-out infinite; }

/* ── Responsive: mobile ───────────────────────────────────── */
@media (max-width: 820px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--rune);
    }
    .sidebar .brand { display: none; }
    .nav-item { white-space: nowrap; }
    .main-content { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}
