/* ══════════════════════════════════════════════════
   ROOT — BRIGHT COLOSSEUM PALETTE
   Terinspirasi dari koloseum Roma di siang hari:
   batu pasir hangat, langit biru, pilar krem,
   ornamen emas, merah terra cotta.
══════════════════════════════════════════════════ */
:root {
    --bg:            #FBF3E2;
    --bg-mid:        #F3E5C8;
    --bg-card:       #FFFDF7;
    --bg-stone:      #EDE0C4;
    --amber:         #D97706;
    --amber-bright:  #F59E0B;
    --amber-light:   #FEF3C7;
    --amber-dark:    #92400E;
    --terra:         #C2410C;
    --terra-bright:  #EA580C;
    --terra-light:   #FFF0E8;
    --blue:          #0369A1;
    --blue-light:    #E0F2FE;
    --text:          #3D1C02;
    --text-mid:      #78350F;
    --text-dim:      #A16207;
    --text-muted:    #D4A96A;
    --border:        rgba(180, 120, 40, 0.35);
    --border-strong: rgba(180, 120, 40, 0.7);
}

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

body {
    font-family: 'Crimson Text', serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── BACKGROUND ──────────────────────────────────── */
.arena-bg {
    position: fixed; inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%,   rgba(125,211,252,0.25) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 0%,   rgba(125,211,252,0.15) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 100%, rgba(194,65,12,0.08)   0%, transparent 45%),
        radial-gradient(ellipse at 10% 80%,  rgba(217,119,6,0.1)    0%, transparent 50%),
        var(--bg);
    z-index: -3;
}
.stone-overlay {
    position: fixed; inset: 0;
    background-image:
        linear-gradient(rgba(180,140,80,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(180,140,80,0.06) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -2; pointer-events: none;
}
.pillar {
    position: fixed; top: 0; bottom: 0; width: 8px;
    background: linear-gradient(180deg,
        rgba(180,140,80,0.35) 0%,
        rgba(180,140,80,0.12) 40%,
        rgba(180,140,80,0.35) 100%);
    z-index: 10; pointer-events: none;
}
.pillar-left  { left: 0; }
.pillar-right { right: 0; }

/* ── PARTICLES ───────────────────────────────────── */
.particle {
    position: fixed; border-radius: 50%;
    pointer-events: none; z-index: 0;
    animation: particleAscend linear infinite;
}
@keyframes particleAscend {
    0%   { transform: translateY(0) translateX(0) scale(0); opacity: 0; }
    15%  { opacity: 0.8; }
    85%  { opacity: 0.4; }
    100% { transform: translateY(-100vh) translateX(var(--drift, 20px)) scale(0.3); opacity: 0; }
}

/* ── SECTION SYSTEM ──────────────────────────────── */
.section { display: none; position: relative; z-index: 1; }
.section.active {
    display: block;
    animation: fadeSlide 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── HELPERS ─────────────────────────────────────── */
.font-cinzel { font-family: 'Cinzel', serif; }

.deco-divider {
    display: flex; align-items: center; gap: 10px; margin: 10px 0;
}
.deco-divider::before, .deco-divider::after {
    content: ''; flex: 1; height: 1.5px;
    background: linear-gradient(90deg, transparent, var(--amber), transparent);
    opacity: 0.6;
}

.label-pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: 'Cinzel', serif; font-size: 0.65rem;
    letter-spacing: 2.5px; text-transform: uppercase;
    padding: 4px 12px; border-radius: 99px;
    border: 1px solid var(--border);
    color: var(--text-dim); background: rgba(255,255,255,0.5);
}

/* ── BUTTONS ─────────────────────────────────────── */
.btn-amber {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, #D97706 0%, #F59E0B 40%, #D97706 100%);
    color: #fff; border: none; border-radius: 8px; padding: 16px 52px;
    font-family: 'Cinzel', serif; font-size: 0.95rem; font-weight: 800;
    cursor: pointer; letter-spacing: 2.5px; text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
    box-shadow: 0 4px 20px rgba(217,119,6,0.4), 0 1px 0 rgba(255,255,255,0.3) inset;
    position: relative; overflow: hidden;
}
.btn-amber::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.3) 50%, transparent 70%);
    transform: translateX(-130%); transition: transform 0.5s ease;
}
.btn-amber:hover::before { transform: translateX(130%); }
.btn-amber:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 32px rgba(217,119,6,0.55); }

