/* ===== VARIABLES ===== */
:root {
    --bg-primary: #0e0b18;
    --bg-secondary: #161225;
    --bg-card: #1e1835;
    --bg-card-hover: #28204a;
    --gold: #f0c27a;
    --gold-dark: #d4a054;
    --gold-glow: rgba(240, 194, 122, 0.3);
    --accent-pink: #e8a0bf;
    --accent-lavender: #b8a9e8;
    --text-primary: #f5f0f8;
    --text-secondary: #a89bbe;
    --text-muted: #6e5f88;
    --common: #a0a8b8;
    --rare: #6eaaff;
    --epic: #c78dff;
    --legendary: #ffb347;
    --success: #6dd5a0;
    --danger: #f07088;
    --border: #3d2d5c;
    --nav-height: 65px;
    --top-height: 50px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================= */
/* ===== GAME BACKGROUND (파티클 + 비네트) ===== */
/* ============================================= */
.game-bg {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    background: radial-gradient(ellipse at 50% 30%, #1a1430 0%, #0e0b18 70%);
    overflow: hidden;
}

.game-bg-particles {
    position: absolute;
    width: 300%; height: 300%;
    top: -100%; left: -100%;
    background:
        radial-gradient(2px 2px at 10% 20%, rgba(240,194,122,0.4), transparent),
        radial-gradient(2px 2px at 25% 55%, rgba(184,169,232,0.35), transparent),
        radial-gradient(3px 3px at 40% 15%, rgba(255,220,150,0.3), transparent),
        radial-gradient(2px 2px at 55% 75%, rgba(232,160,191,0.3), transparent),
        radial-gradient(2px 2px at 70% 35%, rgba(240,194,122,0.25), transparent),
        radial-gradient(3px 3px at 85% 60%, rgba(184,169,232,0.3), transparent),
        radial-gradient(2px 2px at 15% 80%, rgba(255,179,71,0.2), transparent),
        radial-gradient(2px 2px at 60% 10%, rgba(232,160,191,0.25), transparent),
        radial-gradient(3px 3px at 90% 85%, rgba(240,194,122,0.3), transparent),
        radial-gradient(2px 2px at 35% 45%, rgba(110,170,255,0.2), transparent),
        radial-gradient(2px 2px at 75% 90%, rgba(199,141,255,0.25), transparent),
        radial-gradient(3px 3px at 50% 50%, rgba(255,220,150,0.2), transparent);
    animation: bgFloat 25s ease-in-out infinite;
}

@keyframes bgFloat {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-3%, -2%); }
    50%  { transform: translate(-1%, -4%); }
    75%  { transform: translate(-4%, -1%); }
    100% { transform: translate(0, 0); }
}

.game-bg-vignette {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(5,3,12,0.6) 100%);
}

/* ===== RESET ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Gowun Dodum', 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    position: relative;
    z-index: 0;
}

/* All main UI sits above background */
#top-bar, #screens, #bottom-nav,
#modal-overlay, #toast-container, #reveal-overlay {
    position: relative;
    z-index: 1;
}

/* ===== TOP HUD ===== */
#top-bar {
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    background: linear-gradient(180deg, rgba(14,11,24,0.95), rgba(14,11,24,0.8));
    border-bottom: 2px solid rgba(240,194,122,0.25);
    flex-shrink: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

/* HUD 금박 라인 장식 */
#top-bar::after {
    content: '';
    position: absolute;
    bottom: -2px; left: 10%; right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(240,194,122,0.5), rgba(240,194,122,0.8), rgba(240,194,122,0.5), transparent);
}

.top-left, .top-right {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
}

.gold-display, .storage-display {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.35);
    border: 2px solid rgba(240,194,122,0.4);
    border-radius: 25px;
    padding: 5px 14px 5px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

/* 설정 버튼 (HUD 원형 버튼) */
#settings-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    padding: 0;
    font-size: 20px;
    line-height: 1;
    color: inherit;
    cursor: pointer;
    background: rgba(0,0,0,0.35);
    border: 2px solid rgba(184,169,232,0.3);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform 0.2s ease, background 0.2s ease;
}

#settings-btn:hover { background: rgba(0,0,0,0.5); }
#settings-btn:active { transform: scale(0.92) rotate(30deg); }

.gold-display {
    font-size: 18px;
    font-weight: 900;
    color: var(--gold);
}

.gold-display.bump {
    animation: goldBump 0.3s ease;
}

