/* ===========================================
   ATC: ベイライツの伝説 - Main Stylesheet
   =========================================== */

/* CSS Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    background: #0a0a1a;
    font-family: 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
}

/* Game Wrapper - Responsive Container */
#game-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: none;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    max-width: 100vw;
    max-height: 75vw; /* 4:3 aspect ratio */
    touch-action: none;
}

#game-container canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    touch-action: none;
}

/* UI Overlay */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#ui-overlay > * {
    pointer-events: auto;
}

#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    right: 20px;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    pointer-events: auto;
    touch-action: none;
    z-index: 20;
}

#mobile-controls.active {
    display: flex;
}

body.battle-mode #mobile-controls {
    display: none !important;
    pointer-events: none !important;
}

.mobile-dpad,
.mobile-actions {
    display: flex;
    gap: 12px;
}

.mobile-btn {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    border: 2px solid rgba(100, 180, 255, 0.6);
    background: rgba(10, 30, 60, 0.8);
    color: #ffffff;
    font-size: 20px;
    font-weight: bold;
    box-shadow: 0 0 14px rgba(100, 180, 255, 0.25);
}

.mobile-btn:active {
    transform: scale(0.96);
    background: rgba(30, 60, 120, 0.9);
}

.mobile-btn-action {
    width: 72px;
    height: 72px;
    border-radius: 50%;
}

.hidden {
    display: none !important;
}

/* ===========================================
   Dialogue System
   =========================================== */
#dialogue-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 760px;
    z-index: 25;
}

.dialogue-box {
    background: linear-gradient(135deg, rgba(10, 30, 60, 0.95) 0%, rgba(5, 15, 35, 0.98) 100%);
    border: 2px solid rgba(100, 180, 255, 0.6);
    border-radius: 12px;
    padding: 20px 25px;
    box-shadow: 
        0 0 20px rgba(50, 150, 255, 0.3),
        inset 0 0 30px rgba(50, 150, 255, 0.05);
    backdrop-filter: blur(10px);
}

.speaker-name {
    font-size: 16px;
    font-weight: bold;
    color: #64b4ff;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(100, 180, 255, 0.5);
}

.text-content {
    font-size: 18px;
    color: #ffffff;
    line-height: 1.7;
    min-height: 60px;
}

.continue-indicator {
    position: absolute;
    bottom: 10px;
    right: 20px;
    color: #64b4ff;
    font-size: 14px;
    animation: bounce 0.8s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

/* Choices */
.choices-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-btn {
    background: linear-gradient(90deg, rgba(50, 100, 180, 0.8) 0%, rgba(30, 60, 120, 0.8) 100%);
    border: 1px solid rgba(100, 180, 255, 0.5);
    border-radius: 8px;
    padding: 12px 20px;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.choice-btn:hover {
    background: linear-gradient(90deg, rgba(80, 150, 220, 0.9) 0%, rgba(50, 100, 180, 0.9) 100%);
    border-color: rgba(150, 200, 255, 0.8);
    transform: translateX(5px);
    box-shadow: 0 0 15px rgba(100, 180, 255, 0.4);
}

/* ===========================================
   Battle Menu
   =========================================== */
#battle-menu {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 180px;
    background: linear-gradient(to top, rgba(10, 20, 40, 0.95) 0%, rgba(10, 20, 40, 0.8) 100%);
    border-top: 2px solid rgba(100, 180, 255, 0.4);
    z-index: 30;
}

.party-status {
    position: absolute;
    top: 10px;
    left: 20px;
    display: flex;
    gap: 15px;
}

.party-member {
    background: rgba(0, 20, 50, 0.8);
    border: 1px solid rgba(100, 180, 255, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    min-width: 120px;
}

.party-member .name {
    font-size: 12px;
    color: #64b4ff;
    margin-bottom: 5px;
}

.status-icons {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.status-icon {
    min-width: 20px;
    padding: 2px 4px;
    border-radius: 6px;
    font-size: 11px;
    text-align: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.status-icon.guard {
    border-color: rgba(100, 180, 255, 0.6);
    color: #a8dcff;
}

.status-icon.charge {
    border-color: rgba(255, 214, 90, 0.6);
    color: #ffd65a;
}

.party-member .hp-bar,
.party-member .mp-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    margin: 3px 0;
    overflow: hidden;
}

.party-member .hp-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    border-radius: 4px;
}

.party-member .mp-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #60a5fa, #3b82f6);
    border-radius: 4px;
}

.action-menu {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.action-btn {
    width: 100px;
    height: 45px;
    background: linear-gradient(135deg, rgba(40, 80, 140, 0.9) 0%, rgba(20, 50, 100, 0.9) 100%);
    border: 2px solid rgba(100, 180, 255, 0.5);
    border-radius: 8px;
    color: #ffffff;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.action-btn:hover {
    background: linear-gradient(135deg, rgba(60, 120, 200, 0.95) 0%, rgba(40, 80, 160, 0.95) 100%);
    border-color: rgba(150, 200, 255, 0.8);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(100, 180, 255, 0.5);
}

.action-btn:active {
    transform: scale(0.98);
}

.action-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.6));
}

