/* ══════════════════════════════════════════════════════════
   style.css  —  자영업자 범식이 키우기
   전체 게임 UI 디자인 (레이아웃 · 모달 · HUD · 반응형)
══════════════════════════════════════════════════════════ */

/* ── 가로 모드 안내 오버레이 ── */
#landscape-overlay {
    display: none;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #050505;
    color: #fff;
    z-index: 999999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}
@media (orientation: landscape) and (max-height: 500px) {
    #landscape-overlay { display: flex; }
}

/* ── 기본 레이아웃 ── */
body {
    margin: 0;
    background-color: #050510;
    position: relative;
    overflow: hidden;
    color: white;
    font-family: 'Noto Sans KR', sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
    user-select: none;
    display: flex;
    justify-content: center;
    min-height: 100dvh;
}

/* 패턴 레이어 (육각형 격자) */
body::before {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-image:
        radial-gradient(circle 2px at 20px 15px, rgba(255,255,255,0.04) 1px, transparent 2px),
        radial-gradient(circle 2px at 50px 45px, rgba(255,255,255,0.04) 1px, transparent 2px),
        radial-gradient(circle 1px at 35px 30px, rgba(255,255,255,0.025) 0.5px, transparent 1.5px),
        linear-gradient(30deg, transparent 48%, rgba(255,255,255,0.015) 49%, rgba(255,255,255,0.015) 51%, transparent 52%),
        linear-gradient(150deg, transparent 48%, rgba(255,255,255,0.015) 49%, rgba(255,255,255,0.015) 51%, transparent 52%),
        linear-gradient(90deg, transparent 48%, rgba(255,255,255,0.012) 49%, rgba(255,255,255,0.012) 51%, transparent 52%);
    background-size: 60px 52px;
    pointer-events: none;
    z-index: 0;
}

/* 무지개 빛 레이어 (hue-rotate로 자연스러운 색 변화) */
body::after {
    content: '';
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background:
        radial-gradient(ellipse 50% 50% at 15% 25%, rgba(120,0,255,0.08), transparent),
        radial-gradient(ellipse 40% 40% at 85% 75%, rgba(0,200,255,0.08), transparent),
        radial-gradient(ellipse 45% 45% at 50% 50%, rgba(255,0,150,0.06), transparent),
        radial-gradient(ellipse 35% 35% at 75% 20%, rgba(0,255,150,0.05), transparent);
    animation: bgHue 30s linear infinite;
    filter: hue-rotate(0deg);
    pointer-events: none;
    z-index: 0;
}

@keyframes bgHue {
    from { filter: hue-rotate(0deg); }
    to   { filter: hue-rotate(360deg); }
}

#app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 650px;
    background: #0a0a0a;
    min-height: 100dvh;
    box-shadow: 0 0 40px rgba(0,0,0,0.95);
    border-left: 2px solid #222;
    border-right: 2px solid #222;
    position: relative;
    z-index: 1;
    position: relative;
}

/* ── 게임 화면 (캔버스 영역) ── */
#game-section {
    position: relative;
    width: 100%;
    height: 420px;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: pixelated;
    display: block;
}

/* ── 플로팅 텍스트 ── */
#floating-text-container {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.floating-text {
    position: absolute;
    transform: translate(-50%, -50%);
    font-weight: bold;
    text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    pointer-events: none;
    opacity: 0;
    will-change: top, left, opacity;
}

/* ── HUD UI 좌측 ── */
.ui {
    position: absolute;
    top: 10px; left: 10px;
    text-align: left;
    pointer-events: none;
    z-index: 10;
}

/* ── 상단 바 ── */
#top-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 6px 10px;
    background: #0d0d0d;
    border-bottom: 2px solid #333;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 4px;
}

#top-bar-left  { display: flex; gap: 10px; align-items: center; }
#top-bar-right { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

#top-bar-right button {
    padding: 8px 12px;
    background: transparent;
    color: #d2b4de;
    border: 1px solid #9b59b6;
    border-radius: 6px;
    font-weight: bold;
    font-size: 12px;
    cursor: pointer;
    pointer-events: auto;
    text-shadow: 1px 1px 0 #000;
    box-shadow: 0 0 5px rgba(0,0,0,0.8);
    min-height: 38px;
}

#top-bar-right button:last-child { color: #aaa; }

.stats        { font-size: 18px; font-weight: bold; text-shadow: 2px 2px #000; margin-bottom: 2px; }
#stage-text   { color: #eccc68; }
#kill-text    { color: #ff4757; font-size: 14px; margin-bottom: 8px; }

/* ── 스탯 바 (게임창 위) ── */
#stat-bar {
    width: 100%;
    background: #0d0d0d;
    border-bottom: 1px solid #2a2a3a;
    padding: 5px 12px;
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    gap: 3px 16px;
    flex-shrink: 0;
}

#stat-bar span   { font-size: 11px; color: #888; white-space: nowrap; }
#stat-bar span b { color: #f1c40f; font-weight: bold; }

#in-game-stats { display: none; }

/* ── HUD UI 우측 (재화) ── */
#currencies-ui {
    position: absolute;
    top: 10px; right: 10px;
    text-align: right;
    pointer-events: none;
    z-index: 10;
}

