:root {
    --bg: #0a0a1a;
    --panel: #151530;
    --panel-2: #1f1f45;
    --text: #eaeaff;
    --muted: #9a9ac0;
    --gold: #f5b642;
    --gem: #6fd0ff;
    --fire: #ff6b35;
    --water: #2a9df4;
    --nature: #4caf50;
    --rare: #6fb6ff;
    --epic: #c77dff;
    --legendary: #ffc857;
    --mythic: #ff4d6d;
    --border: rgba(255,255,255,0.08);
    --danger: #ff4d6d;
    --success: #4caf50;
}

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

html, body {
    height: 100%;
    background: radial-gradient(ellipse at top, #1a1a3e 0%, var(--bg) 60%);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
    overscroll-behavior-y: contain;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0,0,0,0.45);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(12px);
    gap: 8px;
}

.brand { font-size: 17px; font-weight: 700; }
.logo-img { height: 32px; display: block; }

.currencies { display: flex; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.currencies span {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(0,0,0,0.4);
    padding: 4px 10px;
    border-radius: 100px;
    border: 1px solid var(--border);
}
.coin b { color: var(--gold); }
.gem b { color: var(--gem); }
.trophy b { color: var(--mythic); }

#main { flex: 1; padding: 16px 12px 100px; position: relative; }

.view { display: none; animation: fade 0.25s ease; }
.view.active { display: block; }

@keyframes fade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 { font-size: 24px; margin-bottom: 8px; text-align: center; }
h2 { font-size: 20px; margin-bottom: 14px; }
h3 { font-size: 17px; margin-bottom: 4px; }
.sub { text-align: center; color: var(--muted); margin-bottom: 16px; font-size: 13px; }
.sub.danger { color: var(--danger); }

.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--gold);
    border-radius: 50%;
    margin: 80px auto 16px;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loading { text-align: center; color: var(--muted); }

/* ---------- Starter picker ---------- */

.starter-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }

.starter-card {
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 14px;
}
.starter-card:active { transform: scale(0.98); }
.starter-card.selected {
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(245,182,66,0.3), 0 0 30px rgba(245,182,66,0.2);
}

.starter-sprite {
    width: 88px; height: 88px;
    border-radius: 14px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(0,0,0,0.25);
}