.btn-terra {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    background: linear-gradient(135deg, #C2410C 0%, #EA580C 50%, #C2410C 100%);
    color: #fff; border: none; border-radius: 8px; padding: 15px 44px;
    font-family: 'Cinzel', serif; font-size: 0.95rem; font-weight: 800;
    cursor: pointer; letter-spacing: 2.5px; text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1);
    box-shadow: 0 4px 20px rgba(194,65,12,0.4), 0 1px 0 rgba(255,255,255,0.2) inset;
    position: relative; overflow: hidden;
}
.btn-terra::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.2) 50%, transparent 70%);
    transform: translateX(-130%); transition: transform 0.5s ease;
}
.btn-terra:hover::before { transform: translateX(130%); }
.btn-terra:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 32px rgba(194,65,12,0.55); }
.btn-terra:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; box-shadow: none; }

.btn-ghost {
    background: none; border: 1.5px solid var(--border-strong);
    color: var(--text-mid); padding: 11px 26px; border-radius: 8px;
    font-family: 'Cinzel', serif; font-size: 0.78rem;
    cursor: pointer; letter-spacing: 1.5px; transition: all 0.2s ease;
}
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); background: var(--amber-light); }

/* ── FIGHTER SLOT ────────────────────────────────── */
.fighter-slot {
    border: 2px dashed var(--border); border-radius: 12px;
    padding: 18px 12px; min-height: 125px;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; text-align: center; gap: 6px;
    transition: all 0.35s ease; background: var(--bg-card);
}
.fighter-slot.filled-a { border: 2px solid var(--amber); background: var(--amber-light); box-shadow: 0 4px 20px rgba(217,119,6,0.15); }
.fighter-slot.filled-b { border: 2px solid var(--terra); background: var(--terra-light); box-shadow: 0 4px 20px rgba(194,65,12,0.12); }