@keyframes goldBump {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.gold-icon { font-size: 22px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }
.gold-label { font-size: 11px; color: var(--gold-dark); font-weight: 800; }

.storage-display {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    border-color: rgba(184,169,232,0.3);
}

.storage-icon { font-size: 18px; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.4)); }

/* ===== SCREENS ===== */
#screens {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    opacity: 0;
    transform: translateX(30px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    -webkit-overflow-scrolling: touch;
}

.screen.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.screen-header {
    margin-bottom: 16px;
}

.screen-header h2 {
    font-size: 24px;
    font-weight: 900;
    -webkit-text-stroke: 1px rgba(0,0,0,0.3);
    text-shadow:
        0 2px 4px rgba(0,0,0,0.5),
        0 0 20px rgba(240,194,122,0.15);
    letter-spacing: 1px;
}

/* ===== BOTTOM NAV ===== */
#bottom-nav {
    height: calc(72px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    background: linear-gradient(0deg, rgba(10,7,18,0.98), rgba(18,14,30,0.95));
    border-top: 2px solid rgba(240,194,122,0.25);
    flex-shrink: 0;
    z-index: 100;
    gap: 4px;
    padding: 6px 8px calc(var(--safe-bottom) + 4px);
    box-shadow: 0 -2px 20px rgba(0,0,0,0.5);
}

/* 상단 금박 라인 */
#bottom-nav::before {
    content: '';
    position: absolute;
    top: -2px; left: 10%; right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(240,194,122,0.5), rgba(240,194,122,0.8), rgba(240,194,122,0.5), transparent);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 2px solid transparent;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    border-radius: 14px;
    transition: all 0.2s;
}

.nav-btn:active { transform: scale(0.93); }

.nav-btn.active {
    color: white;
    background: linear-gradient(135deg, rgba(232,160,191,0.2), rgba(184,169,232,0.15));
    border-color: rgba(232,160,191,0.4);
    box-shadow: 0 0 12px rgba(232,160,191,0.15);
}

.nav-btn.active .nav-icon {
    transform: scale(1.2);
    filter: drop-shadow(0 2px 6px rgba(232,160,191,0.5));
}

.nav-icon {
    font-size: 24px;
    transition: all 0.2s;
}

.break-icon {
    font-size: 28px;
}

.nav-label {
    font-weight: 800;
    font-size: 10px;
    letter-spacing: 0.5px;
}

/* ===== WAREHOUSE (HOME) ===== */
#screen-home {
    padding: 0;
    background: transparent;
}

.warehouse {
    padding-bottom: 24px;
}

/* --- Hero Banner --- */
.wh-hero {
    position: relative;
    padding: 20px 16px 24px;
    background: linear-gradient(180deg, rgba(25,20,45,0.9), rgba(15,12,28,0.95));
    border: 2px solid rgba(240,194,122,0.15);
    border-top: none;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 4px 0 rgba(0,0,0,0.25),
        0 8px 24px rgba(0,0,0,0.3);
}

/* 코너 장식 */
.wh-hero::before {
    content: '';
    position: absolute;
    top: 8px; right: 8px;
    width: 20px; height: 20px;
    border-top: 2px solid rgba(240,194,122,0.4);
    border-right: 2px solid rgba(240,194,122,0.4);
    border-radius: 0 6px 0 0;
}

.wh-hero::after {
    content: '';
    position: absolute;
    top: 8px; left: 8px;
    width: 20px; height: 20px;
    border-top: 2px solid rgba(240,194,122,0.4);
    border-left: 2px solid rgba(240,194,122,0.4);
    border-radius: 6px 0 0 0;
}

.wh-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.wh-title {
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wh-level-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f0c27a, #e8a0bf);
    color: #2a1a30;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 900;
    box-shadow: 0 2px 12px rgba(232, 160, 191, 0.3);
}

.wh-capacity {
    margin-bottom: 14px;
}

.wh-cap-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.wh-cap-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.wh-cap-num {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.wh-cap-bar {
    height: 12px;
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.wh-cap-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #6dd5a0, #88e8bb);
    transition: width 0.4s ease;
    position: relative;
}

.wh-cap-fill::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: rgba(255,255,255,0.2);
    border-radius: 6px 6px 0 0;
}

.wh-cap-fill.warning { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.wh-cap-fill.full { background: linear-gradient(90deg, #ef4444, #f87171); }

.wh-expand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 14px;
    padding: 10px 14px;
    backdrop-filter: blur(4px);
}

.wh-expand-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wh-expand-icon {
    font-size: 24px;
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,215,0,0.1);
    border-radius: 10px;
}

.wh-expand-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.wh-expand-label {
    font-size: 13px;
    font-weight: 700;
}

.wh-expand-detail {
    font-size: 11px;
    color: var(--text-muted);
}

.wh-expand-max {
    text-align: center;
    padding: 8px;
    color: var(--success);
    font-size: 13px;
    font-weight: 700;
}

/* --- Quick Actions --- */
.wh-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 16px;
    margin-bottom: 20px;
}