.starter-icon {
    font-size: 48px;
    width: 72px; height: 72px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 14px;
    background: rgba(0,0,0,0.25);
    flex-shrink: 0;
}
.starter-icon.fire { background: linear-gradient(135deg, #4d1d0a, #8a2a0a); }
.starter-icon.water { background: linear-gradient(135deg, #0a1a4d, #0a4a8a); }
.starter-icon.nature { background: linear-gradient(135deg, #0a3d1a, #1a7a2a); }

.starter-info { flex: 1; min-width: 0; }
.starter-info .stats { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.starter-info .stats b { color: var(--text); }

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    padding: 14px 18px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #f5b642, #ff6b35);
    color: #1a0a00;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    width: 100%;
    margin-top: 16px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.btn-danger { background: linear-gradient(135deg, #ff4d6d, #c9184a); color: white; }
.btn.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }

.back-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 14px;
    font-family: inherit;
    font-size: 14px;
}

/* ---------- Card grid ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 14px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    position: relative;
    overflow: hidden;
}
.card:active { transform: scale(0.98); }
.card .emoji { font-size: 40px; display: block; margin-bottom: 6px; }
.card h4 { font-size: 14px; margin-bottom: 4px; }
.card .sub { font-size: 11px; color: var(--muted); margin: 4px 0 0; }
.card .lvl { font-size: 12px; color: var(--gold); font-weight: 700; margin-top: 4px; }
.stage-tag { color: var(--muted); font-weight: 400; font-size: 10px; }

.card-sprite {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border-radius: 10px;
    background: radial-gradient(circle, rgba(245,182,66,0.08), transparent 70%);
    margin-bottom: 4px;
    display: block;
}
.card-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    margin-bottom: 4px;
}

.card.knocked { opacity: 0.55; }
.card.knocked .card-sprite { filter: grayscale(1); }

.mini-hp-wrap {
    height: 5px;
    background: rgba(0,0,0,0.5);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}
.mini-hp { height: 100%; background: var(--success); transition: width 0.3s; }
.mini-hp.low { background: var(--danger); }

.card.ready {
    border-color: var(--gold);
    background: linear-gradient(135deg, var(--panel), rgba(245,182,66,0.15));
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245,182,66,0.4); }
    50% { box-shadow: 0 0 0 8px rgba(245,182,66,0); }
}

/* ---------- Egg images ---------- */

.egg-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}
.egg-img.shake {
    animation: eggShake 0.45s ease-in-out infinite;
}

@keyframes eggShake {
    0%, 100% { transform: translateX(0) rotate(0); }
    20% { transform: translateX(-3px) rotate(-4deg); }
    40% { transform: translateX(3px) rotate(4deg); }
    60% { transform: translateX(-2px) rotate(-3deg); }
    80% { transform: translateX(2px) rotate(3deg); }
}

/* ---------- Rarity ---------- */

.rarity-common { color: #c0c0c0; }
.rarity-rare { color: var(--rare); }
.rarity-epic { color: var(--epic); }
.rarity-legendary { color: var(--legendary); }
.rarity-mythic { color: var(--mythic); }

.rarity-border-common { border-color: rgba(192,192,192,0.3); }
.rarity-border-rare { border-color: var(--rare); box-shadow: 0 0 12px rgba(111,182,255,0.2); }
.rarity-border-epic { border-color: var(--epic); box-shadow: 0 0 16px rgba(199,125,255,0.25); }
.rarity-border-legendary { border-color: var(--legendary); box-shadow: 0 0 22px rgba(255,200,87,0.3); }
.rarity-border-mythic { border-color: var(--mythic); box-shadow: 0 0 26px rgba(255,77,109,0.35); }

.rarity-bg-common { background: linear-gradient(135deg, var(--panel), var(--panel-2)); }
.rarity-bg-rare { background: linear-gradient(135deg, #102040, #0d1e3c); }
.rarity-bg-epic { background: linear-gradient(135deg, #2a1040, #1c0a30); }
.rarity-bg-legendary { background: linear-gradient(135deg, #3a2a05, #251a00); }
.rarity-bg-mythic { background: linear-gradient(135deg, #3a0a20, #250010); }

/* ---------- Perks ---------- */

.perk-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 10px;
}

.perk {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid;
}
.perk-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
}

.perk-common { background: rgba(192,192,192,0.15); border-color: rgba(192,192,192,0.4); color: #eaeaff; }
.perk-uncommon { background: rgba(111,182,255,0.15); border-color: rgba(111,182,255,0.5); color: var(--rare); }
.perk-rare { background: rgba(199,125,255,0.15); border-color: rgba(199,125,255,0.5); color: var(--epic); }
.perk-epic { background: rgba(255,200,87,0.15); border-color: rgba(255,200,87,0.6); color: var(--legendary); }
.perk-legendary {
    background: linear-gradient(90deg, rgba(255,77,109,0.2), rgba(255,200,87,0.2));
    border-color: var(--mythic);
    color: var(--mythic);
    animation: perkGlow 2s ease infinite;
}
@keyframes perkGlow {
    0%,100% { box-shadow: 0 0 0 0 rgba(255,77,109,0.4); }
    50% { box-shadow: 0 0 16px rgba(255,77,109,0.6); }
}

/* ---------- Detail page ---------- */

.detail-hero {
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    margin-bottom: 14px;
}

.hero-sprite {
    width: 100%;
    max-width: 260px;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0 auto 10px;
    display: block;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
}
.hero-sprite.knocked-img {
    filter: grayscale(1) drop-shadow(0 8px 20px rgba(0,0,0,0.5));
    opacity: 0.6;
}

.level-bar-box { margin-top: 12px; text-align: left; }
.bar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }

.xp-bar-wrap {
    background: rgba(0,0,0,0.4);
    border-radius: 100px;
    height: 8px;
    overflow: hidden;
}
.xp-bar {
    background: linear-gradient(90deg, var(--gold), #ff6b35);
    height: 100%;
    transition: width 0.4s ease;
}

.hp-bar-wrap.detail-hp { height: 10px; }
.hp-bar-wrap {
    background: rgba(0,0,0,0.4);
    border-radius: 100px;
    height: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.hp-bar {
    background: linear-gradient(90deg, var(--success), #88dd66);
    height: 100%;
    transition: width 0.5s ease;
}
.hp-bar.low { background: linear-gradient(90deg, var(--danger), #ff8866); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.stat-item {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}
.stat-item b { color: var(--gold); }

.action-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.action-row .btn { flex: 1; margin-top: 0; min-width: 130px; }

.cooldown-text {
    text-align: center;
    color: var(--muted);
    font-size: 12px;
    margin-top: 10px;
}

.knocked-panel {
    background: linear-gradient(135deg, rgba(255,77,109,0.15), rgba(0,0,0,0.3));
    border: 1px solid var(--danger);
    border-radius: 14px;
    padding: 18px;
    text-align: center;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    display: flex;
    background: rgba(10,10,26,0.95);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 20;
}
.bottom-nav.hidden { display: none; }

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s;
}
.nav-btn.active { color: var(--gold); }
.nav-btn .nav-icon { font-size: 20px; }
.nav-btn .nav-label { font-size: 10px; font-weight: 600; }
.nav-btn:active { transform: scale(0.95); }
.nav-btn { position: relative; padding: 6px 2px; }

.nav-badge {
    position: absolute;
    top: 0;
    right: 10%;
    background: var(--mythic);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 100px;
    min-width: 18px;
    text-align: center;
    animation: badgeBounce 0.5s ease;
}
.nav-badge.hidden { display: none; }
@keyframes badgeBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ---------- Battle arena ---------- */

.battle-arena {
    position: relative;
    background: linear-gradient(180deg, #1a0d3d 0%, #0d0522 100%);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    margin-top: 10px;
}

.arena-bg {
    position: absolute;
    inset: 0;
    background: url('/assets/bg-battle.webp') center/cover no-repeat;
    opacity: 0.45;
    filter: blur(1px) saturate(1.2);
    z-index: 0;
    pointer-events: none;
}
.arena-bg.biome-forest { background-image: url('/assets/bg-forest.webp'); }
.arena-bg.biome-mountain { background-image: url('/assets/bg-mountain.webp'); }
.arena-bg.biome-volcano { background-image: url('/assets/bg-volcano.webp'); }
.arena-bg.biome-sky { background-image: url('/assets/bg-sky.webp'); }

.arena-stage {
    position: relative;
    height: 220px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 14px 12px;
    z-index: 1;
}

.fighter-slot {
    position: relative;
    width: 45%;
    height: 200px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: transform 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.fighter-slot.left { transform: translateX(-150%); }
.fighter-slot.right { transform: translateX(150%); }
.fighter-slot.left.enter { transform: translateX(0); }
.fighter-slot.right.enter { transform: translateX(0); }

.fighter-sprite {
    height: 180px;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(4px 10px 10px rgba(0,0,0,0.6));
}

.fighter-slot.left .fighter-sprite { /* player faces right, no flip needed */ }
.fighter-slot.right .fighter-sprite { /* enemy already faces left */ }

.fighter-slot.attack {
    animation: attackLeft 0.42s ease;
}
.fighter-slot.attack-right {
    animation: attackRight 0.42s ease;
}

@keyframes attackLeft {
    0% { transform: translateX(0); }
    40% { transform: translateX(60%) scale(1.08); }
    60% { transform: translateX(70%) scale(1.08); filter: brightness(1.3); }
    100% { transform: translateX(0); }
}
@keyframes attackRight {
    0% { transform: translateX(0); }
    40% { transform: translateX(-60%) scale(1.08); }
    60% { transform: translateX(-70%) scale(1.08); filter: brightness(1.3); }
    100% { transform: translateX(0); }
}

.fighter-slot.hit {
    animation: hitReact 0.35s ease;
}
.fighter-slot.crit-hit {
    animation: critReact 0.55s ease;
}

@keyframes hitReact {
    0% { filter: brightness(1); }
    20% { transform: translateX(-8px); filter: brightness(2) hue-rotate(-20deg); }
    40% { transform: translateX(6px); filter: brightness(1.5); }
    100% { filter: brightness(1); }
}
@keyframes critReact {
    0% { filter: brightness(1); transform: translateX(0) rotate(0); }
    15% { transform: translateX(-14px) rotate(-8deg); filter: brightness(3) hue-rotate(-30deg) drop-shadow(0 0 18px var(--mythic)); }
    30% { transform: translateX(10px) rotate(6deg); filter: brightness(1.8); }
    60% { transform: translateX(-4px) rotate(-2deg); }
    100% { transform: translateX(0) rotate(0); filter: brightness(1); }
}

.fighter-slot.defeated {
    animation: defeated 0.8s ease forwards;
}
@keyframes defeated {
    0% { opacity: 1; filter: grayscale(0); transform: rotate(0); }
    100% { opacity: 0.35; filter: grayscale(1); transform: rotate(-12deg) translateY(20px); }
}

.fighter-slot.phoenix {
    animation: phoenixRise 0.9s ease;
}
@keyframes phoenixRise {
    0% { transform: scale(0.6); filter: brightness(4) hue-rotate(30deg); opacity: 0.2; }
    50% { transform: scale(1.3); filter: brightness(3) drop-shadow(0 0 40px var(--gold)); opacity: 1; }
    100% { transform: scale(1); filter: brightness(1); opacity: 1; }
}

.vs-banner {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    font-weight: 900;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(245,182,66,0.8);
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}
.vs-banner.pulse {
    opacity: 1;
    animation: vsPulse 1.4s ease forwards;
}
@keyframes vsPulse {
    0% { transform: translateX(-50%) scale(3); opacity: 0; }
    20% { transform: translateX(-50%) scale(0.8); opacity: 1; }
    40% { transform: translateX(-50%) scale(1.2); }
    60% { transform: translateX(-50%) scale(1); }
    100% { opacity: 0; }
}

.battle-screen.shake, #battle-screen.shake {
    animation: arenaShake 0.45s ease;
}

@keyframes arenaShake {
    0%, 100% { transform: translate(0, 0); }
    20% { transform: translate(-8px, 3px); }
    40% { transform: translate(8px, -3px); }
    60% { transform: translate(-6px, 2px); }
    80% { transform: translate(6px, -2px); }
}

.battle-hud {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    z-index: 1;
    position: relative;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
}
.hud-side { flex: 1; min-width: 0; }
.hud-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hp-text { font-size: 10px; color: var(--muted); margin-top: 2px; }

.crit-burst {
    position: absolute;
    top: 30%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 60px;
    pointer-events: none;
    animation: critBurst 0.8s ease forwards;
    text-shadow: 0 0 20px var(--mythic), 0 0 40px var(--gold);
    z-index: 6;
}
@keyframes critBurst {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 0; }
    40% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
    100% { transform: translate(-50%, -130%) scale(1.8); opacity: 0; }
}

.hit-effect {
    position: absolute;
    top: 35%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80px; height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.6), transparent 60%);
    pointer-events: none;
    animation: hitFx 0.35s ease forwards;
    z-index: 5;
}
.hit-effect.element-vfx {
    width: 120px; height: 120px;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    background-color: transparent;
    border-radius: 0;
    animation: elementVfx 0.5s ease forwards;
    mix-blend-mode: screen;
}
@keyframes hitFx {
    0% { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}
@keyframes elementVfx {
    0% { transform: translate(-50%, -50%) scale(0.4) rotate(0); opacity: 0; filter: brightness(2); }
    30% { transform: translate(-50%, -50%) scale(1.1) rotate(30deg); opacity: 1; filter: brightness(1.5); }
    100% { transform: translate(-50%, -50%) scale(1.8) rotate(90deg); opacity: 0; filter: brightness(1); }
}

.damage-number {
    position: absolute;
    top: 25%; left: 50%;
    transform: translate(-50%, 0);
    font-size: 26px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 12px rgba(255,77,109,0.6);
    pointer-events: none;
    animation: dmgNumber 1.4s ease forwards;
    z-index: 7;
}
.damage-number.crit {
    color: var(--legendary);
    font-size: 36px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.9), 0 0 20px var(--gold), 0 0 8px var(--mythic);
}
@keyframes dmgNumber {
    0% { transform: translate(-50%, 0) scale(0.3); opacity: 0; }
    25% { transform: translate(-50%, -15px) scale(1.3); opacity: 1; }
    60% { transform: translate(-50%, -50px) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -80px) scale(0.9); opacity: 0; }
}

.battle-log {
    max-height: 150px;
    overflow-y: auto;
    background: rgba(0,0,0,0.4);
    padding: 10px 14px;
    font-size: 12px;
    line-height: 1.6;
    border-top: 1px solid var(--border);
    position: relative;
    z-index: 2;
}
.battle-log .log-line { margin-bottom: 3px; }
.battle-log .player { color: var(--gold); }
.battle-log .opponent { color: var(--danger); }
.battle-log .crit { font-weight: 700; }

.battle-result {
    padding: 16px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.8);
    position: relative;
    z-index: 3;
}
.battle-result button { position: relative; z-index: 4; }
.battle-result.win { background: linear-gradient(135deg, rgba(76,175,80,0.25), rgba(0,0,0,0.4)); }
.battle-result.lose { background: linear-gradient(135deg, rgba(255,77,109,0.25), rgba(0,0,0,0.4)); }
.battle-result h3 { font-size: 22px; margin-bottom: 8px; }
.battle-result .rewards { display: flex; justify-content: center; gap: 16px; margin-top: 10px; font-size: 14px; flex-wrap: wrap; }
.post-battle-actions, .revive-inline { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.post-battle-actions .btn, .revive-inline .btn { margin-top: 0; }
.revive-inline p { color: var(--muted); font-size: 13px; }

/* ---------- Hatch overlay ---------- */

.hatch-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(245,182,66,0.25), rgba(0,0,0,0.95) 60%);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.3s ease;
    padding: 20px;
}

.hatch-stage { text-align: center; position: relative; padding: 20px; max-width: 100%; }

.hatch-egg {
    width: 200px;
    height: 200px;
    object-fit: contain;
    animation: hatchShake 0.18s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(245,182,66,0.6));
    position: relative;
    z-index: 2;
}
.hatch-egg.crack {
    animation: hatchCrack 1.2s ease forwards;
}
@keyframes hatchShake {
    0%, 100% { transform: translateX(0) rotate(0) scale(1); }
    25% { transform: translateX(-6px) rotate(-6deg) scale(1.02); }
    50% { transform: translateX(6px) rotate(6deg) scale(1.02); }
    75% { transform: translateX(-4px) rotate(-4deg) scale(1.04); }
}
@keyframes hatchCrack {
    0% { transform: scale(1); opacity: 1; }
    40% { transform: scale(1.4); filter: brightness(3) drop-shadow(0 0 60px #fff); }
    80% { transform: scale(2.5); opacity: 0.3; }
    100% { transform: scale(3); opacity: 0; }
}

.hatch-rays {
    position: absolute;
    inset: -50px;
    background: conic-gradient(from 0deg,
        transparent 0deg, rgba(255,200,87,0.4) 20deg, transparent 40deg,
        transparent 60deg, rgba(255,200,87,0.4) 80deg, transparent 100deg,
        transparent 120deg, rgba(255,200,87,0.4) 140deg, transparent 160deg,
        transparent 180deg, rgba(255,200,87,0.4) 200deg, transparent 220deg,
        transparent 240deg, rgba(255,200,87,0.4) 260deg, transparent 280deg,
        transparent 300deg, rgba(255,200,87,0.4) 320deg, transparent 340deg, transparent 360deg);
    animation: spinRays 8s linear infinite;
    opacity: 0.5;
    z-index: 0;
}
.hatch-rays.bright { opacity: 0.9; }
@keyframes spinRays { to { transform: rotate(360deg); } }

.hatch-text, .hatch-title {
    margin-top: 20px;
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(90deg, #ffc857, #ff6b35);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    position: relative;
    z-index: 2;
}
.hatch-sub {
    color: var(--muted);
    position: relative;
    z-index: 2;
    font-size: 13px;
    margin-top: 4px;
}
.hatch-dragon {
    width: 240px;
    height: 240px;
    max-width: 80vw;
    object-fit: contain;
    filter: drop-shadow(0 0 60px rgba(255,200,87,0.8));
    animation: dragonReveal 1s ease forwards;
    position: relative;
    z-index: 2;
}
@keyframes dragonReveal {
    0% { transform: scale(0.3); opacity: 0; }
    60% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
.hatch-ok {
    position: relative;
    z-index: 2;
    max-width: 240px;
    margin: 16px auto 0;
}

.hatch-perks {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    margin-top: 16px;
}
.hatch-perks .perk { font-size: 12px; padding: 6px 14px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Level up ---------- */

.levelup-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 999;
    pointer-events: none;
    animation: fadeIn 0.2s ease;
}

.levelup-burst {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(245,182,66,0.4), transparent 50%);
    animation: burstExpand 1s ease forwards;
}

@keyframes burstExpand {
    0% { transform: scale(0.2); opacity: 0; }
    30% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

.levelup-text {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(90deg, #ff6b35, #ffc857, #ff6b35);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: levelPop 1.8s ease forwards;
    letter-spacing: 2px;
}
.levelup-level {
    font-size: 42px;
    font-weight: 900;
    color: var(--gold);
    margin-top: 8px;
    text-shadow: 0 0 30px rgba(245,182,66,0.8);
    animation: levelPop 1.8s ease 0.15s both;
}
@keyframes levelPop {
    0% { transform: scale(0.3); opacity: 0; }
    30% { transform: scale(1.2); opacity: 1; }
    70% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0; }
}

/* ---------- Toast + misc ---------- */

.coming-soon {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    background: var(--panel);
    border: 1px dashed var(--border);
    border-radius: 14px;
    font-size: 16px;
}

.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--panel-2);
    border: 1px solid var(--gold);
    border-radius: 100px;
    padding: 10px 20px;
    font-size: 14px;
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: toastIn 0.3s ease;
    max-width: 85vw;
    text-align: center;
}
.toast.hidden { display: none; }
.toast.error { border-color: var(--danger); }
.toast.success { border-color: var(--success); }

@keyframes toastIn {
    from { opacity: 0; transform: translate(-50%, -20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 30px 20px;
    grid-column: 1 / -1;
}

#error { text-align: center; padding-top: 40px; }
#error-msg { color: var(--muted); margin: 12px 0 24px; }

/* Bg for home */
#home::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background: url('/assets/bg-home.webp') center/cover no-repeat;
    opacity: 0.12;
    pointer-events: none;
}

/* ---------- Breeding ---------- */

.breed-stage {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, rgba(255,105,180,0.08), rgba(30,10,60,0.6));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 14px;
}

.breed-slot {
    flex: 1;
    aspect-ratio: 1 / 1;
    min-height: 150px;
    border: 2px dashed var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: rgba(0,0,0,0.2);
}
.breed-slot.filled {
    border-style: solid;
    border-color: #ff69b4;
    box-shadow: 0 0 14px rgba(255,105,180,0.25);
}
.breed-slot .emoji { font-size: 40px; opacity: 0.5; }
.breed-slot p { color: var(--muted); font-size: 12px; }

.breed-sprite {
    width: 85%;
    max-height: 100px;
    object-fit: contain;
}
.breed-name { font-size: 13px; font-weight: 700; margin-top: 4px; }
.breed-cd {
    position: absolute;
    top: 6px; right: 6px;
    background: rgba(0,0,0,0.7);
    color: var(--mythic);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
}

.heart {
    font-size: 36px;
    animation: heartBeat 1.2s ease infinite;
}
@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.15); }
}

.breed-empty-slot { text-align: center; }

.breed-estimate {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}
.estimate-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
}
.estimate-row b { color: var(--gold); }
.breed-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 8px 0;
    line-height: 1.5;
}

.selected-breed {
    border-color: #ff69b4 !important;
    box-shadow: 0 0 14px rgba(255,105,180,0.3);
}
.breed-tag {
    position: absolute;
    top: 6px; left: 6px;
    background: #ff69b4;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    color: #1a0a00;
}
.card.cooldown { opacity: 0.6; cursor: default; }

.mutation-badge {
    position: relative;
    z-index: 2;
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(90deg, var(--mythic), var(--gold));
    color: #1a0a00;
    font-weight: 900;
    border-radius: 100px;
    margin-bottom: 10px;
    animation: mutationPulse 1s ease infinite;
}
@keyframes mutationPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(255,200,87,0.4); transform: scale(1); }
    50% { box-shadow: 0 0 20px rgba(255,200,87,0.7); transform: scale(1.05); }
}

/* ---------- Market ---------- */

.tabs {
    display: flex;
    gap: 6px;
    background: var(--panel);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 14px;
}
.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    border-radius: 10px;
    font-family: inherit;
}
.tab-btn.active {
    background: var(--panel-2);
    color: var(--gold);
}

.market-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.market-filters select {
    flex: 1;
    background: var(--panel);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
}

.price-tag {
    background: var(--panel-2);
    color: var(--gold);
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    display: inline-block;
    margin-top: 6px;
}
.seller-tag { font-size: 10px; color: var(--muted); margin-top: 4px; }
.perk-list-mini { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-top: 4px; }
.perk-mini { font-size: 9px !important; padding: 2px 6px !important; }
.unlist-btn { margin-top: 8px !important; padding: 8px !important; font-size: 12px !important; }

/* ---------- Modal ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease;
}

.modal-box {
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 20px;
    max-width: 360px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
}
.modal-box h3 { margin-bottom: 6px; }
.modal-box .hero-sprite { max-width: 180px; }

.form-row {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin: 10px 0;
}
.form-row span {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}
.form-row input, .form-row select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 12px;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
}

.price-box {
    background: rgba(245,182,66,0.1);
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 10px;
    margin: 12px 0;
    font-size: 15px;
}
.price-box b { color: var(--gold); font-size: 18px; }

.hint { font-size: 12px; color: var(--muted); margin: 10px 0; }

/* ---------- Wallet ---------- */

.wallet-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
}

.balance-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.balance-row:last-child { border-bottom: none; }

.balance-icon { font-size: 32px; }
.balance-info { flex: 1; }
.balance-label { font-size: 12px; color: var(--muted); }
.balance-val { font-size: 22px; font-weight: 700; color: var(--gold); }

.token-card {
    background: linear-gradient(135deg, #2a1020, #0a0a1a);
    border: 1px solid var(--mythic);
    box-shadow: 0 0 20px rgba(255,77,109,0.15);
}
.token-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.token-stats { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.muted-small { font-size: 11px; color: var(--muted); }

.coming-soon-banner {
    background: linear-gradient(90deg, rgba(255,200,87,0.2), rgba(255,107,53,0.2));
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 10px;
    font-size: 12px;
    text-align: center;
    margin-bottom: 12px;
    color: var(--legendary);
    font-weight: 600;
}

.info-card h3 { margin-bottom: 10px; font-size: 15px; }
.info-list {
    list-style: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.8;
}
.info-list li { padding: 4px 0; color: var(--muted); }

/* ---------- Farm / Economy ---------- */

.farm-card {
    background: linear-gradient(135deg, #1a3a1a, #0d1f0d);
    border: 1px solid #4caf50;
    box-shadow: 0 0 20px rgba(76,175,80,0.15);
}
.farm-card h3 { color: #8dee7c; margin-bottom: 10px; }

.farm-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
}
.farm-big { font-size: 24px; font-weight: 800; color: var(--gold); }
.farm-sub { font-size: 11px; color: var(--muted); }
.farm-rate-box { text-align: right; }
.farm-rate-val { font-size: 18px; font-weight: 700; color: #8dee7c; }
.farm-rate-lbl { font-size: 10px; color: var(--muted); }

.farm-list { margin-top: 12px; }
.farm-header { font-size: 11px; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

.farm-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
}
.farm-row:last-of-type { border-bottom: none; }
.farm-name { color: var(--text); font-weight: 600; }
.farm-rate { color: var(--muted); }
.farm-pending { color: var(--gold); font-weight: 700; }
.farm-idle { font-size: 11px; color: var(--muted); margin-top: 6px; text-align: center; }

.convert-info {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
}
.convert-info div { padding: 4px 0; font-size: 13px; }
.convert-info b { color: var(--gold); }

/* ---------- Referral ---------- */

.referral-card {
    background: linear-gradient(135deg, rgba(255,77,109,0.15), rgba(255,200,87,0.1));
    border: 1px solid var(--mythic);
}
.referral-card h3 { color: var(--legendary); }

.ref-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 14px 0;
}
.ref-stats > div {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 10px 6px;
    text-align: center;
}
.ref-stats b { display: block; font-size: 18px; color: var(--gold); }
.ref-stats small { font-size: 10px; color: var(--muted); }

.ref-link-box {
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
}
.ref-link-box code {
    flex: 1;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    color: var(--legendary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ref-list {
    margin-top: 8px;
    max-height: 140px;
    overflow-y: auto;
}
.ref-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 10px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 12px;
}
.ref-row span { color: var(--gold); font-weight: 600; }

.community-card {
    background: linear-gradient(135deg, rgba(111,208,255,0.08), rgba(111,182,255,0.05));
    border: 1px solid rgba(111,208,255,0.3);
}
.community-card h3 { color: var(--gem); }
.community-card a.btn { padding: 14px 10px !important; font-size: 14px !important; }

/* ---------- Campaign ---------- */

.campaign-header {
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}
.campaign-progress-bar {
    height: 8px;
    background: rgba(0,0,0,0.4);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 8px;
}
.campaign-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), #ff6b35);
    transition: width 0.5s;
}
.campaign-stats {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
}
.campaign-stats b { color: var(--gold); font-size: 16px; }

.biome-section {
    margin-bottom: 22px;
}
.biome-title {
    font-size: 18px;
    margin-bottom: 10px;
    padding-left: 12px;
    border-left: 4px solid var(--biome-color, var(--gold));
    color: var(--biome-color, var(--gold));
}
.biome-levels {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
@media (max-width: 480px) {
    .biome-levels { grid-template-columns: repeat(5, 1fr); gap: 6px; }
}

.campaign-level {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 8px 4px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s;
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.campaign-level:not(.locked):active { transform: scale(0.95); }
.campaign-level.locked { opacity: 0.4; cursor: not-allowed; filter: grayscale(1); }
.campaign-level.completed { border-color: var(--success); background: linear-gradient(135deg, var(--panel), rgba(76,175,80,0.1)); }
.campaign-level.boss {
    border-color: var(--mythic);
    background: linear-gradient(135deg, #2a0a20, var(--panel));
    box-shadow: 0 0 16px rgba(255,77,109,0.3);
}
.campaign-level.boss.completed { border-color: var(--legendary); box-shadow: 0 0 16px rgba(255,200,87,0.4); }

.lvl-num {
    position: absolute;
    top: 2px; left: 6px;
    font-size: 10px;
    color: var(--muted);
    font-weight: 700;
}
.lvl-enemy { font-size: 18px; position: relative; }
.lvl-enemy img {
    width: 46px; height: 46px;
    object-fit: contain;
    margin: 6px auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}
.campaign-level.boss .lvl-enemy img { width: 52px; height: 52px; }
.lvl-name {
    font-size: 10px;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 24px;
}
.lvl-stars { font-size: 10px; }

.level-modal {
    max-width: 340px;
    text-align: center;
}
.close-x {
    position: absolute;
    top: 8px; right: 12px;
    background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer;
}
.boss-badge {
    display: inline-block;
    background: linear-gradient(90deg, var(--mythic), var(--legendary));
    color: #1a0a00;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 8px;
}
.level-enemy-img {
    width: 120px; height: 120px;
    object-fit: contain;
    margin: 0 auto 8px;
    display: block;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
}
.level-rewards {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 10px;
    margin: 10px 0;
    font-size: 13px;
    text-align: left;
}
.level-rewards div { padding: 3px 0; }

.level-dragons {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}
.dragon-mini {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
}
.dragon-mini:active { transform: scale(0.98); }
.dragon-mini img { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; background: rgba(0,0,0,0.2); }
.mini-info { flex: 1; text-align: left; }
.mini-info b { display: block; font-size: 13px; }
.mini-info span { font-size: 11px; color: var(--muted); }

.stars-big {
    font-size: 28px;
    margin: 10px 0;
    letter-spacing: 4px;
}

/* ---------- Dungeon ---------- */

.dungeon-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.dungeon-card {
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
}
.dungeon-card.completed {
    opacity: 0.6;
    background: linear-gradient(135deg, var(--panel), rgba(76,175,80,0.08));
    border-color: var(--success);
}
.dungeon-tier { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.dungeon-enemy { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.dungeon-mult { font-size: 13px; margin-bottom: 6px; }
.dungeon-mult b { color: var(--mythic); }
.dungeon-rewards {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
    color: var(--gold);
    margin-bottom: 10px;
}
.dungeon-enter { padding: 10px !important; }
.dungeon-done { color: var(--success); font-size: 13px; text-align: center; padding: 8px 0; font-weight: 600; }

/* ---------- Event Banner ---------- */

.event-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(255,200,87,0.18), rgba(255,77,109,0.12));
    border: 1px solid var(--gold);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 14px;
    box-shadow: 0 0 14px rgba(245,182,66,0.15);
    animation: eventGlow 2.5s ease infinite;
}
@keyframes eventGlow {
    0%,100% { box-shadow: 0 0 10px rgba(245,182,66,0.1); }
    50% { box-shadow: 0 0 22px rgba(245,182,66,0.3); }
}
.event-emoji { font-size: 36px; }
.event-info { flex: 1; }
.event-name { font-size: 15px; font-weight: 800; color: var(--gold); }
.event-desc { font-size: 12px; color: var(--text); margin: 2px 0; }
.event-time { font-size: 11px; color: var(--muted); }

/* ---------- Guilds ---------- */

.guild-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

.guild-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    transition: transform 0.15s;
}
.guild-card:active { transform: scale(0.98); }
.guild-emblem { font-size: 32px; width: 48px; text-align: center; }
.guild-info { flex: 1; min-width: 0; }
.guild-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-sub { font-size: 11px; color: var(--muted); }
.guild-level {
    background: var(--panel-2);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
}

.guild-detail-hero {
    text-align: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}
.guild-emblem-big { font-size: 64px; margin-bottom: 6px; }
.guild-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.guild-stats > div {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 8px 4px;
}
.guild-stats b { display: block; font-size: 16px; color: var(--gold); }
.guild-stats small { font-size: 10px; color: var(--muted); }

.guild-members {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.guild-member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    font-size: 13px;
}
.guild-role { font-size: 18px; }
.member-name { flex: 1; font-weight: 600; }
.member-trophies { color: var(--gold); font-size: 12px; }

/* ---------- Polish: counter flash ---------- */

.currencies b {
    transition: color 0.2s, transform 0.15s;
    display: inline-block;
}
.count-up {
    animation: countUpFlash 0.6s ease;
}
.count-down {
    animation: countDownFlash 0.4s ease;
}
@keyframes countUpFlash {
    0% { color: var(--gold); transform: scale(1); filter: drop-shadow(0 0 8px rgba(245,182,66,0.8)); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}
@keyframes countDownFlash {
    0% { color: var(--danger); transform: scale(1); }
    50% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

/* ---------- Polish: Skeleton loader ---------- */

.skeleton {
    background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
    border-radius: 10px;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    height: 140px;
    width: 100%;
    margin-bottom: 10px;
}
.skeleton-row {
    height: 14px;
    margin-bottom: 8px;
}
.skeleton-row.short { width: 60%; }
.skeleton-row.medium { width: 80%; }

/* ---------- Polish: Button ripple ---------- */

.btn {
    position: relative;
    overflow: hidden;
}
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s, opacity 0.4s;
    opacity: 0;
    pointer-events: none;
}
.btn:active::after {
    width: 300px;
    height: 300px;
    opacity: 1;
    transition: 0s;
}

/* ---------- Polish: Screen transition ---------- */

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
.view.active {
    animation: slideInRight 0.3s ease;
}

/* ---------- Polish: Toast improvements ---------- */

.toast {
    border-left: 4px solid var(--gold);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.05);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* ---------- Polish: Card hover juice ---------- */

.card, .dragon-card, .guild-card, .shop-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover, .dragon-card:hover, .guild-card:hover, .shop-card:hover {
    transform: translateY(-2px);
}
.card:active {
    transform: scale(0.97) translateY(0);
}

/* ---------- Polish: Input focus states ---------- */

input[type=text], input[type=number], select {
    transition: border-color 0.2s, background 0.2s;
}
input[type=text]:focus, input[type=number]:focus, select:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(245,182,66,0.05);
}

/* ---------- Polish: Nickname edit inline ---------- */

.nickname-edit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.nickname-edit:hover {
    background: rgba(255,255,255,0.05);
}
.nickname-edit .edit-icon {
    font-size: 11px;
    opacity: 0.5;
}
.nickname-input {
    background: var(--bg);
    border: 1px solid var(--gold);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    text-align: center;
    width: 180px;
}

/* ---------- Home widgets: streak + mission ---------- */

.streak-widget {
    background: linear-gradient(135deg, rgba(255,107,53,0.12), rgba(0,0,0,0.3));
    border: 1px solid rgba(255,107,53,0.3);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 12px;
}
.streak-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.streak-header b { color: var(--gold); }
.streak-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.streak-day {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 2px;
    text-align: center;
    font-size: 9px;
    line-height: 1.3;
}
.streak-day.past {
    background: linear-gradient(135deg, rgba(76,175,80,0.25), rgba(76,175,80,0.1));
    border-color: var(--success);
    opacity: 0.8;
}
.streak-day.past::before { content: '✓ '; color: var(--success); }
.streak-day.active {
    background: linear-gradient(135deg, var(--legendary), #ff6b35);
    border-color: var(--gold);
    color: #1a0a00;
    animation: streakPulse 1.5s ease infinite;
}
@keyframes streakPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(245,182,66,0.5); }
    50% { box-shadow: 0 0 12px rgba(245,182,66,0.7); }
}
.streak-day.future { opacity: 0.4; }
.day-num { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.day-reward { font-size: 8px; }

.mission-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 12px;
}
.mission-widget.ready {
    background: linear-gradient(135deg, rgba(245,182,66,0.15), rgba(255,107,53,0.1));
    border-color: var(--gold);
    animation: claimPulse 1.5s ease infinite;
}
.mission-icon {
    font-size: 28px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
}
.mission-info { flex: 1; min-width: 0; }
.mission-title { font-size: 13px; font-weight: 700; }
.mission-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.mission-progress-bar {
    height: 4px;
    background: rgba(0,0,0,0.4);
    border-radius: 3px;
    margin: 4px 0;
    overflow: hidden;
}
.mission-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), #ff6b35);
    transition: width 0.4s;
}
.btn-claim-now {
    background: linear-gradient(135deg, var(--legendary), #ff6b35) !important;
    color: #1a0a00 !important;
    border: none !important;
    padding: 8px 14px !important;
    font-size: 12px !important;
}

/* ---------- Season Pass ---------- */

.season-header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    background: linear-gradient(135deg, #2a1a40, #1a0a30);
    border: 1px solid var(--epic);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}
.season-header h3 { color: var(--legendary); font-size: 17px; }
.season-time { font-size: 12px; color: var(--muted); margin-top: 4px; }
.season-level-big { text-align: center; background: rgba(0,0,0,0.3); border-radius: 10px; padding: 10px; }
.level-big-num {
    font-size: 32px;
    font-weight: 900;
    color: var(--gold);
    line-height: 1;
}
.level-big-num small { font-size: 14px; color: var(--muted); font-weight: 400; }

.season-xp { margin-bottom: 12px; }
.season-xp-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.season-xp-bar {
    height: 10px;
    background: rgba(0,0,0,0.4);
    border-radius: 100px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.season-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--epic), var(--legendary), var(--mythic));
    transition: width 0.6s;
}

.season-tiers {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
}
.season-tier {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 10px;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
}
.season-tier.locked { opacity: 0.45; filter: grayscale(0.3); }
.season-tier.unlocked {
    border-color: var(--gold);
    background: linear-gradient(135deg, var(--panel), rgba(245,182,66,0.08));
    animation: claimPulse 1.5s ease infinite;
}
.season-tier.claimed {
    background: linear-gradient(135deg, var(--panel), rgba(76,175,80,0.08));
    border-color: var(--success);
    opacity: 0.7;
}
.season-tier.milestone {
    background: linear-gradient(135deg, #1a1040, var(--panel-2));
    border-color: var(--epic);
}
.season-tier.milestone.unlocked {
    background: linear-gradient(135deg, rgba(199,125,255,0.25), rgba(255,200,87,0.2));
    border-color: var(--legendary);
    box-shadow: 0 0 16px rgba(255,200,87,0.2);
}
.season-tier.special {
    border-color: var(--mythic);
}
.tier-level {
    font-weight: 800;
    color: var(--gold);
    font-size: 14px;
    text-align: center;
}
.tier-reward { font-size: 12px; color: var(--text); font-weight: 600; }
.tier-status { font-size: 16px; }
.tier-claim { padding: 6px 10px !important; font-size: 11px !important; }

/* ---------- Collection ---------- */

.collection-header {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
    align-items: center;
}
.collection-summary { text-align: center; }
.collection-num { font-size: 28px; font-weight: 900; }
.collection-num b { color: var(--gold); }
.collection-progress { min-width: 0; }

.collection-rarity-section { margin-bottom: 20px; }
.collection-rarity-section h3 { font-size: 15px; margin-bottom: 10px; }

.collection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.collection-card {
    background: var(--panel);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 8px 6px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.collection-card:active { transform: scale(0.96); }
.collection-card img {
    width: 60px; height: 60px;
    object-fit: contain;
    margin: 0 auto 4px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}
.col-name { font-size: 11px; font-weight: 700; }
.col-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.col-silhouette {
    font-size: 48px;
    filter: blur(1px);
    opacity: 0.4;
    margin: 10px 0;
}
.collection-card.locked {
    opacity: 0.55;
    background: repeating-linear-gradient(45deg, var(--panel) 0 10px, var(--panel-2) 10px 20px);
    border-color: rgba(255,255,255,0.05);
}

.species-detail { text-align: center; max-width: 340px; }
.species-big-sprite {
    width: 160px; height: 160px;
    object-fit: contain;
    margin: 0 auto 10px;
    display: block;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.6));
}
.species-summary {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 10px;
    margin-top: 12px;
    font-size: 13px;
    text-align: left;
}
.species-summary div { padding: 3px 0; }
.species-summary b { color: var(--gold); }

/* ---------- Welcome Quests ---------- */

.welcome-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(199,125,255,0.15), rgba(111,208,255,0.1));
    border: 1px solid var(--epic);
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}
.welcome-widget:active { transform: scale(0.98); }
.welcome-widget.has-claim {
    border-color: var(--legendary);
    background: linear-gradient(135deg, rgba(245,182,66,0.2), rgba(255,107,53,0.1));
    animation: claimPulse 1.5s ease infinite;
}
.ww-icon { font-size: 28px; }
.ww-info { flex: 1; }
.ww-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.ww-bar {
    height: 6px;
    background: rgba(0,0,0,0.4);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 3px;
}
.ww-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--epic), var(--legendary));
}
.ww-count { font-size: 11px; color: var(--muted); }
.ww-arrow { font-size: 22px; color: var(--muted); }

