/* ===== RESET + BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    color: #fff;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    overscroll-behavior: none;
    touch-action: none;
    /* Fluid typography base */
    font-size: clamp(13px, 1.8vh, 17px);
}

#app {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: #0a0a14;
}

#game {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.hidden {
    display: none !important;
}

/* Safe area shortcuts */
:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --hud-h: 60px;
}

/* ===== ORIENTATION PROMPT ===== */
#orientation-prompt {
    position: fixed;
    inset: 0;
    background: #0a0a14;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.orientation-prompt-content {
    text-align: center;
    color: #fff;
}
.orientation-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: rotate-prompt 2s ease-in-out infinite;
}
@keyframes rotate-prompt {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(90deg); }
}
#orientation-prompt h2 {
    color: #ffd60a;
    margin-bottom: 12px;
}

/* ===== HUD (gameplay overlay) ===== */
#hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.hud-top {
    position: absolute;
    top: calc(var(--safe-top) + 8px);
    left: calc(var(--safe-left) + 8px);
    right: calc(60px + var(--safe-right));  /* leave room for pause button */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    max-width: 600px;
}

.hud-bar {
    position: relative;
    height: 18px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    overflow: hidden;
}

.hud-bar-fill {
    position: absolute;
    inset: 0;
    transform-origin: left center;
    transition: transform 0.2s ease-out;
}

.hp-bar .hud-bar-fill {
    background: linear-gradient(90deg, #e63946 0%, #f77f00 100%);
}

.xp-bar .hud-bar-fill {
    background: linear-gradient(90deg, #3a86ff 0%, #8338ec 100%);
}

.hud-bar-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
    z-index: 2;
}

.hud-stats {
    position: absolute;
    top: calc(var(--safe-top) + 36px);
    left: calc(var(--safe-left) + 8px);
    display: flex;
    gap: 6px;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

.stat {
    display: flex;
    align-items: center;
    gap: 3px;
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 12px;
}

.stat-icon {
    font-size: 13px;
}

#pause-btn {
    position: absolute;
    top: calc(var(--safe-top) + 8px);
    right: calc(var(--safe-right) + 8px);
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    pointer-events: auto;
    z-index: 11;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pause-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== BOSS BAR ===== */
#boss-bar {
    position: absolute;
    top: calc(var(--safe-top) + 70px);
    left: 50%;
    transform: translateX(-50%);
    width: min(60vw, 500px);
    z-index: 9;
}

.boss-name {
    text-align: center;
    font-weight: bold;
    color: #ff4757;
    text-shadow: 0 0 10px #ff4757, 1px 1px 2px #000;
    font-size: 13px;
    margin-bottom: 4px;
    letter-spacing: 2px;
}

.boss-bar-bg {
    width: 100%;
    height: 14px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ff4757;
    border-radius: 4px;
    overflow: hidden;
}

.boss-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff4757, #ff6b81);
    transform-origin: left;
    transition: transform 0.15s ease-out;
}

/* ===== SCREENS (modals) ===== */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: stretch;
    justify-content: center;
    background: rgba(10, 10, 20, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 20;
    padding: calc(var(--safe-top) + 8px) calc(var(--safe-right) + 8px) calc(var(--safe-bottom) + 8px) calc(var(--safe-left) + 8px);
    overflow: hidden;
}

/* Default screen-content (used by most simple screens) */
.screen-content {
    width: 100%;
    max-width: 760px;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===== MAIN MENU (special 2-col layout) ===== */
.menu-layout {
    width: 100%;
    max-width: 1100px;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.5fr);
    gap: 12px;
    padding: 12px;
    align-items: stretch;
}

.menu-col-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 8px;
    text-align: center;
}

.menu-col-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
}

/* ===== TYPOGRAPHY ===== */
.title {
    font-size: clamp(32px, 6vh, 56px);
    font-weight: 900;
    text-align: center;
    line-height: 1;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 4px 0 #3a0ca3, 0 8px 24px rgba(58, 12, 163, 0.6);
}

.title-accent {
    color: #f72585;
    text-shadow: 0 4px 0 #720026, 0 8px 24px rgba(247, 37, 133, 0.6);
}

h2 {
    font-size: clamp(20px, 3.5vh, 32px);
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 1.5px;
    color: #ffd60a;
    text-shadow: 0 2px 0 #b8860b, 0 4px 12px rgba(255, 214, 10, 0.4);
}