.wh-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 18px 8px;
    border-radius: 18px;
    border: 2px solid rgba(255,255,255,0.15);
    cursor: pointer;
    font-weight: 900;
    font-size: 14px;
    transition: all 0.12s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.wh-action-btn:active { transform: scale(0.95) translateY(3px); }

.wh-action-btn .wh-act-icon {
    font-size: 32px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.wh-action-btn .wh-act-img {
    width: 52px;
    height: 52px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.35));
}

/* --- Ad Reward Card --- */
.wh-ad-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, rgba(35,28,60,0.9), rgba(22,18,38,0.95));
    border: 2px solid rgba(184, 169, 232, 0.2);
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 4px 0 rgba(0,0,0,0.25),
        0 6px 16px rgba(0,0,0,0.2);
}

.wh-ad-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wh-ad-icon {
    width: 48px;
    height: 48px;
}

.wh-ad-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wh-ad-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.wh-ad-gold {
    font-size: 16px;
    font-weight: 900;
    background: linear-gradient(90deg, #f0c27a, #e8a0bf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wh-ad-btn {
    padding: 10px 18px;
    border-radius: 14px;
    border: none;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    background: linear-gradient(135deg, #b8a9e8, #9888d0);
    color: white;
    box-shadow: 0 3px 12px rgba(184, 169, 232, 0.3);
    border-bottom: 3px solid rgba(0,0,0,0.1);
    transition: all 0.15s;
    white-space: nowrap;
}

.wh-ad-btn:active {
    transform: scale(0.95) translateY(1px);
    border-bottom-width: 1px;
}

.wh-ad-btn.disabled {
    background: #3d2d5c;
    color: var(--text-muted);
    box-shadow: none;
    cursor: not-allowed;
    border-bottom: none;
}

.wh-action-break {
    background: linear-gradient(180deg, #f08098, #d05070);
    color: white;
    box-shadow: 0 6px 0 #a03050, 0 8px 20px rgba(160,48,80,0.3);
}
.wh-action-break:active { box-shadow: 0 2px 0 #a03050; }

.wh-action-shop {
    background: linear-gradient(180deg, #9888d8, #7060b0);
    color: white;
    box-shadow: 0 6px 0 #504088, 0 8px 20px rgba(80,64,136,0.3);
}
.wh-action-shop:active { box-shadow: 0 2px 0 #504088; }

/* --- Section Headers --- */
.wh-section {
    padding: 0 16px;
    margin-bottom: 16px;
}

.wh-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 900;
    color: var(--gold);
    letter-spacing: 1px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.wh-section-header::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, rgba(240,194,122,0.4), transparent);
}

/* --- Items Grid --- */
.wh-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px;
}

.wh-item {
    position: relative;
    background: linear-gradient(180deg, rgba(30,24,50,0.9), rgba(18,14,32,0.95));
    border: 2px solid rgba(240,194,122,0.12);
    border-radius: 12px;
    padding: 10px 6px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.12s;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 3px 0 rgba(0,0,0,0.25),
        0 5px 10px rgba(0,0,0,0.2);
}

.wh-item:active { transform: scale(0.93) translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.25); }

.wh-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: 12px 12px 0 0;
}

.wh-item.r-common::before { background: var(--common); }
.wh-item.r-rare { border-color: rgba(59,130,246,0.4); }
.wh-item.r-rare::before { background: var(--rare); }
.wh-item.r-epic { border-color: rgba(168,85,247,0.4); box-shadow: 0 0 10px rgba(168,85,247,0.1); }
.wh-item.r-epic::before { background: var(--epic); }
.wh-item.r-legendary {
    border-color: rgba(245,158,11,0.5);
    box-shadow: 0 0 15px rgba(245,158,11,0.15);
    animation: legendaryPulse 2s ease-in-out infinite;
}
.wh-item.r-legendary::before { background: linear-gradient(90deg, #f59e0b, #fbbf24, #f59e0b); }

@keyframes legendaryPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255,179,71,0.15); }
    50% { box-shadow: 0 0 25px rgba(255,179,71,0.35); }
}

.wh-item-icon { font-size: 30px; margin-bottom: 2px; }