.welcome-header {
    background: linear-gradient(135deg, rgba(199,125,255,0.2), rgba(255,200,87,0.15));
    border: 1px solid var(--epic);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
}
.welcome-progress { margin-top: 10px; }
.welcome-bar {
    height: 10px;
    background: rgba(0,0,0,0.4);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 6px;
}
.welcome-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--epic), var(--legendary), var(--mythic));
    transition: width 0.6s;
}
.welcome-count { text-align: center; font-size: 13px; }
.welcome-count b { color: var(--legendary); font-size: 16px; }

.welcome-list { display: flex; flex-direction: column; gap: 8px; }

.welcome-quest {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
}
.welcome-quest.ready {
    border-color: var(--legendary);
    background: linear-gradient(135deg, var(--panel), rgba(245,182,66,0.1));
    animation: claimPulse 1.5s ease infinite;
}
.welcome-quest.claimed {
    opacity: 0.55;
    background: linear-gradient(135deg, var(--panel), rgba(76,175,80,0.06));
    border-color: var(--success);
}

.wq-icon {
    font-size: 28px;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
}
.wq-info { flex: 1; }
.wq-name { font-size: 14px; font-weight: 700; }
.wq-desc { font-size: 11px; color: var(--muted); margin: 2px 0; }
.wq-reward { font-size: 12px; color: var(--gold); font-weight: 600; }
.wq-action { flex-shrink: 0; }
.wq-pending { font-size: 18px; opacity: 0.5; }