h3 {
    font-size: clamp(13px, 1.8vh, 16px);
    margin-bottom: 4px;
    color: #ffd60a;
}

.hint-text {
    font-size: 11px;
    color: #aaa;
    text-align: center;
    margin-bottom: 6px;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: bold;
    background: linear-gradient(180deg, #3a86ff 0%, #2667c5 100%);
    color: #fff;
    border: none;
    border-bottom: 3px solid #1a4a8c;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.08s, border-bottom-width 0.08s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    letter-spacing: 0.5px;
    font-family: inherit;
}

.btn:active {
    transform: translateY(1px);
    border-bottom-width: 2px;
}

.btn-primary {
    background: linear-gradient(180deg, #f72585 0%, #c0186a 100%);
    border-bottom-color: #720026;
    font-size: 17px;
    padding: 14px 20px;
}

.btn-mega {
    font-size: clamp(20px, 3vh, 28px);
    padding: clamp(14px, 2.5vh, 24px) 24px;
    letter-spacing: 2px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    background: linear-gradient(180deg, #6c757d 0%, #495057 100%);
    border-bottom-color: #343a40;
}

.btn-special {
    background: linear-gradient(180deg, #c77dff 0%, #7b2cbf 100%);
    border-bottom-color: #4a1268;
    font-size: 13px;
    padding: 10px;
}

.btn:disabled {
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    border-bottom-color: #1a1a1a;
    color: #888;
    cursor: not-allowed;
}

/* ===== META INFO ===== */
.meta-info {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    justify-content: space-around;
    gap: 8px;
}

.meta-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
    gap: 2px;
}

.meta-row span:first-child {
    font-size: 16px;
}
.meta-row span:last-child {
    color: #ffd60a;
    font-weight: bold;
    font-size: 13px;
}

/* ===== MODE TOGGLE ===== */
.menu-mode-toggle {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.btn-mode {
    padding: 8px 4px;
    font-size: 11px;
    font-weight: bold;
    background: rgba(0,0,0,0.4);
    color: #888;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    font-family: inherit;
}

.btn-mode.active {
    color: #ffd60a;
    border-color: #ffd60a;
    background: rgba(255,214,10,0.15);
}

/* ===== DAILY CARD ===== */
.daily-card {
    background: linear-gradient(135deg, rgba(255, 214, 10, 0.15) 0%, rgba(247, 37, 133, 0.1) 100%);
    border: 2px solid rgba(255, 214, 10, 0.4);
    border-radius: 6px;
    padding: 8px 10px;
}

.daily-card-title {
    font-size: 11px;
    font-weight: bold;
    color: #ffd60a;
    letter-spacing: 1px;
}

.daily-card-desc {
    font-size: 12px;
    color: #fff;
    margin: 3px 0;
}

.daily-card-status {
    font-size: 11px;
    color: #aaa;
}

.daily-card.completed {
    border-color: #06d6a0;
    background: linear-gradient(135deg, rgba(6, 214, 160, 0.2) 0%, rgba(58, 134, 255, 0.1) 100%);
}

.daily-card.completed .daily-card-status {
    color: #06d6a0;
    font-weight: bold;
}

/* ===== MENU GRID ===== */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.btn-grid {
    padding: 10px 4px;
    font-size: 12px;
    background: linear-gradient(180deg, #4c5b8a 0%, #2d3656 100%);
    border-bottom-color: #1a2240;
    letter-spacing: 0.3px;
}

/* ===== SHOP / RELICS / GENERIC LISTS ===== */
.shop-list, .relics-list, .ach-list, .history-list, .bp-quests, .bp-tiers, .cosmetics-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}
.cosmetics-list {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
}
.bp-quests, .bp-weekly, .ach-list, .history-list, .bp-tiers {
    grid-template-columns: 1fr;
}

.shop-gold, .shop-item, .relic-item, .ach-item, .history-item {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px;
}

.shop-gold {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #ffd60a;
    margin-bottom: 8px;
    grid-column: 1 / -1;
}

.shop-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 8px;
    align-items: center;
}

.shop-item-icon {
    font-size: 22px;
    text-align: center;
}

.shop-item-name {
    font-weight: bold;
    font-size: 12px;
}

.shop-item-desc {
    font-size: 10px;
    color: #aaa;
}

.shop-item-level {
    font-size: 9px;
    color: #ffd60a;
    margin-top: 2px;
}

.shop-item-btn, .relic-btn {
    padding: 6px 8px;
    font-size: 11px;
    background: linear-gradient(180deg, #06d6a0 0%, #05a37b 100%);
    color: #fff;
    border: none;
    border-bottom: 2px solid #047a5b;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    min-width: 60px;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

.shop-item-btn:active, .relic-btn:active {
    transform: translateY(1px);
}

.shop-item-btn:disabled, .relic-btn:disabled {
    background: linear-gradient(180deg, #4a4a4a 0%, #2a2a2a 100%);
    border-bottom-color: #1a1a1a;
    color: #888;
}

.shop-item-btn.maxed {
    background: linear-gradient(180deg, #ffd60a 0%, #c9a200 100%);
    border-bottom-color: #8a6f00;
    color: #000;
}

/* ===== CARDS (level up, characters) ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}

.card {
    background: linear-gradient(135deg, rgba(58, 134, 255, 0.15) 0%, rgba(131, 56, 236, 0.15) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    color: #fff;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.card:active {
    transform: scale(0.97);
}

.card-rare { border-color: #3a86ff; box-shadow: 0 0 12px rgba(58, 134, 255, 0.3); }
.card-epic { border-color: #c77dff; box-shadow: 0 0 14px rgba(199, 125, 255, 0.4); }
.card-legendary { border-color: #ffd60a; box-shadow: 0 0 16px rgba(255, 214, 10, 0.5); animation: legendary-pulse 1.5s ease-in-out infinite; }
.card.locked { opacity: 0.5; cursor: not-allowed; }
.card.selected { border-color: #ffd60a; box-shadow: 0 0 12px rgba(255, 214, 10, 0.6); }

@keyframes legendary-pulse {
    0%, 100% { box-shadow: 0 0 16px rgba(255, 214, 10, 0.5); }
    50% { box-shadow: 0 0 24px rgba(255, 214, 10, 0.9); }
}

.card-icon {
    font-size: 32px;
    line-height: 1;
}

.card-info {
    flex: 1;
    width: 100%;
}

.card-name {
    font-weight: bold;
    font-size: 13px;
    color: #fff;
}

.card-desc {
    font-size: 11px;
    color: #c0c0c0;
    margin-top: 2px;
    line-height: 1.2;
}

.card-level {
    font-size: 10px;
    color: #ffd60a;
    margin-top: 2px;
    font-weight: bold;
}

/* ===== LEVEL UP SCREEN ===== */
#levelup .screen-content {
    max-width: 900px;
    align-items: center;
}

.levelup-content { animation: levelup-in 0.3s ease-out; }
@keyframes levelup-in {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.levelup-title { color: #ffd60a; font-size: clamp(20px, 3.5vh, 28px); }
.levelup-sub {
    text-align: center;
    color: #aaa;
    margin-bottom: 6px;
    font-size: 12px;
}

#levelup-cards.cards-grid {
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    max-width: 900px;
}

/* ===== GAME OVER / PAUSE / SCREEN STATS ===== */
.gameover-title {
    color: #ff4757;
    font-size: clamp(24px, 4vh, 36px);
    text-shadow: 0 2px 0 #b80c1c, 0 4px 16px rgba(255, 71, 87, 0.6);
}

.game-stats, .run-stats {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
}

.game-stats .stat-row, #pause-stats .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.game-stats .stat-row:last-child, #pause-stats .stat-row:last-child {
    border-bottom: none;
}

.game-stats .stat-row span:last-child, #pause-stats .stat-row span:last-child {
    color: #ffd60a;
    font-weight: bold;
}

/* ===== TOAST ===== */
#toast-container {
    position: absolute;
    bottom: calc(var(--safe-bottom) + 60px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 7px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: bold;
    border: 1px solid rgba(255, 215, 10, 0.5);
    animation: toast-anim 2s ease-out forwards;
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes toast-anim {
    0% { opacity: 0; transform: translateY(20px); }
    15%, 70% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

/* ===== ACHIEVEMENTS ===== */
.ach-progress {
    background: rgba(0,0,0,0.4);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    text-align: center;
    font-size: 13px;
}

.ach-progress-bar {
    height: 6px;
    background: #1a1a2e;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.ach-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd60a, #f72585);
    transition: width 0.4s;
}

.ach-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 8px;
}
.ach-item.unlocked {
    border-color: #ffd60a;
    background: linear-gradient(135deg, rgba(255, 214, 10, 0.12), rgba(247, 37, 133, 0.08));
}
.ach-item.locked .ach-icon { filter: grayscale(1) brightness(0.5); }
.ach-icon { font-size: 22px; text-align: center; }
.ach-name { font-weight: bold; font-size: 12px; }
.ach-desc { font-size: 10px; color: #aaa; }
.ach-reward { font-size: 11px; color: #ffd60a; font-weight: bold; }

/* ===== HISTORY ===== */
.history-item {
    padding: 8px 10px;
}
.history-item-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
.history-item-char { font-weight: bold; font-size: 12px; color: #ffd60a; }
.history-item-time { font-size: 10px; color: #888; }
.history-stats {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 11px;
}
.history-stat {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 3px;
}
.history-weapons {
    display: flex;
    gap: 3px;
    margin-top: 4px;
    flex-wrap: wrap;
}
.history-weapon {
    background: rgba(58, 134, 255, 0.15);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 10px;
    border: 1px solid rgba(58, 134, 255, 0.3);
}
.history-empty {
    text-align: center;
    color: #aaa;
    padding: 20px;
    font-style: italic;
    grid-column: 1 / -1;
}

/* ===== SETTINGS ===== */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr 60px;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-row label {
    font-size: 12px;
    font-weight: bold;
}

.setting-row input[type="range"] {
    width: 100%;
    accent-color: #f72585;
}

.setting-row input[type="checkbox"] {
    width: 22px;
    height: 22px;
    grid-column: 2 / 4;
    justify-self: end;
    accent-color: #06d6a0;
    cursor: pointer;
}

.setting-row span {
    font-size: 11px;
    color: #ffd60a;
    text-align: right;
}

/* ===== TALENT TREE ===== */
.talent-points {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.4);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid rgba(255,214,10,0.3);
    font-size: 13px;
}
.talent-points-num {
    font-size: 20px;
    font-weight: bold;
    color: #ffd60a;
    text-shadow: 0 0 8px rgba(255,214,10,0.5);
}
.talents-tree {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 8px;
}
.talent-branch {
    background: rgba(0,0,0,0.3);
    border: 2px solid;
    border-radius: 8px;
    padding: 6px;
}
.talent-branch-title {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
    text-align: center;
    letter-spacing: 1px;
}
.talent-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}
.talent-node {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    padding: 6px 4px;
    cursor: pointer;
    font-family: inherit;
    color: #fff;
    text-align: center;
}
.talent-node.learned {
    background: rgba(255,214,10,0.15);
    border-color: #ffd60a;
}
.talent-node.locked { opacity: 0.4; cursor: not-allowed; }
.talent-node-icon { font-size: 16px; }
.talent-node-name { font-size: 10px; font-weight: bold; }
.talent-node-cost { font-size: 9px; color: #ffd60a; }

/* ===== CATALOG ===== */
.catalog-tabs, .cosmetic-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}
.cosmetic-tabs { grid-template-columns: 1fr 1fr; }
.cat-tab, .cos-tab, .lb-tab {
    padding: 8px 4px;
    font-size: 11px;
    font-weight: bold;
    background: rgba(0,0,0,0.4);
    color: #888;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
}
.cat-tab.active, .cos-tab.active, .lb-tab.active {
    color: #f72585;
    border-color: #f72585;
    background: rgba(247,37,133,0.15);
}

.catalog-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 8px;
}

.catalog-item {
    display: grid;
    grid-template-columns: 30px 1fr;
    gap: 6px;
    align-items: center;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 6px 8px;
}
.catalog-icon { font-size: 20px; text-align: center; }
.catalog-name { font-size: 12px; font-weight: bold; }
.catalog-desc { font-size: 10px; color: #aaa; }
.catalog-req { font-size: 10px; color: #ffd60a; }
.catalog-cat { font-size: 8px; color: #888; text-transform: uppercase; letter-spacing: 1px; }

/* ===== RELICS ===== */
.relic-item {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    gap: 6px;
    align-items: center;
}
.relic-item.unlocked { border-color: rgba(58,134,255,0.5); }
.relic-item.equipped {
    border-color: #ffd60a;
    background: rgba(255,214,10,0.1);
    box-shadow: 0 0 8px rgba(255,214,10,0.3);
}
.relic-icon { font-size: 22px; text-align: center; }
.relic-name { font-size: 12px; font-weight: bold; }
.relic-desc { font-size: 10px; color: #aaa; }
.relic-btn.unequip {
    background: linear-gradient(180deg, #ff6b35 0%, #c0410d 100%);
    border-bottom-color: #7a2a08;
}

/* ===== COSMETICS ===== */
.cosmetic-item {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
}
.cosmetic-item.equipped {
    border-color: #ffd60a;
    box-shadow: 0 0 8px rgba(255,214,10,0.3);
}
.cosmetic-item.locked { opacity: 0.6; }
.cosmetic-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 4px;
    border: 2px solid #000;
}
.cosmetic-name { font-size: 11px; font-weight: bold; }
.cosmetic-cost { font-size: 10px; color: #ffd60a; margin-top: 2px; }

/* ===== CHARACTERS ===== */
#characters-list .card {
    flex-direction: column;
}
.starting-weapon-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 3px;
    width: 100%;
    margin-top: 4px;
}
.sw-btn {
    padding: 4px;
    background: rgba(0,0,0,0.5);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 4px;
    color: #fff;
    font-size: 9px;
    cursor: pointer;
    font-family: inherit;
}
.sw-btn.selected {
    border-color: #ffd60a;
    background: rgba(255,214,10,0.15);
}
.sw-btn-icon { font-size: 16px; display: block; }

/* ===== MUTATORS ===== */
.mutators-section { margin-bottom: 8px; }
.mut-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}
.mut-item {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 5px;
    padding: 6px 4px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    color: #fff;
}
.mut-item.selected {
    border-color: #ffd60a;
    background: rgba(255,214,10,0.15);
    box-shadow: 0 0 6px rgba(255,214,10,0.3);
}
.mut-icon { font-size: 18px; display: block; }
.mut-name { font-size: 10px; font-weight: bold; margin: 2px 0; }
.mut-desc { font-size: 9px; color: #aaa; line-height: 1.2; }

/* ===== BATTLE PASS ===== */
.bp-info {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,214,10,0.3);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 8px;
}
.bp-season { font-weight: bold; color: #ffd60a; margin-bottom: 4px; font-size: 13px; }
.bp-progress-bar { height: 8px; background: #1a1a2e; border-radius: 4px; overflow: hidden; margin: 3px 0; }
.bp-progress-fill { height: 100%; background: linear-gradient(90deg, #ffd60a, #f72585); transition: width 0.4s; }
.bp-progress-text { font-size: 10px; color: #aaa; }
.bp-premium-banner {
    background: linear-gradient(135deg, rgba(247,37,133,0.2), rgba(199,125,255,0.15));
    border: 2px solid rgba(247,37,133,0.4);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
}
.bp-quest {
    background: rgba(0,0,0,0.4);
    padding: 5px 8px;
    border-radius: 4px;
    border-left: 3px solid #ffd60a;
    font-size: 11px;
}
.bp-quest.complete { border-left-color: #06d6a0; opacity: 0.7; }
.bp-quest-name { font-weight: bold; }
.bp-quest-progress { color: #aaa; font-size: 10px; }
.bp-tier {
    display: grid;
    grid-template-columns: 24px 1fr 1fr;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.4);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 10px;
}
.bp-tier.reached { background: rgba(58,134,255,0.15); }
.bp-tier-num { font-weight: bold; color: #ffd60a; text-align: center; }
.bp-tier-reward { background: rgba(255,255,255,0.05); padding: 3px 5px; border-radius: 3px; }
.bp-tier-reward.claimed { opacity: 0.5; }
.bp-tier-reward.locked { opacity: 0.3; }
.bp-tier-reward.claimable {
    border: 1px solid #ffd60a;
    cursor: pointer;
    box-shadow: 0 0 4px rgba(255,214,10,0.4);
}

/* ===== LEADERBOARD ===== */
.lb-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}
.lb-content { margin-bottom: 8px; }
.lb-char-section { margin-bottom: 8px; }
.lb-char-title {
    font-size: 12px;
    font-weight: bold;
    color: #ffd60a;
    margin-bottom: 3px;
}
.lb-entry {
    display: grid;
    grid-template-columns: 28px 1fr 1fr 60px;
    gap: 5px;
    background: rgba(0,0,0,0.4);
    padding: 4px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    font-size: 10px;
}
.lb-rank { font-weight: bold; color: #ffd60a; text-align: center; }
.lb-empty {
    text-align: center;
    color: #aaa;
    padding: 16px;
    font-style: italic;
    font-size: 12px;
}

/* ===== MAP ===== */
#mapview .screen-content {
    align-items: center;
}
.map-info {
    text-align: center;
    color: #ffd60a;
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 14px;
}
.map-canvas-wrap {
    overflow: auto;
    flex: 1;
    max-height: 70vh;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    margin-bottom: 8px;
    width: 100%;
    max-width: 700px;
}
#map-canvas {
    display: block;
    margin: 0 auto;
    background: transparent;
    cursor: pointer;
}

/* ===== CAMPAIGN ===== */
.campaign-acts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}
.campaign-act {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 8px;
}
.campaign-act.locked { opacity: 0.5; }
.campaign-act.current { border-color: #ffd60a; }
.campaign-act.completed { border-color: #06d6a0; }
.campaign-act-title {
    font-size: 13px;
    font-weight: bold;
    color: #ffd60a;
    margin-bottom: 4px;
}
.campaign-mission {
    display: flex;
    justify-content: space-between;
    background: rgba(255,255,255,0.05);
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    margin-bottom: 2px;
}
.campaign-mission.locked { opacity: 0.3; cursor: not-allowed; }
.campaign-mission.completed { background: rgba(6,214,160,0.15); }
.campaign-mission.current { background: rgba(255,214,10,0.15); border: 1px solid #ffd60a; }
.campaign-mission-objective {
    font-size: 10px;
    color: #aaa;
}

/* ===== DIALOG ===== */
#dialog-screen {
    align-items: flex-end;
    background: rgba(10, 10, 20, 0.7);
    padding-bottom: calc(var(--safe-bottom) + 24px);
}
.dialog-box {
    background: rgba(10,10,30,0.95);
    border: 3px solid #ffd60a;
    border-radius: 10px;
    padding: 12px;
    margin: 8px;
    max-width: 700px;
    width: 100%;
    display: grid;
    grid-template-columns: 64px 1fr 40px;
    gap: 10px;
    align-items: center;
    box-shadow: 0 0 30px rgba(255,214,10,0.3);
}
.dialog-portrait {
    font-size: 48px;
    width: 64px;
    height: 64px;
    background: rgba(255,255,255,0.1);
    border: 2px solid #ffd60a;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dialog-speaker {
    font-weight: bold;
    color: #ffd60a;
    margin-bottom: 4px;
    font-size: 13px;
}
.dialog-text {
    font-size: 13px;
    line-height: 1.3;
}
.dialog-next {
    width: 36px;
    height: 36px;
    background: #ffd60a;
    color: #000;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

/* ===== EVENT MODAL ===== */
#event-modal .screen-content { max-width: 500px; }
.event-desc { font-size: 13px; line-height: 1.4; margin-bottom: 8px; }
.event-choices {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}
.event-choice {
    padding: 10px;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    color: #fff;
    font-size: 12px;
}
.event-choice:active {
    border-color: #ffd60a;
    background: rgba(255,214,10,0.1);
}
.event-result {
    background: rgba(58,134,255,0.15);
    border: 2px solid #3a86ff;
    border-radius: 5px;
    padding: 8px;
    font-size: 12px;
    margin-bottom: 6px;
}

/* ===== MULTIPLAYER (lobby UI) ===== */
#multiplayer .screen-content { max-width: 800px; }
.mp-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}
.mp-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin: 8px 0;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.4);
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255,214,10,0.3);
    font-size: 13px;
}
.lobby-room { color: #ffd60a; font-weight: bold; }
.lobby-count {
    background: rgba(58,134,255,0.2);
    color: #3a86ff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.lobby-players {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.lobby-player {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 8px 10px;
}
.lobby-player.empty {
    border-style: dashed;
    border-color: rgba(255,255,255,0.1);
    opacity: 0.5;
    justify-content: center;
    font-style: italic;
    color: #888;
    font-size: 11px;
}
.lobby-player.ready {
    border-color: #06d6a0;
    box-shadow: 0 0 8px rgba(6,214,160,0.3);
}
.lobby-player-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid #000;
}
.lobby-player-info { flex: 1; }
.lobby-player-name { font-weight: bold; font-size: 12px; }
.lobby-player-char { font-size: 11px; color: #aaa; }
.lobby-player-status { font-size: 10px; color: #ffd60a; }
.lobby-player.ready .lobby-player-status { color: #06d6a0; }

.lobby-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.mp-invite-flow {
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,214,10,0.3);
    border-radius: 6px;
    padding: 10px;
    margin-top: 6px;
}
.invite-share-row {
    margin-bottom: 8px;
}
#mp-answer-input, #mp-host-input-url {
    width: 100%;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 8px;
    color: #fff;
    font-size: 12px;
    font-family: monospace;
    margin-bottom: 6px;
}

.guest-character-pick {
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 10px;
}
.lobby-char-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 6px;
}
.lobby-char-btn {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 8px 4px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    color: #fff;
}
.lobby-char-btn.selected {
    border-color: #ffd60a;
    background: rgba(255,214,10,0.15);
}
.lobby-char-btn-icon { font-size: 24px; }
.lobby-char-btn-name { font-size: 10px; font-weight: bold; }

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Very small landscape (< 600w) - compact */
@media (orientation: landscape) and (max-width: 599px) {
    .menu-layout {
        grid-template-columns: minmax(180px, 0.8fr) 1.5fr;
        gap: 8px;
        padding: 8px;
    }
    .title { font-size: 28px; }
    .btn-mega { font-size: 18px; padding: 12px 18px; }
    .menu-grid { grid-template-columns: repeat(3, 1fr); }
    .mut-grid { grid-template-columns: 1fr 1fr; }
}

/* Tablet+ landscape (>= 900w) */
@media (orientation: landscape) and (min-width: 900px) {
    .menu-grid { grid-template-columns: repeat(3, 1fr); }
    .shop-list, .relics-list {
        grid-template-columns: repeat(3, 1fr);
    }
    .catalog-content {
        grid-template-columns: repeat(3, 1fr);
    }
    .campaign-acts {
        grid-template-columns: repeat(3, 1fr);
    }
    .talents-tree { grid-template-columns: repeat(3, 1fr); }
    .talent-row { grid-template-columns: repeat(4, 1fr); }
}

/* Wide desktop (>= 1280) */
@media (orientation: landscape) and (min-width: 1280px) {
    .menu-grid { grid-template-columns: repeat(4, 1fr); }
    .shop-list, .relics-list { grid-template-columns: repeat(3, 1fr); }
    .campaign-acts { grid-template-columns: repeat(5, 1fr); }
}

/* Portrait fallback (desktop in narrow window) - single column */
@media (orientation: portrait) {
    .menu-layout {
        grid-template-columns: 1fr;
        max-height: 100%;
        overflow-y: auto;
    }
    .menu-col-left {
        padding-bottom: 4px;
    }
    .menu-col-right {
        overflow-y: visible;
    }
    .menu-grid { grid-template-columns: repeat(2, 1fr); }
    .mut-grid { grid-template-columns: 1fr 1fr; }
    .menu-mode-toggle { grid-template-columns: repeat(3, 1fr); }
    .shop-list, .relics-list, .ach-list, .campaign-acts {
        grid-template-columns: 1fr;
    }
    .talents-tree { grid-template-columns: 1fr; }
    .talent-row { grid-template-columns: repeat(4, 1fr); }
    .catalog-content { grid-template-columns: 1fr; }
}

/* Very short landscape (height < 380) - shrink everything */
@media (orientation: landscape) and (max-height: 380px) {
    .title { font-size: clamp(20px, 5vh, 32px); }
    .btn-mega { font-size: 16px; padding: 8px 14px; }
    .btn { padding: 6px 10px; font-size: 12px; }
    .btn-grid { padding: 6px 4px; font-size: 11px; }
    h2 { font-size: 16px; margin-bottom: 4px; }
    .meta-info { padding: 4px; }
    .meta-row span:last-child { font-size: 11px; }
}