/* ── CATEGORY TABS ───────────────────────────────── */
.cat-tab {
    cursor: pointer; padding: 7px 14px; border-radius: 99px;
    font-size: 0.7rem; border: 1.5px solid var(--border);
    color: var(--text-mid); background: var(--bg-card);
    transition: all 0.2s ease; font-family: 'Cinzel', serif; white-space: nowrap;
}
.cat-tab:hover { border-color: var(--amber); color: var(--amber-dark); background: var(--amber-light); }
.cat-tab.active { background: var(--amber); color: #fff; border-color: var(--amber); font-weight: 700; box-shadow: 0 3px 12px rgba(217,119,6,0.35); }

/* ── FIGHTER CARD ────────────────────────────────── */
.fighter-card {
    cursor: pointer; border: 1.5px solid var(--border); border-radius: 10px;
    padding: 12px 8px; text-align: center;
    transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
    background: var(--bg-card); font-family: 'Cinzel', serif;
    font-size: 0.7rem; color: var(--text-mid); line-height: 1.4;
    user-select: none; box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.fighter-card:hover { border-color: var(--amber); background: var(--amber-light); transform: translateY(-3px); box-shadow: 0 6px 16px rgba(217,119,6,0.2); color: var(--amber-dark); }
.fighter-card.sel-a { border-color: var(--amber); background: var(--amber-light); box-shadow: 0 0 0 3px rgba(217,119,6,0.2), 0 4px 12px rgba(217,119,6,0.15); color: var(--amber-dark); font-weight: 700; }
.fighter-card.sel-b { border-color: var(--terra); background: var(--terra-light); box-shadow: 0 0 0 3px rgba(194,65,12,0.2), 0 4px 12px rgba(194,65,12,0.12); color: var(--terra); font-weight: 700; }

/* ── VS BADGE ────────────────────────────────────── */
.vs-badge {
    background: linear-gradient(135deg, #C2410C, #EA580C);
    color: #fff; font-family: 'Cinzel', serif; font-weight: 900;
    padding: 6px 16px; border-radius: 99px; font-size: 0.8rem;
    letter-spacing: 2px; box-shadow: 0 3px 12px rgba(194,65,12,0.4);
}

/* ── CARDS ───────────────────────────────────────── */
.arena-card {
    background: var(--bg-card); border: 1.5px solid var(--border);
    border-radius: 16px; box-shadow: 0 4px 20px rgba(120,80,20,0.1);
}

/* ── LOADING ─────────────────────────────────────── */
.loading-ring {
    width: 72px; height: 72px;
    border: 3px solid rgba(217,119,6,0.2);
    border-top-color: var(--amber); border-right-color: rgba(217,119,6,0.5);
    border-radius: 50%; animation: spinRing 1s linear infinite;
}
.loading-ring-outer {
    width: 104px; height: 104px;
    border: 2px solid rgba(194,65,12,0.15);
    border-bottom-color: var(--terra-bright); border-left-color: rgba(194,65,12,0.4);
    border-radius: 50%; animation: spinRing 1.6s linear infinite reverse;
}
@keyframes spinRing { to { transform: rotate(360deg); } }

.clash-icon { font-size: 2.4rem; display: inline-block; animation: clashPulse 1.4s ease-in-out infinite; }
.clash-icon-r { animation-delay: 0.7s; }
@keyframes clashPulse {
    0%, 100% { transform: scale(0.85) rotate(-6deg); opacity: 0.6; }
    50%       { transform: scale(1.15) rotate(6deg); opacity: 1; }
}

.flash-vs { font-family: 'Cinzel', serif; font-size: 1.8rem; font-weight: 900; animation: vsFlash 1s ease-in-out infinite; }
@keyframes vsFlash {
    0%, 100% { color: var(--terra-bright); }
    50%       { color: var(--amber); }
}

@keyframes sparkle {
    0%, 100% { opacity: 0.4; transform: translate(-50%,-50%) scale(0.8); color: var(--amber); }
    50%       { opacity: 1;   transform: translate(-50%,-50%) scale(1.4); color: var(--terra-bright); }
}

/* ── RESULT ──────────────────────────────────────── */
.result-panel {
    border: 2px solid var(--border); border-radius: 14px;
    padding: 20px 12px; text-align: center;
    background: var(--bg-card); transition: all 0.4s ease;
}
.result-panel.winner-a { border-color: var(--amber); background: var(--amber-light); box-shadow: 0 0 24px rgba(217,119,6,0.25); }
.result-panel.winner-b { border-color: var(--terra); background: var(--terra-light); box-shadow: 0 0 24px rgba(194,65,12,0.2); }

.narrative-box {
    background: var(--bg-stone); border: 1.5px solid var(--border);
    border-radius: 12px; padding: 24px;
    font-size: 1.08rem; line-height: 2; color: var(--text);
}

.winner-banner {
    border: 2px solid var(--amber); border-radius: 14px;
    padding: 26px 20px; text-align: center;
    background: linear-gradient(135deg, var(--amber-light), #FFFDE8);
    box-shadow: 0 8px 32px rgba(217,119,6,0.2), 0 0 0 4px rgba(217,119,6,0.08);
    animation: bannerPulse 2.5s ease-in-out infinite alternate;
}
@keyframes bannerPulse {
    from { box-shadow: 0 6px 24px rgba(217,119,6,0.18), 0 0 0 4px rgba(217,119,6,0.06); }
    to   { box-shadow: 0 10px 40px rgba(217,119,6,0.35), 0 0 0 6px rgba(217,119,6,0.12); }
}
@keyframes trophyPop {
    0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
    60%  { transform: scale(1.25) rotate(12deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ── ARCH DECORATION ─────────────────────────────── */
.arch-decoration { position: absolute; width: 100%; display: flex; justify-content: space-between; pointer-events: none; }
.arch-col {
    width: 40px;
    background: linear-gradient(180deg, rgba(180,140,80,0.22) 0%, rgba(180,140,80,0.08) 60%, transparent 100%);
    border-radius: 0 0 50% 50%;
}

/* ── TYPEWRITER CURSOR ───────────────────────────── */
#tw-cursor {
    display: inline-block; width: 2px; height: 1em;
    background: var(--amber); margin-left: 2px;
    vertical-align: middle; animation: blink 0.75s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* ── CONFETTI ────────────────────────────────────── */
.confetti-p {
    position: fixed; top: -20px; opacity: 0;
    z-index: 9999; pointer-events: none;
    animation: confFall linear forwards;
}
@keyframes confFall {
    0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0; transform: translateY(110vh) rotate(720deg); }
}

/* ── FLAME ───────────────────────────────────────── */
.flame-anim { animation: flamePulse 1.8s ease-in-out infinite; display: inline-block; }
@keyframes flamePulse { 0%, 100% { transform: scale(1) rotate(-4deg); } 50% { transform: scale(1.15) rotate(4deg); } }

/* ── SCROLLBAR ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-mid); }
::-webkit-scrollbar-thumb { background: var(--amber); border-radius: 3px; }

/* ── ERROR TOAST ─────────────────────────────────── */
.error-toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--terra); color: #fff;
    font-family: 'Cinzel', serif; font-size: 0.78rem; letter-spacing: 1px;
    padding: 12px 24px; border-radius: 8px;
    box-shadow: 0 8px 24px rgba(194,65,12,0.4);
    z-index: 9999; display: none;
}