.final-reward {
    background: linear-gradient(135deg, #2a0a20, rgba(255,200,87,0.2));
    border: 2px solid var(--legendary);
    border-radius: 16px;
    padding: 18px;
    text-align: center;
    margin-top: 16px;
    animation: perkGlow 2s ease infinite;
}
.final-reward h3 { color: var(--legendary); font-size: 20px; }
.final-rewards-list {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 12px;
    margin: 10px 0;
}
.final-rewards-list div { padding: 4px 0; font-size: 14px; font-weight: 600; color: var(--gold); }

.final-complete {
    text-align: center;
    padding: 20px;
    color: var(--success);
    font-weight: 700;
    background: rgba(76,175,80,0.1);
    border: 1px solid var(--success);
    border-radius: 12px;
    margin-top: 16px;
}

/* ---------- Tournament ---------- */

.tournament-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    background: linear-gradient(135deg, #2a1a40, #150a25);
    border: 1px solid var(--epic);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}
.tournament-time, .tournament-pool { padding: 4px; }
.big-time { font-size: 28px; font-weight: 900; color: var(--legendary); margin-top: 4px; }
.tournament-pool div { font-size: 13px; padding: 2px 0; font-weight: 600; }

.tournament-rule {
    background: rgba(0,0,0,0.3);
    border-left: 3px solid var(--gold);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.6;
    margin-bottom: 14px;
}

.tournament-list { display: flex; flex-direction: column; gap: 5px; }
.tournament-list .lb-row {
    display: grid;
    grid-template-columns: 50px 1fr auto auto;
    gap: 8px;
}
.tour-score { text-align: right; font-size: 11px; }
.tour-score b { display: block; color: var(--legendary); font-size: 14px; }
.tour-score small { color: var(--muted); }
.tour-prize {
    font-size: 10px;
    color: var(--gold);
    background: rgba(245,182,66,0.1);
    padding: 2px 6px;
    border-radius: 6px;
    white-space: nowrap;
}

.unclaimed-rewards {
    background: linear-gradient(135deg, rgba(255,200,87,0.18), rgba(255,107,53,0.1));
    border: 1px solid var(--legendary);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 14px;
    animation: claimPulse 1.5s ease infinite;
}
.unclaimed-rewards h3 { color: var(--legendary); margin-bottom: 10px; }
.unclaimed-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 13px;
}
.claim-tournament { padding: 8px 14px !important; font-size: 13px !important; width: auto !important; margin: 0 !important; }