.action-icon.attack {
    background-image: url("../assets/ui/icons/1_icon_energy_beacon.png");
}

.action-icon.skill {
    background-image: url("../assets/ui/icons/3_icon_bay_explorer.png");
}

.action-icon.item {
    background-image: url("../assets/ui/icons/4_icon_achievement_event.png");
}

.action-icon.defend {
    background-image: url("../assets/ui/icons/5_icon_atc_logo.png");
}

/* ===========================================
   HUD
   =========================================== */
#hud {
    position: absolute;
    top: 15px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
}

.location-name {
    background: rgba(10, 30, 60, 0.85);
    border: 1px solid rgba(100, 180, 255, 0.4);
    border-radius: 20px;
    padding: 8px 20px;
    color: #ffffff;
    font-size: 14px;
}

.bay-light-counter {
    background: rgba(10, 30, 60, 0.85);
    border: 1px solid rgba(255, 180, 100, 0.5);
    border-radius: 20px;
    padding: 8px 15px;
    color: #ffb060;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bay-light-counter .icon {
    animation: glow 2s infinite;
}

.stats-container {
    display: flex;
    gap: 12px;
}

.stat-item {
    background: rgba(10, 30, 60, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 8px 15px;
    color: white;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    align-items: center;
}

.stat-item.gold {
    color: #ffd700;
    border-color: rgba(255, 215, 0, 0.4);
}

.stat-item.lvl {
    color: #64b4ff;
    border-color: rgba(100, 180, 255, 0.4);
}

.stat-item.class {
    color: #ffd65a;
    border-color: rgba(255, 214, 90, 0.4);
}

.stat-item.hp {
    color: #7bf2a3;
    border-color: rgba(120, 255, 160, 0.4);
}

.stat-item.mp {
    color: #7fb7ff;
    border-color: rgba(120, 170, 255, 0.4);
}

.stat-item .val {
    margin-left: 6px;
}

.quest-log-btn {
    background: rgba(10, 30, 60, 0.85);
    border: 1px solid rgba(100, 180, 255, 0.4);
    border-radius: 16px;
    padding: 8px 14px;
    color: #ffffff;
    font-size: 12px;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.hud-buttons {
    display: flex;
    gap: 8px;
}

.skill-btn {
    background: rgba(10, 30, 60, 0.85);
    border: 1px solid rgba(255, 200, 120, 0.4);
    border-radius: 16px;
    padding: 8px 14px;
    color: #ffffff;
    font-size: 12px;
    letter-spacing: 0.5px;
    cursor: pointer;
}

.quest-log-btn:active {
    transform: scale(0.98);
}

.skill-btn:active {
    transform: scale(0.98);
}

@keyframes glow {
    0%, 100% { text-shadow: 0 0 5px rgba(255, 180, 100, 0.5); }
    50% { text-shadow: 0 0 15px rgba(255, 180, 100, 0.8); }
}

/* ===========================================
   Quest Popup
   =========================================== */
#quest-popup {
    position: absolute;
    top: 80px;
    right: 20px;
    background: rgba(10, 40, 30, 0.9);
    border: 2px solid rgba(100, 255, 150, 0.5);
    border-radius: 10px;
    padding: 15px 20px;
    max-width: 300px;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.quest-title {
    font-size: 14px;
    color: #80ffa0;
    font-weight: bold;
    margin-bottom: 8px;
}

.quest-objective {
    font-size: 13px;
    color: #ffffff;
    line-height: 1.5;
}

/* ===========================================
   Mobile Responsive
   =========================================== */
@media (max-width: 820px) {
    #game-container {
        width: 100vw;
        height: 75vw;
        max-height: 100vh;
    }

    #hud {
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 8px 10px;
    }

    .location-name {
        order: 1;
    }

    .bay-light-counter {
        order: 2;
    }

    .stats-container {
        order: 3;
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 8px;
    }

    .hud-buttons {
        order: 4;
        width: 100%;
        justify-content: flex-end;
        gap: 6px;
    }

    #mobile-controls {
        display: none;
    }

    #mobile-controls.active {
        display: flex;
    }

    #quest-log {
        width: 90vw;
        left: 5vw;
        right: 5vw;
    }
    
    .dialogue-box {
        padding: 15px 18px;
    }
    
    .text-content {
        font-size: 16px;
    }
    
    .action-btn {
        width: 80px;
        height: 40px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .text-content {
        font-size: 15px;
        line-height: 1.6;
    }
    
    .speaker-name {
        font-size: 15px;
    }
    
    .action-menu {
        gap: 6px;
    }
    
    .action-btn {
        width: 70px;
        height: 35px;
        font-size: 12px;
    }
    
    .party-member {
        min-width: 90px;
        padding: 6px 8px;
    }

    .mobile-btn {
        width: 56px;
        height: 56px;
        font-size: 18px;
    }

    .mobile-btn-action {
        width: 64px;
        height: 64px;
    }

    .quest-log-btn {
        font-size: 11px;
        padding: 6px 10px;
    }

    .shop-item {
        grid-template-columns: 1fr;
    }

    .shop-item-price {
        justify-self: start;
    }

    .shop-buy {
        width: 100%;
    }
}

