:root {
    --pk-green: #4CAF50;
    --pk-blue: #2196F3;
    --pk-red: #ff5252;
    --pk-yellow: #ffeb3b;
}

body {
    font-family: 'Fira Code', monospace;
    background-color: #111;
    background-image: url('assets/images/wapaperingame.png');
    background-repeat: repeat; 
    background-size: auto;
    color: #fff; margin: 0; overflow: hidden;
    display: flex; flex-direction: column; align-items: center; min-height: 100vh;
    /* จอสูงพอ = อยู่กลางจอ / จอเตี้ย = ชิดบน ไม่โดนตัด */
    justify-content: safe center;
}

/* --- UI: MAIN MENU --- */
#main-menu {
    position: fixed; inset: 0; z-index: 500;
    background-image: url('assets/images/wapaper.png');
    background-size: cover; background-position: center;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.menu-screen {
    display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%;
}

.hidden { display: none !important; }

.menu-title { 
    font-family: 'Press Start 2P'; font-size: 45px; color: #ffcb05; 
    text-shadow: 5px 5px 0 #3c5aa6; margin-bottom: 10px;
}
.menu-sub { 
    font-family: 'Press Start 2P'; font-size: 16px; color: #fff;
    letter-spacing: 2px; text-shadow: 2px 2px 0 #000;
}

.mode-btn {
    background: #fff; border: 4px solid #ffcb05; border-radius: 50px;
    padding: 20px 40px; width: 420px; cursor: pointer; margin-bottom: 20px;
    font-family: 'Press Start 2P'; font-size: 14px; color: #3c5aa6;
    transition: 0.2s; box-shadow: 0 6px 0 rgba(0,0,0,0.3);
}
.mode-btn:hover { transform: scale(1.06); }

.img-btn {
    color: #ffffff;
    text-shadow: 2px 2px 0px #000, -2px -2px 0px #000, 2px -2px 0px #000, -2px 2px 0px #000;
    height: 85px; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
}

/* --- ปุ่มเลือกภาษา มุมซ้ายล่างของหน้าแรก --- */
#menu-home { position: relative; width: 100%; height: 100%; }
.lang-corner {
    position: absolute; bottom: 20px; left: 20px;
    width: 340px; height: 70px; font-size: 13px; margin-bottom: 0;
}

/* --- UI: RANKING SCROLLBAR --- */
#ranking-list-container::-webkit-scrollbar { width: 10px; }
#ranking-list-container::-webkit-scrollbar-track { background: #333; border-radius: 5px; }
#ranking-list-container::-webkit-scrollbar-thumb { background: #ffcb05; border-radius: 5px; border: 2px solid #333; }

/* --- UI: SLIDER HOW TO PLAY --- */
.slider-container {
    position: relative; width: 800px; height: 450px; 
    background-size: 100% 100%; background-position: center; background-repeat: no-repeat; 
    background-color: rgba(0,0,0,0.8); border: 4px solid #fff; border-radius: 10px; 
    margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    transition: background-image 0.3s ease-in-out;
}
.slider-indicator {
    position: absolute; top: 15px; right: 20px; background: rgba(0,0,0,0.7); color: #fff; 
    padding: 5px 10px; border-radius: 5px; font-family: 'Press Start 2P'; font-size: 12px; border: 2px solid #fff;
}
.slider-btn {
    position: absolute; bottom: 15px; color: #fff; border: 3px solid #fff; border-radius: 8px; 
    padding: 10px 20px; cursor: pointer; font-family: 'Press Start 2P'; font-size: 12px; 
    box-shadow: 0 4px 0 rgba(0,0,0,0.5); transition: 0.2s;
}
.slider-btn:hover { transform: scale(1.08); }
.slider-btn.prev { left: 15px; background: #ff5252; }
.slider-btn.next { right: 15px; background: #4CAF50; }

/* --- UI: BATTLE ARENA --- */
#battle-container { position: relative; width: 100%; max-width: 1000px; display: none; }

#battle-arena {
    width: 100%; height: 500px;
    border: 8px solid #ffffff; 
    border-radius: 20px; position: relative;
    display: flex; align-items: flex-end; padding: 40px; box-shadow: 0 0 50px rgba(0,0,0,0.8);
    overflow: hidden;
    background-size: cover !important;
    background-position: center bottom !important;
    background-repeat: no-repeat !important;
}

#quit-btn {
    position: absolute; top: 25px; left: 25px; z-index: 600;
    background: var(--pk-red); border: 3px solid #fff; color: white;
    padding: 10px 18px; border-radius: 8px; cursor: pointer;
    font-family: 'Press Start 2P'; font-size: 10px;
}

