/* =========================================================
   Beast Brawl styles
   Each theme is one block of colours below. Every part of the
   page reads these variables, so a new theme = one new block
   (plus an entry in THEMES in logic/settings_logic.py).
   ========================================================= */

:root,
[data-theme="classic"] {
    --bg: #f4f5f7;
    --bg-art: radial-gradient(circle at 10% 0%, #ffe3dc 0, transparent 40%),
              radial-gradient(circle at 100% 100%, #dfe8ff 0, transparent 45%);
    --surface: #ffffff;
    --surface-2: #f1f2f5;
    --text: #1d2130;
    --muted: #6b7183;
    --border: #e3e5ea;
    --accent: #e3350d;
    --accent-hover: #c42c09;
    --accent-text: #ffffff;
    --accent-2: #3b5bdb;
    --play-a: #e3350d;
    --play-b: #3b5bdb;
    --play-c: #e8590c;
    --topbar: #e3350d;
    --topbar-text: #ffffff;
    --shadow: 0 6px 20px rgba(20, 24, 40, 0.08);
}

[data-theme="dark"] {
    --bg: #141113;
    --bg-art: radial-gradient(circle at 0% 0%, #4a1418 0, transparent 45%),
              radial-gradient(circle at 100% 100%, #3a1015 0, transparent 45%);
    --surface: #1f1a1c;
    --surface-2: #2c2326;
    --text: #f1eced;
    --muted: #b09ea2;
    --border: #45292e;
    --accent: #ff4d55;
    --accent-hover: #ff6e75;
    --accent-text: #ffffff;
    --accent-2: #ff8a8f;
    --play-a: #e63946;
    --play-b: #c1121f;
    --play-c: #9d0208;
    --topbar: linear-gradient(90deg, #7a0f16, #b3141e);
    --topbar-text: #ffffff;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

[data-theme="ocean"] {
    --bg: #072a40;
    --bg-art: radial-gradient(circle at 100% 0%, #0f5f7d 0, transparent 45%),
              radial-gradient(circle at 0% 100%, #0b4a63 0, transparent 45%);
    --surface: #0b3954;
    --surface-2: #104a6b;
    --text: #e6f7fb;
    --muted: #9cc7d6;
    --border: #175a7e;
    --accent: #22c1c3;
    --accent-hover: #3fd6d8;
    --accent-text: #04222f;
    --accent-2: #fdbb2d;
    --play-a: #1aa3a5;
    --play-b: #1f5fa8;
    --play-c: #3a86d6;
    --topbar: #0b3954;
    --topbar-text: #e6f7fb;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="forest"] {
    --bg: #cfdcc8;
    --bg-art: radial-gradient(circle at 0% 0%, #b9cfae 0, transparent 45%),
              radial-gradient(circle at 100% 100%, #d9c8a8 0, transparent 45%);
    --surface: #e6ede0;
    --surface-2: #d3dfcb;
    --text: #1a2e1f;
    --muted: #4f6554;
    --border: #bccdb3;
    --accent: #2f7d4a;
    --accent-hover: #24633a;
    --accent-text: #ffffff;
    --accent-2: #a87b3f;
    --play-a: #2f7d4a;
    --play-b: #8a5a2b;
    --play-c: #5b8c3a;
    --topbar: #2f5d3a;
    --topbar-text: #ffffff;
    --shadow: 0 6px 20px rgba(31, 51, 36, 0.1);
}

[data-theme="candy"] {
    --bg: #fff1f7;
    --bg-art: radial-gradient(circle at 0% 0%, #ffd6ea 0, transparent 45%),
              radial-gradient(circle at 100% 100%, #e6dcff 0, transparent 45%);
    --surface: #ffffff;
    --surface-2: #fde6f1;
    --text: #4a2341;
    --muted: #8f6a86;
    --border: #f6d3e4;
    --accent: #ff4f9a;
    --accent-hover: #e63a85;
    --accent-text: #ffffff;
    --accent-2: #8b6cff;
    --play-a: #ff4f9a;
    --play-b: #8b6cff;
    --play-c: #d6589f;
    --topbar: linear-gradient(90deg, #ff6fae, #b69cff);
    --topbar-text: #ffffff;
    --shadow: 0 6px 20px rgba(255, 79, 154, 0.12);
}

[data-theme="sunset"] {
    --bg: #ffb36b;
    --bg-art: radial-gradient(ellipse at 50% 100%, #fff1a8 0, #ffd36e 18%, transparent 45%),
              linear-gradient(180deg, #ffcf6b 0%, #ffad5c 40%, #ff8a5c 75%, #ff6f61 100%);
    --surface: #fff3e0;
    --surface-2: #ffe2bf;
    --text: #40200f;
    --muted: #8a5a3c;
    --border: #f7c891;
    --accent: #f26a1b;
    --accent-hover: #d95a10;
    --accent-text: #ffffff;
    --accent-2: #e0453a;
    --play-a: #f26a1b;
    --play-b: #e0453a;
    --play-c: #f59e0b;
    --topbar: linear-gradient(90deg, #ffb703, #fb8500 50%, #f3533a);
    --topbar-text: #ffffff;
    --shadow: 0 6px 20px rgba(160, 60, 10, 0.18);
}

[data-theme="galaxy"] {
    --bg: #0d0820;
    --bg-art:
        /* small stars, 160px tile */
        radial-gradient(circle at 12px 18px, #fff 0 1px, transparent 1.5px),
        radial-gradient(circle at 75px 42px, #e9e2ff 0 1px, transparent 1.5px),
        radial-gradient(circle at 130px 95px, #fff 0 1px, transparent 1.5px),
        radial-gradient(circle at 40px 120px, #cfe8ff 0 1px, transparent 1.5px),
        radial-gradient(circle at 105px 150px, #fff 0 0.8px, transparent 1.3px),
        /* medium stars, 230px tile */
        radial-gradient(circle at 60px 70px, #fff 0 1.4px, transparent 2px),
        radial-gradient(circle at 190px 30px, #d8c8ff 0 1.3px, transparent 2px),
        radial-gradient(circle at 150px 200px, #fff 0 1.4px, transparent 2px),
        /* bright stars, 370px tile */
        radial-gradient(circle at 90px 260px, #fff 0 2px, rgba(200, 180, 255, 0.4) 3px, transparent 5px),
        radial-gradient(circle at 300px 80px, #fff 0 1.8px, rgba(180, 220, 255, 0.4) 3px, transparent 5px),
        /* nebula glow */
        radial-gradient(circle at 80% 0%, #3b1d7a 0, transparent 50%),
        radial-gradient(circle at 0% 100%, #1d2b7a 0, transparent 50%);
    --bg-size: 160px 160px, 160px 160px, 160px 160px, 160px 160px, 160px 160px,
               230px 230px, 230px 230px, 230px 230px,
               370px 370px, 370px 370px,
               100% 100%, 100% 100%;
    --surface: #1a1035;
    --surface-2: #261a4a;
    --text: #efe9ff;
    --muted: #a99bd1;
    --border: #33255e;
    --accent: #b388ff;
    --accent-hover: #c9a8ff;
    --accent-text: #1a1035;
    --accent-2: #5ee0ff;
    --play-a: #8f5cff;
    --play-b: #3b5bdb;
    --play-c: #c15cff;
    --topbar: #1a1035;
    --topbar-text: #efe9ff;
    --shadow: 0 0 24px rgba(179, 136, 255, 0.15);
}


/* ---------------- Page ---------------- */

body {
    background-color: var(--bg);
    background-image: var(--bg-art);
    background-attachment: fixed;
    background-size: var(--bg-size, auto);
    color: var(--text);
    font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
    min-height: 100vh;
    margin: 0;
}

h1, h2, h3, h4, h5 {
    font-family: "Fredoka", "Nunito", "Segoe UI", system-ui, sans-serif;
    font-weight: 600;
    letter-spacing: 0.3px;
}

a { color: var(--accent-2); }

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

.section-title {
    font-size: 1.15rem;
    margin: 28px 0 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

.muted { color: var(--muted); }


/* ---------------- Top bar ---------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--topbar);
    color: var(--topbar-text);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.topbar-title {
    flex: 1;
    font-family: "Fredoka", "Nunito", sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    width: 42px;
    height: 42px;
    flex: none;
    border-radius: 12px;
    border: 0;
    background: rgba(255, 255, 255, 0.18);
    color: inherit;
    font-size: 1.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.3); color: inherit; }

.pills { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 5px 12px;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
}


/* ---------------- Cards ---------------- */

.box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 20px;
    color: var(--text);
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.grid-sm { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }


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

.btn-game {
    background: var(--accent);
    color: var(--accent-text);
    border: 0;
    border-radius: 12px;
    font-weight: 700;
    padding: 10px 16px;
    transition: background 0.15s, transform 0.1s;
}
.btn-game:hover, .btn-game:focus { background: var(--accent-hover); color: var(--accent-text); }
.btn-game:active { transform: scale(0.97); }
.btn-game:disabled { opacity: 0.45; background: var(--accent); color: var(--accent-text); }

.btn-soft {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
    padding: 10px 16px;
}
.btn-soft:hover, .btn-soft:focus { background: var(--border); color: var(--text); }
.btn-soft:disabled { opacity: 0.5; color: var(--text); }


/* ---------------- Dashboard ---------------- */

.hero {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}
@media (min-width: 768px) {
    .hero { grid-template-columns: 1.3fr 1fr; }
}

.welcome h1 { font-size: 2rem; margin: 0 0 6px; }

.stat-row { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.stat {
    flex: 1;
    min-width: 110px;
    background: var(--surface-2);
    border-radius: 14px;
    padding: 12px 14px;
}
.stat-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.stat-value { font-size: 1.6rem; font-weight: 800; font-family: "Fredoka", "Nunito", sans-serif; }

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 130px;
    text-decoration: none;
    color: var(--text);
    font-weight: 800;
    font-size: 1.1rem;
    transition: transform 0.15s, border-color 0.15s;
}
.tile:hover { transform: translateY(-3px); border-color: var(--accent); color: var(--text); }
.tile-icon { font-size: 2.4rem; line-height: 1; }
.tile small { font-weight: 600; color: var(--muted); font-size: 0.85rem; }


/* ---------------- Beasts ---------------- */

.mon-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.mon-name { font-size: 1.35rem; margin: 0; }
.mon-sub { color: var(--muted); font-weight: 600; font-size: 0.95rem; }

.badge-rarity {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fff;
    white-space: nowrap;
}
.r-common    { background: #8a919c; }
.r-uncommon  { background: #2fa85a; }
.r-rare      { background: #2f74e0; }
.r-epic      { background: #9b4dea; }
.r-mythic    { background: #e0418c; }
.r-ancient   { background: linear-gradient(90deg, #1f9e8f, #8a6a3b); }
.r-legendary { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.r-divine    { background: linear-gradient(90deg, #f7d774, #fff6d8, #c7b8ff); color: #4a3a00; }

.badge-active {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    background: var(--accent);
    color: var(--accent-text);
}

.hp-bar {
    height: 10px;
    background: var(--surface-2);
    border-radius: 999px;
    overflow: hidden;
    margin: 6px 0 4px;
}
.hp-fill { height: 100%; background: linear-gradient(90deg, #22c55e, #84cc16); border-radius: 999px; }
.hp-fill.low { background: linear-gradient(90deg, #ef4444, #f97316); }
.sta-bar { height: 7px; margin-top: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.sta-fill { height: 100%; background: linear-gradient(90deg, #f59e0b, #facc15); border-radius: 999px; transition: width 0.4s; }
.sta-fill.low { background: linear-gradient(90deg, #a16207, #ca8a04); }
.sta-text { font-size: 0.8rem; }

.mini-stats { display: flex; gap: 14px; font-weight: 700; margin: 8px 0 14px; flex-wrap: wrap; }
.mini-stats span { color: var(--muted); font-weight: 600; }

.mon-card.is-active { border: 2px solid var(--accent); }


/* ---------------- Chests ---------------- */

.chest {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}
.chest-art {
    width: 84px;
    height: 64px;
    border-radius: 12px 12px 8px 8px;
    position: relative;
    box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.18);
}
.chest-art::before {               /* lid line */
    content: "";
    position: absolute;
    left: 0; right: 0; top: 22px;
    height: 4px;
    background: rgba(0, 0, 0, 0.25);
}
.chest-art::after {                /* lock */
    content: "";
    position: absolute;
    left: 50%; top: 16px;
    width: 14px; height: 16px;
    margin-left: -7px;
    border-radius: 3px;
    background: #ffe08a;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
}
.starter-chest  { background: linear-gradient(135deg, #5fd17c, #2f9e57); }
.wooden-chest   { background: linear-gradient(135deg, #a0693a, #7a4b25); }
.iron-chest     { background: linear-gradient(135deg, #c9ced6, #8c939e); }
.gold-chest     { background: linear-gradient(135deg, #ffe066, #e0a800); }
.mythic-chest   { background: linear-gradient(135deg, #b14cf0, #e0418c); }
.silver-chest   { background: linear-gradient(135deg, #f1f4f8, #a9b4c2); }
.ancient-chest  { background: linear-gradient(135deg, #2bb3a3, #8a6a3b); }
.divine-chest   { background: linear-gradient(135deg, #fffbe6, #ffd76a, #f5f0ff); }
.ultimate-chest { background: linear-gradient(135deg, #ef4444, #f59e0b, #22c55e, #3b82f6); }   /* old name, kept for old pages */

.key-count { font-weight: 700; color: var(--muted); }

.reward {
    text-align: center;
    border: 2px solid var(--accent);
    animation: pop 0.35s ease-out;
}
.reward h2 { margin: 6px 0; }
@keyframes pop {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}


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

.item { display: flex; flex-direction: column; gap: 10px; text-align: center; align-items: center; }
.item-icon { font-size: 2.2rem; line-height: 1; }
.price { font-weight: 800; font-size: 1.1rem; }
.count { font-size: 1.8rem; font-weight: 800; font-family: "Fredoka", "Nunito", sans-serif; }


/* ---------------- Forms ---------------- */

.form-control, .form-select {
    background-color: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
}
.form-control:focus, .form-select:focus {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.form-text { color: var(--muted); }
.form-label { font-weight: 700; }


/* ---------------- Messages ---------------- */

.note {
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-weight: 700;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 6px solid var(--accent-2);
    box-shadow: var(--shadow);
}
.note.success { border-left-color: #22c55e; }
.note.error   { border-left-color: #ef4444; }


/* ---------------- Settings panel ---------------- */

.offcanvas {
    background: var(--surface);
    color: var(--text);
    max-width: 92vw;
}
.offcanvas .btn-close { filter: var(--close-filter, none); }
[data-bs-theme="dark"] .offcanvas .btn-close { filter: invert(1); }

.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.theme-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 12px;
    border: 2px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-weight: 700;
    text-align: left;
}
.theme-btn:hover { border-color: var(--accent); }
.theme-btn.current { border-color: var(--accent); }
.swatch { display: inline-flex; flex: none; }
.swatch i {
    width: 18px; height: 18px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid var(--border);
}
.swatch i + i { margin-left: -6px; }

.modal-content {
    background: var(--surface);
    color: var(--text);
    border-radius: 18px;
    border: 1px solid var(--border);
}


/* ---------------- Login pages ---------------- */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}
.auth-card { width: 100%; max-width: 410px; }
.brand { text-align: center; margin-bottom: 18px; }
.brand h1 { font-size: 2.2rem; margin: 10px 0 0; }

.brand-badge {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
    background: #fff;
    border: 4px solid var(--accent);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    transform: rotate(-6deg);
}


/* ---------------- Types ---------------- */

.badge-type {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    background: var(--type-color, #8a919c);
    white-space: nowrap;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
    vertical-align: middle;
}
.type-card { border-top: 6px solid var(--type-color); }
.type-line { margin-bottom: 12px; }
.type-line .badge-type { margin: 0 4px 4px 0; }
.type-label {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin-bottom: 4px;
}


/* ---------------- Beasts page toolbar ---------------- */

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px;
    margin-bottom: 12px;
}
.toolbar input { flex: 2 1 220px; }
.toolbar select { flex: 1 1 170px; }
.mon-group { margin-bottom: 22px; }
.group-head { font-size: 1.2rem; margin: 6px 0 12px; }
.group-head .badge-type { font-size: 1rem; padding: 5px 14px; }


/* ---------------- SPs (special powers) + roles ---------------- */

.badge-sp {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--accent-2);
    white-space: nowrap;
    vertical-align: middle;
}
.badge-sp.legend, .sp-card.legend { border-color: #f59e0b; }
.badge-sp.legend { background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(239, 68, 68, 0.18)); }
.sp-card {
    background: var(--surface-2);
    border: 2px solid var(--accent-2);
    border-radius: 14px;
    padding: 12px 14px;
}
.sp-kind { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; color: var(--muted); text-align: right; }
.perk-list { margin: 0; padding-left: 1.2rem; }
.perk-list li { margin-bottom: 2px; }



/* =========================================================
   PLAY BUTTONS (dashboard) - base look, used by every style
   ========================================================= */

.play-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}
.play-btn {
    position: relative;
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    min-height: 120px;
    padding: 14px 8px;
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: "Fredoka", "Nunito", sans-serif;
    font-weight: 600;
    box-shadow: var(--shadow);
    -webkit-tap-highlight-color: transparent;
}
.play-icon { font-size: 2.6rem; line-height: 1; }
.play-label { font-size: 1.35rem; letter-spacing: 0.5px; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); }
/* colours come from the theme (darkened a bit so white text stays readable) */
.play-battle   { --play: var(--play-a); }
.play-campaign { --play: var(--play-b); }
.play-practice { --play: var(--play-c); }
.play-btn { --play-bg: linear-gradient(160deg, color-mix(in srgb, var(--play) 92%, #000), color-mix(in srgb, var(--play) 64%, #000)); }
.play-btn { background: var(--play-bg); }
.play-row.two { grid-template-columns: repeat(2, 1fr); }
.play-btn.big { min-height: 190px; }
.play-btn.big .play-icon { font-size: 3.4rem; }
[data-style="fancy"] .play-btn.big .play-icon { width: 92px; height: 92px; font-size: 3rem; }
@media (max-width: 480px) {
    .play-btn.big { min-height: 160px; }
    .play-btn.big .play-icon { font-size: 2.6rem; }
    [data-style="fancy"] .play-btn.big .play-icon { width: 70px; height: 70px; font-size: 2.2rem; }
}
.play-sub { font-family: "Nunito", "Segoe UI", sans-serif; font-weight: 700; font-size: 0.9rem; opacity: 0.9; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
a.play-btn, a.play-btn:hover { color: #fff; }
@media (max-width: 480px) {
    .play-row { gap: 8px; }
    .play-btn { min-height: 96px; }
    .play-icon { font-size: 2rem; }
    .play-label { font-size: 1.05rem; }
}


/* =========================================================
   CHOICE BUTTONS (Host page) - tap one, it lights up
   ========================================================= */

.host-form { max-width: 640px; margin: 0 auto; }
.host-form .section-title { margin-top: 22px; }
.choice-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}
.choice { flex: 1 1 0; min-width: 0; max-width: 220px; cursor: pointer; margin: 0; }
.choice.num { flex: 0 0 76px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    height: 100%;
    min-height: 64px;
    padding: 10px 8px;
    text-align: center;
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 14px;
    transition: transform 0.15s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.choice b { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600; font-size: 1.2rem; }
.choice.num b { font-size: 1.7rem; }
.choice small { color: var(--muted); font-weight: 700; font-size: 0.8rem; line-height: 1.2; }
.choice.big span { min-height: 84px; }
.choice:hover span { border-color: var(--accent); transform: translateY(-2px); }
.choice input:focus-visible + span { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.choice input:checked + span {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-text);
}
.choice input:checked + span small { color: var(--accent-text); opacity: 0.85; }
.create-btn { min-width: 220px; font-size: 1.1rem; padding: 12px 24px; }
@media (max-width: 480px) {
    .choice-row { gap: 8px; }
    .choice b { font-size: 1.05rem; }
    .choice small { font-size: 0.72rem; }
}

/* Classic: bouncy pill with a shadow */
[data-style="classic"] .choice span { box-shadow: 0 3px 0 var(--border); border-radius: 18px; }
[data-style="classic"] .choice input:checked + span {
    box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 60%, #000);
    animation: icon-pop 0.35s ease;
}
/* Fancy: cut corners and a glow when picked */
[data-style="fancy"] .choice span {
    border-radius: 4px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    background: linear-gradient(160deg, var(--surface-2), var(--surface));
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s, border-color 0.2s;
}
[data-style="fancy"] .choice input:checked + span {
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent));
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.22);
    transform: scale(1.04);
}
/* Simple: flat, square-ish */
[data-style="simple"] .choice span { border-radius: 8px; }


/* Waiting room */
.room-code { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 3rem; letter-spacing: 10px; line-height: 1.1; color: var(--accent-2); }
.room-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.room-team-title { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600; text-align: center; margin-bottom: 8px; }
.room-list, .room-team { padding: 12px; }
.room-player {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    min-height: 48px; padding: 6px 12px; margin-bottom: 8px;
    background: var(--surface-2); border: 2px solid var(--border); border-radius: 12px; font-weight: 700;
}
.room-player:last-child { margin-bottom: 0; }
.room-player.me { border-color: var(--accent); }
.room-player.empty { justify-content: center; border-style: dashed; color: var(--muted); background: transparent; font-weight: 600; }
.room-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-move { padding: 4px 10px; line-height: 1.2; }
@media (max-width: 480px) {
    .room-teams { gap: 8px; }
    .room-code { font-size: 2.4rem; letter-spacing: 6px; }
    .room-team .room-player { padding: 6px 8px; font-size: 0.9rem; }
}
[data-style="classic"] .room-player.empty { animation: room-wait 1.6s ease-in-out infinite; }
@keyframes room-wait { 50% { opacity: 0.5; } }
[data-style="fancy"] .room-player { border-radius: 4px; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
[data-style="fancy"] .room-player.empty { animation: room-wait 1.6s ease-in-out infinite; }
[data-style="fancy"] .room-code { text-shadow: 0 0 18px color-mix(in srgb, var(--accent-2) 60%, transparent); }


/* Join page */
.code-form { display: flex; gap: 10px; max-width: 340px; margin: 0 auto; }
.code-input {
    flex: 1; min-width: 0; text-align: center; text-transform: uppercase;
    font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 1.6rem; letter-spacing: 8px;
}
.code-input::placeholder { letter-spacing: 6px; opacity: 0.4; }
.code-form .btn-game { padding-left: 22px; padding-right: 22px; font-size: 1.1rem; }
.filter-label { text-align: center; color: var(--muted); font-weight: 800; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.small-choices { gap: 8px; }
.small-choices .choice { flex: 0 1 90px; }
.small-choices .choice span { min-height: 40px; padding: 6px 8px; }
.small-choices .choice b { font-size: 1rem; }
.rarity-choices .choice { flex: 1 1 28%; max-width: 31%; }      /* 6 rarity buttons: 3 a row, so they never overlap */
.rarity-select { width: auto; min-width: 140px; }
.only-open { font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.only-open input { width: 18px; height: 18px; accent-color: var(--accent); }
.game-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.game-card {
    width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 14px 10px; background: var(--surface); color: var(--text);
    border: 2px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
    transition: transform 0.15s, border-color 0.15s;
}
.game-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--accent); }
.game-card:active:not(:disabled) { transform: scale(0.97); }
.game-mode { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 1.7rem; line-height: 1.1; }
.game-line { font-weight: 700; font-size: 0.9rem; color: var(--muted); }
.game-tag { margin-top: 6px; font-size: 0.78rem; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); }
.game-tag.go { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.game-card.locked { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.game-card.mine { border-color: var(--accent-2); }
@media (max-width: 480px) {
    .game-list { grid-template-columns: 1fr 1fr; gap: 8px; }
    .small-choices .choice { flex: 1 1 0; }
    .rarity-choices .choice { flex: 1 1 28%; max-width: 31%; }
}
[data-style="classic"] .game-card { border-radius: 20px; box-shadow: 0 4px 0 var(--border); }
[data-style="classic"] .game-card:hover:not(:disabled) .game-mode { animation: icon-pop 0.4s ease; }
[data-style="fancy"] .game-card {
    border-radius: 4px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08);
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
    background: linear-gradient(160deg, var(--surface-2), var(--surface));
}
[data-style="simple"] .game-card { box-shadow: none; border-radius: 10px; }


/* Pick screen */
.host-form.wide { max-width: 1000px; }
.pick-timer { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 2rem; line-height: 1; }
.pick-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 8px auto 0; max-width: 360px; }
.pick-bar > div { height: 100%; background: var(--accent); transition: width 1s linear; }
.pick-players { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pick-player { padding: 3px 10px; border-radius: 99px; border: 2px solid var(--border); font-weight: 700; font-size: 0.9rem; }
.pick-player.ready { border-color: #22c55e; }
.pick-tray { text-align: center; position: sticky; top: 64px; z-index: 5; background: var(--surface); border: 2px solid var(--border); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); }
.pick-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; background: var(--accent); color: var(--accent-text); font-weight: 800; }
.pick-chip.empty { background: transparent; color: var(--muted); border: 2px dashed var(--border); }
.pick-card { position: relative; width: 100%; text-align: left; color: var(--text); cursor: pointer; }
[data-style] .pick-card.picked { border: 2px solid var(--accent) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent) !important; }
.pick-card.fainted { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.8); }
.pick-num { position: absolute; top: -10px; left: -10px; width: 32px; height: 32px; border-radius: 50%; display: none;
    align-items: center; justify-content: center; background: var(--accent); color: var(--accent-text); font-weight: 800; z-index: 2; }
.pick-card.picked .pick-num { display: flex; }
.pick-faint { margin-top: 8px; font-weight: 800; color: #ef4444; text-align: center; }
.pick-order-list { display: inline-block; text-align: left; margin: 0 0 8px; }
[data-style="fancy"] .pick-card.picked .pick-num { border-radius: 4px; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); width: 38px; height: 38px; top: -12px; left: -12px; }
[data-style="classic"] .pick-card.picked { animation: icon-pop 0.3s ease; }


/* Battle screen */
.bt-wrap { max-width: 1150px; margin: 0 auto; position: relative; }
.bt-banner {
    display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
    font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600; font-size: 1.3rem;
    padding: 10px 16px; margin-bottom: 14px; border-radius: 14px;
    background: var(--surface); border: 2px solid var(--border); text-align: center;
}
.bt-banner.go { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.bt-timer { font-size: 1.1rem; padding: 2px 12px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); min-width: 56px; }
.bt-timer.low { color: #fff; background: #ef4444; border-color: #ef4444; }
.bt-layout { display: grid; grid-template-columns: 1fr 280px; gap: 14px; align-items: start; }
.bt-field { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
.bt-side { display: flex; flex-direction: column; gap: 12px; }
.bt-vs { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 1.8rem; color: var(--accent-2);
    display: flex; flex-direction: column; align-items: center; gap: 6px; transition: padding 0.6s cubic-bezier(.3,.8,.3,1); }
/* distance: the cards slide together (Close) or apart (Far) */
.bt-field[data-dist="0"] .bt-vs { padding: 0 2px; }
.bt-field[data-dist="1"] .bt-vs { padding: 0 34px; }
.bt-field[data-dist="2"] .bt-vs { padding: 0 90px; }
.bt-card.foe { transition: transform 0.15s, border-color 0.15s, opacity 0.2s, margin 0.6s cubic-bezier(.3,.8,.3,1); }
.bt-card.foe[data-dist="1"] { margin-left: 22px; }
.bt-card.foe[data-dist="2"] { margin-left: 48px; }

.bt-range { font-family: "Nunito", sans-serif; font-size: 0.78rem; font-weight: 800; white-space: nowrap; padding: 2px 8px; border-radius: 99px;
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.bt-range.r0 { border-color: #ef4444; } .bt-range.r1 { border-color: #eab308; } .bt-range.r2 { border-color: #22c55e; }
.bt-acts { font-size: 0.85em; font-weight: 800; color: var(--muted); margin-left: 6px; }
.bt-pass { grid-column: 1 / -1; justify-self: center; }
.bt-card { position: relative; padding: 14px; transition: transform 0.15s, border-color 0.15s, opacity 0.2s; }
.bt-card.mine { border: 2px solid var(--accent); }
.bt-card.turn { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 55%, transparent), var(--shadow); }
.bt-card.out { opacity: 0.45; filter: grayscale(0.8); }
.bt-card.targetable { cursor: pointer; border: 2px solid #ef4444 !important; animation: bt-pulse 0.9s ease-in-out infinite; }
.bt-card.blocked { opacity: 0.4; }
@keyframes bt-pulse { 50% { transform: scale(1.03); } }
.bt-owner { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 0.9rem; margin-bottom: 6px; }
.bt-bench { margin-left: auto; letter-spacing: 2px; color: var(--accent-2); }
.bt-skip { font-size: 0.75rem; color: #ef4444; }
.bt-empty { padding: 18px 0; text-align: center; font-weight: 700; color: var(--muted); }
.bt-status { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; font-size: 0.82rem; font-weight: 800; }
.bt-status span { padding: 2px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); }
.bt-log { padding: 12px; max-height: 340px; overflow-y: auto; font-size: 0.82rem; }
.bt-log-title { font-weight: 800; color: var(--muted); text-transform: uppercase; font-size: 0.72rem; letter-spacing: 1px; margin-bottom: 6px; }
.bt-line { padding: 3px 0; border-bottom: 1px dashed var(--border); }
.bt-line:first-of-type { font-weight: 800; }
.bt-actions { margin-top: 14px; padding: 14px; text-align: center; }
.bt-main { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.play-move { --play: #0d9488; }
.bt-big { min-height: 90px; }
.bt-big:disabled { opacity: 0.45; }
.bt-panel, .bt-choose { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.bt-panel[hidden] { display: none; }
.bt-choice {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
    padding: 10px 14px; border-radius: 14px; border: 2px solid var(--border);
    background: var(--surface-2); color: var(--text); font-weight: 700;
    transition: transform 0.12s, border-color 0.12s;
}
.bt-choice:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-2px); }
.bt-choice:disabled { opacity: 0.45; }
.bt-choice small { color: var(--muted); font-weight: 700; }
.bt-back { grid-column: 1 / -1; justify-self: center; }
.bt-target-hint { font-weight: 800; font-size: 1.1rem; }
.bt-giveup { border: 0; background: none; color: var(--muted); font-weight: 700; font-size: 0.85rem; text-decoration: underline; }
.bt-toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
    background: #111827; color: #fff; padding: 10px 18px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow);
}
.bt-pop {
    position: absolute; top: 30%; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none;
    font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 2rem; white-space: nowrap;
    color: #ef4444; text-shadow: 0 2px 0 #fff, 0 0 8px rgba(0, 0, 0, 0.35);
    animation: bt-float 1.4s ease-out forwards;
}
.bt-pop.heal { color: #16a34a; }
.bt-pop.miss { color: var(--muted); font-size: 1.4rem; }
.bt-pop.poison { color: #9b4dea; }
.bt-pop.sp { color: var(--accent-2); font-size: 1.3rem; }
.bt-pop.crit { font-size: 2.6rem; color: #f59e0b; }
.bt-pop.faint { color: #111827; font-size: 1.5rem; }
@keyframes bt-float { 0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -50px) scale(1); } }
.bt-card.shake { animation: bt-shake 0.4s; }
@keyframes bt-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (max-width: 860px) {
    .bt-layout { grid-template-columns: 1fr; }
    .bt-log { order: -1; max-height: 110px; }
}
@media (max-width: 560px) {
    .bt-field { gap: 4px; }
    .bt-side { gap: 8px; min-width: 0; }
    .bt-vs { font-size: 0.95rem; gap: 4px; }
    .bt-range { font-size: 0.62rem; padding: 1px 5px; }
    .bt-field[data-dist="0"] .bt-vs { padding: 0; }
    .bt-field[data-dist="1"] .bt-vs { padding: 0 8px; }
    .bt-field[data-dist="2"] .bt-vs { padding: 0 22px; }
    .bt-card.foe[data-dist="1"] { margin-left: 8px; }
    .bt-card.foe[data-dist="2"] { margin-left: 18px; }
    .bt-card { padding: 8px; min-width: 0; }
    .bt-card .mon-head { flex-direction: column; gap: 4px; }
    .bt-card .mon-name { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
    .bt-card .mon-sub { font-size: 0.78rem; }
    .bt-card .badge-type, .bt-card .badge-sp, .bt-card .badge-rarity { font-size: 0.66rem; padding: 2px 6px; }
    .bt-owner { font-size: 0.75rem; gap: 4px; flex-wrap: wrap; }
    .bt-bench { letter-spacing: 0; }
    .bt-status { gap: 3px; font-size: 0.68rem; }
    .bt-status span { padding: 1px 5px; }
    .bt-pop { font-size: 1.5rem; }
    .bt-pop.crit { font-size: 1.9rem; }
    .bt-banner { font-size: 1.1rem; }
    .bt-big { min-height: 76px; }
    .bt-panel, .bt-choose { grid-template-columns: 1fr; }
    .bt-main { grid-template-columns: repeat(2, 1fr); }
}
[data-style="fancy"] .bt-choice { border-radius: 4px; clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
[data-style="fancy"] .bt-vs { text-shadow: 0 0 16px color-mix(in srgb, var(--accent-2) 70%, transparent); }
[data-style="simple"] .bt-pop { animation: bt-fade 1.4s linear forwards; }
[data-style="simple"] .bt-vs, [data-style="simple"] .bt-card.foe { transition: none; }
.bt-field[data-dist] .bt-card.foe[data-dist] { margin-left: 0; }   /* 1v1: the gap in the middle shows the distance */
[data-style="simple"] .bt-card.shake, [data-style="simple"] .bt-card.targetable { animation: none; }
@keyframes bt-fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }


/* Results page */
.res-head { padding: 24px 16px; }
.res-head.won { border: 2px solid #f59e0b; background: linear-gradient(180deg, color-mix(in srgb, #f59e0b 16%, var(--surface)), var(--surface)); }
.res-head.lost { border: 2px solid var(--border); }
.res-icon { font-size: 4rem; line-height: 1; margin-bottom: 6px; }
[data-style="classic"] .res-head.won .res-icon, [data-style="fancy"] .res-head.won .res-icon { animation: res-bounce 1.2s ease-in-out infinite; }
@keyframes res-bounce { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }
.res-amounts { display: flex; justify-content: center; gap: 28px; margin-bottom: 8px; }
.res-amounts div { display: flex; flex-direction: column; align-items: center; }
.res-num { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 2.4rem; line-height: 1.1; color: var(--accent-2); }
.res-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.res-team { padding: 14px; }
.res-team.winner { border: 2px solid #f59e0b; }
.res-owner { margin-bottom: 8px; }
.res-mon { padding: 8px 0; border-top: 1px dashed var(--border); }
.res-mon.fainted { opacity: 0.55; }
.res-faint { font-weight: 800; color: #ef4444; font-size: 0.85rem; }
.res-log summary { cursor: pointer; }
.res-log ol { max-height: 360px; overflow-y: auto; font-size: 0.88rem; padding-left: 1.4rem; }
.res-log li { padding: 2px 0; }
@media (max-width: 480px) {
    .res-buttons .ms-2 { margin-left: 0 !important; margin-top: 8px; }
    .res-icon { font-size: 3rem; }
}


/* Medbay */
.med-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 160px; border-style: dashed !important; font-weight: 800; text-align: center; }
.med-tag, .pick-med { display: inline-block; font-size: 0.75rem; font-weight: 800; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); }
.pick-med { margin-top: 8px; display: block; text-align: center; }
.med-fainted { opacity: 0.8; }
.med-bed .med-fill { transition: width 0.6s ease; }
.med-levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.med-level { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px; border-radius: 12px; border: 2px solid var(--border); font-weight: 700; font-size: 0.9rem; text-align: center; }
.med-level b { font-family: "Fredoka", "Nunito", sans-serif; font-size: 1.1rem; }
.med-level.current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.med-level.done { opacity: 0.55; }


/* Daily rewards */
.daily-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.daily-day { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; text-align: center; }
.daily-num { font-weight: 800; font-size: 0.8rem; text-transform: uppercase; color: var(--muted); letter-spacing: 1px; }
.daily-icon { font-size: 2rem; line-height: 1.1; }
.daily-line { font-weight: 700; font-size: 0.82rem; }
.daily-day.done { opacity: 0.5; }
.daily-day.today { border: 2px solid var(--accent) !important; }
.daily-day.big { background: color-mix(in srgb, #f59e0b 12%, var(--surface)); }
[data-style="classic"] .daily-day.ready .daily-icon, [data-style="fancy"] .daily-day.ready .daily-icon { animation: icon-pop 1s ease-in-out infinite; }
.daily-wait { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 1.8rem; }
.tile-ready { border: 2px solid var(--accent) !important; }
[data-style="classic"] .tile-ready .tile-icon, [data-style="fancy"] .tile-ready .tile-icon { animation: icon-pop 1.2s ease-in-out infinite; }
@media (max-width: 760px) {
    .daily-grid { grid-template-columns: repeat(4, 1fr); }
    .daily-day.big { grid-column: span 2; }
}
@media (max-width: 420px) {
    .daily-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .daily-day.big { grid-column: span 3; }
    .daily-line { font-size: 0.72rem; }
}


/* Practice */
.prac-tray { text-align: center; }
.prac-filter { max-width: 180px; }
.prac-pool { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.prac-mon { border: 2px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 99px; padding: 6px 12px; font-weight: 700; font-size: 0.88rem; }
.prac-mon:hover { border-color: var(--accent); }
[data-style="fancy"] .prac-mon { border-radius: 4px; }


/* Campaign */
.camp-worlds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.camp-world { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 14px;
    border: 2px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; text-align: center; font-size: 0.9rem; }
.camp-world small { color: var(--muted); font-weight: 700; font-size: 0.72rem; }
.camp-world.current { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.camp-world.locked { opacity: 0.5; }
.camp-world:hover:not(.locked) { color: var(--text); border-color: var(--accent); }
.camp-wicon { font-size: 1.6rem; line-height: 1; }
.camp-path { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; justify-items: center; }
.camp-node { width: 72px; height: 72px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 3px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none; font-weight: 800; transition: transform 0.15s; }
.camp-num { font-family: "Fredoka", "Nunito", sans-serif; font-size: 1.4rem; line-height: 1; }
.camp-node small { font-size: 0.7rem; }
.camp-node.done { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 15%, var(--surface)); }
.camp-node.next { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.camp-node.done.next { background: color-mix(in srgb, #f59e0b 15%, var(--surface)); color: var(--text); border-color: #f59e0b; }
.camp-node.locked { opacity: 0.45; }
.camp-node.boss { width: 84px; height: 84px; border-width: 4px; }
a.camp-node:hover { transform: scale(1.08); color: inherit; }
.camp-boss-box { border: 2px solid #f59e0b !important; }
.camp-boss-mon { border: 2px solid #f59e0b !important; }
@media (max-width: 560px) {
    .camp-worlds { grid-template-columns: repeat(3, 1fr); }
    .camp-path { grid-template-columns: repeat(4, 1fr); gap: 10px; }
    .camp-node { width: 60px; height: 60px; }
    .camp-node.boss { width: 70px; height: 70px; }
}
[data-style="classic"] .camp-node.next:not(.done) { animation: icon-pop 1.4s ease-in-out infinite; }
[data-style="fancy"] .camp-node { border-radius: 12px; transform: rotate(45deg); }
[data-style="fancy"] .camp-node > * { transform: rotate(-45deg); }
[data-style="fancy"] a.camp-node:hover { transform: rotate(45deg) scale(1.08); }
[data-style="fancy"] .camp-node.boss { border-radius: 50%; transform: none; }
[data-style="fancy"] .camp-node.boss > * { transform: none; }
[data-style="fancy"] .camp-path { gap: 22px; padding: 8px 0; }


/* Status effects in battle */
.bt-status .st-poison { background: color-mix(in srgb, #9b4dea 22%, var(--surface)); border-color: #9b4dea; color: var(--text); }
.bt-status .st-bad { background: color-mix(in srgb, #ef4444 16%, var(--surface)); border-color: #ef4444; }
.bt-card.poisoned { box-shadow: 0 0 0 3px color-mix(in srgb, #9b4dea 55%, transparent), var(--shadow) !important; }
[data-style="classic"] .bt-card.poisoned, [data-style="fancy"] .bt-card.poisoned { animation: st-pulse 1.8s ease-in-out infinite; }
@keyframes st-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, #9b4dea 30%, transparent), var(--shadow); } }


/* Bestiary */
.dex-bar { height: 14px; max-width: 420px; margin: 0 auto; }
.dex-miles { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.dex-mile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; text-align: center; }
.dex-mile b { font-family: "Fredoka", "Nunito", sans-serif; font-size: 1.4rem; line-height: 1; }
.dex-mile small { font-weight: 700; font-size: 0.72rem; color: var(--muted); }
.dex-mile.ready { border: 2px solid var(--accent) !important; }
.dex-mile.claimed { opacity: 0.6; }
.dex-mile.locked { opacity: 0.75; }
.dex-tag { font-size: 0.75rem; font-weight: 800; }
.dex-filters select { max-width: 200px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.dex-card { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; text-align: center;
    border-top: 4px solid var(--type-color) !important; }
.dex-card.unknown { opacity: 0.55; filter: grayscale(0.7); }
.dex-icon { font-size: 2rem; line-height: 1; }
.dex-name { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 700; font-size: 1.05rem; }
[data-style="classic"] .dex-mile.ready b { animation: icon-pop 1.2s ease-in-out infinite; }
@media (max-width: 760px) { .dex-miles { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 480px) {
    .dex-miles { grid-template-columns: repeat(3, 1fr); gap: 6px; }
    .dex-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}


/* How to play */
.help-sec { margin-bottom: 10px; padding: 14px 16px; }
.help-sec summary { cursor: pointer; font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600; font-size: 1.15rem; }
.help-sec[open] summary { margin-bottom: 10px; }
.help-sec p, .help-sec li { line-height: 1.5; }
.help-list { padding-left: 1.2rem; }
.help-list li { margin-bottom: 4px; }
.help-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.help-table th, .help-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.help-table th { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }


/* Notification bell */
.bell-wrap { margin-left: auto; }
.admin-btn { margin-left: auto; width: 32px; height: 32px; font-size: .85rem; }
.admin-btn + .bell-wrap { margin-left: 6px; }
.bell-wrap + .pills { margin-left: 8px; }
.bell { position: relative; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
    background: #ef4444; color: #fff; font-size: 0.72rem; font-weight: 800; line-height: 20px; text-align: center; }
.bell-menu { min-width: 260px; max-width: 320px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.bell-item { white-space: normal; border-radius: 10px; padding: 8px 10px; color: var(--text); font-weight: 700; }
.bell-item:hover { background: var(--surface-2); color: var(--text); }
.bell-empty { padding: 10px; color: var(--muted); font-weight: 700; text-align: center; }
[data-style="classic"] .bell-count { animation: icon-pop 1.6s ease-in-out infinite; }


/* Friends */
.fr-add { max-width: 420px; }
.fr-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 12px 14px; }
.fr-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fr-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #9ca3af; }
.fr-dot.on { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 30%, transparent); }
.fr-size { width: auto; padding-top: 6px; padding-bottom: 6px; }


.match-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-left-color: #f59e0b !important; }


.bt-status .st-good { background: color-mix(in srgb, #22c55e 16%, var(--surface)); border-color: #22c55e; }
.bt-choice.bt-typemove { border-color: color-mix(in srgb, var(--accent-2) 60%, var(--border)); }
.bt-choice.bt-typemove:disabled small { color: var(--muted); font-weight: 800; }


/* Battle animations */
.bt-fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; display: flex; align-items: center; justify-content: center; overflow: visible; }
.bt-fx .fx-p { position: absolute; left: 50%; top: 45%; margin: -5px 0 0 -5px; display: block; line-height: 1; }
.bt-fx .fx-bolt { position: absolute; width: 60%; height: 90%; opacity: 0; filter: drop-shadow(0 0 8px #fff59d); }
.bt-fx .fx-bolt polyline { fill: #ffeb3b; stroke: #fff; stroke-width: 2; }
.bt-fx .fx-streak { height: 6px; margin-left: -40px; border-radius: 99px; opacity: 0; box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.85);
    animation: fx-streak 0.7s ease-in-out forwards; }
@keyframes fx-streak {
    0% { transform: translate(-120px, calc(var(--y) + 12px)) rotate(-8deg); opacity: 0; }
    45% { transform: translate(0, var(--y)) rotate(-8deg); opacity: 1; }
    100% { transform: translate(120px, calc(var(--y) - 12px)) rotate(-8deg); opacity: 0; }
}
.bt-fx .fx-rays { position: absolute; width: 180px; height: 180px; border-radius: 50%; opacity: 0;
    background: repeating-conic-gradient(var(--c) 0 10deg, transparent 10deg 30deg); mask: radial-gradient(circle, transparent 18%, #000 20%, transparent 70%); -webkit-mask: radial-gradient(circle, transparent 18%, #000 20%, transparent 70%); }
.bt-fx .fx-bottle { font-size: 44px; margin: -22px 0 0 -22px; filter: drop-shadow(0 0 10px #4ade80); }
.bt-fx .fx-ring { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 4px solid; opacity: 0; }
[data-style="fancy"] .bt-fx .fx-rays { width: 240px; height: 240px; }
[data-style="fancy"] .bt-fx .fx-ring { width: 160px; height: 160px; border-width: 6px; }
.bt-card { overflow: visible; }


/* Home screen menu groups */
.menu-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 24px; }
.menu-group { background: color-mix(in srgb, var(--surface) 55%, transparent); border: 1px solid var(--border); border-radius: 18px; padding: 12px; }
.menu-head { font-family: "Fredoka", "Nunito", sans-serif; font-weight: 600; font-size: 1.05rem; margin: 0 0 10px 4px; }
.menu-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-tiles .tile { min-height: 96px; padding: 10px 6px; }
@media (max-width: 860px) { .menu-groups { grid-template-columns: 1fr; } }
@media (max-width: 420px) {
    .menu-tiles { gap: 6px; }
    .menu-tiles .tile { min-height: 84px; font-size: 0.85rem; }
    .menu-tiles .tile small { font-size: 0.68rem; }
}
[data-style="fancy"] .menu-group { border-radius: 6px; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
[data-style="simple"] .menu-group { background: transparent; border-width: 2px; }


/* Leaderboard */
.lb-tabs { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.lb-tab { padding: 8px 14px; border-radius: 99px; border: 2px solid var(--border); background: var(--surface); color: var(--text); font-weight: 800; text-decoration: none; }
.lb-tab.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.lb-tab:hover { color: var(--text); border-color: var(--accent); }
.lb-tab.on:hover { color: var(--accent-text); }
.small-tabs .lb-tab { padding: 5px 12px; font-size: 0.85rem; }
.lb-list { padding: 8px; }
.lb-row { display: grid; grid-template-columns: 48px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; }
.lb-row + .lb-row { border-top: 1px dashed var(--border); }
.lb-row.me { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.lb-rank { font-family: "Fredoka", "Nunito", sans-serif; font-size: 1.4rem; font-weight: 700; text-align: center; }
.lb-name { font-weight: 800; display: flex; align-items: center; gap: 6px; }
.lb-score { text-align: right; line-height: 1.1; }
.lb-score b { font-family: "Fredoka", "Nunito", sans-serif; font-size: 1.4rem; }
.lb-row.top1 .lb-score b { color: #f59e0b; }
[data-style="fancy"] .lb-tab { border-radius: 4px; }


/* =========================================================
   STYLE: CLASSIC - rounded, gentle animations
   ========================================================= */

[data-style="classic"] .btn-game,
[data-style="classic"] .btn-soft {
    border-radius: 999px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s;
}
[data-style="classic"] .btn-game {
    background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 82%, #fff), var(--accent));
    box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 65%, #000);
}
[data-style="classic"] .btn-game:hover { background: linear-gradient(180deg, color-mix(in srgb, var(--accent-hover) 82%, #fff), var(--accent-hover)); }
[data-style="classic"] .btn-soft { box-shadow: 0 3px 0 var(--border); }
[data-style="classic"] .btn-game:active:not(:disabled),
[data-style="classic"] .btn-soft:active:not(:disabled) {
    transform: translateY(2px) scale(0.96);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 65%, #000);
}
[data-style="classic"] .btn-game:disabled { box-shadow: none; }
[data-style="classic"] .box { border-radius: 22px; }
[data-style="classic"] .tile,
[data-style="classic"] .mon-card,
[data-style="classic"] .chest { transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s; }
[data-style="classic"] .tile:hover,
[data-style="classic"] .mon-card:hover,
[data-style="classic"] .chest:hover { transform: translateY(-4px); }
[data-style="classic"] .chest:hover .chest-art { animation: chest-wiggle 0.5s ease; }
[data-style="classic"] .play-btn {
    border-radius: 24px;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.22), var(--shadow);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
[data-style="classic"] .play-btn:hover { transform: translateY(-3px); }
[data-style="classic"] .play-btn:active { transform: translateY(3px) scale(0.97); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.22); }
[data-style="classic"] .icon-btn:active { transform: scale(0.9); }

[data-style="classic"] .box {
    border: 1px solid var(--border);
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 6%, transparent), transparent 120px),
        var(--surface);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
[data-style="classic"] .tile:hover,
[data-style="classic"] .mon-card:hover,
[data-style="classic"] .chest:hover {
    border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
    box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 16%, transparent), var(--shadow);
}
[data-style="classic"] .tile:hover .tile-icon,
[data-style="classic"] .play-btn:hover .play-icon { animation: icon-pop 0.4s ease; }
[data-style="classic"] .section-title {
    display: inline-block;
    padding-bottom: 4px;
    border-bottom: 3px solid var(--accent);
    border-radius: 0 0 2px 2px;
}
[data-style="classic"] .stat {
    border-radius: 16px;
    box-shadow: inset 0 0 0 1px var(--border);
}
[data-style="classic"] .btn-game { position: relative; overflow: hidden; }
[data-style="classic"] .btn-game::after {        /* soft shine on the top half */
    content: "";
    position: absolute;
    left: 8%; right: 8%; top: 2px;
    height: 45%;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0));
    pointer-events: none;
}
[data-style="classic"] .play-btn {
    background-image:
        radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.22), transparent 55%),
        var(--play-bg);
}

@keyframes icon-pop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(-6deg); }
}

@keyframes chest-wiggle {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-6deg); }
    75% { transform: rotate(6deg); }
}


/* =========================================================
   STYLE: FANCY - designed boxes (corner brackets, double frame,
   texture), cut-corner buttons, big animations. Theme colours only.
   ========================================================= */

[data-style="fancy"] .box {
    --frame: color-mix(in srgb, var(--accent) 75%, var(--text));
    border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
    border-radius: 14px;
    background:
        /* corner brackets */
        linear-gradient(var(--frame), var(--frame)) left 8px top 8px / 18px 3px no-repeat,
        linear-gradient(var(--frame), var(--frame)) left 8px top 8px / 3px 18px no-repeat,
        linear-gradient(var(--frame), var(--frame)) right 8px top 8px / 18px 3px no-repeat,
        linear-gradient(var(--frame), var(--frame)) right 8px top 8px / 3px 18px no-repeat,
        linear-gradient(var(--frame), var(--frame)) left 8px bottom 8px / 18px 3px no-repeat,
        linear-gradient(var(--frame), var(--frame)) left 8px bottom 8px / 3px 18px no-repeat,
        linear-gradient(var(--frame), var(--frame)) right 8px bottom 8px / 18px 3px no-repeat,
        linear-gradient(var(--frame), var(--frame)) right 8px bottom 8px / 3px 18px no-repeat,
        /* soft light from the top */
        linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 40%),
        /* dot texture */
        radial-gradient(circle, color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 1.6px) 0 0 / 14px 14px,
        var(--surface);
    /* double frame: a thin inner line 5px inside the edge */
    box-shadow:
        inset 0 0 0 4px var(--surface),
        inset 0 0 0 5px color-mix(in srgb, var(--accent) 28%, transparent),
        var(--shadow);
}
[data-style="fancy"] .mon-card.is-active {
    border: 2px solid var(--accent);
    box-shadow:
        inset 0 0 0 4px var(--surface),
        inset 0 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent),
        var(--shadow);
}

/* section titles get a diamond and a fading line */
[data-style="fancy"] .section-title { display: flex; align-items: center; gap: 10px; }
[data-style="fancy"] .section-title::before {
    content: "";
    width: 9px; height: 9px;
    flex: none;
    background: var(--accent);
    transform: rotate(45deg);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
[data-style="fancy"] .section-title::after {
    content: "";
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 60%, transparent), transparent);
}

/* stat boxes: accent bar on the left */
[data-style="fancy"] .stat {
    border-left: 4px solid var(--accent);
    border-radius: 6px 14px 14px 6px;
    background:
        linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
        var(--surface-2);
}

/* buttons: cut corners, bevel, light sweep on hover */
[data-style="fancy"] .btn-game,
[data-style="fancy"] .btn-soft,
[data-style="fancy"] .tile { position: relative; overflow: hidden; }

[data-style="fancy"] .btn-game,
[data-style="fancy"] .btn-soft {
    border-radius: 4px;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    letter-spacing: 0.4px;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s;
}
[data-style="fancy"] .btn-game {
    background: var(--accent);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.22);
    text-transform: uppercase;
    font-size: 0.95rem;
}
[data-style="fancy"] .btn-soft {
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12), inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
[data-style="fancy"] .btn-game::before,
[data-style="fancy"] .btn-soft::before {          /* light sweep on hover */
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}
[data-style="fancy"] .btn-game:hover:not(:disabled)::before,
[data-style="fancy"] .btn-soft:hover:not(:disabled)::before { left: 120%; }
[data-style="fancy"] .btn-game:hover:not(:disabled),
[data-style="fancy"] .btn-soft:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.08); }
[data-style="fancy"] .btn-game:active:not(:disabled),
[data-style="fancy"] .btn-soft:active:not(:disabled) { transform: scale(0.94); transition-duration: 0.08s; }

/* menu tiles: icon sits in a ringed badge, tile lifts on hover */
[data-style="fancy"] .tile-icon {
    width: 66px; height: 66px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
}
[data-style="fancy"] .tile,
[data-style="fancy"] .mon-card,
[data-style="fancy"] .chest { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s; }
[data-style="fancy"] .tile:hover,
[data-style="fancy"] .mon-card:hover,
[data-style="fancy"] .chest:hover { transform: translateY(-6px); border-color: var(--accent); }
[data-style="fancy"] .tile:hover .tile-icon { animation: icon-wiggle 0.6s ease; }
[data-style="fancy"] .chest .chest-art { animation: chest-idle 3s ease-in-out infinite; }
[data-style="fancy"] .chest:hover .chest-art { animation: chest-shake 0.45s ease infinite; }

/* play buttons: cut corners, stripes, icon badge */
[data-style="fancy"] .play-btn {
    border-radius: 6px;
    clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
    background-image:
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0 10px, transparent 10px 20px),
        var(--play-bg);
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.22), inset 0 -5px 0 rgba(0, 0, 0, 0.22);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.3s;
}
[data-style="fancy"] .play-btn::before {          /* light sweep on hover */
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: -60%;
    width: 40%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.7s ease;
    pointer-events: none;
}
[data-style="fancy"] .play-btn:hover::before { left: 120%; }
[data-style="fancy"] .play-btn > *:not(.ripple) { position: relative; }
[data-style="fancy"] .play-icon {
    width: 64px; height: 64px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.18);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
    animation: float 2.4s ease-in-out infinite;
}
[data-style="fancy"] .play-label { text-transform: uppercase; letter-spacing: 2px; font-size: 1.15rem; }
[data-style="fancy"] .play-campaign .play-icon { animation-delay: 0.4s; }
[data-style="fancy"] .play-practice .play-icon { animation-delay: 0.8s; }
[data-style="fancy"] .play-btn:hover { transform: translateY(-5px); filter: brightness(1.08); }
[data-style="fancy"] .play-btn:active { transform: scale(0.95); transition-duration: 0.08s; }
@media (max-width: 480px) {
    [data-style="fancy"] .play-icon { width: 48px; height: 48px; }
    [data-style="fancy"] .play-label { letter-spacing: 1px; font-size: 0.95rem; }
}

[data-style="fancy"] .icon-btn { transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s; }
[data-style="fancy"] .icon-btn:hover { transform: rotate(-8deg) scale(1.08); }
[data-style="fancy"] .icon-btn:active { transform: scale(0.88); }

.ripple {                                          /* click ripple (Fancy, added by JS) */
    position: absolute !important;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    transform: scale(0);
    animation: ripple 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes ripple { to { transform: scale(1); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes icon-wiggle {
    0%, 100% { transform: rotate(0) scale(1); }
    30% { transform: rotate(-12deg) scale(1.15); }
    60% { transform: rotate(10deg) scale(1.15); }
}
@keyframes chest-idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes chest-shake {
    0%, 100% { transform: rotate(0); }
    25% { transform: rotate(-5deg) translateY(-2px); }
    75% { transform: rotate(5deg) translateY(-2px); }
}


/* =========================================================
   CHEST OPENING SHOW (Classic + Fancy)
   ========================================================= */

.chest-show {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rar) 30%, rgba(8, 8, 20, 0.88)), rgba(8, 8, 20, 0.92) 70%);
    overflow: hidden;
    cursor: pointer;
    animation: fade-in 0.25s ease;
}
.chest-show.closing { animation: fade-out 0.25s ease forwards; }
.cs-stage { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.cs-chest {
    width: 168px !important;
    height: 128px !important;
    border-radius: 22px 22px 14px 14px;
}
.cs-chest::before { top: 44px !important; height: 8px !important; }
.cs-chest::after { top: 32px !important; width: 28px !important; height: 32px !important; margin-left: -14px !important; border-radius: 6px !important; }
.cs-card {
    position: relative;
    z-index: 3;
    text-align: center;
    min-width: min(320px, 86vw);
    max-width: 92vw;
    opacity: 0;
    transform: scale(0.6);
    pointer-events: none;
    border: 3px solid var(--rar) !important;
    box-shadow: 0 0 40px color-mix(in srgb, var(--rar) 60%, transparent) !important;
}
.cs-skip {
    position: absolute;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    left: 0; right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
    letter-spacing: 1px;
}
.cs-rays, .cs-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; }

/* ---- the end state (also what "tap to skip" jumps to) ---- */
.chest-show.done { cursor: default; }
.chest-show.done .cs-card { opacity: 1; transform: none; pointer-events: auto; animation: card-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.chest-show.done .cs-chest { opacity: 0; animation: none; }
.chest-show.done .cs-skip { display: none; }

/* ---- Classic: quick bounce, pop, card ---- */
.cs-classic .cs-chest { animation: cs-bounce 0.8s ease forwards; }

@keyframes cs-bounce {
    0%   { transform: translateY(-40px) scale(0.7); opacity: 0; }
    35%  { transform: translateY(0) scale(1.05); opacity: 1; }
    55%  { transform: scale(0.95, 1.05); }
    80%  { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* ---- Fancy: drop, shake harder and harder, flash, rays, confetti, card flips in ---- */
.cs-fancy .cs-chest { animation: cs-drop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), cs-rumble 1.2s ease-in 0.45s forwards; }
.cs-fancy .cs-flash {
    background: radial-gradient(circle, #fff 0, color-mix(in srgb, var(--rar) 70%, #fff) 30%, transparent 70%);
    animation: cs-flash 0.7s ease-out 1.6s forwards;
}
.cs-fancy .cs-rays {
    inset: -60%;
    background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rar) 55%, transparent) 0 8deg, transparent 8deg 22deg);
    -webkit-mask: radial-gradient(circle, #000 0, transparent 60%);
            mask: radial-gradient(circle, #000 0, transparent 60%);
    animation: cs-rays-in 0.5s ease 1.6s forwards, spin 14s linear 1.6s infinite;
}
.cs-fancy.rar-legendary .cs-rays, .cs-fancy.rar-divine .cs-rays {
    background: repeating-conic-gradient(from 0deg, rgba(255, 215, 90, 0.5) 0 7deg, transparent 7deg 15deg);
}
.cs-fancy.done .cs-rays { animation: spin 14s linear infinite; opacity: 1; }
.cs-fancy.done .cs-card { animation: card-flip 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }

.cs-confetti { position: absolute; left: 0; top: 0; }
.cs-confetti i {
    position: absolute;
    width: 10px; height: 14px;
    left: -5px; top: -7px;
    opacity: 0;
    border-radius: 2px;
    animation: confetti 1.6s cubic-bezier(0.15, 0.7, 0.35, 1) calc(1.62s + var(--delay)) forwards;
}

@keyframes cs-drop { from { transform: translateY(-110vh) rotate(-12deg); } to { transform: translateY(0) rotate(0); } }
@keyframes cs-rumble {
    0%  { transform: rotate(0); }
    10% { transform: rotate(-3deg); }   20% { transform: rotate(3deg); }
    30% { transform: rotate(-5deg) translateY(-2px); }   40% { transform: rotate(5deg); }
    50% { transform: rotate(-8deg) translateY(-4px) scale(1.04); }   60% { transform: rotate(8deg) scale(1.06); }
    70% { transform: rotate(-11deg) translateY(-6px) scale(1.08); }  80% { transform: rotate(11deg) scale(1.1); }
    90% { transform: rotate(-13deg) translateY(-8px) scale(1.14); filter: brightness(1.6); }
    100% { transform: scale(1.5); opacity: 0; filter: brightness(3); }
}
@keyframes cs-flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cs-rays-in { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes confetti {
    0%   { opacity: 1; transform: translate(0, 0) rotate(0); }
    80%  { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 220px)) rotate(var(--rot)); }
}
@keyframes card-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes card-flip {
    from { transform: perspective(800px) rotateY(90deg) scale(0.7); opacity: 0; }
    to   { transform: perspective(800px) rotateY(0) scale(1); opacity: 1; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }


/* =========================================================
   STYLE: SIMPLE - plain: no fancy animations or shadows,
   but clear borders and a gentle hover
   ========================================================= */

[data-style="simple"] *,
[data-style="simple"] *::before,
[data-style="simple"] *::after { animation: none !important; }
[data-style="simple"] .box,
[data-style="simple"] .note,
[data-style="simple"] .play-btn,
[data-style="simple"] .topbar,
[data-style="simple"] .modal-content { box-shadow: none !important; }
[data-style="simple"] .modal.fade .modal-dialog,
[data-style="simple"] .offcanvas { transition: none !important; }
[data-style="simple"] .box { border: 2px solid var(--border); }
[data-style="simple"] .btn-game { border: 2px solid color-mix(in srgb, var(--accent) 70%, #000); }
[data-style="simple"] .btn-soft { border-width: 2px; }
[data-style="simple"] .tile,
[data-style="simple"] .mon-card,
[data-style="simple"] .chest,
[data-style="simple"] .play-btn,
[data-style="simple"] .btn-game,
[data-style="simple"] .btn-soft { transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease; }
[data-style="simple"] .tile:hover,
[data-style="simple"] .mon-card:hover,
[data-style="simple"] .chest:hover { transform: translateY(-2px); border-color: var(--accent); }
[data-style="simple"] .btn-game:active,
[data-style="simple"] .icon-btn:hover { transform: none; }
[data-style="simple"] .play-btn {
    background: var(--play);
    border: 2px solid color-mix(in srgb, var(--play) 65%, #000);
}
[data-style="simple"] .play-btn:hover { transform: translateY(-2px); border-color: var(--text); }
[data-style="simple"] .play-label { text-shadow: none; }
[data-style="simple"] .modal-backdrop.show { opacity: 0.35; }


/* =========================================================
   THEME PICKER (Settings)
   ========================================================= */

.theme-picker summary { list-style: none; }
.theme-picker summary::-webkit-details-marker { display: none; }
.theme-current {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-weight: 700;
    cursor: pointer;
}
.theme-current:hover { border-color: var(--accent); }
.theme-picker[open] .chev { transform: rotate(180deg); }
.swatch.big i { width: 24px; height: 24px; }
.theme-swatches {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px 6px;
    padding: 12px 4px 4px;
}
.theme-dot {
    border: 0;
    background: none;
    padding: 0;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.theme-dot .dot {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c1) 0 50%, var(--c2) 50% 100%);
    box-shadow: 0 0 0 2px var(--border);
}
.theme-dot:hover .dot { box-shadow: 0 0 0 3px var(--accent); }
.theme-dot.current .dot { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.theme-dot small { font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.theme-dot.current small { color: var(--text); }


/* Borders that mean something keep working in every style */
[data-style] .box.mon-card.is-active { border: 2px solid var(--accent); }
[data-style] .box.type-card { border-top: 6px solid var(--type-color); }
[data-style] .box.reward { border: 2px solid var(--accent); }


/* Respect devices that ask for less motion */
@media (prefers-reduced-motion: reduce) {
    [data-style] *, [data-style] *::before, [data-style] *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Terms & Privacy page */
.terms h5 { font-size: 1rem; margin: 14px 0 6px; }
.terms ul { padding-left: 1.1rem; margin-bottom: 6px; }

/* Daily mystery chest (2026-11-19) */
.daily-dots { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.daily-dot { width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; background: var(--surface-2); border: 2px solid var(--border); color: var(--muted); }
.daily-dot.done { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.daily-dot.today { border-color: var(--accent); color: var(--text); }
.daily-dot.big { width: 40px; height: 40px; }
.daily-chest { position: relative; display: inline-block; margin: 8px auto; }
.daily-chest .chest-art { width: 120px; height: 90px; }
.daily-q { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; font-weight: 900; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.daily-chest.ready { animation: daily-wiggle 1.6s ease-in-out infinite; }
.daily-chest.locked { opacity: 0.6; filter: grayscale(0.4); }
.daily-chest.opening { animation: daily-open 0.9s ease forwards; }
.daily-prize { animation: daily-prize-in 0.6s ease 0.7s both; }
.daily-prize .daily-line { font-size: 1.15rem; font-weight: 800; }
@keyframes daily-wiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-6deg); } 85% { transform: rotate(6deg); } 92% { transform: rotate(-3deg); } }
@keyframes daily-open { 0% { transform: scale(1); } 40% { transform: scale(1.15) rotate(-4deg); } 60% { transform: scale(1.2) rotate(4deg); } 100% { transform: scale(0.8); opacity: 0.35; } }
@keyframes daily-prize-in { from { opacity: 0; transform: translateY(14px) scale(0.9); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .daily-chest.ready, .daily-chest.opening, .daily-prize { animation: none; } }