/* ===========================================
   Quest Log
   =========================================== */
#quest-log {
    position: absolute;
    top: 120px;
    right: 20px;
    width: 320px;
    max-height: 60%;
    overflow: auto;
    background: rgba(10, 20, 40, 0.95);
    border: 2px solid rgba(100, 180, 255, 0.5);
    border-radius: 12px;
    padding: 12px;
    z-index: 15;
}

.quest-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64b4ff;
    font-weight: bold;
    margin-bottom: 8px;
}

.quest-log-close {
    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
}

.quest-log-section {
    margin-top: 10px;
}

.quest-log-title {
    font-size: 13px;
    color: #ffb060;
    margin-bottom: 6px;
}

.quest-log-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0;
    margin: 0;
}

.quest-log-item {
    background: rgba(5, 15, 35, 0.9);
    border: 1px solid rgba(100, 180, 255, 0.25);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    color: #ffffff;
}

.quest-log-item .quest-name {
    font-weight: bold;
    margin-bottom: 4px;
    color: #64b4ff;
}

.quest-log-item .quest-objective {
    color: #d0e6ff;
    line-height: 1.4;
}

/* ===========================================
   Skill Panel
   =========================================== */
#skill-panel {
    position: absolute;
    top: 120px;
    left: 20px;
    width: 320px;
    max-height: 60%;
    overflow: auto;
    background: rgba(10, 20, 40, 0.95);
    border: 2px solid rgba(255, 200, 120, 0.5);
    border-radius: 12px;
    padding: 12px;
    z-index: 15;
}

.skill-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffb060;
    font-weight: bold;
    margin-bottom: 8px;
}

.skill-panel-close {
    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
}

.skill-points {
    font-size: 12px;
    color: #ffffff;
    margin-bottom: 8px;
}

.skill-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    margin: 0;
}

.skill-item {
    background: rgba(5, 15, 35, 0.9);
    border: 1px solid rgba(255, 200, 120, 0.25);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.skill-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.skill-name {
    font-weight: bold;
    color: #ffb060;
    font-size: 13px;
}

.skill-level {
    font-size: 11px;
    color: #ffffff;
    margin-left: 6px;
}

.skill-desc {
    font-size: 11px;
    color: #d0e6ff;
}

.skill-actions {
    display: flex;
    align-items: center;
}

.skill-upgrade {
    background: rgba(60, 120, 200, 0.9);
    border: 1px solid rgba(100, 180, 255, 0.6);
    border-radius: 8px;
    color: #ffffff;
    padding: 6px 10px;
    font-size: 11px;
    cursor: pointer;
}

.skill-upgrade:disabled {
    opacity: 0.5;
    cursor: default;
}

/* ===========================================
   Shop / Pause / Audio Panels
   =========================================== */
#shop-overlay,
#pause-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    z-index: 25;
}