.header-stats {
    width: 100%; display: flex; justify-content: flex-end; gap: 30px;
    padding: 15px; font-family: 'Press Start 2P'; font-size: 12px;
    color: #fff; text-shadow: 3px 3px 0 #000;
}
.header-stats > * { white-space: nowrap; }

#feedback-bar {
    position: absolute; top: 120px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.85); color: var(--pk-red); padding: 12px 24px;
    border-radius: 5px; font-family: 'Press Start 2P'; font-size: 11px; opacity: 0; z-index: 10;
}

.word-display {
    background: rgba(255, 255, 255, 0.9); padding: 12px 25px; border-radius: 12px;
    color: #333; font-size: 26px; border: 4px solid #3c5aa6; font-weight: bold;
}
.word-display span.correct { color: #2ecc71; }
.word-display span.current { border-bottom: 4px solid #3c5aa6; }
.word-display span.error { color: #e74c3c; background: #ffdada; animation: shake 0.2s; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* --- ตัวละคร & มอนสเตอร์ --- */
#player { 
    width: 140px; transform: scaleX(-1); z-index: 2; 
    filter: drop-shadow(5px 5px 0 rgba(0,0,0,0.3)); 
    transition: margin-bottom 0.3s ease;
}

.attack-anim { animation: pkDash 0.3s forwards; }
@keyframes pkDash { 0% { transform: scaleX(-1) translateX(0); } 50% { transform: scaleX(-1) translateX(-350px); } 100% { transform: scaleX(-1) translateX(0); } }

@keyframes monDash { 0% { transform: translateX(0); } 50% { transform: translateX(-150px); } 100% { transform: translateX(0); } }
.mon-attack-anim { animation: monDash 0.2s forwards; }

#monsters-zone { 
    display: flex; gap: 50px; z-index: 2; flex-grow: 1; 
    justify-content: flex-end; align-items: flex-end; margin-bottom: 10px; 
}
.monster-sprite { height: 120px; filter: drop-shadow(5px 5px 0 rgba(0,0,0,0.3)); }
.is-boss .monster-sprite { height: 250px; }

/* --- คีย์บอร์ด UI --- */
#ui-kb { 
    background: #222; padding: 25px; border-radius: 15px; border: 4px solid #444;
    display: none; margin-top: 15px; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}