.currency    { font-size: 16px; font-weight: bold; text-shadow: 2px 2px #000; margin-bottom: 5px; }
.gold-text   { color: #f1c40f; }
.relic-text  { color: #9b59b6; }

/* ── 상점 버튼 (HUD 위) ── */
.shop-btn-top {
    margin-top: 5px;
    padding: 6px 10px;
    background: rgba(74,35,90,0.7);
    color: #d2b4de;
    border: 1px solid #9b59b6;
    border-radius: 6px;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    transition: 0.2s;
    pointer-events: auto;
    text-shadow: 1px 1px 0 #000;
    box-shadow: 0 0 5px rgba(0,0,0,0.8);
}

.shop-btn-top:hover                 { background: rgba(91,44,111,0.9); transform: scale(1.05); color: #fff; border-color: #d2b4de; }
.shop-btn-top.setting-btn           { background: transparent; color: #aaa; border-color: #555; }
.shop-btn-top.setting-btn:hover     { background: rgba(80,80,80,0.2); border-color: #aaa; color: #fff; }

/* ── 설정 모달 ── */
#setting-modal-wrap {
    display: none;
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 3000;
    justify-content: center;
    align-items: center;
}

#setting-modal-box {
    background: #1a1a2e;
    border: 2px solid #555;
    border-radius: 12px;
    padding: 24px 28px;
    text-align: center;
    min-width: 260px;
    position: relative;
}

#setting-modal-box h3 { color: #fff; margin: 0 0 20px; font-size: 18px; }
.setting-row          { display: flex; flex-direction: column; gap: 10px; }

.setting-close-btn {
    position: absolute; top: 10px; right: 12px;
    background: none; border: none;
    color: #888; font-size: 18px;
    cursor: pointer; line-height: 1;
}
.setting-close-btn:hover { color: #fff; }

.toggle-row               { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #333; }
.toggle-row:last-of-type  { border-bottom: none; }
.toggle-row span          { color: #ccc; font-size: 14px; }
.toggle-btn               { padding: 5px 16px; border-radius: 20px; border: 1.5px solid; font-size: 12px; font-weight: bold; cursor: pointer; transition: 0.2s; }
.toggle-btn.on            { background: #00b894; color: #fff; border-color: #00b894; }
.toggle-btn.off           { background: transparent; color: #888; border-color: #555; }

/* ── 랭킹 모달 ── */
#ranking-modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    display: none;
    align-items: center; justify-content: center;
    z-index: 1000;
}

#ranking-box {
    background: #0a1a0f;
    border: 2px solid #f1c40f;
    border-radius: 12px;
    padding: 20px;
    width: min(480px, 94vw);
    max-height: 85vh;
    display: flex; flex-direction: column;
    gap: 10px;
}

#ranking-box h2       { color: #f1c40f; font-size: 20px; text-align: center; margin: 0; text-shadow: 0 0 10px #f1c40f88; }
#ranking-list         { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; }

.rank-row             { display: grid; grid-template-columns: 36px 1fr 60px 50px; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 6px; background: #0f2a18; font-size: 13px; }
.rank-row.rank-me     { background: #1a3a0a; border: 1px solid #f1c40f; }
.rank-row.rank-1      { background: #2a1f00; border: 1px solid #f1c40f; }
.rank-row.rank-2      { background: #1a1f2a; border: 1px solid #aaa; }
.rank-row.rank-3      { background: #2a1500; border: 1px solid #cd7f32; }
.rank-num             { font-weight: bold; text-align: center; font-size: 15px; }
.rank-name            { font-weight: bold; color: #eee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score           { text-align: right; color: #f1c40f; font-weight: bold; font-size: 12px; }
.rank-level           { text-align: right; color: #aaa; font-size: 11px; }

#ranking-nickname-wrap   { display: flex; gap: 8px; }
#ranking-nickname-input  { flex: 1; padding: 8px; background: #0f2a18; border: 1px solid #555; border-radius: 6px; color: #fff; font-size: 13px; }
#ranking-nickname-input.locked { background: #aaa !important; color: #000 !important; -webkit-text-fill-color: #000 !important; opacity: 1 !important; border-color: #888 !important; }
#ranking-submit-btn      { padding: 8px 16px; background: #f1c40f; color: #000; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; font-size: 13px; }
#ranking-submit-btn:hover { background: #ffd700; }
#ranking-close-btn       { padding: 8px; background: transparent; color: #aaa; border: 1px solid #555; border-radius: 6px; cursor: pointer; font-size: 13px; }
#ranking-close-btn:hover { color: #fff; border-color: #aaa; }
#ranking-my-score        { color: #aaa; font-size: 12px; text-align: center; }

/* ── 액션 바 (하단 스킬 영역) ── */
#action-bar-section {
    position: relative;
    width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0d0d0d;
    border-top: 2px solid #333;
    z-index: 60;
    pointer-events: auto;
    flex-shrink: 0;
}

/* 스킬 툴팁 */
#skill-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 8px;
    transform: none;
    background: rgba(10,10,20,0.97);
    border: 1.5px solid rgba(241,196,15,0.7);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    color: #eee;
    line-height: 1.7;
    z-index: 200;
    box-shadow: 0 4px 20px rgba(0,0,0,0.9);
    text-align: left;
    max-width: 260px;
    white-space: normal;
    pointer-events: none;
}

#skill-tooltip.show { display: block; }

#skill-tooltip::after {
    content: '';
    position: absolute; top: 100%; left: 12px;
    border: 7px solid transparent;
    border-top-color: rgba(241,196,15,0.7);
}

#skill-tooltip::before {
    content: '';
    position: absolute; top: 100%; left: 13px;
    border: 6px solid transparent;
    border-top-color: rgba(10,10,20,0.97);
    margin-top: -1px;
    z-index: 1;
}

/* 스킬 정보(!) 버튼 */
#skill-info-btn {
    position: absolute; top: 4px; left: 6px;
    width: 20px; height: 20px;
    background: rgba(241,196,15,0.15);
    border: 1.5px solid rgba(241,196,15,0.6);
    border-radius: 4px;
    color: rgba(241,196,15,0.9);
    font-size: 11px; font-weight: bold;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    touch-action: manipulation;
    user-select: none;
    z-index: 70;
}

#skills-container, #btn-bag { z-index: 1; }

/* HP / XP 바 */
#player-info   { width: 160px; flex-shrink: 0; pointer-events: auto; }
#player-hpbar  { position: absolute; bottom: 10px; left: 10px; width: 160px; pointer-events: auto; z-index: 10; }
#level-text    { font-size: 14px; color: #f1c40f; font-weight: bold; margin-bottom: 4px; text-shadow: 2px 2px 4px #000; }

.bar-bg {
    background: transparent;
    border: 2px solid rgba(255,255,255,0.4);
    height: 14px; border-radius: 7px;
    position: relative;
    margin-bottom: 4px;
    overflow: hidden;
    box-shadow: 0 0 5px rgba(0,0,0,0.8);
}

#hp-fill  { background: rgba(231,76,60,0.85);  height: 100%; width: 100%; transition: width 0.2s; will-change: width; }
#xp-fill  { background: rgba(52,152,219,0.85); height: 100%; width: 0%;   transition: width 0.2s; will-change: width; }

.bar-text {
    position: absolute; top: -1px; left: 0;
    width: 100%; font-size: 11px;
    text-shadow: 1px 1px 2px #000, -1px -1px 0 #000;
    font-weight: bold; text-align: center;
}

/* ── 스킬 슬롯 ── */
#skills-container {
    display: flex;
    gap: 10px;
    pointer-events: auto;
    align-items: center;
    flex-wrap: nowrap;
}

.skill-slot {
    width: 62px; height: 62px;
    background: linear-gradient(145deg, rgba(20,20,35,0.95), rgba(10,10,20,0.98));
    border: 1.5px solid rgba(100,100,150,0.5);
    border-radius: 12px;
    position: relative; text-align: center;
    color: rgba(255,255,255,0.7);
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    cursor: pointer; transition: 0.2s;
    touch-action: manipulation;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.08);
    overflow: hidden;
}

.skill-slot.ready {
    border-color: rgba(241,196,15,0.8);
    color: #fff;
    background: linear-gradient(145deg, rgba(30,25,10,0.98), rgba(15,12,5,0.99));
    box-shadow: 0 4px 15px rgba(0,0,0,0.8), 0 0 12px rgba(241,196,15,0.3), inset 0 1px 0 rgba(241,196,15,0.15);
}

.skill-slot:active { transform: scale(0.93); }

.skill-slot.pending { animation: pending-pulse 0.6s ease-in-out infinite alternate; }

@keyframes pending-pulse {
    0%   { border-color: rgba(243,156,18,0.8); box-shadow: 0 4px 15px rgba(0,0,0,0.8), 0 0 12px rgba(243,156,18,0.4); }
    100% { border-color: rgba(255,255,255,0.95); box-shadow: 0 4px 20px rgba(0,0,0,0.8), 0 0 25px rgba(255,255,255,0.7), 0 0 40px rgba(243,156,18,0.5); }
}
@keyframes max-skill-flash {
    0%   { border-color: #fff !important; box-shadow: 0 0 30px #ffd54f, 0 0 60px #ff9800 !important; transform: scale(1.15); filter: brightness(2); }
    30%  { border-color: #ffd54f !important; box-shadow: 0 0 20px #ffd54f, 0 0 40px #ff9800 !important; transform: scale(1.05); filter: brightness(1.5); }
    100% { border-color: rgba(241,196,15,0.8) !important; box-shadow: 0 4px 15px rgba(0,0,0,0.8) !important; transform: scale(1); filter: brightness(1); }
}

.skill-slot .key {
    position: absolute; top: 3px; left: 5px;
    font-size: 10px; font-weight: bold;
    color: rgba(241,196,15,0.9);
    text-shadow: 0 0 6px rgba(241,196,15,0.5);
    z-index: 3; letter-spacing: 0.5px;
}

.skill-slot .cd-overlay {
    position: absolute; bottom: 0; left: 0;
    width: 100%; background: rgba(0,0,0,0.75);
    height: 0%; z-index: 1;
    pointer-events: none; will-change: height;
    border-radius: 10px;
}

.skill-slot .cd-text {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px; font-weight: bold;
    color: #fff; text-shadow: 2px 2px 6px #000;
    z-index: 4; display: none; pointer-events: none;
}

.skill-slot .lv-badge {
    position: absolute; bottom: 3px; left: 50%;
    transform: translateX(-50%);
    font-size: 8px; color: rgba(241,196,15,0.7);
    pointer-events: none; z-index: 3;
    white-space: nowrap;
    text-shadow: 1px 1px 2px #000; letter-spacing: 0.3px;
}

.skill-name {
    position: relative; z-index: 2;
    font-size: 10px; font-weight: bold;
    pointer-events: none; line-height: 1.2;
    text-shadow: 1px 1px 2px #000;
}

/* ── 가방 버튼 ── */
#btn-bag {
    position: absolute; right: 8px; bottom: 8px;
    z-index: 65;
    width: 36px; height: 36px; padding: 4px;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; pointer-events: auto;
    touch-action: manipulation; transition: 0.2s;
}

#btn-bag:active { opacity: 0.7; }

@keyframes skip-glow {
    0%   { border-color: rgba(241,196,15,0.4); box-shadow: 0 0 4px rgba(241,196,15,0.2); }
    100% { border-color: rgba(241,196,15,1.0); box-shadow: 0 0 12px rgba(241,196,15,0.8), 0 0 4px rgba(241,196,15,0.4); }
}

@keyframes bag-shake {
    0%,100% { transform: rotate(0deg); }
    8%      { transform: rotate(-18deg); }
    16%     { transform: rotate(18deg); }
    24%     { transform: rotate(-15deg); }
    32%     { transform: rotate(15deg); }
    40%     { transform: rotate(-10deg); }
    48%     { transform: rotate(10deg); }
    56%     { transform: rotate(-6deg); }
    64%     { transform: rotate(6deg); }
    72%     { transform: rotate(-3deg); }
    80%     { transform: rotate(3deg); }
    90%     { transform: rotate(-1deg); }
}

#btn-bag.shaking { animation: bag-shake 0.5s cubic-bezier(0.36,0.07,0.19,0.97); }

#bag-notify {
    position: absolute; top: -8px; right: -8px;
    font-size: 11px; font-weight: bold;
    background: rgba(0,0,0,0.8);
    border-radius: 10px; padding: 1px 5px;
    pointer-events: none;
    animation: notify-pop 0.3s ease;
    white-space: nowrap;
}

@keyframes notify-pop {
    0%   { transform: scale(0.5); opacity: 0; }
    70%  { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* ── 인벤토리 팝업 모달 ── */
#bag-modal       { display: none; position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,0.75); align-items: center; justify-content: center; }
#bag-modal.open  { display: flex; }

#bag-modal-inner {
    width: 95vw; max-width: 620px;
    height: 90vh; max-height: 90vh;
    background: #0d1f10;
    border: 3px solid #f1c40f;
    border-radius: 10px;
    display: flex; flex-direction: column;
    padding: 18px; box-sizing: border-box;
    position: relative;
    box-shadow: 0 0 30px rgba(241,196,15,0.3);
    overflow: hidden;
}

#bag-modal-inner .inv-items-wrap { max-height: none; flex: 1; min-height: 0; overflow-y: auto; }

#bag-modal-close       { position: static; font-size: 22px; color: #aaa; cursor: pointer; background: none; border: none; line-height: 1; padding: 0; }
#bag-modal-close:hover { color: #fff; }

#bag-modal-title { color: #f1c40f; font-size: 18px; font-weight: bold; margin: 0; text-shadow: 0 0 8px rgba(241,196,15,0.5); }

.bag-stone-slot { width:56px; height:28px; background:#ffffff; border:1px solid #555; border-radius:6px; display:flex; align-items:center; justify-content:center; }
@media (hover: hover) and (pointer: fine) { .bag-stone-slot:hover { border-color:#e67e22; background:#2a1a3e; } }
.bag-stone-slot:active { background:#ffffff; }

/* ── 인벤토리 패널 ── */
.inv-header    { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #444; padding-bottom: 10px; margin-bottom: 12px; }
.inv-header h2 { margin: 0; color: #f1c40f; font-size: 18px; }

.sell-all-btn                        { padding: 3px 6px; background: transparent; color: #e74c3c; border: 1px solid #e74c3c; border-radius: 4px; font-size: 10px; cursor: pointer; display: block; transition: 0.2s; margin-left: auto; }
.sell-all-btn:hover:not(:disabled)   { background: rgba(231,76,60,0.2); }
.sell-all-btn:disabled               { color: #555; border-color: #555; cursor: not-allowed; opacity: 0.5; }

.sub-tabs  { display: flex; gap: 4px; margin-bottom: 15px; flex-wrap: wrap; flex: 1; }
.sub-tab   { padding: 6px 10px; background: #222; border: 2px solid #444; border-radius: 6px; font-size: 11px; cursor: pointer; color: #aaa; font-weight: bold; }
.sub-tab.active { background: #34495e; color: #fff; border-color: #3498db; }

.inv-items-wrap {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    overflow-y: auto;
    max-height: calc(100dvh - 420px - 80px);
    min-height: 160px;
    padding-right: 4px;
    align-content: flex-start;
}

.inv-items-wrap::-webkit-scrollbar        { width: 5px; }
.inv-items-wrap::-webkit-scrollbar-track  { background: #1a1a1a; border-radius: 3px; }
.inv-items-wrap::-webkit-scrollbar-thumb  { background: #555; border-radius: 3px; }
.inv-items-wrap::-webkit-scrollbar-thumb:hover { background: #888; }

.inv-items-fixed { display: none; }
.inv-items       { display: contents; }

/* 아이템 카드 */
.item-card          { background: #1a1a1a; border: 2px solid #444; border-radius: 8px; padding: 10px; cursor: pointer; position: relative; min-height: 220px; box-sizing: border-box; display: flex; flex-direction: column; }
.item-card.equipped { border: 2px solid #2ecc71 !important; background: #1e3a29; }
.item-name          { font-weight: bold; font-size: 12px; margin-bottom: 4px; padding-right: 26px; }
.item-section-title { color: #7f8c8d; font-size: 9px; margin-top: 4px; }
.item-stat          { color: #fff; font-size: 11px; font-weight: bold; margin-bottom: 2px; }
.item-opt           { color: #a29bfe; font-size: 10px; }
.item-price         { color: #f1c40f; font-size: 10px; margin-top: auto; padding-top: 4px; }
.item-sell          { position: absolute; top: 4px; right: 4px; color: #e74c3c; background: #111; border-radius: 3px; width: 22px; height: 22px; text-align: center; line-height: 20px; border: 2px solid #e74c3c; font-size: 12px; font-weight: bold; cursor: pointer; }
.item-equipped      { position: absolute; top: 4px; right: 4px; color: #2ecc71; font-weight: bold; font-size: 11px; background: #111; border-radius: 4px; padding: 2px 4px; border: 2px solid #2ecc71; }

/* ── 공통 모달 ── */
.modal {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    display: none; flex-direction: column;
    justify-content: center; align-items: center;
    z-index: 1000;
}

/* ── 타이틀 오버레이 ── */
#start-overlay {
    position: absolute !important;
    top: 0; left: 0;
    width: 100%; height: 100%;
    cursor: default; text-align: center;
    display: flex; overflow: hidden;
    z-index: 500; background: #1a0a2e;
}

#start-overlay h1 { display: none !important; }

#title-bg {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    display: flex; align-items: flex-start; justify-content: center;
    overflow: hidden;
}

#title-bg canvas { width: 100%; height: auto; display: block; image-rendering: pixelated; }

#title-ui {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none; z-index: 10;
}

#title-ui > * { pointer-events: auto; }
#title-spacer { display: none; }

#title-start-btn {
    position: absolute; left: 50%; transform: translateX(-50%);
    top: 18dvh;
    width: 240px; height: 54px;
    border: none; cursor: pointer;
    background: transparent; padding: 0; overflow: hidden;
}

#title-start-btn span {
    position: relative; z-index: 2;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 19px; font-weight: bold;
    color: #fff; letter-spacing: 3px;
    text-shadow: 0 0 8px rgba(255,220,80,0.9), 0 0 20px rgba(255,150,0,0.7);
}

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

#title-blink {
    animation: blink-txt 1s step-end infinite;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 10px; color: #f1c40f; letter-spacing: 2px;
    position: absolute; left: 50%; transform: translateX(-50%);
    top: calc(18dvh + 62px);
    white-space: nowrap;
}

#title-google-btn {
    position: absolute; left: 50%; transform: translateX(-50%);
    top: calc(18dvh + 82px);
    width: 196px; height: 40px;
    background: #fff; border: 2px solid #ddd; border-radius: 4px;
    color: #444; font-family: 'Noto Sans KR', sans-serif;
    font-size: 12px; font-weight: bold;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    letter-spacing: 1px;
}

/* ── 스킬 선택 모달 ── */
#skill-modal h2   { color: #f1c40f; font-size: 32px; text-shadow: 2px 2px #000; margin-bottom: 20px; }
.card-container   { display: flex; gap: 15px; flex-wrap: wrap; justify-content: center; max-width: 90vw; }
.skill-card       { background: #2c3e50; border: 3px solid #7f8c8d; padding: 15px; width: 150px; border-radius: 8px; cursor: pointer; text-align: center; transition: 0.2s; }
.skill-card:hover { transform: scale(1.05); border-color: #f1c40f; }
.skill-card h3    { color: #7bed9f; margin-top: 0; font-size: 16px; }
.skill-card p     { color: #ccc; font-size: 12px; line-height: 1.4; margin-bottom: 0; }

/* ── 상점 모달 ── */
#shop-modal       { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 1000; }
#shop-modal.open  { display: flex; }

#shop-modal-inner {
    width: 95vw; max-width: 620px;
    height: 90vh; max-height: 90vh;
    background: #0d1a10;
    border: 3px solid #f1c40f;
    border-radius: 12px;
    display: flex; flex-direction: column;
    padding: 18px; box-sizing: border-box;
    position: relative;
}

#shop-tabs              { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid #333; padding-bottom: 10px; flex-wrap: nowrap; }
.shop-tab               { padding: 5px 8px; background: #1a1a1a; border: 2px solid #444; border-radius: 8px 8px 0 0; font-size: 10px; font-weight: bold; cursor: pointer; color: #aaa; transition: 0.2s; white-space: nowrap; }
.shop-tab.active        { background: #1a2a1a; color: #f1c40f; border-color: #f1c40f; }
.shop-tab-content       { display: none; flex: 1; overflow-y: auto; }
.shop-tab-content.active { display: block; }
.shop-section-title     { color: #f1c40f; font-size: 14px; font-weight: bold; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid #333; }
.shop-coming-soon       { color: #555; font-size: 13px; text-align: center; margin-top: 40px; }

/* 스킨 그리드 */
.skin-grid             { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 10px; }
.skin-card             { background: #1a1a2e; border: 2px solid #333; border-radius: 10px; padding: 12px; text-align: center; cursor: pointer; transition: 0.2s; position: relative; }
.skin-card:hover       { border-color: #9b59b6; }
.skin-card.owned       { border-color: #2ecc71; }
.skin-card.equipped    { border-color: #f1c40f; background: #1a2a0a; }
.skin-card .skin-preview { width: 60px; height: 60px; margin: 0 auto 8px; image-rendering: pixelated; display: block; }
.skin-card .skin-name  { font-size: 12px; font-weight: bold; color: #ddd; margin-bottom: 4px; display: inline-block; }
.skin-card .skin-price { font-size: 11px; color: #f1c40f; }
.skin-card .skin-badge { position: absolute; top: 6px; right: 6px; font-size: 9px; padding: 2px 5px; border-radius: 4px; font-weight: bold; }
.skin-badge.owned      { background: #1a3a2a; color: #2ecc71; border: 1px solid #2ecc71; }
.skin-badge.equipped   { background: #2a2a0a; color: #f1c40f; border: 1px solid #f1c40f; }
.skin-badge.locked     { background: #2a1a1a; color: #e74c3c; border: 1px solid #e74c3c; }

/* ── 유물 모달 ── */
#relic-modal-content {
    width: 95vw; max-width: 620px;
    height: 90vh; max-height: 90vh;
    background: #1a0f1c;
    border: 4px solid #8e44ad;
    border-radius: 8px;
    display: flex; flex-direction: column;
    padding: 20px; box-sizing: border-box;
}

.relic-header       { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #5b2c6f; padding-bottom: 10px; margin-bottom: 15px; }
.relic-header h2    { margin: 0; color: #9b59b6; display: flex; align-items: center; gap: 8px; font-size: 18px; }
.relic-grid         { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; overflow-y: auto; align-content: start; flex: 1; padding-right: 5px; }
.relic-card         { background: #2c1a30; border: 2px solid #5b2c6f; border-radius: 8px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; }
.relic-title        { font-weight: bold; font-size: 14px; color: #d2b4de; display: flex; justify-content: space-between; margin-bottom: 5px; }
.relic-desc         { font-size: 11px; color: #bbb; line-height: 1.4; margin-bottom: 10px; background: #1a0f1c; padding: 5px; border-radius: 4px; }
.relic-buy          { padding: 8px; background: #8e44ad; color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 12px; }
.relic-buy:disabled { background: #444; color: #888; cursor: not-allowed; }
.close-btn          { cursor: pointer; color: #e74c3c; font-weight: bold; font-size: 14px; background: #222; padding: 6px 12px; border: 2px solid #e74c3c; border-radius: 6px; }

/* ── 펫 모달 ── */
#pet-modal-content {
    width: 95vw; max-width: 620px;
    height: 90vh; max-height: 90vh;
    background: #0d1f10;
    border: 3px solid #00b894;
    border-radius: 10px;
    display: flex; flex-direction: column;
    padding: 18px; box-sizing: border-box;
}

.pet-header      { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #00b894; padding-bottom: 10px; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
.pet-header h2   { margin: 0; color: #55efc4; font-size: 18px; }

.pet-gacha-btn        { padding: 7px 12px; background: #ff4757; color: #fff; border: none; border-radius: 6px; font-weight: bold; font-size: 12px; cursor: pointer; transition: 0.2s; }
.pet-gacha-btn:hover  { background: #ff6b81; transform: scale(1.05); }
.pet-gacha-btn.x10    { background: #e67e22; }
.pet-gacha-btn.x10:hover { background: #f39c12; }

/* 가챠 버튼 (1회) */
.gacha-btn-1 {
    position: relative; overflow: hidden;
    padding: 8px 14px; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(135deg, #f953c6, #b91d73);
    color: #fff; font-weight: bold; font-size: 13px; line-height: 1.3;
    box-shadow: 0 4px 15px rgba(249,83,198,0.5);
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: center; min-width: 80px;
}
.gacha-btn-1:hover        { transform: scale(1.08) translateY(-2px); box-shadow: 0 6px 22px rgba(249,83,198,0.75); }
.gacha-btn-1:active       { transform: scale(0.96); }
.gacha-btn-1::before      { content:''; position:absolute; top:-50%; left:-60%; width:40%; height:200%; background:rgba(255,255,255,0.18); transform:skewX(-20deg); transition:left 0.4s; }
.gacha-btn-1:hover::before { left: 130%; }

/* 가챠 버튼 (10회) */
.gacha-btn-3 {
    position: relative; overflow: hidden;
    padding: 8px 14px; border: none; border-radius: 10px; cursor: pointer;
    background: linear-gradient(135deg, #f7971e, #ffd200);
    color: #1a1a1a; font-weight: bold; font-size: 13px; line-height: 1.3;
    box-shadow: 0 4px 15px rgba(255,210,0,0.5);
    transition: transform 0.15s, box-shadow 0.15s;
    text-align: center; min-width: 80px;
}
.gacha-btn-3:hover        { transform: scale(1.08) translateY(-2px); box-shadow: 0 6px 22px rgba(255,210,0,0.75); }
.gacha-btn-3:active       { transform: scale(0.96); }
.gacha-btn-3::before      { content:''; position:absolute; top:-50%; left:-60%; width:40%; height:200%; background:rgba(255,255,255,0.25); transform:skewX(-20deg); transition:left 0.4s; }
.gacha-btn-3:hover::before { left: 130%; }

.gacha-btn-label { font-size: 14px; display: block; letter-spacing: 0.5px; }
.gacha-btn-price { font-size: 10px; opacity: 0.85; display: block; margin-top: 1px; }

.pet-section-title  { color: #55efc4; font-size: 11px; font-weight: bold; margin: 8px 0 6px; border-left: 3px solid #00b894; padding-left: 6px; flex-shrink: 0; }
#pet-active-display { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; flex-shrink: 0; min-height: 20px; }

#pet-list-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px; overflow-y: auto;
    align-content: start; flex: 1;
    padding-right: 4px;
}
#pet-list-panel::-webkit-scrollbar        { width: 5px; }
#pet-list-panel::-webkit-scrollbar-track  { background: #0a1f10; border-radius: 3px; }
#pet-list-panel::-webkit-scrollbar-thumb  { background: #00b894; border-radius: 3px; }

/* 펫 카드 */
.pet-card canvas      { display: block; margin: 0 auto 2px; width: 32px; height: 32px; image-rendering: pixelated; flex-shrink: 0; }
.pet-card .pet-info   { flex: 1; overflow: hidden; }
.pet-card .pet-btn-row { flex-shrink: 0; margin-top: auto; padding-top: 4px; }

.pet-card.p-common    { border-color: #888; }
.pet-card.p-rare      { border-color: #3498db; }
.pet-card.p-epic      { border-color: #9b59b6; }
.pet-card.p-legendary { border-color: #f1c40f; box-shadow: 0 0 6px rgba(241,196,15,0.35); }
.pet-card.p-mythic    { border-width: 2px; border-color: #ff6b00; box-shadow: 0 0 8px rgba(255,107,0,0.5), 0 0 16px rgba(255,107,0,0.25); animation: mythic-card-border-pulse 1.5s ease-in-out infinite; }

@keyframes mythic-card-border-pulse {
    0%,100% { border-color: #ff6b00; box-shadow: 0 0 8px rgba(255,107,0,0.5), 0 0 16px rgba(255,107,0,0.25); }
    50%     { border-color: #ffaa00; box-shadow: 0 0 12px rgba(255,170,0,0.7), 0 0 24px rgba(255,107,0,0.4); }
}

.pet-card.p-active { border-color: #00b894 !important; border-width: 3px; background: #0a3322; box-shadow: 0 0 14px rgba(0,184,148,0.6), inset 0 0 10px rgba(0,184,148,0.1); }

.pet-name        { font-size: 12px; font-weight: bold; color: #fff; margin-bottom: 2px; }
.pet-grade-label { font-size: 11px; margin-bottom: 2px; }
.pet-type-label  { font-size: 11px; color: #aaa; margin-bottom: 3px; }
.pet-atk-label   { font-size: 11px; color: #f39c12; margin-bottom: 3px; font-weight: bold; }
.pet-opts        { font-size: 10px; color: #a29bfe; text-align: left; line-height: 1.5; min-height: 10px; margin-bottom: 4px; }
.pet-btn-row     { display: flex; gap: 3px; margin-top: 3px; }

.pet-equip-btn             { flex: 1; padding: 5px 2px; background: #00b894; color: #fff; border: none; border-radius: 3px; font-size: 11px; cursor: pointer; font-weight: bold; transition: 0.15s; }
.pet-equip-btn:hover:not(:disabled) { background: #55efc4; color: #000; }
.pet-equip-btn:disabled    { background: #1a3a2a; color: #555; cursor: not-allowed; }

.pet-release-btn           { flex: 1; padding: 5px 2px; background: #c0392b; color: #fff; border: none; border-radius: 3px; font-size: 11px; cursor: pointer; font-weight: bold; transition: 0.15s; }
.pet-release-btn:hover:not(:disabled) { background: #e74c3c; }
.pet-release-btn:disabled  { background: #3a1a1a; color: #555; cursor: not-allowed; }

.pet-lock-btn        { flex-shrink: 0; padding: 5px 4px; background: #2a2a2a; color: #888; border: 1px solid #555; border-radius: 3px; font-size: 11px; cursor: pointer; transition: 0.15s; }
.pet-lock-btn:hover  { background: #3a3a3a; }
.pet-lock-btn.locked { background: #1a2a1a; border-color: #f1c40f; color: #f1c40f; }

.pet-select-combine-btn          { flex: 1; padding: 5px 2px; background: #1a1a2e; color: #a29bfe; border: 1px solid #6c5ce7; border-radius: 3px; font-size: 11px; cursor: pointer; font-weight: bold; transition: 0.15s; }
.pet-select-combine-btn.selected { background: #2d1b69; color: #fff; border-color: #a29bfe; }
.pet-select-combine-btn:disabled { background: #111; color: #444; border-color: #333; cursor: not-allowed; }

#select-combine-btn.active { background: #2d1b69; color: #fff; border-color: #a29bfe; box-shadow: 0 0 8px rgba(162,155,254,0.6); animation: select-combine-glow 1s ease-in-out infinite; }
@keyframes select-combine-glow { 0%,100% { box-shadow: 0 0 6px rgba(162,155,254,0.5); } 50% { box-shadow: 0 0 14px rgba(162,155,254,0.9); } }

.pet-lv-bar   { display: flex; align-items: center; gap: 4px; margin-bottom: 3px; }
.pet-lv-text  { font-size: 11px; font-weight: bold; color: #55efc4; white-space: nowrap; flex-shrink: 0; }
.pet-exp-track { flex: 1; height: 4px; background: #1a3a2a; border-radius: 2px; overflow: hidden; }
.pet-exp-fill  { height: 100%; background: #55efc4; border-radius: 2px; transition: width 0.3s; }
.pet-none-msg  { color: #555; font-size: 12px; padding: 8px 0; }

/* ── 펫 슬롯 ── */
#pet-slots-row { display: flex; gap: 8px; margin-bottom: 8px; justify-content: center; flex-shrink: 0; }

.pet-slot {
    width: 72px; height: 88px;
    border: 2px dashed #444; border-radius: 8px;
    background: #081a10;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
    cursor: default;
}

.pet-slot.slot-over       { border-color: #00b894; background: #0a2a1a; box-shadow: 0 0 10px rgba(0,184,148,0.4); }
.pet-slot.slot-filled     { border-style: solid; border-color: #00b894; background: #0a2a1a; }
.pet-slot.slot-filled.p-rare     { border-color: #3498db; }
.pet-slot.slot-filled.p-epic     { border-color: #9b59b6; box-shadow: 0 0 6px rgba(155,89,182,0.4); }
.pet-slot.slot-filled.p-legendary { border-color: #f1c40f; box-shadow: 0 0 10px rgba(241,196,15,0.5); }
.pet-slot-label { font-size: 9px; color: #555; margin-top: 2px; }

.pet-card.assigning  { border-color: #00b894 !important; box-shadow: 0 0 12px 3px rgba(0,184,148,0.6) !important; }

.pet-slot.slot-active-pick {
    border-color: #00b894 !important;
    box-shadow: 0 0 14px 4px rgba(0,184,148,0.7), inset 0 0 10px rgba(0,184,148,0.25) !important;
    animation: slot-pulse 0.7s infinite alternate;
    cursor: pointer;
}

@keyframes slot-pulse {
    from { box-shadow: 0 0 10px 2px rgba(0,184,148,0.5), inset 0 0 8px rgba(0,184,148,0.2); }
    to   { box-shadow: 0 0 22px 8px rgba(0,184,148,0.9), inset 0 0 16px rgba(0,184,148,0.4); }
}

.pet-slot-name   { font-size: 9px; color: #55efc4; font-weight: bold; margin-top: 1px; max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pet-slot-remove { position: absolute; top: 3px; right: 3px; font-size: 13px; color: #e74c3c; cursor: pointer; line-height: 1; background: rgba(0,0,0,0.5); border: 1px solid #e74c3c; border-radius: 3px; padding: 0px 3px; font-weight: bold; }
.pet-slot-remove:hover { color: #fff; background: #e74c3c; }

.pet-card {
    width: 100%; height: 240px;
    background: #0a2a1a; border: 2px solid #444;
    border-radius: 6px; padding: 6px 5px;
    text-align: center; box-sizing: border-box;
    display: flex; flex-direction: column;
    cursor: grab; user-select: none;
}

.pet-card.dragging { opacity: 0.4; cursor: grabbing; }

/* ── 가챠 결과 모달 ── */
#gacha-result-card {
    background: #111; border-radius: 16px;
    padding: 28px 36px; text-align: center;
    animation: gacha-pop 0.4s cubic-bezier(0.175,0.885,0.32,1.275);
    max-width: 90vw;
    display: flex; flex-direction: column; align-items: center;
}

@keyframes gacha-pop {
    from { transform: scale(0.4) rotate(-8deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

#gacha-result-icon    { font-size: 56px; margin-bottom: 8px; }
#gacha-result-name    { font-size: 20px; font-weight: bold; color: #fff; margin-bottom: 5px; }
#gacha-result-grade   { font-size: 13px; margin-bottom: 8px; }
#gacha-result-opts    { font-size: 12px; color: #a29bfe; line-height: 1.8; margin-bottom: 14px; min-height: 16px; }
#gacha-result-close   { padding: 10px 30px; background: #00b894; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: bold; cursor: pointer; transition: 0.2s; }
#gacha-result-close:hover { background: #55efc4; color: #000; }

/* ── 뽑기 연출 애니메이션 ── */

/* 전설 */
@keyframes legendary-shine {
    0%   { box-shadow: 0 0 10px #f1c40f, 0 0 30px #f1c40f, 0 0 60px #e67e22; border-color: #f1c40f; }
    25%  { box-shadow: 0 0 20px #fff, 0 0 60px #f1c40f, 0 0 100px #e67e22; border-color: #fff; }
    50%  { box-shadow: 0 0 10px #f1c40f, 0 0 40px #e67e22, 0 0 80px #f1c40f; border-color: #f1c40f; }
    75%  { box-shadow: 0 0 25px #fff, 0 0 70px #f1c40f, 0 0 120px #e67e22; border-color: #fff; }
    100% { box-shadow: 0 0 10px #f1c40f, 0 0 30px #f1c40f, 0 0 60px #e67e22; border-color: #f1c40f; }
}

@keyframes legendary-bg-flash {
    0%   { background: rgba(241,196,15,0); }
    20%  { background: rgba(241,196,15,0.18); }
    50%  { background: rgba(255,255,255,0.08); }
    80%  { background: rgba(241,196,15,0.12); }
    100% { background: rgba(241,196,15,0); }
}

@keyframes legendary-star-spin {
    0%   { transform: scale(0) rotate(0deg); opacity: 1; }
    60%  { transform: scale(1.4) rotate(180deg); opacity: 1; }
    100% { transform: scale(1) rotate(360deg); opacity: 0.8; }
}

.legendary-card-glow  { animation: legendary-shine 0.8s ease-in-out infinite !important; background: #1a1200 !important; }
.legendary-result-bg  { animation: legendary-bg-flash 1.2s ease-out; }

@keyframes mini-card-shine {
    0%   { box-shadow: 0 0 6px #f1c40f, 0 0 14px #f1c40f, 0 0 28px #e67e22; border-color: #f1c40f; }
    25%  { box-shadow: 0 0 10px #fff,   0 0 22px #f1c40f, 0 0 44px #e67e22; border-color: #fff; }
    50%  { box-shadow: 0 0 6px #f1c40f, 0 0 18px #e67e22, 0 0 36px #f1c40f; border-color: #f1c40f; }
    75%  { box-shadow: 0 0 12px #fff,   0 0 26px #f1c40f, 0 0 52px #e67e22; border-color: #fff; }
    100% { box-shadow: 0 0 6px #f1c40f, 0 0 14px #f1c40f, 0 0 28px #e67e22; border-color: #f1c40f; }
}

.legendary-mini-glow { animation: mini-card-shine 0.8s ease-in-out infinite !important; background: #1a1200 !important; }

#legendary-stars { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; overflow: hidden; border-radius: 16px; }
.lstar           { position: absolute; font-size: 22px; animation: legendary-star-spin 0.9s ease-out forwards; }

/* 신화 */
@keyframes mythic-shine {
    0%   { box-shadow: 0 0 14px #fff, 0 0 40px #74b9ff, 0 0 80px #ffffff; border-color: #ffffff; }
    25%  { box-shadow: 0 0 30px #74b9ff, 0 0 80px #fff, 0 0 140px #74b9ff; border-color: #74b9ff; }
    50%  { box-shadow: 0 0 20px #fff, 0 0 60px #74b9ff, 0 0 110px #ffffff; border-color: #ffffff; }
    75%  { box-shadow: 0 0 35px #74b9ff, 0 0 90px #fff, 0 0 160px #74b9ff; border-color: #74b9ff; }
    100% { box-shadow: 0 0 14px #fff, 0 0 40px #74b9ff, 0 0 80px #ffffff; border-color: #ffffff; }
}

@keyframes mythic-bg-pulse {
    0%   { background: rgba(116,185,255,0); }
    15%  { background: rgba(255,255,255,0.12); }
    35%  { background: rgba(116,185,255,0.20); }
    60%  { background: rgba(255,255,255,0.08); }
    80%  { background: rgba(116,185,255,0.15); }
    100% { background: rgba(116,185,255,0); }
}

@keyframes mythic-particle-spin {
    0%   { transform: scale(0) rotate(0deg) translateY(0px); opacity: 1; }
    50%  { transform: scale(1.6) rotate(240deg) translateY(-20px); opacity: 1; }
    100% { transform: scale(0.8) rotate(480deg) translateY(-40px); opacity: 0; }
}

.mythic-card-glow { animation: mythic-shine 0.6s ease-in-out infinite !important; background: #001a2e !important; border-color: #ffffff !important; }

@keyframes mythic-mini-shine {
    0%   { box-shadow: 0 0 10px #fff, 0 0 24px #ff6b00, 0 0 48px #fff; border-color: #ffffff; }
    25%  { box-shadow: 0 0 18px #ff6b00, 0 0 40px #fff, 0 0 70px #ff6b00; border-color: #ff6b00; }
    50%  { box-shadow: 0 0 12px #fff, 0 0 30px #ff6b00, 0 0 60px #fff; border-color: #ffffff; }
    75%  { box-shadow: 0 0 20px #ff6b00, 0 0 46px #fff, 0 0 80px #ff6b00; border-color: #ff6b00; }
    100% { box-shadow: 0 0 10px #fff, 0 0 24px #ff6b00, 0 0 48px #fff; border-color: #ffffff; }
}

.mythic-mini-glow { animation: mythic-mini-shine 0.5s ease-in-out infinite !important; background: #1a0a00 !important; }

/* ── 종료 확인 모달 ── */
#quit-modal-content { background: #1a0f1c; border: 4px solid #e74c3c; border-radius: 8px; padding: 30px; text-align: center; max-width: 90vw; }
.quit-btn  { padding: 10px 30px; border: none; border-radius: 4px; font-weight: bold; font-size: 16px; cursor: pointer; margin: 0 10px; }
.quit-yes  { background: transparent; color: #e74c3c; border: 2px solid #e74c3c; }
.quit-no   { background: #34495e; color: white; border: 2px solid #2c3e50; }

/* ── 안티 쓰로틀링 핵 ── */
@keyframes antiThrottle { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

@keyframes ancient3starShake {
    0%,100% { transform: translate(0,0); }
    5% { transform: translate(-10px,-8px); }
    10% { transform: translate(8px,10px); }
    15% { transform: translate(-12px,5px); }
    20% { transform: translate(10px,-7px); }
    25% { transform: translate(-6px,9px); }
    30% { transform: translate(9px,-5px); }
    35% { transform: translate(-8px,6px); }
    40% { transform: translate(7px,-8px); }
    45% { transform: translate(-5px,4px); }
    50% { transform: translate(6px,-3px); }
    55% { transform: translate(-4px,5px); }
    60% { transform: translate(5px,-4px); }
    65% { transform: translate(-3px,3px); }
    70% { transform: translate(3px,-2px); }
    75% { transform: translate(-2px,2px); }
    80% { transform: translate(2px,-1px); }
    85% { transform: translate(-1px,1px); }
    90% { transform: translate(1px,0); }
}
@keyframes powersave-rainbow {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}
#anti-throttle-hack {
    width: 1px; height: 1px;
    position: absolute; top: -10px;
    opacity: 0.01;
    animation: antiThrottle 1s linear infinite;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   반응형 — 태블릿 / 모바일 (800px 이하)
══════════════════════════════════════════════════════════ */
@media (max-width: 800px) {
    body {
        display: block; overflow: auto;
        height: auto; min-height: 100dvh;
        margin: 0; padding: 0;
    }
    #app-container {
        flex-direction: column; width: 100%;
        height: auto; min-height: 100dvh;
        max-width: none; max-height: none;
        border: none; border-radius: 0;
        box-shadow: none; margin: 0;
    }
    #game-section   { height: 50vh; min-height: 350px; border-bottom: 4px solid #333; }
    #inventory-section { width: 100%; height: auto; padding: 10px; overflow: visible; }
    .inv-items-wrap { max-height: 260px; grid-template-columns: repeat(2, 1fr); }
    #pet-list-panel { grid-template-columns: repeat(2, 1fr); }
    .ui             { top: 10px; left: 10px; }
    #top-bar        { padding: 4px 8px; }
    #top-bar-right button { padding: 4px 7px; font-size: 10px; }
    #action-bar-section { padding: 6px 8px; }
    #skills-container   { gap: 3px; }
    .skill-slot         { width: 52px; height: 52px; }
    .card-container     { flex-direction: column; width: 80%; }
    .skill-card         { width: auto; padding: 15px; }
}

/* ══════════════════════════════════════════════════════════
   반응형 — 소형 화면 (390px 이하, 아이폰 SE 등)
══════════════════════════════════════════════════════════ */
@media (max-width: 390px) {
    .btn-full  { display: none !important; }
    .btn-small { display: inline !important; }

    #currencies-ui button span:not(.icon-only) { display: none; }
    #currencies-ui button { padding: 4px 6px !important; font-size: 10px !important; }
    #currencies-ui        { gap: 3px !important; }

    #in-game-stats { font-size: 9px !important; gap: 1px 6px !important; }

    #level-text { font-size: 11px !important; margin-bottom: 2px !important; }
    .bar-bg     { height: 11px !important; margin-bottom: 2px !important; }
    .bar-text   { font-size: 9px !important; }

    #player-info { width: 115px !important; }

    .skill-slot            { width: 46px !important; height: 46px !important; }
    #skills-container      { gap: 3px !important; bottom: 6px !important; }
    .skill-slot .key       { font-size: 9px !important; }
    .skill-slot .skill-name { font-size: 7px !important; }
    .skill-slot .lv-badge  { font-size: 7px !important; }

    .sub-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 4px !important;
        gap: 3px !important;
    }
    .sub-tab {
        flex-shrink: 0 !important;
        padding: 5px 8px !important;
        font-size: 10px !important;
    }

    .inv-header h2 { font-size: 14px !important; }
    .currency      { font-size: 12px !important; }
}