.shop-panel {
    width: 520px;
    max-width: 92vw;
    background: rgba(10, 20, 40, 0.95);
    border: 2px solid rgba(255, 180, 100, 0.6);
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
    padding: 16px;
}

.shop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #ffb060;
    font-weight: bold;
    margin-bottom: 12px;
}

.shop-title {
    font-size: 16px;
}

.shop-gold {
    font-size: 13px;
    color: #ffd65a;
}

.shop-close {
    background: transparent;
    border: 0;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
}

.shop-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
    overflow: auto;
    padding-right: 4px;
}

.shop-item {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    align-items: center;
    background: rgba(5, 15, 35, 0.9);
    border: 1px solid rgba(255, 200, 120, 0.25);
    border-radius: 10px;
    padding: 10px 12px;
}

.shop-item-name {
    font-weight: bold;
    color: #ffffff;
    font-size: 14px;
}

.shop-item-desc {
    grid-column: 1 / 3;
    font-size: 12px;
    color: #d0e6ff;
    line-height: 1.4;
}

.shop-item-price {
    font-size: 12px;
    color: #ffd65a;
}

.shop-buy {
    background: rgba(60, 120, 200, 0.9);
    border: 1px solid rgba(100, 180, 255, 0.6);
    border-radius: 8px;
    color: #ffffff;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
}

.shop-buy:active {
    transform: scale(0.98);
}

.pause-panel {
    width: 320px;
    max-width: 85vw;
    background: rgba(10, 20, 40, 0.95);
    border: 2px solid rgba(100, 180, 255, 0.5);
    border-radius: 14px;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.pause-panel .pause-title {
    font-size: 18px;
    color: #ffb060;
    font-weight: bold;
}

.pause-panel button {
    width: 180px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(100, 180, 255, 0.5);
    background: rgba(20, 50, 100, 0.9);
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
}

.pause-panel button.pause-to-title {
    border-color: rgba(255, 180, 100, 0.6);
    background: rgba(60, 40, 20, 0.9);
    color: #ffb060;
}

#audio-settings {
    position: absolute;
    top: 90px;
    right: 20px;
    z-index: 26;
}

.audio-panel {
    width: 260px;
    background: rgba(10, 20, 40, 0.95);
    border: 2px solid rgba(100, 180, 255, 0.5);
    border-radius: 12px;
    padding: 12px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audio-title {
    font-size: 14px;
    font-weight: bold;
    color: #64b4ff;
}

.audio-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.audio-row input[type="range"] {
    flex: 1;
}

.mute-row {
    justify-content: space-between;
}

@media (max-width: 820px) {
    #quest-log {
        width: 90vw;
        left: 5vw;
        right: 5vw;
    }

    #skill-panel {
        width: 90vw;
        left: 5vw;
        right: 5vw;
    }

    .shop-panel {
        width: 90vw;
    }

    .pause-panel {
        width: 85vw;
    }

    #audio-settings {
        right: 5vw;
        left: 5vw;
        top: 70px;
    }

    .audio-panel {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .quest-log-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
}

.dialogue-hints {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(100, 180, 255, 0.2);
}

.skip-hint {
    color: #607890;
    font-size: 11px;
    opacity: 0.7;
}

/* ===========================================
   Character Selection Screen
   =========================================== */
#character-select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a1a3a 0%, #051224 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.char-select-title {
    font-size: 28px;
    font-weight: bold;
    color: #64b4ff;
    text-shadow: 0 0 20px rgba(100, 180, 255, 0.6);
    margin-bottom: 10px;
}

.char-select-subtitle {
    font-size: 14px;
    color: #a0c8ff;
    margin-bottom: 30px;
}

.character-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    max-width: 600px;
    padding: 0 20px;
}