.wh-item-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wh-item-count {
    position: absolute;
    top: 4px; right: 6px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
}

.wh-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px 16px;
}

.wh-empty-icon {
    font-size: 48px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.wh-empty-text {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
}

/* --- Stats --- */
.wh-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.wh-stat {
    background: linear-gradient(180deg, rgba(30,24,50,0.9), rgba(18,14,32,0.95));
    border: 2px solid rgba(240,194,122,0.1);
    border-radius: 12px;
    padding: 14px 8px;
    text-align: center;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 3px 0 rgba(0,0,0,0.2),
        0 5px 10px rgba(0,0,0,0.15);
}

.wh-stat-icon { font-size: 20px; margin-bottom: 4px; }

.wh-stat-value {
    font-size: 20px;
    font-weight: 900;
    background: linear-gradient(180deg, #f0c27a, #e8a0bf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.wh-stat-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 600;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 16px 28px;
    border: none;
    border-radius: 16px;
    font-size: 17px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.15);
    position: relative;
}

.btn:active {
    transform: scale(0.95) translateY(2px);
}

.btn-primary {
    background: linear-gradient(180deg, #f7c97e, #e8a060);
    color: #3a2010;
    box-shadow: 0 6px 0 #c07838, 0 8px 20px rgba(192,120,56,0.35);
    border: 2px solid rgba(255,255,255,0.2);
}

.btn-primary:active {
    box-shadow: 0 2px 0 #c07838, 0 3px 10px rgba(192,120,56,0.3);
}

.btn-glow {
    animation: btnGlow 2s ease-in-out infinite;
}

@keyframes btnGlow {
    0%, 100% { box-shadow: 0 4px 15px rgba(232, 160, 191, 0.3); }
    50% { box-shadow: 0 4px 30px rgba(232, 160, 191, 0.5); }
}

.btn-secondary {
    background: linear-gradient(180deg, #3d3060, #2d2248);
    color: var(--text-primary);
    border: 2px solid rgba(255,255,255,0.1);
    box-shadow: 0 4px 0 #1a1530, 0 6px 15px rgba(0,0,0,0.3);
}

.btn-secondary:active {
    box-shadow: 0 1px 0 #1a1530;
}

.btn-small {
    padding: 8px 14px;
    font-size: 12px;
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-buy {
    padding: 8px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 900;
    background: linear-gradient(180deg, #80dd60, #50b830);
    color: #1a3010;
    border: 2px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: all 0.12s;
    box-shadow: 0 4px 0 #308818, 0 5px 12px rgba(48,136,24,0.3);
    text-shadow: 0 1px 1px rgba(255,255,255,0.2);
}

.btn-buy:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #308818;
}

.btn-buy:disabled {
    background: linear-gradient(180deg, #444, #333);
    color: #666;
    cursor: not-allowed;
    box-shadow: 0 3px 0 #222;
    border-color: transparent;
    text-shadow: none;
}

.btn-sell {
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 900;
    background: linear-gradient(180deg, #80dd60, #50b830);
    color: #1a3010;
    border: 2px solid rgba(255,255,255,0.15);
    cursor: pointer;
    box-shadow: 0 3px 0 #308818;
}

.btn-sell:active { transform: translateY(2px); box-shadow: 0 0px 0 #308818; }

.btn-sell-all {
    background: linear-gradient(180deg, #80dd60, #50b830);
    color: #1a3010;
    font-weight: 900;
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 3px 0 #308818;
}

.btn-sell-all:active { transform: translateY(2px); box-shadow: none; }

/* ===== SHOP ===== */
#screen-shop {
    background: transparent;
}

.shop-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    /* 상자/도구 탭을 스크롤해도 상단에 고정 (스크롤 내려도 탭 전환 가능) */
    position: sticky;
    top: -1px;
    z-index: 20;
    /* .screen 의 좌우 패딩(16px)을 상쇄해 가로 전체를 덮어 뒤 컨텐츠가 비치지 않게 */
    margin-left: -16px;
    margin-right: -16px;
    padding: 8px 16px 10px;
    background: var(--bg-primary);
    box-shadow: 0 6px 12px -6px rgba(0,0,0,0.6);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: linear-gradient(135deg, rgba(232,160,191,0.15), rgba(184,169,232,0.1));
    border-color: var(--accent-pink);
    color: var(--accent-pink);
    box-shadow: 0 0 15px rgba(232, 160, 191, 0.1);
}

.shop-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 20px;
}

.shop-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, rgba(35,28,60,0.9), rgba(22,18,38,0.95));
    border: 2px solid rgba(240,194,122,0.15);
    border-radius: 14px;
    padding: 12px 14px;
    transition: all 0.12s;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.05),
        0 4px 0 rgba(0,0,0,0.3),
        0 6px 16px rgba(0,0,0,0.3);
}

/* 좌측 금박 장식선 */
.shop-item::before {
    content: '';
    position: absolute;
    top: 8px; bottom: 8px; left: 0;
    width: 3px;
    background: linear-gradient(180deg, transparent, rgba(240,194,122,0.5), transparent);
    border-radius: 0 2px 2px 0;
}

.shop-item:active { transform: scale(0.97) translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,0.3); }

.shop-item.owned { border-color: var(--success); opacity: 0.7; }

.shop-item-icon {
    font-size: 38px;
    width: 58px; height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    border-radius: 12px;
    flex-shrink: 0;
    border: 2px solid rgba(240,194,122,0.1);
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.05);
}