/* ---------- Airdrop ---------- */

.airdrop-card {
    background: linear-gradient(135deg, #3a1a0d, #1a0a0a);
    border: 1px solid var(--mythic);
    box-shadow: 0 0 24px rgba(255,77,109,0.25);
    position: relative;
    overflow: hidden;
}
.airdrop-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(255,200,87,0.2), transparent 60%);
    pointer-events: none;
}
.airdrop-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    position: relative;
}
.airdrop-badge {
    background: linear-gradient(90deg, var(--mythic), var(--legendary));
    color: #1a0a00;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 100px;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 4px;
}
.airdrop-countdown {
    color: var(--gold);
    font-weight: 700;
    font-size: 14px;
}
.early-bird-badge {
    background: linear-gradient(135deg, var(--legendary), #ff6b35);
    color: #1a0a00;
    font-weight: 800;
    font-size: 10px;
    text-align: center;
    padding: 8px 12px;
    border-radius: 10px;
    animation: pulse 1.5s ease infinite;
}
.airdrop-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
    position: relative;
}
.airdrop-grid > div {
    background: rgba(0,0,0,0.4);
    border-radius: 10px;
    padding: 10px;
}
.airdrop-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.airdrop-val { font-size: 20px; font-weight: 800; color: var(--gold); margin-top: 4px; }
.airdrop-val small { font-size: 11px; color: var(--muted); font-weight: 400; }
.airdrop-progress {
    height: 6px;
    background: rgba(0,0,0,0.5);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}