.character-card {
    background: rgba(10, 30, 60, 0.9);
    border: 2px solid rgba(100, 180, 255, 0.4);
    border-radius: 16px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.character-card:hover {
    border-color: rgba(100, 200, 255, 0.8);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(100, 180, 255, 0.3);
}

.character-card.selected {
    border-color: #ffb060;
    background: rgba(40, 30, 10, 0.9);
    box-shadow: 0 0 25px rgba(255, 180, 100, 0.5);
}

.char-portrait {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    background: rgba(0, 20, 50, 0.8);
    border-radius: 50%;
    border: 2px solid rgba(100, 180, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.char-name {
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 6px;
}

.char-desc {
    font-size: 11px;
    color: #a0c8ff;
    line-height: 1.4;
}

.char-stats {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 10px;
}

.char-stat {
    background: rgba(0, 20, 50, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    color: #ffffff;
}

.char-stat.atk { color: #ff8080; }
.char-stat.def { color: #80ff80; }
.char-stat.spd { color: #80c0ff; }

.start-btn {
    margin-top: 30px;
    padding: 15px 50px;
    background: linear-gradient(135deg, rgba(255, 160, 80, 0.9) 0%, rgba(200, 100, 40, 0.9) 100%);
    border: 2px solid rgba(255, 200, 150, 0.6);
    border-radius: 30px;
    color: #ffffff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 180, 100, 0.6);
}

.start-btn:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

/* ===========================================
   Battle Skill Icons
   =========================================== */
.skill-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(100, 180, 255, 0.2);
    border-radius: 6px;
    margin-right: 8px;
    font-size: 14px;
}

.skill-icon.attack { background: rgba(255, 100, 100, 0.3); }
.skill-icon.heal { background: rgba(100, 255, 150, 0.3); }
.skill-icon.buff { background: rgba(255, 200, 100, 0.3); }
.skill-icon.debuff { background: rgba(150, 100, 255, 0.3); }

/* ===========================================
   Enemy Speech Bubble
   =========================================== */
.enemy-speech {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(60, 40, 80, 0.95);
    border: 2px solid rgba(180, 100, 255, 0.6);
    border-radius: 12px;
    padding: 10px 18px;
    color: #ffffff;
    font-size: 14px;
    max-width: 300px;
    text-align: center;
    animation: speechBounce 0.3s ease;
    z-index: 20;
}

.enemy-speech::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(60, 40, 80, 0.95);
}

@keyframes speechBounce {
    0% { transform: translateX(-50%) scale(0.8); opacity: 0; }
    50% { transform: translateX(-50%) scale(1.05); }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@media (max-width: 600px) {
    .character-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .char-select-title {
        font-size: 22px;
    }
    
    .character-card {
        padding: 15px 10px;
    }

    #hud {
        top: 8px;
        padding: 0 8px;
        gap: 6px;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: flex-start;
    }

    .location-name,
    .bay-light-counter,
    .stat-item {
        font-size: 11px;
        padding: 6px 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .location-name {
        max-width: 48vw;
    }

    .stat-item {
        max-width: 32vw;
    }

    .stats-container {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 6px;
        width: 100%;
    }

    .hud-buttons {
        flex-direction: row;
        gap: 6px;
        width: 100%;
        justify-content: flex-end;
    }

    .quest-log-btn,
    .skill-btn {
        font-size: 10px;
        padding: 6px 10px;
    }

    .stat-item.class,
    .stat-item.lvl {
        display: none;
    }

    #battle-menu {
        height: 150px;
    }

    .party-status {
        top: 8px;
        left: 8px;
        gap: 8px;
        flex-wrap: wrap;
        max-width: 58%;
    }

    .party-member {
        min-width: 96px;
        padding: 6px 8px;
    }

    .action-menu {
        right: 8px;
        bottom: 12px;
        gap: 6px;
    }

    .action-btn {
        width: 80px;
        height: 36px;
        font-size: 12px;
    }

    .action-icon {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 420px) {
    #hud {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .location-name {
        width: 100%;
    }

    .stats-container {
        width: 100%;
        justify-content: flex-start;
    }
}

/* ===========================================
   MOBILE LANDSCAPE (Horizontal Phone View)
   For phones in landscape orientation
   =========================================== */
@media (max-height: 500px) and (orientation: landscape) {
    /* Game container - ensure proper fit */
    #game-container {
        height: 100vh;
        width: auto;
        max-width: 100vw;
        aspect-ratio: 4/3;
    }

    /* HUD - Ultra compact for landscape */
    #hud {
        top: 4px;
        padding: 0 10px;
        gap: 4px 8px;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
    }

    .location-name {
        font-size: 10px;
        padding: 4px 10px;
        max-width: 30vw;
    }

    .bay-light-counter {
        font-size: 10px;
        padding: 4px 8px;
        gap: 4px;
    }

    .stats-container {
        gap: 4px;
    }

    .stat-item {
        font-size: 10px;
        padding: 4px 8px;
    }

    /* Hide class and level stats in landscape to save space */
    .stat-item.class,
    .stat-item.lvl {
        display: none;
    }

    .hud-buttons {
        gap: 4px;
    }

    .quest-log-btn,
    .skill-btn {
        font-size: 9px;
        padding: 4px 8px;
    }

    /* Mobile controls - Smaller and repositioned */
    #mobile-controls {
        bottom: 8px;
        left: 10px;
        right: 10px;
    }

    .mobile-dpad,
    .mobile-actions {
        gap: 6px;
    }

    .mobile-btn {
        width: 48px;
        height: 48px;
        font-size: 16px;
        border-radius: 10px;
    }

    .mobile-btn-action {
        width: 54px;
        height: 54px;
    }

    /* Battle menu - Compact for landscape */
    #battle-menu {
        height: 110px;
    }

    .party-status {
        top: 6px;
        left: 10px;
        gap: 6px;
    }

    .party-member {
        min-width: 80px;
        padding: 4px 6px;
    }

    .party-member .name {
        font-size: 10px;
        margin-bottom: 3px;
    }

    .party-member .hp-bar,
    .party-member .mp-bar {
        height: 6px;
        margin: 2px 0;
    }

    .action-menu {
        bottom: 10px;
        right: 10px;
        gap: 5px;
    }

    .action-btn {
        width: 70px;
        height: 32px;
        font-size: 11px;
        padding: 0 4px;
    }

    .action-icon {
        width: 14px;
        height: 14px;
    }

    /* Dialogue box - Compact for landscape */
    #dialogue-container {
        bottom: 10px;
        width: 70%;
        max-width: 500px;
    }

    .dialogue-box {
        padding: 10px 14px;
    }

    .speaker-name {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .text-content {
        font-size: 13px;
        line-height: 1.5;
        min-height: 36px;
    }

    .continue-indicator {
        font-size: 12px;
        bottom: 6px;
        right: 12px;
    }

    /* Quest/Skill panels - Smaller in landscape */
    #quest-log,
    #skill-panel {
        top: 60px;
        width: 280px;
        max-height: 50vh;
        padding: 10px;
    }

    .quest-log-header,
    .skill-panel-header {
        font-size: 13px;
        margin-bottom: 6px;
    }

    /* Shop/Pause panels */
    .shop-panel {
        max-height: 90vh;
    }

    .shop-items {
        max-height: 200px;
    }

    /* Audio settings - Repositioned */
    #audio-settings {
        top: 50px;
        right: 10px;
    }

    .audio-panel {
        width: 220px;
        padding: 10px;
    }

    .audio-row {
        font-size: 11px;
        gap: 6px;
    }

    /* Character select - Compact grid */
    .character-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        max-width: 90vw;
    }

    .char-select-title {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .char-select-subtitle {
        font-size: 11px;
        margin-bottom: 15px;
    }

    .character-card {
        padding: 10px 8px;
    }

    .char-portrait {
        width: 40px;
        height: 40px;
        font-size: 20px;
        margin-bottom: 6px;
    }

    .char-name {
        font-size: 11px;
    }

    .char-desc {
        font-size: 9px;
    }

    .char-stats {
        gap: 4px;
        margin-top: 6px;
    }

    .char-stat {
        font-size: 8px;
        padding: 2px 4px;
    }

    .start-btn {
        margin-top: 15px;
        padding: 10px 30px;
        font-size: 14px;
    }

    /* Enemy speech bubble - Repositioned */
    .enemy-speech {
        top: 50px;
        max-width: 250px;
        font-size: 12px;
        padding: 8px 14px;
    }

    /* Quest popup - Repositioned */
    #quest-popup {
        top: 50px;
        right: 10px;
        max-width: 220px;
        padding: 10px 14px;
    }

    .quest-title {
        font-size: 12px;
    }

    .quest-objective {
        font-size: 11px;
    }
}