.shop-item-info { flex: 1; min-width: 0; }
.shop-item-name { font-size: 16px; font-weight: 900; }
.shop-item-desc { font-size: 11px; color: var(--text-secondary); margin-top: 3px; line-height: 1.4; }
.shop-item-price {
    font-size: 15px;
    color: var(--gold);
    font-weight: 900;
    margin-top: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.shop-item-drops {
    font-size: 12px;
    color: var(--success);
    font-weight: 800;
    margin-top: 2px;
}

.shop-buy-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.btn-buy-multi {
    font-size: 12px !important;
    padding: 7px 16px !important;
    background: linear-gradient(180deg, #60b0dd, #3088b8) !important;
    box-shadow: 0 3px 0 #206888 !important;
    border-color: rgba(255,255,255,0.15) !important;
    color: #0a2030 !important;
}

.btn-buy-multi:active {
    box-shadow: 0 1px 0 #206888 !important;
}

.btn-buy-multi:disabled {
    background: linear-gradient(180deg, #444, #333) !important;
    box-shadow: 0 3px 0 #222 !important;
}
.shop-item-count { font-size: 11px; color: var(--text-muted); font-weight: 700; }

/* ===== BREAK SCREEN ===== */
.break-area {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    margin: -16px;
}

.break-top-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    flex-shrink: 0;
}

.tool-indicator {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(255,255,255,0.1);
    padding: 6px 14px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
}

.tool-dur-bar {
    display: inline-block;
    width: 48px;
    height: 6px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
}

.tool-dur-fill {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #6dd5a0, #88e8bb);
    transition: width 0.2s ease;
}

.tool-dur-fill.dur-warn {
    background: linear-gradient(90deg, #f0c27a, #e8a060);
}

.tool-dur-fill.dur-crit {
    background: linear-gradient(90deg, #f07088, #e85070);
    animation: durBlink 0.8s ease-in-out infinite;
}

@keyframes durBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chest-select-btn {
    background: rgba(0,0,0,0.4);
    border: 2px solid rgba(240,194,122,0.3);
    padding: 6px 14px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 800;
    color: var(--gold);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.chest-hp-bar {
    height: 26px;
    background: rgba(0,0,0,0.4);
    border-radius: 13px;
    margin: 0 12px 8px;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}

.hp-fill {
    height: 100%;
    background: linear-gradient(180deg, #ff8888, #e04050);
    border-radius: 11px;
    transition: width 0.15s ease;
    box-shadow: 0 0 10px rgba(224,64,80,0.4);
    position: relative;
}

.hp-fill::after {
    content: '';
    position: absolute;
    top: 2px; left: 4px; right: 4px;
    height: 40%;
    background: rgba(255,255,255,0.25);
    border-radius: 8px;
}

.hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 900;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

#break-canvas {
    flex: 1;
    width: 100%;
    cursor: pointer;
    touch-action: none;
}

.break-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.break-message p {
    color: var(--text-secondary);
    font-size: 16px;
}

.break-message.hidden { display: none; }

.tool-switch {
    display: flex;
    gap: 6px;
    padding: 8px 16px 12px;
    overflow-x: auto;
    flex-shrink: 0;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 7px 14px;
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.08);
    border-radius: 25px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.tool-btn:active { transform: scale(0.93); }

.tool-btn.active {
    border-color: var(--accent-pink);
    color: white;
    background: linear-gradient(135deg, rgba(232,160,191,0.25), rgba(184,169,232,0.15));
    box-shadow: 0 0 10px rgba(232,160,191,0.2), 0 2px 6px rgba(0,0,0,0.2);
}

/* ===== INVENTORY ===== */
.storage-meter {
    margin-top: 8px;
    height: 8px;
    background: var(--bg-card);
    border-radius: 4px;
    overflow: hidden;
}

.storage-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success), #16a34a);
    border-radius: 4px;
    transition: width 0.3s;
}

.storage-meter-fill.warning { background: linear-gradient(90deg, #f59e0b, #d97706); }
.storage-meter-fill.full { background: linear-gradient(90deg, var(--danger), #dc2626); }

.inventory-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.filter-btn {
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.filter-btn.active {
    border-color: var(--accent-lavender);
    color: var(--accent-lavender);
    background: rgba(184, 169, 232, 0.1);
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    padding-bottom: 20px;
}

.inv-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.inv-item:active { transform: scale(0.95); }

.inv-item.rarity-common { border-color: var(--common); }
.inv-item.rarity-rare { border-color: var(--rare); }
.inv-item.rarity-epic { border-color: var(--epic); }
.inv-item.rarity-legendary {
    border-color: var(--legendary);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

.inv-item-icon { font-size: 28px; }

.inv-item-name {
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inv-item-count {
    font-size: 10px;
    color: var(--text-muted);
}

/* ===== MARKET ===== */
#screen-market {
    background: transparent;
}

.market-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.market-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 20px;
}

.market-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(180deg, rgba(35,28,60,0.9), rgba(22,18,38,0.95));
    border: 2px solid rgba(240,194,122,0.12);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 3px 0 rgba(0,0,0,0.25),
        0 5px 12px rgba(0,0,0,0.2);
}

.market-item-icon { font-size: 28px; }

.market-item-info { flex: 1; }

.market-item-name {
    font-size: 14px;
    font-weight: 600;
}

.market-item-rarity {
    font-size: 11px;
    margin-top: 2px;
}

.market-item-rarity.common { color: var(--common); }
.market-item-rarity.rare { color: var(--rare); }
.market-item-rarity.epic { color: var(--epic); }
.market-item-rarity.legendary { color: var(--legendary); }

.market-item-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--gold);
    margin-right: 8px;
}

.market-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.market-empty p { margin-bottom: 16px; }

/* ===== MODAL ===== */
#modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#modal-overlay.hidden { display: none; }

#modal-content {
    background: linear-gradient(180deg, rgba(25,20,42,0.98), rgba(14,11,24,0.99));
    border: 2px solid rgba(240,194,122,0.2);
    border-bottom: none;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 24px 16px;
    animation: slideUp 0.3s ease;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.5);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header h3 { font-size: 18px; font-weight: 700; }

.modal-close {
    background: var(--bg-card);
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.modal-item:active {
    transform: scale(0.97);
    background: var(--bg-card-hover);
}

.modal-item-icon {
    font-size: 30px;
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.modal-item-info { flex: 1; }

.modal-item-name { font-size: 14px; font-weight: 600; }

.modal-item-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== TOAST ===== */
#toast-container {
    position: fixed;
    top: calc(var(--safe-top) + var(--top-height) + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: linear-gradient(180deg, rgba(30,24,50,0.95), rgba(14,11,24,0.98));
    border: 2px solid rgba(240,194,122,0.2);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 1.7s forwards;
    pointer-events: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.info { border-color: var(--rare); color: var(--rare); }
.toast.legendary { border-color: var(--legendary); color: var(--legendary); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* ===== ITEM REVEAL ===== */
#reveal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(5, 3, 12, 0.9);
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: hidden;
}

/* 회전하는 빛줄기 */
#reveal-overlay::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 200%; height: 200%;
    transform: translate(-50%, -50%);
    background:
        conic-gradient(from 0deg,
            transparent 0deg, rgba(240,194,122,0.06) 15deg,
            transparent 30deg, transparent 60deg,
            rgba(184,169,232,0.05) 75deg, transparent 90deg,
            transparent 120deg, rgba(232,160,191,0.05) 135deg,
            transparent 150deg, transparent 180deg,
            rgba(240,194,122,0.06) 195deg, transparent 210deg,
            transparent 240deg, rgba(184,169,232,0.05) 255deg,
            transparent 270deg, transparent 300deg,
            rgba(232,160,191,0.05) 315deg, transparent 330deg
        );
    animation: revealRays 4s linear infinite;
}

@keyframes revealRays {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

#reveal-overlay.hidden { display: none; }

#reveal-content {
    text-align: center;
    animation: revealPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    z-index: 1;
}

@keyframes revealPop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.reveal-icon {
    font-size: 88px;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
    animation: revealIconFloat 2s ease-in-out infinite;
}

@keyframes revealIconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.reveal-name {
    font-size: 26px;
    font-weight: 900;
    margin-bottom: 4px;
    -webkit-text-stroke: 1px rgba(0,0,0,0.4);
    text-shadow: 0 3px 6px rgba(0,0,0,0.6), 0 0 30px currentColor;
    letter-spacing: 1px;
}

.reveal-rarity {
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 8px;
    text-shadow: 0 0 15px currentColor;
}

.reveal-value {
    font-size: 20px;
    color: var(--gold);
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5), 0 0 15px rgba(240,194,122,0.3);
}

.reveal-rarity.common { color: var(--common); }
.reveal-rarity.rare { color: var(--rare); }
.reveal-rarity.epic { color: var(--epic); }
.reveal-rarity.legendary { color: var(--legendary); }

.reveal-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: -1;
    animation: glowPulse 1.5s ease-in-out infinite;
}

.reveal-glow.common { background: radial-gradient(circle, rgba(156,163,175,0.3), transparent 70%); }
.reveal-glow.rare { background: radial-gradient(circle, rgba(59,130,246,0.4), transparent 70%); }
.reveal-glow.epic { background: radial-gradient(circle, rgba(168,85,247,0.4), transparent 70%); }
.reveal-glow.legendary { background: radial-gradient(circle, rgba(255,179,71,0.5), transparent 70%); }

@keyframes glowPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}

.reveal-tap-hint {
    margin-top: 24px;
    font-size: 12px;
    color: var(--text-muted);
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ===== DAMAGE NUMBER ===== */
.damage-float {
    position: fixed;
    font-size: 24px;
    font-weight: 900;
    color: #ffdd88;
    -webkit-text-stroke: 1px rgba(0,0,0,0.3);
    pointer-events: none;
    z-index: 150;
    animation: damageFloat 0.8s ease-out forwards;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

@keyframes damageFloat {
    0% { opacity: 1; transform: translateY(0) scale(1.2); }
    100% { opacity: 0; transform: translateY(-60px) scale(0.8); }
}

/* ===== SCREEN SHAKE ===== */
.shake {
    animation: shake 0.15s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px) translateY(2px); }
    50% { transform: translateX(4px) translateY(-2px); }
    75% { transform: translateX(-2px) translateY(1px); }
}

/* ===== SCROLLBAR ===== */
.screen::-webkit-scrollbar { width: 4px; }
.screen::-webkit-scrollbar-track { background: transparent; }
.screen::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== DURABILITY BAR ===== */
.durability-bar {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.durability-fill {
    height: 100%;
    background: var(--success);
    border-radius: 2px;
    transition: width 0.3s;
}

.durability-fill.low { background: var(--danger); }

/* ===== COLLECTION (도감) ===== */
.collection-content { padding: 0 4px 20px; }

.coll-hero {
    position: relative;
    background: linear-gradient(180deg, rgba(25,20,45,0.9), rgba(15,12,28,0.95));
    border: 2px solid rgba(240,194,122,0.18);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.coll-hero-title { font-size: 16px; font-weight: 900; margin-bottom: 10px; }
.coll-bar {
    height: 14px; background: rgba(255,255,255,0.08);
    border-radius: 7px; overflow: hidden;
}
.coll-bar-fill {
    height: 100%; border-radius: 7px;
    background: linear-gradient(90deg, #8dd5ff, #6eaaff);
    transition: width 0.4s ease;
}
.coll-percent {
    position: absolute; top: 16px; right: 16px;
    font-size: 13px; font-weight: 900; color: var(--gold);
}

.coll-rarity-section { margin-bottom: 18px; padding: 0 4px; }
.coll-rarity-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.coll-rarity-label { font-size: 12px; font-weight: 900; min-width: 44px; }
.coll-rarity-bar {
    flex: 1; height: 8px; background: rgba(255,255,255,0.08);
    border-radius: 4px; overflow: hidden;
}
.coll-rarity-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.coll-rarity-num {
    font-size: 12px; font-weight: 800; color: var(--text-secondary);
    min-width: 40px; text-align: right;
}

.coll-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
    gap: 8px; padding: 0 4px;
}
.coll-item {
    background: linear-gradient(180deg, rgba(30,24,50,0.9), rgba(18,14,32,0.95));
    border: 2px solid rgba(240,194,122,0.12);
    border-radius: 12px;
    padding: 10px 6px 8px;
    text-align: center;
    transition: transform 0.12s;
}
.coll-item.discovered { cursor: pointer; }
.coll-item.discovered:active { transform: scale(0.93); }
.coll-item.discovered.r-rare { border-color: rgba(59,130,246,0.4); }
.coll-item.discovered.r-epic { border-color: rgba(168,85,247,0.45); }
.coll-item.discovered.r-legendary { border-color: rgba(245,158,11,0.5); }
.coll-item.locked { opacity: 0.5; filter: grayscale(0.6); }
.coll-item-icon { font-size: 30px; margin-bottom: 4px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
.coll-item-name {
    font-size: 10px; font-weight: 700; color: var(--text-secondary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;
}
.coll-item-value { font-size: 10px; font-weight: 800; color: var(--gold); }

/* 아이템 획득 NEW 뱃지 */
.reveal-new-badge {
    position: absolute; top: -6px; right: 50%;
    transform: translateX(50%);
    background: linear-gradient(135deg, #ff6b9d, #ff8fb8);
    color: #fff; font-size: 12px; font-weight: 900;
    padding: 4px 14px; border-radius: 20px;
    box-shadow: 0 2px 10px rgba(255,107,157,0.5);
    animation: newPop 0.4s ease;
    z-index: 2;
}
@keyframes newPop {
    0% { transform: translateX(50%) scale(0); }
    60% { transform: translateX(50%) scale(1.2); }
    100% { transform: translateX(50%) scale(1); }
}

/* ===== AUTO TOGGLES (자동 재구매 / 도구 보충) ===== */
.auto-toggles {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 6px 8px 2px;
    flex-wrap: wrap;
}
.auto-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    color: var(--text-muted);
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.08);
    transition: all 0.18s;
}
.auto-chip-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #666;
    box-shadow: none;
    transition: all 0.18s;
}
.auto-chip.on {
    color: #ffe7a8;
    background: rgba(240,194,122,0.16);
    border-color: rgba(240,194,122,0.55);
}
.auto-chip.on .auto-chip-dot {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74,222,128,0.8);
}
.auto-chip:active { transform: scale(0.94); }

/* ===== COLLECTION CATEGORY TABS ===== */
.coll-cat-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 4px 2px 10px;
    margin-bottom: 6px;
    -webkit-overflow-scrolling: touch;
}
.coll-cat {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    color: var(--text-secondary);
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.08);
    transition: all 0.15s;
}
.coll-cat .coll-cat-num {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
}
.coll-cat.on {
    color: #ffe7a8;
    background: rgba(240,194,122,0.16);
    border-color: rgba(240,194,122,0.5);
}
.coll-cat.on .coll-cat-num { color: var(--gold); }
.coll-cat.done {
    border-color: rgba(109,213,160,0.5);
}
.coll-cat.done .coll-cat-num { color: var(--success); }
.coll-cat:active { transform: scale(0.94); }

/* 도감 상세 모달: 카테고리 칩 + lore */
.coll-detail-cat {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 800;
    color: var(--accent-lavender);
    background: rgba(184,169,232,0.14);
    border: 1px solid rgba(184,169,232,0.3);
}
.coll-detail-lore {
    margin: 4px auto 0;
    max-width: 280px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    font-style: italic;
}

/* ===== MASCOT: 보물 정령 에스파 ===== */
#mascot {
    position: fixed;
    right: 12px;
    bottom: calc(84px + var(--safe-bottom));
    z-index: 90;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
}
#mascot-char {
    font-size: 34px;
    filter: drop-shadow(0 2px 6px rgba(184,169,232,0.5));
    animation: mascotFloat 3.5s ease-in-out infinite;
    transform-origin: center bottom;
}
#mascot.talking #mascot-char {
    animation: mascotWiggle 0.6s ease-in-out infinite;
}
@keyframes mascotFloat {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50% { transform: translateY(-6px) rotate(3deg); }
}
@keyframes mascotWiggle {
    0%, 100% { transform: translateY(0) rotate(-6deg) scale(1.05); }
    50% { transform: translateY(-4px) rotate(6deg) scale(1.05); }
}
#mascot-bubble {
    max-width: 220px;
    margin-bottom: 8px;
    padding: 10px 14px;
    border-radius: 16px 16px 4px 16px;
    background: linear-gradient(180deg, rgba(40,32,68,0.97), rgba(24,18,40,0.98));
    border: 2px solid rgba(184,169,232,0.45);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    text-align: left;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    animation: bubblePop 0.3s cubic-bezier(0.18,0.89,0.32,1.28);
}
#mascot-bubble.hidden { display: none; }
@keyframes bubblePop {
    0% { transform: scale(0.6) translateY(8px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}