.airdrop-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--mythic), var(--legendary));
    transition: width 0.6s;
}

.star-pack {
    text-align: center;
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    padding: 16px;
}
.star-pack.premium-pack {
    border-color: var(--legendary);
    background: linear-gradient(135deg, rgba(255,200,87,0.12), rgba(0,0,0,0.4));
    box-shadow: 0 0 20px rgba(255,200,87,0.2);
}
.pack-rewards {
    margin: 10px 0;
    font-size: 13px;
    color: var(--text);
}
.pack-rewards div { padding: 3px 0; }



/* ---------- Shop ---------- */

.shop-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.shop-card {
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 16px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.shop-card::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle at 30% 20%, rgba(255,200,87,0.1), transparent 50%);
    pointer-events: none;
}

.gacha-basic { border-color: rgba(192,192,192,0.3); }
.gacha-rare {
    border-color: var(--rare);
    box-shadow: 0 0 16px rgba(111,182,255,0.15);
    background: linear-gradient(135deg, var(--panel), rgba(40,80,160,0.2));
}
.gacha-epic {
    border-color: var(--epic);
    box-shadow: 0 0 20px rgba(199,125,255,0.2);
    background: linear-gradient(135deg, var(--panel), rgba(90,20,140,0.25));
}
.gacha-mythic {
    border-color: var(--mythic);
    box-shadow: 0 0 26px rgba(255,77,109,0.3);
    background: linear-gradient(135deg, #2a0010, #0d0005);
    animation: mythicPulse 2.5s ease infinite;
}
@keyframes mythicPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255,77,109,0.3); }
    50% { box-shadow: 0 0 40px rgba(255,77,109,0.5); }
}