.hand-container svg { background: rgba(0,0,0,0.5); border-radius: 10px; border: 2px solid #444; padding: 10px; width: 80px; height: 80px; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.hand-container rect { transition: fill 0.2s; }
.l-hand { margin-right: 30px; } 
.r-hand { margin-left: 30px; }

.key { width: 48px; height: 48px; background: #333; border-radius: 6px; display: flex; justify-content: center; align-items: center; font-weight: bold; border-bottom: 4px solid #000; color: #fff; }
.key.active { background: var(--pk-yellow); color: #000; transform: translateY(4px); border-bottom: 0; }

#hint-text { text-align: center; margin-top: 15px; font-family: 'Press Start 2P'; font-size: 12px; text-shadow: 2px 2px #000; line-height: 1.5; }

#summary {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.95);
    z-index: 1000; flex-direction: column; align-items: center; justify-content: center;
    font-family: 'Press Start 2P'; text-align: center;
}
#res-title { color: var(--pk-yellow); margin-bottom: 30px; font-size: 40px; }
#res-stats { line-height: 2; margin-bottom: 40px; color: #fff; }

/* --- ปุ่มเต็มจอ (Fullscreen) --- */
#fullscreen-btn {
    position: fixed; bottom: 20px; right: 90px; z-index: 1000;
    background: #222; color: #fff; border: 3px solid #2196F3; border-radius: 50%;
    width: 55px; height: 55px;
    font-size: 24px; 
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; transition: font-size 0.3s ease, transform 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
}
#fullscreen-btn:hover { transform: scale(1.1); }

#settings-btn {
    position: fixed; bottom: 20px; right: 20px; z-index: 1000;
    background: #222; color: #fff; border: 3px solid #4CAF50; border-radius: 50%;
    width: 55px; height: 55px; font-size: 24px; cursor: pointer; transition: 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
}
#settings-btn:hover { transform: scale(1.1); }
#settings-panel {
    position: fixed; bottom: 90px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 12px;
    background: #222; color: #fff; border: 3px solid #4CAF50; border-radius: 10px;
    padding: 14px 18px; font-family: 'Press Start 2P', monospace; font-size: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
}
#settings-panel label { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
#settings-panel input { accent-color: #4CAF50; cursor: pointer; }
#mute-toggle {
    background: #333; color: #fff; border: 2px solid #4CAF50; border-radius: 6px;
    padding: 8px; font-family: inherit; font-size: 10px; cursor: pointer;
}
#mute-toggle.muted { border-color: #ff5252; color: #ff5252; }
/* --- บัญชีผู้เล่น: ฟอร์มล็อกอิน / สมัคร / กู้รหัส --- */
.form-sub { background: rgba(0,0,0,0.5); padding: 5px 10px; border-radius: 5px; margin-bottom: 20px; }
.form-box {
    display: flex; flex-direction: column; gap: 12px; width: 420px; max-width: calc(100vw - 32px);
    background: rgba(0,0,0,0.75); border: 4px solid #ffcb05; border-radius: 12px; padding: 22px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}
.form-input {
    width: 100%; box-sizing: border-box; padding: 12px; border: 3px solid #fff; border-radius: 8px;
    background: #222; color: #4CAF50; font-family: 'Press Start 2P'; font-size: 11px;
}
.form-input:focus { outline: none; border-color: #ffcb05; }
select.form-input { font-family: 'Fira Code', monospace; font-size: 14px; color: #fff; }
.pw-row { display: flex; gap: 8px; }
.pw-row .form-input { flex: 1; }
.pw-toggle {
    background: #333; color: #fff; border: 3px solid #fff; border-radius: 8px; cursor: pointer;
    font-family: 'Press Start 2P'; font-size: 9px; padding: 0 10px;
}
.form-label { font-family: 'Press Start 2P'; font-size: 9px; color: #ffcb05; margin-top: 4px; }
.form-question { font-family: 'Fira Code', monospace; font-size: 16px; color: #ffcb05; text-align: center; }
.form-msg { min-height: 14px; font-family: 'Press Start 2P'; font-size: 10px; line-height: 1.6; text-align: center; color: #ff5252; }
.form-btn {
    padding: 14px; border: 3px solid #fff; border-radius: 30px; cursor: pointer; background: #333; color: #fff;
    font-family: 'Press Start 2P'; font-size: 12px; transition: 0.2s;
}
.form-btn.primary { background: #4CAF50; }
.form-btn:not(:disabled):hover { transform: scale(1.05); }
.form-btn:disabled, .pc-btn:disabled { opacity: 0.5; cursor: wait; }
.form-btn.narrow { width: 300px; margin-top: 14px; }
.form-link { background: none; border: none; color: #ffcb05; cursor: pointer; font-family: 'Press Start 2P'; font-size: 9px; text-decoration: underline; }

/* --- เมนูหลัก: ป้ายชื่อผู้เล่น + ปุ่มบัญชี --- */
#trainer-badge {
    position: absolute; top: 20px; left: 20px; display: flex; align-items: center; gap: 10px;
    background: rgba(0,0,0,0.75); border: 4px solid #ffcb05; border-radius: 14px; padding: 8px 22px 8px 8px; gap: 14px;
    font-family: 'Press Start 2P';
}
#trainer-badge:empty { display: none; }
#trainer-badge > img { width: 84px; height: 84px; object-fit: contain; }
.tb-name { font-size: 16px; color: #ffcb05; margin-bottom: 10px; }
.tb-poke { font-size: 12px; color: #fff; line-height: 1.8; }
.home-account { position: absolute; top: 20px; right: 20px; display: flex; gap: 8px; }
.home-account button {
    background: rgba(0,0,0,0.7); color: #fff; border: 3px solid #fff; border-radius: 20px; padding: 10px 14px;
    font-family: 'Press Start 2P'; font-size: 9px; cursor: pointer;
}
.side-menu { position: absolute; top: 80px; right: 20px; display: flex; flex-direction: column; gap: 14px; }
.side-menu button {
    width: 230px; height: 64px; background: #ffcb05; color: #3c5aa6; border: 4px solid #fff; border-radius: 32px;
    font-family: 'Press Start 2P'; font-size: 13px; cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,0.3); transition: 0.2s;
}
.side-menu button:hover { transform: scale(1.06); }
.side-menu .admin-side { background: #c0392b; color: #fff; }

/* --- แผงแอดมิน --- */
#menu-admin .form-box { width: 560px; }
.admin-row { display: flex; gap: 8px; align-items: stretch; }
.admin-row .form-input { flex: 1; }
.admin-row .pc-btn { width: auto; padding: 0 14px; min-height: 40px; }
.form-btn.danger { background: #c0392b; }

/* --- Pokédex --- */
.dex-grid {
    display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
    width: 960px; max-width: calc(100vw - 32px); max-height: 58vh; overflow-y: auto; padding: 6px;
}
.dex-cell {
    width: 110px; background: rgba(0,0,0,0.8); border: 3px solid #fff; border-radius: 10px; padding: 8px 4px;
    display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: 'Press Start 2P'; color: #fff;
}
.dex-cell > img { width: 64px; height: 64px; object-fit: contain; }
.dex-cell.unseen { border-color: #555; }
.dex-cell.unseen > img { filter: brightness(0); opacity: 0.7; }
.dex-no { font-size: 8px; color: #aaa; }
.dex-name { font-size: 8px; text-align: center; line-height: 1.4; min-height: 22px; }

/* --- การ์ดโปเกมอน (Starter / คลัง) --- */
.card-row { display: flex; gap: 24px; margin: 10px 0 20px; flex-wrap: wrap; justify-content: center; }
.card-grid {
    display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
    width: 900px; max-width: calc(100vw - 32px); max-height: 52vh; overflow-y: auto; padding: 6px;
}
.poke-card {
    width: 170px; background: rgba(0,0,0,0.8); border: 4px solid #fff; border-radius: 12px; padding: 12px;
    display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: 'Press Start 2P'; color: #fff;
}
.poke-card > img { width: 90px; height: 90px; object-fit: contain; }
.poke-card.active { border-color: #ffcb05 !important; transform: scale(1.04); }
.starter-card { cursor: pointer; transition: 0.2s; }
.starter-card:hover { transform: scale(1.06); }
.pc-name { font-size: 11px; }
.pc-el { font-size: 9px; }
.pc-exp { width: 100%; height: 10px; background: #333; border: 2px solid #fff; border-radius: 5px; overflow: hidden; }
.pc-exp div { height: 100%; background: #4CAF50; }
.pc-exp-text { font-size: 8px; color: #ccc; text-align: center; line-height: 1.5; }
.pc-btn {
    width: 100%; padding: 8px; border: 2px solid #fff; border-radius: 16px; background: #2196F3; color: #fff;
    font-family: 'Press Start 2P'; font-size: 9px; cursor: pointer;
}
.pc-btn.evolve { background: #9c27b0; }
.pc-active { font-size: 9px; color: #ffcb05; padding: 8px 0; }
.stone-bar { display: flex; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; justify-content: center; }
.stone-chip {
    background: rgba(0,0,0,0.75); border: 2px solid #fff; border-radius: 16px; padding: 8px 12px;
    font-family: 'Press Start 2P'; font-size: 9px;
}

/* --- ด่านหิน --- */
#trial-list {
    display: flex; flex-wrap: wrap; gap: 0 20px; justify-content: center;
    width: 900px; max-width: calc(100vw - 32px); max-height: 55vh; overflow-y: auto;
}
.trial-btn { display: flex; align-items: center; gap: 16px; text-align: left; line-height: 1.8; }
.trial-btn > img { width: 56px; height: 56px; object-fit: contain; }
.trial-btn small { font-size: 8px; color: #666; }

/* --- Ranking / แจ้งเตือน --- */
.rank-icon { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; margin-right: 6px; }
#toast {
    position: fixed; top: 20px; left: 50%; transform: translate(-50%, -150%); z-index: 2000;
    background: #222; color: #fff; border: 3px solid #ff5252; border-radius: 10px; padding: 12px 20px;
    font-family: 'Press Start 2P'; font-size: 10px; transition: transform 0.3s, opacity 0.3s;
    opacity: 0; visibility: hidden; pointer-events: none;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }

/* --- หน้าสรุปผลแบบหลายหน้า (ผลการเล่น → EXP → ของที่ได้) --- */
.sum-page { display: flex; flex-direction: column; align-items: center; min-height: 360px; justify-content: center; }
.sum-sprite { width: 180px; height: 180px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(5px 5px 0 rgba(0,0,0,0.3)); transition: filter 0.3s; }
.sum-evolving { filter: brightness(0) invert(1); }
.sum-name { font-size: 22px; color: #fff; margin: 14px 0 10px; }
.sum-gain { font-size: 20px; color: var(--pk-yellow); margin-bottom: 18px; }
.sum-exp-bar { width: 360px; max-width: 80vw; height: 18px; background: #333; border: 3px solid #fff; border-radius: 10px; overflow: hidden; }
#sum-exp-fill { height: 100%; width: 0; background: linear-gradient(90deg, #4CAF50, #8bc34a); }
.sum-small { font-size: 11px; color: #ccc; margin-top: 12px; line-height: 1.6; }
.sum-evolve { font-size: 13px; color: #ffcb05; margin-top: 18px; min-height: 16px; line-height: 1.6; max-width: 700px; }
#summary #normal-back-btn { margin-top: 20px; }
#summary #normal-back-btn:disabled { opacity: 0.4; cursor: wait; transform: none; }

/* --- ธาตุ: ป้ายได้เปรียบ/เสียเปรียบ --- */
#menu-boss .mode-btn, #menu-boss-tier .mode-btn, .trial-btn { position: relative; }
.match-badge {
    position: absolute; top: -12px; right: 24px; padding: 5px 10px; border-radius: 12px; border: 2px solid #fff;
    font-family: 'Press Start 2P'; font-size: 9px; color: #fff; text-shadow: none; line-height: 1;
}
.match-badge.up { background: #2e7d32; }
.match-badge.down { background: #c62828; }
.match-badge.even { background: #555; }
.eff { font-size: 9px; padding: 1px 4px; border-radius: 4px; color: #fff; }
.eff.up { background: #2e7d32; }
.eff.down { background: #c62828; }
#matchup-txt { font-family: 'Press Start 2P'; font-size: 11px; padding: 4px 8px; border-radius: 6px; text-shadow: none; }
#matchup-txt.up { background: #2e7d32; color: #fff; }
#matchup-txt.down { background: #c62828; color: #fff; }
#matchup-txt.even { background: #555; color: #fff; }
#trial-list { padding-top: 16px; }
#menu-boss .menu-title { margin-bottom: 26px; }

/* --- เมนูหลัก: 6 โหมดให้พอดีจอ 720px --- */

/* --- PvP: เลือกทีม --- */
.pvp-slots { display: flex; gap: 14px; margin-bottom: 12px; }
.pvp-slot {
    width: 150px; height: 70px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; position: relative;
    background: rgba(0,0,0,0.8); border: 3px solid #fff; border-radius: 12px; color: #fff; cursor: pointer;
    font-family: 'Press Start 2P'; font-size: 8px; text-align: left;
}
.pvp-slot.empty { justify-content: center; border-style: dashed; color: #888; font-size: 18px; cursor: default; }
.pvp-slot > img { width: 48px; height: 48px; object-fit: contain; }
.pvp-slot-no { position: absolute; top: -10px; left: -10px; width: 24px; height: 24px; border-radius: 50%; background: #ffcb05; color: #3c5aa6; display: flex; align-items: center; justify-content: center; font-size: 10px; }
.pvp-pool { max-height: 40vh; }
.pvp-pick { cursor: pointer; }
.pvp-pick.picked { opacity: 0.35; cursor: default; }
.pvp-actions { display: flex; gap: 12px; margin-top: 12px; }
.pvp-actions .form-btn { width: 200px; }

/* --- PvP: สนาม --- */
.pvp-side { display: flex; flex-direction: column; gap: 4px; min-width: 220px; }
.pvp-who { font-family: 'Press Start 2P'; font-size: 10px; color: #fff; text-shadow: 2px 2px 0 #000; }
.pvp-hp { width: 200px; height: 12px; background: #333; border: 2px solid #fff; }
.pvp-hp div { height: 100%; transition: width 0.3s; }
.pvp-hp-text { font-family: 'Press Start 2P'; font-size: 9px; color: #ff5252; text-shadow: 2px 2px 0 #000; }
.pvp-pips { display: flex; gap: 6px; }
.pvp-pip { width: 12px; height: 12px; border-radius: 50%; background: #e74c3c; border: 2px solid #fff; }
.pvp-pip.down { background: #333; }
.pvp-pip.now { border-color: #ffcb05; transform: scale(1.3); }
.pvp-opp { gap: 4px; }
.skill-label { font-size: 10px; margin-bottom: 5px; font-weight: bold; font-family: 'Press Start 2P'; }
#matchup-txt { align-self: center; }

/* --- PvP: หน้าโหลดระหว่างหาคู่ --- */
#pvp-searching {
    position: fixed; inset: 0; z-index: 1500; background: rgba(0,20,60,0.92);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    font-family: 'Press Start 2P'; color: #fff; text-align: center;
}
.pvp-ball {
    width: 110px; height: 110px; border-radius: 50%; border: 6px solid #222; position: relative;
    background: linear-gradient(#e74c3c 0 46%, #222 46% 54%, #fff 54% 100%);
    animation: pvp-spin 1.1s linear infinite;
}
.pvp-ball::after {
    content: ''; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; transform: translate(-50%, -50%);
    background: #fff; border: 6px solid #222; border-radius: 50%;
}
@keyframes pvp-spin { to { transform: rotate(360deg); } }
.pvp-search-title { font-size: 18px; color: #ffcb05; text-shadow: 3px 3px 0 #3c5aa6; }
.pvp-search-time { font-size: 28px; }
.pvp-search-tip { font-size: 9px; color: #aaa; }
#pvp-searching .form-btn { width: 220px; }

/* --- ปุ่มกาชา (เหนือปุ่ม LANGUAGE) / ป้ายตั๋ว / คนออนไลน์ --- */
.gacha-corner { bottom: 102px; background: linear-gradient(90deg, #f39c12, #e74c3c); border-color: #ffcb05; }
.ticket-badge {
    position: absolute; bottom: -12px; left: 24px; padding: 5px 10px; border-radius: 12px; border: 2px solid #fff;
    background: #8e44ad; font-family: 'Press Start 2P'; font-size: 9px; color: #fff; text-shadow: none; line-height: 1;
}
.pvp-lobby { font-family: 'Press Start 2P'; font-size: 10px; color: #7CFC9A; margin-bottom: 10px; text-shadow: 2px 2px 0 #000; }
.sum-item { width: 180px; height: 180px; object-fit: contain; image-rendering: pixelated; }

/* --- Typing Lessons --- */
.lesson-grid { display: grid; grid-template-columns: repeat(6, 140px); gap: 12px; margin: 10px 0 16px; }
.lesson-card {
    height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
    background: rgba(0,0,0,0.8); border: 3px solid #fff; border-radius: 12px; color: #fff; cursor: pointer;
    font-family: 'Press Start 2P'; transition: 0.2s;
}
.lesson-card:hover { transform: scale(1.06); }
.lesson-card.done { border-color: #4CAF50; }
.lesson-no { font-size: 16px; color: #ffcb05; }
.lesson-name { font-size: 8px; text-align: center; line-height: 1.4; }
.lesson-stars { font-size: 12px; color: #ffcb05; }
#lesson-screen { width: 1000px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; align-items: center; gap: 14px; font-family: 'Press Start 2P'; }
#lesson-screen.hidden { display: none !important; }
.lesson-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lesson-head .form-btn { width: 120px; padding: 10px; font-size: 10px; }
#lesson-title { font-size: 16px; color: #ffcb05; text-shadow: 3px 3px 0 #3c5aa6; }
#lesson-progress { font-size: 10px; color: #fff; }
.lesson-text {
    width: 100%; box-sizing: border-box; padding: 24px; background: rgba(255,255,255,0.95); border: 4px solid #3c5aa6; border-radius: 12px;
    font-family: 'Fira Code', monospace; font-size: 32px; line-height: 1.6; color: #999; word-break: break-word; text-align: center;
}
.lesson-text span.ok { color: #2e7d32; }
.lesson-text span.now { color: #fff; background: #3c5aa6; border-radius: 4px; }
.lesson-text span.sp { display: inline-block; min-width: 0.6em; }
.lesson-text span.sp.now { box-shadow: inset 0 -4px 0 #ffcb05; }
.lesson-text span.bad { animation: lesson-bad 0.3s; }
@keyframes lesson-bad { 0%, 100% { background: #3c5aa6; } 50% { background: #ff5252; } }
.lesson-stats { font-size: 12px; color: #fff; text-shadow: 2px 2px 0 #000; }
.lesson-result {
    display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 30px;
    background: rgba(0,0,0,0.85); border: 4px solid #ffcb05; border-radius: 14px; color: #fff; font-size: 12px;
}
.lesson-result.hidden { display: none !important; }
.lesson-result-title { font-size: 18px; color: #ffcb05; }
.lesson-result-stars { font-size: 34px; color: #ffcb05; display: flex; gap: 8px; }
.key-space { width: 320px; font-size: 11px; }
.key.wrong { background: #ff5252 !important; }

.gacha-elements { display: flex; gap: 14px; margin: 12px 0 6px; }
.gacha-el {
    width: 150px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px;
    background: rgba(0,0,0,0.75); border: 3px solid #fff; border-radius: 12px; color: #fff; cursor: pointer; font-family: 'Press Start 2P'; font-size: 10px;
}
.gacha-el.on { background: rgba(255,203,5,0.25); border-color: #ffcb05 !important; transform: scale(1.06); }
.gacha-el-badge { width: 130px; height: 26px; object-fit: contain; image-rendering: pixelated; }
.gacha-el small { font-size: 8px; color: #ccc; }

/* --- ไอคอนโปเกบอล (แทน emoji ในฟอนต์ pixel) --- */
.ball-icon {
    display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 3px solid #222; vertical-align: middle; position: relative;
    background: linear-gradient(#e74c3c 0 44%, #222 44% 56%, #fff 56%); margin-right: 8px;
}
.ball-icon::after { content: ''; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; transform: translate(-50%, -50%); background: #fff; border: 2px solid #222; border-radius: 50%; }
.ball-icon.big { width: 30px; height: 30px; border-width: 4px; }
.ball-icon.big::after { width: 8px; height: 8px; }

/* --- กาชาแบบวงล้อ (แถบการ์ดเลื่อนผ่านเส้นกลาง) --- */
.roulette {
    position: relative; width: 660px; max-width: calc(100vw - 32px); height: 150px; overflow: hidden;
    background: rgba(0,0,0,0.85); border: 4px solid #fff; border-radius: 12px; margin: 6px 0 10px;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.9);
}
.roulette::before, .roulette::after {
    content: ''; position: absolute; top: 0; bottom: 0; width: 90px; z-index: 2; pointer-events: none;
}
.roulette::before { left: 0; background: linear-gradient(90deg, rgba(0,0,0,0.9), transparent); }
.roulette::after { right: 0; background: linear-gradient(-90deg, rgba(0,0,0,0.9), transparent); }
.roulette-strip { position: absolute; top: 14px; left: 0; display: flex; gap: 8px; will-change: transform; }
.roulette-card {
    flex: 0 0 110px; height: 118px; box-sizing: border-box; border-radius: 10px; border: 3px solid #fff; border-bottom-width: 8px;
    background: linear-gradient(#2c2c2c, #111); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    font-family: 'Press Start 2P'; font-size: 7px; color: #ddd;
}
.roulette-card > img { width: 76px; height: 76px; object-fit: contain; }
.roulette-card.win { transform: scale(1.08); border-color: #ffcb05 !important; transition: 0.3s; }
.roulette-marker {
    position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; margin-left: -2px; background: #ffcb05; z-index: 3;
}
.roulette-marker::before, .roulette-marker::after {
    content: ''; position: absolute; left: 50%; margin-left: -10px; border: 10px solid transparent;
}
.roulette-marker::before { top: 0; border-top-color: #ffcb05; }
.roulette-marker::after { bottom: 0; border-bottom-color: #ffcb05; }
@keyframes ran-away { to { opacity: 0; transform: translateX(120px) scale(0.5); } }
.match-badge { white-space: nowrap; }
.tier-badge {
    position: absolute; top: -12px; right: 24px; padding: 5px 10px; border-radius: 12px; border: 2px solid #fff;
    font-family: 'Press Start 2P'; font-size: 9px; color: #fff; text-shadow: none; line-height: 1; white-space: nowrap;
}
.tier-badge.easy { background: #2e7d32; }
.tier-badge.medium { background: #ffcb05; color: #000; }
.tier-badge.hard { background: #c62828; }
#gacha-roll { width: 280px; white-space: nowrap; }

/* --- ผลกาชาแบบเต็มจอ (หลังวงล้อหยุด) --- */
#gacha-reveal {
    position: fixed; inset: 0; z-index: 1600; background: rgba(0,0,0,0.92);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
    font-family: 'Press Start 2P'; color: #fff; text-align: center;
}
#gacha-reveal.hidden { display: none !important; }
.reveal-title { font-size: 26px; color: #ffcb05; text-shadow: 4px 4px 0 #3c5aa6; }
.reveal-title.dup { color: #ff5252; }
#reveal-img { width: 220px; height: 220px; object-fit: contain; image-rendering: pixelated; animation: reveal-pop 0.6s; }
@keyframes reveal-pop { from { transform: scale(0.3); } 70% { transform: scale(1.15); } to { transform: scale(1); } }
#reveal-img.ran-away { animation: reveal-pop 0.6s, ran-away 1.8s 1s forwards; }
#reveal-name { font-size: 22px; }
#reveal-sub { font-size: 11px; color: #ccc; line-height: 1.8; max-width: 640px; }
#gacha-reveal .form-btn { width: 240px; margin-top: 10px; }

/* --- Boss Stage: การ์ดด่าน --- */
.boss-btn { gap: 18px; }
.gift-note { font-size: 9px; color: #ffcb05; }

/* --- ปุ่มอื่น ๆ ที่กดได้: ชี้แล้วขยาย (ไม่มีเอฟเฟคแสง) --- */
.home-account button, .pc-btn, .pvp-slot:not(.empty), .pvp-pick:not(.picked), .gacha-el, .pw-toggle, #mute-toggle, #quit-btn, .form-link {
    transition: transform 0.2s;
}
.home-account button:hover, .pc-btn:not(:disabled):hover, .pvp-slot:not(.empty):hover, .pvp-pick:not(.picked):hover,
.gacha-el:not(:disabled):hover, .pw-toggle:hover, #mute-toggle:hover, #quit-btn:hover, .form-link:hover { transform: scale(1.06); }

/* --- ไอคอนรูปแทนอิโมจิ --- */
.type-icon { width: 1.4em; height: 1.4em; vertical-align: middle; image-rendering: pixelated; border-radius: 4px; }
.item-icon { width: 1.6em; height: 1.6em; vertical-align: middle; image-rendering: pixelated; object-fit: contain; }
.svg-icon { width: 1em; height: 1em; vertical-align: middle; }
#mute-toggle .svg-icon { width: 14px; height: 14px; margin-right: 4px; }
.svg-star { width: 1em; height: 1em; vertical-align: middle; }
.online-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #2ecc71; border: 2px solid #fff; margin-right: 8px; vertical-align: middle; }