.gacha-egg-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin: 0 auto 8px;
    display: block;
    filter: drop-shadow(0 4px 14px rgba(0,0,0,0.5));
    animation: gachaFloat 2.8s ease-in-out infinite;
}

@keyframes gachaFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-6px) rotate(2deg); }
}

.gacha-title {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 4px;
}
.gacha-desc {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
}
.gacha-time {
    font-size: 11px;
    color: var(--muted);
    margin-top: 8px;
}

.rate-box {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin: 8px 0;
}

.rate {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 100px;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
}
.rate.rarity-common { color: #c0c0c0; border-color: rgba(192,192,192,0.3); }
.rate.rarity-rare { color: var(--rare); border-color: var(--rare); }
.rate.rarity-epic { color: var(--epic); border-color: var(--epic); }
.rate.rarity-legendary { color: var(--legendary); border-color: var(--legendary); }
.rate.rarity-mythic { color: var(--mythic); border-color: var(--mythic); }

.gacha-buy { margin-top: 10px !important; }

.speedup-card {
    padding: 14px;
}

.btn-mini {
    background: var(--panel-2);
    border: 1px solid var(--gem);
    color: var(--gem);
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 6px;
    font-family: inherit;
}
.btn-mini:active { transform: scale(0.95); }

.speedup-small {
    margin-top: 8px !important;
    padding: 10px !important;
    font-size: 13px !important;
}
.speedup-icon {
    font-size: 42px;
    margin-bottom: 8px;
}

.gacha-spin {
    animation: gachaSpin 0.4s ease-in-out infinite !important;
}
@keyframes gachaSpin {
    0%, 100% { transform: rotate(0) scale(1); }
    25% { transform: rotate(-8deg) scale(1.05); }
    75% { transform: rotate(8deg) scale(1.05); }
}

.gacha-reveal .hatch-dragon {
    border-radius: 24px;
    padding: 6px;
    background: rgba(0,0,0,0.3);
}
.gacha-reveal .hatch-dragon.rarity-border-legendary {
    box-shadow: 0 0 40px rgba(255,200,87,0.7);
    animation: legendaryGlow 1.5s ease infinite;
}
.gacha-reveal .hatch-dragon.rarity-border-mythic {
    box-shadow: 0 0 60px rgba(255,77,109,0.9), 0 0 100px rgba(255,200,87,0.4);
    animation: mythicBirthGlow 1.5s ease infinite;
}

/* ---------- Quests ---------- */

.streak-box {
    background: linear-gradient(135deg, rgba(255,107,53,0.2), rgba(245,182,66,0.15));
    border: 1px solid var(--gold);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    margin-bottom: 14px;
}
.streak-title { font-size: 16px; }
.streak-title b { color: var(--gold); font-size: 20px; }
.streak-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.progress-header {
    display: flex;
    justify-content: space-between;
    padding: 4px 4px 10px;
    font-size: 14px;
    color: var(--muted);
}
.progress-header b { color: var(--text); }

.quest-list { display: flex; flex-direction: column; gap: 10px; }

.quest-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s;
}
.quest-card.complete {
    border-color: var(--gold);
    background: linear-gradient(135deg, var(--panel), rgba(245,182,66,0.12));
    box-shadow: 0 0 12px rgba(245,182,66,0.2);
}
.quest-card.claimed {
    opacity: 0.6;
    background: linear-gradient(135deg, var(--panel), rgba(76,175,80,0.08));
    border-color: var(--success);
}

.quest-icon {
    font-size: 30px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    flex-shrink: 0;
}

.quest-body { flex: 1; min-width: 0; }
.quest-name {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}
.quest-progress-bar {
    height: 5px;
    background: rgba(0,0,0,0.5);
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 0;
}
.quest-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), #ff6b35);
    transition: width 0.4s;
}
.quest-progress-text { font-size: 11px; color: var(--muted); }

.quest-reward { flex-shrink: 0; text-align: right; }
.reward-text { font-size: 12px; color: var(--gold); font-weight: 700; }
.badge-done { font-size: 20px; }

.btn-claim {
    background: linear-gradient(135deg, var(--gold), #ff6b35);
    color: #1a0a00;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    animation: claimPulse 1.2s ease infinite;
}
@keyframes claimPulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(245,182,66,0.5); }
    50% { box-shadow: 0 0 14px rgba(245,182,66,0.8); }
}
.btn-claim:active { transform: scale(0.95); }

/* Streak modal */

.streak-modal { text-align: center; }
.streak-fire { font-size: 64px; animation: fireBounce 1s ease infinite; }
@keyframes fireBounce {
    0%,100% { transform: scale(1) rotate(-5deg); }
    50% { transform: scale(1.15) rotate(5deg); }
}
.streak-reward {
    background: linear-gradient(135deg, rgba(245,182,66,0.2), rgba(255,107,53,0.2));
    border: 1px solid var(--gold);
    border-radius: 14px;
    padding: 14px;
    margin: 14px 0;
    font-size: 20px;
    font-weight: 800;
    color: var(--gold);
}

/* ---------- Achievements ---------- */

.ach-summary {
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    text-align: center;
    margin-bottom: 14px;
}
.ach-summary-num {
    font-size: 32px;
    font-weight: 900;
    color: var(--gold);
}
.ach-summary-label {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 8px;
}
.ach-claimable-banner {
    background: linear-gradient(90deg, rgba(245,182,66,0.2), rgba(255,107,53,0.2));
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 8px;
    font-size: 13px;
    color: var(--legendary);
    font-weight: 700;
    animation: claimPulse 1.5s ease infinite;
    margin-top: 10px;
}

.ach-categories { display: flex; flex-direction: column; gap: 20px; }

.ach-cat-header {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}
.cat-badge {
    background: var(--mythic);
    color: white;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 100px;
    animation: badgeBounce 0.5s ease;
}

.ach-grid { display: flex; flex-direction: column; gap: 8px; }

.ach-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s;
    position: relative;
    overflow: hidden;
}

.ach-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.ach-card.tier-bronze::before { background: #cd7f32; }
.ach-card.tier-silver::before { background: #c0c0c0; }
.ach-card.tier-gold::before { background: #ffd700; }
.ach-card.tier-platinum::before { background: linear-gradient(180deg, #e5e5f9, #8b8bc7); }

.ach-card.unlocked {
    border-color: var(--gold);
    background: linear-gradient(135deg, var(--panel), rgba(245,182,66,0.08));
}
.ach-card.claimable {
    border-color: var(--legendary);
    box-shadow: 0 0 14px rgba(255,200,87,0.3);
    background: linear-gradient(135deg, var(--panel), rgba(245,182,66,0.18));
    animation: claimPulse 1.5s ease infinite;
}
.ach-card.claimed {
    opacity: 0.55;
    background: linear-gradient(135deg, var(--panel), rgba(76,175,80,0.06));
    border-color: var(--success);
}

.ach-icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    border-radius: 12px;
    flex-shrink: 0;
}
.ach-card.unlocked .ach-icon,
.ach-card.claimable .ach-icon {
    background: linear-gradient(135deg, rgba(245,182,66,0.25), rgba(255,107,53,0.2));
}

.ach-body { flex: 1; min-width: 0; }
.ach-name { font-size: 14px; font-weight: 700; }
.ach-desc { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.ach-progress-bar {
    height: 5px;
    background: rgba(0,0,0,0.4);
    border-radius: 3px;
    overflow: hidden;
}
.ach-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), #ff6b35);
    transition: width 0.5s;
}
.ach-progress-text { font-size: 10px; color: var(--muted); margin-top: 2px; }

.ach-action { flex-shrink: 0; text-align: right; min-width: 60px; }
.ach-reward-text { font-size: 11px; color: var(--gold); font-weight: 700; }

/* Unlock modal */

.ach-unlock { text-align: center; }
.ach-trophy {
    font-size: 80px;
    animation: trophySpin 2s ease;
    filter: drop-shadow(0 0 30px rgba(245,182,66,0.8));
}
@keyframes trophySpin {
    0% { transform: scale(0.2) rotate(0); }
    50% { transform: scale(1.3) rotate(360deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.ach-tier-label {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.3);
}
.ach-unlock.tier-bronze .ach-tier-label { color: #cd7f32; border: 1px solid #cd7f32; }
.ach-unlock.tier-silver .ach-tier-label { color: #c0c0c0; border: 1px solid #c0c0c0; }
.ach-unlock.tier-gold .ach-tier-label { color: #ffd700; border: 1px solid #ffd700; }
.ach-unlock.tier-platinum .ach-tier-label { color: #8b8bc7; border: 1px solid #8b8bc7; }

/* ---------- Leaderboard ---------- */

.my-rank-box {
    background: linear-gradient(135deg, var(--panel), rgba(245,182,66,0.15));
    border: 1px solid var(--gold);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    margin-bottom: 12px;
    font-size: 14px;
}
.my-rank-box b { color: var(--gold); font-size: 18px; }

.lb-list { display: flex; flex-direction: column; gap: 6px; }

.lb-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
}
.lb-row.top { border-color: var(--gold); background: linear-gradient(135deg, var(--panel), rgba(245,182,66,0.08)); }
.lb-row.is-me { border-color: var(--gem); background: linear-gradient(135deg, rgba(111,208,255,0.15), var(--panel)); }

.lb-rank { font-size: 18px; font-weight: 800; width: 50px; text-align: center; }
.lb-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-tag { color: var(--gem); font-size: 11px; }
.lb-score { font-weight: 700; color: var(--gold); white-space: nowrap; }

/* ---------- PvP ---------- */

.pvp-info {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    font-size: 14px;
}
.pvp-info p { margin-bottom: 4px; }

.matchmaking {
    padding: 60px 20px;
    text-align: center;
    font-size: 16px;
    color: var(--gold);
    animation: matchPulse 1.5s ease infinite;
}
@keyframes matchPulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---------- Profile ---------- */

.profile-hero {
    text-align: center;
    padding: 20px 0;
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 1px solid var(--border);
    border-radius: 18px;
    margin-bottom: 12px;
}
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #ff6b35);
    color: #1a0a00;
    font-size: 36px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.profile-hero h3 { margin-bottom: 4px; }

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}
.pstat {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 4px;
    text-align: center;
}
.pstat span { font-size: 20px; display: block; }
.pstat b { font-size: 16px; color: var(--gold); display: block; margin-top: 2px; }
.pstat small { font-size: 9px; color: var(--muted); display: block; }

.settings-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 12px;
}
.settings-card h3 { margin-bottom: 10px; font-size: 15px; }

.inline-row {
    display: flex;
    gap: 8px;
}
.inline-row input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
}
.btn-inline {
    margin-top: 0 !important;
    width: auto !important;
    padding: 10px 16px !important;
    font-size: 13px !important;
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    cursor: pointer;
}
.toggle-row:first-of-type { border-top: none; }
.toggle-row input[type=checkbox] {
    appearance: none;
    width: 44px;
    height: 24px;
    background: rgba(0,0,0,0.4);
    border-radius: 100px;
    border: 1px solid var(--border);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-row input[type=checkbox]::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    transition: left 0.2s;
}
.toggle-row input[type=checkbox]:checked {
    background: var(--gold);
}
.toggle-row input[type=checkbox]:checked::before {
    left: 22px;
}

/* ---------- More menu ---------- */

.more-menu {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.more-menu.hidden { display: none; }

.more-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.more-panel {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.more-item {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}
.more-item:active { transform: scale(0.98); }
.more-item.more-close {
    background: rgba(255,77,109,0.1);
    border-color: var(--danger);
    color: var(--danger);
    justify-content: center;
}

/* ---------- Tutorial ---------- */

.tutorial-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5,5,15,0.88);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.25s ease;
}
.tutorial-overlay.hidden { display: none; }

.tutorial-tooltip {
    background: linear-gradient(135deg, var(--panel), var(--panel-2));
    border: 2px solid var(--gold);
    border-radius: 22px;
    padding: 28px 22px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 40px rgba(245,182,66,0.2);
    animation: tutIn 0.35s ease;
}
@keyframes tutIn {
    from { opacity: 0; transform: scale(0.85); }
    to { opacity: 1; transform: scale(1); }
}

.tut-dragon {
    font-size: 56px;
    margin-bottom: 10px;
    animation: tutBounce 1.2s ease infinite;
    display: block;
}
@keyframes tutBounce {
    0%,100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-6px) rotate(3deg); }
}

.tutorial-tooltip h3 {
    font-size: 20px;
    margin-bottom: 10px;
    color: var(--gold);
}
.tutorial-tooltip p {
    font-size: 15px;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 16px;
}

.tut-progress-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 18px;
}
.tut-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: all 0.2s;
}
.tut-dot.passed { background: rgba(245,182,66,0.5); }
.tut-dot.active {
    background: var(--gold);
    width: 24px;
    border-radius: 4px;
}

.tut-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}
.tut-actions .btn {
    margin: 0 !important;
    width: auto !important;
    flex: 1;
    padding: 12px 18px !important;
    font-size: 15px !important;
}
.btn-ghost {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 12px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
}
.btn-ghost:active { transform: scale(0.95); }

.mono { font-family: 'Courier New', monospace; font-size: 12px; }
@keyframes legendaryGlow {
    0%,100% { box-shadow: 0 0 40px rgba(255,200,87,0.5); }
    50% { box-shadow: 0 0 70px rgba(255,200,87,0.9); }
}
@keyframes mythicBirthGlow {
    0%,100% { box-shadow: 0 0 60px rgba(255,77,109,0.7), 0 0 100px rgba(255,200,87,0.3); }
    50% { box-shadow: 0 0 100px rgba(255,77,109,1), 0 0 140px rgba(255,200,87,0.6); }
}
