:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --surface: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #475569;
}

/* ========== FIX: Panel scrolling ========== */
.panel-content {
    height: 100%;
    overflow-y: auto;
    padding: 12px;
}

/* Team Panel - Scrollable */
.team-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
    padding-right: 4px;
}

.team-member {
    background: var(--surface);
    border-radius: 14px;
    padding: 10px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

/* Items Panel - Scrollable */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
    padding-right: 4px;
}

.item-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 10px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

/* Shop Panel - Scrollable */
.shop-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
    padding-right: 4px;
}

.shop-item {
    background: var(--surface);
    border-radius: 14px;
    padding: 10px;
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

/* ========== FIX: Text Colors for readability ========== */
.shop-header {
    text-align: center;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 14px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.shop-header div {
    color: var(--text-primary);
    font-weight: 600;
}

.shop-header div:first-child {
    color: var(--success);
    font-size: 14px;
}

.shop-header div:last-child {
    color: var(--primary-light);
    font-size: 12px;
    margin-top: 4px;
}

.item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

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

.item-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.item-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
}

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

.item-count {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
}

.shop-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.shop-item-price {
    font-size: 13px;
    font-weight: bold;
    color: var(--warning);
    background: rgba(245, 158, 11, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 6px;
    text-align: center;
}

/* ========== FIX: Action Grid Text Colors ========== */
.action-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 4px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
}

.action-btn:active {
    transform: scale(0.97);
    background: var(--primary-dark);
}

.action-btn.primary {
    background: var(--primary);
    color: white;
    border: none;
}

.action-btn.danger {
    background: var(--danger);
    color: white;
    border: none;
}

.action-btn.success {
    background: var(--success);
    color: white;
    border: none;
}

.action-btn.warning {
    background: var(--warning);
    color: white;
    border: none;
}

.action-btn.info {
    background: var(--info);
    color: white;
    border: none;
}

.move-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
}

/* ========== FIX: Stat Panel Text Colors ========== */
.stats-container {
    padding: 12px;
    background: var(--surface);
    border-radius: 16px;
    max-height: calc(100% - 20px);
    overflow-y: auto;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.stat-label {
    color: var(--text-muted);
    font-size: 11px;
}

.stat-value {
    color: var(--primary-light);
    font-weight: bold;
    font-size: 11px;
}

/* ========== FIX: Team Panel Text Colors ========== */
.team-member-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
}

.team-member-level {
    font-size: 10px;
    color: var(--primary-light);
}

.team-member-hp {
    font-size: 10px;
    color: var(--text-secondary);
}

.team-member-status {
    font-size: 10px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 10px;
}

.team-member-status:contains("FAINTED") {
    color: var(--danger);
}

.team-member-status:contains("OK") {
    color: var(--success);
}

/* ========== FIX: Zone Info Button Text ========== */
.action-btn[onclick="showZoneInfo()"] {
    background: var(--info);
    color: white;
}

/* ========== FIX: Bottom Nav Active State ========== */
.nav-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 5px 2px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.1s;
    color: var(--text-muted);
}

.nav-btn.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

.nav-icon {
    font-size: 18px;
}

.nav-label {
    font-size: 9px;
    font-weight: 500;
    color: inherit;
}

/* ========== FIX: Save Bar Text Colors ========== */
.save-btn {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.save-btn:active {
    transform: scale(0.97);
    background: var(--primary);
    color: white;
}

.save-btn.danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ========== FIX: Modal Text Colors ========== */
.story-text {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.story-character span:last-child {
    color: var(--primary-light);
    font-weight: bold;
    font-size: 13px;
}

/* ========== FIX: Badge Colors ========== */
.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: bold;
}

.badge-poison { background: #8b5cf6; color: white; }
.badge-sleep { background: #3b82f6; color: white; }
.badge-burn { background: #f97316; color: white; }
.badge-freeze { background: #06b6d4; color: white; }

/* ========== Ensure all text is readable ========== */
* {
    color-scheme: dark;
}

button, .action-btn, .nav-btn, .save-btn {
    color: var(--text-primary);
}

button span, .action-btn span, .nav-btn span, .save-btn span {
    color: inherit;
}





:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --dark-bg: #0f172a;
    --card-bg: #1e293b;
    --surface: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Poppins', system-ui, sans-serif;
    background: #0f172a;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
}

.game-container {
    max-width: 550px;
    width: 100%;
    margin: auto;
    background: var(--dark-bg);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    height: 95vh;
    display: flex;
    flex-direction: column;
}

/* ========== HEADER (6%) ========== */
.game-header {
    background: var(--card-bg);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    height: 6%;
    min-height: 52px;
}

.zone-badge {
    background: rgba(99, 102, 241, 0.15);
    padding: 6px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.zone-icon {
    font-size: 14px;
}

.zone-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-light);
}

.money-display {
    background: rgba(34, 197, 94, 0.15);
    padding: 6px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

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

.money-amount {
    font-weight: 700;
    color: var(--success);
    font-size: 14px;
}

.auth-status {
    padding: 4px 10px;
    border-radius: 10px;
    background: var(--surface);
    font-size: 11px;
    color: var(--text-secondary);
}

/* ========== BATTLE AREA (15%) ========== */
.battle-area {
    padding: 10px 12px;
    background: linear-gradient(180deg, var(--dark-bg) 0%, #0a0f1a 100%);
    flex-shrink: 0;
    height: 15%;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.battle-side-by-side {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    height: 100%;
}

.creature-card {
    flex: 1;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 8px 10px;
    border: 1px solid var(--border);
}

.player-card {
    border-left: 3px solid var(--primary);
}

.enemy-card {
    border-right: 3px solid var(--danger);
}

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

.creature-name-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.creature-icon {
    font-size: 20px;
}

.creature-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.creature-level {
    font-size: 9px;
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.15);
    padding: 2px 6px;
    border-radius: 10px;
}

.creature-status-badge {
    font-size: 12px;
}

.hp-bar-wrapper {
    margin-top: 4px;
}

.hp-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.hp-numbers {
    color: var(--text-secondary);
}

.hp-bar-bg {
    background: var(--surface);
    border-radius: 4px;
    height: 5px;
    overflow: hidden;
}

.hp-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.player-hp-fill {
    background: linear-gradient(90deg, var(--danger), #f97316);
}

.enemy-hp-fill {
    background: linear-gradient(90deg, #f97316, var(--warning));
}

.vs-divider {
    font-size: 11px;
    font-weight: bold;
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.15);
    padding: 4px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

/* EXP Bar */
.exp-bar-wrapper {
    margin-top: 6px;
}

.exp-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 8px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.exp-bar-bg {
    background: var(--surface);
    border-radius: 4px;
    height: 4px;
    overflow: hidden;
}

.exp-bar-fill {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ========== LOG AREA (50%) ========== */
.log-area {
    background: var(--card-bg);
    margin: 0 12px;
    border-radius: 16px;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--border);
}

.log-header {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-light);
    flex-shrink: 0;
}

.log-icon {
    font-size: 12px;
}

.log-clear-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
}

.log-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

.log-entry {
    padding: 4px 8px;
    margin: 2px 0;
    border-left: 3px solid var(--primary);
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    font-size: 10px;
    line-height: 1.4;
}

.log-entry.combat {
    border-left-color: var(--danger);
    color: #fca5a5;
}

.log-entry.victory {
    border-left-color: var(--success);
    color: #86efac;
}

/* ========== ACTION GRID (19%) ========== */
.action-grid {
    padding: 10px 12px;
    background: var(--dark-bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    height: 19%;
    min-height: 130px;
    display: flex;
    flex-direction: column;
}

.buttons-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    flex: 1;
}

.action-btn {
    background: var(--surface);
    border: none;
    padding: 8px 4px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    border: 1px solid var(--border);
}

.action-btn:active {
    transform: scale(0.97);
    background: var(--primary-dark);
}

.action-btn.primary {
    background: var(--primary);
    color: white;
    border: none;
}

.action-btn.danger {
    background: var(--danger);
    color: white;
    border: none;
}

.action-btn.success {
    background: var(--success);
    color: white;
    border: none;
}

.action-btn.warning {
    background: var(--warning);
    color: white;
    border: none;
}

.action-btn.info {
    background: var(--info);
    color: white;
    border: none;
}

.move-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    gap: 10px;
}

.page-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px 12px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

.page-btn:active {
    transform: scale(0.97);
    background: var(--primary);
    color: white;
}

.page-info {
    font-size: 10px;
    color: var(--text-muted);
}

/* ========== BOTTOM NAV (6%) ========== */
.bottom-nav {
    display: flex;
    background: var(--card-bg);
    padding: 6px 12px;
    gap: 8px;
    flex-shrink: 0;
    height: 6%;
    min-height: 48px;
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 5px 2px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    cursor: pointer;
    transition: all 0.1s;
    color: var(--text-muted);
}

.nav-btn.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary-light);
}

.nav-icon {
    font-size: 18px;
}

.nav-label {
    font-size: 9px;
    font-weight: 500;
}

/* ========== SAVE BAR (4%) ========== */
.save-bar {
    display: flex;
    gap: 8px;
    padding: 6px 12px;
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    height: 4%;
    min-height: 40px;
}

.save-btn {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.save-btn:active {
    transform: scale(0.97);
    background: var(--primary);
    color: white;
}

.save-btn.danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.save-btn.danger:active {
    background: var(--danger);
    color: white;
}

/* ========== PANELS ========== */
.panel-content {
    height: 100%;
    overflow-y: auto;
    padding: 10px;
}

.team-list, .items-list, .shop-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.team-member, .item-card, .shop-item {
    background: var(--surface);
    border-radius: 14px;
    padding: 10px;
    border: 1px solid var(--border);
}

.team-member.active {
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.team-member-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.team-member-icon {
    font-size: 28px;
}

.team-member-details {
    flex: 1;
}

.team-member-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
}

.team-member-level {
    font-size: 10px;
    color: var(--primary-light);
}

.team-member-hp {
    font-size: 10px;
    color: var(--text-secondary);
}

.team-member-hp-bar {
    width: 80px;
    height: 4px;
    background: var(--dark-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.team-member-hp-fill {
    height: 100%;
    background: var(--danger);
}

.item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.item-count {
    font-size: 15px;
    font-weight: bold;
    color: var(--primary-light);
}

.item-use-btn {
    background: var(--success);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
}

.item-use-btn:active {
    transform: scale(0.97);
}

.shop-item-price {
    font-size: 12px;
    font-weight: bold;
    color: var(--warning);
}

/* Stats Panel */
.stats-container {
    padding: 12px;
    background: var(--surface);
    border-radius: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.stat-label {
    color: var(--text-muted);
    font-size: 11px;
}

.stat-value {
    color: var(--primary-light);
    font-weight: bold;
    font-size: 11px;
}

.badge-collection {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: bold;
}

.badge-poison { background: #8b5cf6; color: white; }
.badge-sleep { background: #3b82f6; color: white; }
.badge-burn { background: #f97316; color: white; }
.badge-freeze { background: #06b6d4; color: white; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.creature-card, .log-area, .action-grid {
    animation: fadeIn 0.2s ease;
}

/* Badge Notification */
.badge-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    animation: bounceIn 0.4s ease;
}

.badge-notification-content {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 16px 24px;
    border-radius: 20px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
}

.badge-notification-content .badge-icon {
    font-size: 40px;
    display: block;
    margin-bottom: 8px;
}

.badge-notification-content p {
    font-size: 14px;
    font-weight: 600;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Mobile Adjustments */
@media (max-width: 480px) {
    body {
        padding: 8px;
    }
    
    .game-container {
        border-radius: 20px;
    }
    
    .game-header {
        min-height: 48px;
        padding: 6px 12px;
    }
    
    .zone-name, .money-amount {
        font-size: 11px;
    }
    
    .battle-area {
        min-height: 100px;
        padding: 6px 10px;
    }
    
    .creature-name {
        font-size: 10px;
    }
    
    .creature-icon {
        font-size: 16px;
    }
    
    .action-btn {
        font-size: 10px;
        padding: 6px 3px;
    }
    
    .buttons-container {
        gap: 6px;
    }
    
    .bottom-nav {
        min-height: 44px;
        padding: 4px 10px;
    }
    
    .nav-icon {
        font-size: 16px;
    }
    
    .save-bar {
        min-height: 38px;
        padding: 4px 12px;
    }
    
    .save-btn {
        font-size: 9px;
    }
}

/* Landscape Mode */
@media (orientation: landscape) and (max-height: 600px) {
    .game-container {
        max-height: 98vh;
    }
    
    .battle-area {
        min-height: 85px;
    }
    
    .log-messages {
        max-height: 100px;
    }
    
    .action-grid {
        min-height: 100px;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}

/* Story Modal Styles */
.story-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.story-modal-content {
    max-width: 450px;
    width: 90%;
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--primary);
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.story-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 16px 20px;
    text-align: center;
    color: white;
}

.story-header h2 {
    margin: 8px 0 0;
    font-size: 18px;
}

.story-icon {
    font-size: 32px;
}

.story-body {
    padding: 24px;
    min-height: 180px;
}

.story-text {
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.story-character {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 16px;
    margin-top: 16px;
}

.story-character span:first-child {
    font-size: 32px;
}

.story-character span:last-child {
    color: var(--primary-light);
    font-weight: bold;
    font-size: 13px;
}

.story-footer {
    padding: 16px 20px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--border);
}

.story-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.1s;
}

.story-btn:active {
    transform: scale(0.97);
}

.story-btn.secondary {
    background: var(--surface);
    color: var(--text-secondary);
}

.npc-modal .story-header {
    background: linear-gradient(135deg, var(--success), #059669);
}


/* ========== GBA-STYLE PANELS ========== */

/* Panel Container */
.panel-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

/* Panel Header */
.panel-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.panel-header-icon {
    font-size: 24px;
}

.panel-header-title {
    font-size: 16px;
    font-weight: bold;
    color: white;
    letter-spacing: 1px;
}

.panel-header-sub {
    margin-left: auto;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
}

/* ========== BAG PANEL (GBA Style) ========== */
.bag-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.bag-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Left side - Icon area (25%) */
.bag-icon-area {
    width: 25%;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-right: 1px solid var(--border);
}

.bag-icon-large {
    font-size: 64px;
    margin-bottom: 12px;
}

.bag-icon-label {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Right side - Items list (75%) */
.bag-items-area {
    width: 75%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.bag-items-header {
    display: grid;
    grid-template-columns: 3fr 1fr;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid var(--primary);
    font-size: 11px;
    font-weight: bold;
    color: var(--primary-light);
    text-transform: uppercase;
}

.bag-items-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.bag-item-row {
    display: grid;
    grid-template-columns: 3fr 1fr;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.bag-item-row.selected {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid var(--primary);
}

.bag-item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.bag-item-count {
    font-size: 12px;
    color: var(--primary-light);
    text-align: right;
}

/* Bottom area - Item description (25%) */
.bag-description-area {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.bag-desc-icon {
    font-size: 32px;
    min-width: 48px;
    text-align: center;
}

.bag-desc-text {
    flex: 1;
}

.bag-desc-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.bag-desc-desc {
    font-size: 10px;
    color: var(--text-muted);
}

.bag-action-btn {
    background: var(--success);
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    cursor: pointer;
}

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

/* ========== TEAM PANEL (GBA Style) ========== */
.team-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.team-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Left side - Pokemon list (75%) */
.team-list-area {
    width: 75%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border);
}

.team-list-header {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid var(--primary);
    font-size: 10px;
    font-weight: bold;
    color: var(--primary-light);
    text-transform: uppercase;
}

.team-list-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.team-row {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr 1fr;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    align-items: center;
}

.team-row.active {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid var(--primary);
}

.team-row-icon {
    font-size: 20px;
}

.team-row-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.team-row-level {
    font-size: 11px;
    color: var(--primary-light);
}

.team-row-hp {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Right side - Pokemon details (25%) */
.team-detail-area {
    width: 25%;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.team-detail-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.team-detail-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.team-detail-level {
    font-size: 11px;
    color: var(--primary-light);
    margin-bottom: 8px;
}

.team-detail-hp {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.team-detail-hp-bar {
    width: 100%;
    height: 4px;
    background: var(--surface);
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0;
}

.team-detail-hp-fill {
    height: 100%;
    background: var(--danger);
    border-radius: 3px;
}

.team-detail-moves {
    font-size: 9px;
    color: var(--text-muted);
    text-align: center;
    margin-top: 8px;
}

/* ========== SHOP PANEL (GBA Style) ========== */
.shop-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.shop-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Left side - Items list (75%) */
.shop-list-area {
    width: 75%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border);
}

.shop-list-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 2px solid var(--primary);
    font-size: 10px;
    font-weight: bold;
    color: var(--primary-light);
    text-transform: uppercase;
}

.shop-list-items {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.shop-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
    align-items: center;
}

.shop-row.selected {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid var(--primary);
}

.shop-row-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
}

.shop-row-price {
    font-size: 11px;
    color: var(--warning);
}

/* Right side - Item details (25%) */
.shop-detail-area {
    width: 25%;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.shop-detail-icon {
    font-size: 56px;
    margin-bottom: 12px;
}

.shop-detail-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
    text-align: center;
}

.shop-detail-desc {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
}

.shop-detail-price {
    font-size: 14px;
    font-weight: bold;
    color: var(--warning);
    margin-bottom: 12px;
}

.shop-buy-btn {
    background: var(--success);
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    width: 100%;
}

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

/* Money display in shop */
.shop-money-display {
    background: var(--surface);
    padding: 8px 12px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 12px;
}

.shop-money-display span {
    color: var(--success);
    font-weight: bold;
    font-size: 14px;
}

/* ========== STATS PANEL (GBA Style) ========== */
.stats-panel {
    padding: 16px;
    height: 100%;
    overflow-y: auto;
}

.stats-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.stats-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--primary-light);
    margin-bottom: 12px;
    border-left: 3px solid var(--primary);
    padding-left: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-label {
    font-size: 11px;
    color: var(--text-muted);
}

.stats-value {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
}

.badge-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

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

.badge-item-name {
    font-size: 8px;
    color: var(--text-muted);
}

/* ========== MODAL STYLES ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeInModal 0.2s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-container {
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid var(--primary);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUpModal 0.3s ease;
}

@keyframes slideUpModal {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.modal-icon {
    font-size: 24px;
}

.modal-header h2 {
    flex: 1;
    font-size: 18px;
    font-weight: bold;
    color: white;
    margin: 0;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 16px;
    font-size: 18px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--dark-bg);
}

.modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

.modal-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 8px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}

.modal-btn:active {
    transform: scale(0.97);
    background: var(--primary);
}

/* ========== MODAL CONTENT STYLES ========== */

/* Team Modal Content */
.team-modal-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.team-modal-row {
    background: var(--surface);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.1s;
}

.team-modal-row.active {
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.team-modal-row:active {
    transform: scale(0.98);
}

.team-modal-icon {
    font-size: 36px;
}

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

.team-modal-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

.team-modal-level {
    font-size: 11px;
    color: var(--primary-light);
}

.team-modal-hp {
    font-size: 11px;
    color: var(--text-secondary);
}

.team-modal-hp-bar {
    width: 100px;
    height: 4px;
    background: var(--dark-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.team-modal-hp-fill {
    height: 100%;
    background: var(--danger);
    border-radius: 3px;
}

.team-modal-status {
    font-size: 11px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 10px;
}

/* Items Modal Content */
.items-modal-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.items-modal-row {
    background: var(--surface);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid var(--border);
}

.items-modal-row.selected {
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.items-modal-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.items-modal-icon {
    font-size: 28px;
}

.items-modal-details {
    flex: 1;
}

.items-modal-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
}

.items-modal-desc {
    font-size: 10px;
    color: var(--text-muted);
}

.items-modal-count {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
}

.items-modal-use {
    background: var(--success);
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    margin-left: 8px;
}

/* Shop Modal Content */
.shop-modal-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shop-money-header {
    background: var(--surface);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    margin-bottom: 8px;
}

.shop-money-header span {
    color: var(--success);
    font-weight: bold;
    font-size: 16px;
}

.shop-modal-row {
    background: var(--surface);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid var(--border);
}

.shop-modal-row.selected {
    border: 2px solid var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.shop-modal-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.shop-modal-icon {
    font-size: 28px;
}

.shop-modal-details {
    flex: 1;
}

.shop-modal-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-primary);
}

.shop-modal-desc {
    font-size: 10px;
    color: var(--text-muted);
}

.shop-modal-price {
    font-size: 14px;
    font-weight: bold;
    color: var(--warning);
}

.shop-modal-buy {
    background: var(--success);
    border: none;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    margin-left: 8px;
}

/* Stats Modal Content */
.stats-modal-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.stats-section {
    background: var(--surface);
    border-radius: 14px;
    padding: 12px;
}

.stats-section-title {
    font-size: 13px;
    font-weight: bold;
    color: var(--primary-light);
    margin-bottom: 10px;
    border-left: 3px solid var(--primary);
    padding-left: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-label {
    font-size: 11px;
    color: var(--text-muted);
}

.stats-value {
    font-size: 12px;
    font-weight: bold;
    color: var(--text-primary);
}

.badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.badge-item-icon {
    font-size: 32px;
}

.badge-item-name {
    font-size: 9px;
    color: var(--text-muted);
}

.moves-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.move-tag {
    background: var(--dark-bg);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 10px;
    color: var(--primary-light);
}

/* Requirement notification styles */
.requirement-notification {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 16px 24px;
    z-index: 1000;
    animation: slideDown 0.3s ease;
    max-width: 90%;
    width: 320px;
    text-align: center;
}

.requirement-notification h4 {
    color: var(--primary-light);
    margin-bottom: 12px;
}

.requirement-notification ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.requirement-notification li {
    padding: 4px 0;
    font-size: 12px;
}

.requirement-notification .success {
    color: #22c55e;
}

.requirement-notification .error {
    color: #ef4444;
}

.requirement-notification .warning {
    color: #f59e0b;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Sell button styles */
.items-modal-sell-btn, .team-modal-sell-btn, .shop-modal-sell {
    transition: transform 0.1s;
}

.items-modal-sell-btn:active, .team-modal-sell-btn:active, .shop-modal-sell:active {
    transform: scale(0.95);
}

.items-modal-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.shop-tabs {
    border-bottom: 1px solid var(--border);
}

.shop-tab-btn {
    transition: all 0.2s;
}

.shop-tab-btn:hover {
    color: var(--primary-light);
    background: rgba(99, 102, 241, 0.1);
}

.shop-tab-btn.active {
    color: var(--primary-light);
    border-bottom: 2px solid var(--primary-light);
}

/* ============================================================================
   TYPING ANIMATION FOR LOG MESSAGES
   ============================================================================ */

.log-messages {
    font-family: 'Courier New', 'VT323', 'Fira Code', monospace;
    font-size: 12px;
    line-height: 1.5;
}

.log-entry {
    animation: fadeInSlide 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.log-entry.typing {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.05);
}

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

/* Cursor blink effect for typing */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: #c084fc;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

/* ============================================================================
   ELEGANT MODAL STYLES (Pokemon GBA Style)
   ============================================================================ */

.pokemon-modal {
    max-width: 480px;
    width: 90%;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    border: 3px solid #6366f1;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.3);
}

.pokemon-modal .modal-header {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    padding: 16px 20px;
    border-radius: 17px 17px 0 0;
}

.pokemon-modal .modal-header h2 {
    font-size: 20px;
    letter-spacing: 1px;
}

.pokemon-modal .modal-body {
    padding: 20px;
}

/* Starter Selection Modal */
.starter-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.starter-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid var(--border);
}

.starter-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

.starter-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.starter-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.starter-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.starter-type {
    font-size: 10px;
    color: var(--primary-light);
    margin-bottom: 4px;
}

.starter-desc {
    font-size: 9px;
    color: var(--text-muted);
}

/* Zone Selection Modal */
.zone-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
    max-height: 400px;
    overflow-y: auto;
}

.zone-card {
    background: var(--surface);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.zone-card:hover {
    transform: translateX(4px);
    border-color: var(--primary);
}

.zone-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.zone-card.locked:hover {
    transform: none;
}

.zone-icon-large {
    font-size: 32px;
}

.zone-info {
    flex: 1;
}

.zone-name-large {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.zone-details {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.zone-boss-status {
    font-size: 10px;
    margin-top: 4px;
}

.zone-boss-status.active {
    color: var(--warning);
}

.zone-boss-status.defeated {
    color: var(--success);
}

.zone-lock-icon {
    font-size: 20px;
    color: var(--danger);
}

/* Transaction Notification */
.transaction-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 12px 24px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: bold;
    z-index: 2000;
    animation: slideUpToast 0.3s ease, fadeOutToast 0.3s ease 2s forwards;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.transaction-toast.sell {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.transaction-toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

@keyframes slideUpToast {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOutToast {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* Better log readability */
.log-entry {
    font-family: 'Courier New', 'Fira Code', monospace;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.log-entry.combat {
    color: #fca5a5;
    text-shadow: 0 0 2px rgba(239, 68, 68, 0.3);
}

.log-entry.victory {
    color: #86efac;
    text-shadow: 0 0 2px rgba(34, 197, 94, 0.3);
}

.log-entry.normal {
    color: #cbd5e1;
}

/* ============================================================================
   CUSTOM SELECTION MODAL STYLES
   ============================================================================ */

.custom-selection-modal .modal-body {
    max-height: 60vh;
    overflow-y: auto;
    padding: 16px;
}

.selection-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.selection-item {
    background: var(--surface);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid var(--border);
}

.selection-item:hover {
    transform: translateX(4px);
    border-color: var(--primary);
}

.selection-item.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.selection-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.selection-item.locked:hover {
    transform: none;
}

/* Zone item specific */
.zone-icon-large {
    font-size: 32px;
    min-width: 48px;
    text-align: center;
}

.zone-info {
    flex: 1;
}

.zone-name-large {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.zone-details {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.zone-boss-status {
    font-size: 10px;
    margin-top: 4px;
}

.zone-boss-status.active {
    color: var(--warning);
}

.zone-boss-status.defeated {
    color: var(--success);
}

.zone-lock-reason {
    font-size: 9px;
    color: var(--danger);
    margin-top: 2px;
}

.zone-status-icon {
    font-size: 20px;
    min-width: 40px;
    text-align: center;
}

/* Starter item specific */
.starter-icon {
    font-size: 48px;
    min-width: 64px;
    text-align: center;
}

.starter-info {
    flex: 1;
}

.starter-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.starter-type {
    font-size: 11px;
    color: var(--primary-light);
    margin-top: 2px;
}

.starter-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.starter-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Item select specific */
.item-select-icon {
    font-size: 32px;
    min-width: 48px;
    text-align: center;
}

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

.item-select-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

.item-select-desc {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.item-select-quantity {
    font-size: 16px;
    font-weight: bold;
    color: var(--primary-light);
    min-width: 50px;
    text-align: right;
}

/* Monster select specific */
.monster-select-icon {
    font-size: 36px;
    min-width: 56px;
    text-align: center;
}

.monster-select-info {
    flex: 1;
}

.monster-select-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--text-primary);
}

.monster-select-level {
    font-size: 10px;
    color: var(--primary-light);
    margin-top: 2px;
}

.monster-select-hp {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.hp-bar-mini {
    width: 100px;
    height: 4px;
    background: var(--dark-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.hp-bar-mini-fill {
    height: 100%;
    background: var(--danger);
    border-radius: 3px;
}

.monster-select-status {
    font-size: 11px;
    font-weight: bold;
    min-width: 70px;
    text-align: right;
}

/* Confirm button */
.confirm-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cancel-btn {
    background: var(--surface);
    color: var(--text-secondary);
}

.cancel-btn:active {
    transform: scale(0.97);
}


/* ============================================================================
   CONFIRMATION MODAL STYLES
   ============================================================================ */

.confirmation-modal .modal-container {
    max-width: 400px;
    width: 90%;
}

.confirmation-body {
    text-align: center;
    padding: 24px !important;
}

.confirmation-message {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-line;
    margin-bottom: 0;
}

.confirmation-footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 16px 20px !important;
}

.confirmation-footer .modal-btn {
    min-width: 100px;
    padding: 10px 20px;
    font-size: 13px;
}

.confirmation-footer .confirm-btn.danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.confirmation-footer .confirm-btn.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.confirmation-footer .confirm-btn.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.confirmation-footer .cancel-btn {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.confirmation-footer .cancel-btn:active {
    transform: scale(0.97);
    background: var(--gray);
}

/* Animation for confirmation modal */
.confirmation-modal .modal-container {
    animation: modalPopIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

/* Lore button special animation */
.lore-btn-glow {
    animation: lorePulse 2s infinite;
}

@keyframes lorePulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(139, 92, 246, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(139, 92, 246, 0.8);
    }
}

/* Lore modal entry animation */
.lore-modal .modal-container {
    animation: slideUpLore 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideUpLore {
    0% {
        transform: translateY(50px) scale(0.9);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Lore Modal Styles */
.lore-modal .modal-container {
    animation: slideUpModal 0.4s ease;
}

@keyframes slideUpModal {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.lore-story p {
    margin-bottom: 16px;
    animation: fadeInText 0.5s ease forwards;
}

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

/* ============================================================================
   MINI-UTXODEX MODAL STYLES
   ============================================================================ */

.utxodex-modal .modal-container {
    max-width: 380px;
    width: 90%;
    background: linear-gradient(135deg, #1a1a2e, #0f172a);
    border: 2px solid #f59e0b;
}

.utxodex-header {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border-bottom: 2px solid #f59e0b;
    position: relative;
    overflow: hidden;
}

.utxodex-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.2), transparent);
    animation: utxodexShine 3s infinite;
}

@keyframes utxodexShine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.utxodex-icon-animated {
    font-size: 64px;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
    transition: transform 0.3s ease;
}

.utxodex-icon-animated:hover {
    transform: scale(1.1) rotate(5deg);
}

/* Floating animation for the icon */
@keyframes utxodexFloat {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

.utxodex-icon-floating {
    animation: utxodexFloat 2s ease-in-out infinite;
}

/* HP bar in UTXODex */
.utxodex-hp-bar {
    width: 100%;
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.utxodex-hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Move tags */
.utxodex-move-tag {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #a5b4fc;
    margin: 4px;
}

.utxodex-move-power {
    background: #f59e0b;
    color: #1a1a2e;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: bold;
    margin-left: 6px;
}

/* Type badge in UTXODex */
.utxodex-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
}

/* Pulsing scan effect */
@keyframes utxodexScan {
    0% { opacity: 0.3; transform: translateY(-100%); }
    100% { opacity: 1; transform: translateY(100%); }
}

.utxodex-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #f59e0b, transparent);
    animation: utxodexScan 2s linear infinite;
    pointer-events: none;
}

/* ============================================================================
   CRITICAL HIT & COMBAT EFFECTS
   ============================================================================ */

/* Screen shake animation for critical hits */
@keyframes screenShake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-0.5deg); }
    20% { transform: translate(-3px, 0px) rotate(0.5deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(0.5deg); }
    50% { transform: translate(-1px, 2px) rotate(-0.5deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-0.5deg); }
    80% { transform: translate(-1px, -1px) rotate(0.5deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(0, 0) rotate(0); }
}

.screen-shake {
    animation: screenShake 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Critical hit flash effect */
@keyframes criticalFlash {
    0% { background-color: transparent; text-shadow: none; }
    20% { background-color: rgba(245, 158, 11, 0.3); text-shadow: 0 0 8px #f59e0b; }
    40% { background-color: rgba(245, 158, 11, 0.5); text-shadow: 0 0 12px #f59e0b; }
    60% { background-color: rgba(245, 158, 11, 0.3); text-shadow: 0 0 8px #f59e0b; }
    100% { background-color: transparent; text-shadow: none; }
}

.critical-flash {
    animation: criticalFlash 0.4s ease-in-out;
}

/* Critical hit text animation */
@keyframes criticalTextPop {
    0% { transform: scale(0.8); opacity: 0; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.critical-text {
    display: inline-block;
    animation: criticalTextPop 0.3s ease-out;
    color: #f59e0b;
    font-weight: bold;
    text-shadow: 0 0 4px #f59e0b;
}

/* Super effective text animation */
@keyframes superEffectivePulse {
    0% { transform: scale(1); color: #f59e0b; }
    50% { transform: scale(1.15); color: #f97316; text-shadow: 0 0 6px #f97316; }
    100% { transform: scale(1); color: #f59e0b; }
}

.super-effective-text {
    display: inline-block;
    animation: superEffectivePulse 0.4s ease-out;
    color: #f59e0b;
    font-weight: bold;
}

/* Damage number popup animation */
@keyframes damagePop {
    0% { transform: scale(0.5); opacity: 0; }
    20% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.damage-number {
    animation: damagePop 0.2s ease-out;
}

/* Critical hit damage number special effect */
@keyframes criticalDamagePop {
    0% { transform: scale(0.3) rotate(-10deg); opacity: 0; color: #f59e0b; }
    30% { transform: scale(1.4) rotate(5deg); opacity: 1; color: #f97316; text-shadow: 0 0 8px #f59e0b; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; color: #f59e0b; }
}

.critical-damage-number {
    animation: criticalDamagePop 0.3s ease-out;
    color: #f59e0b;
    font-weight: bold;
    text-shadow: 0 0 4px #f59e0b;
}

/* Enemy HP bar flash on hit */
@keyframes hpBarFlash {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.5); background: linear-gradient(90deg, #ef4444, #ff6b6b); }
    100% { filter: brightness(1); }
}

.hp-flash {
    animation: hpBarFlash 0.2s ease-out;
}

/* Battle log entry for critical hits */
.log-entry.critical {
    border-left-color: #f59e0b;
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), rgba(0, 0, 0, 0.2));
    color: #fde68a;
    font-weight: bold;
}

.log-entry.super-effective {
    border-left-color: #f97316;
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.15), rgba(0, 0, 0, 0.2));
    color: #fdba74;
}

/* Status effect log styles */
.log-entry.poison {
    border-left-color: #8b5cf6;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.15), rgba(0, 0, 0, 0.2));
    color: #c4b5fd;
}

.log-entry.burn {
    border-left-color: #f97316;
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.15), rgba(0, 0, 0, 0.2));
    color: #fdba74;
}

.log-entry.freeze {
    border-left-color: #06b6d4;
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.15), rgba(0, 0, 0, 0.2));
    color: #67e8f9;
}

.log-entry.sleep {
    border-left-color: #3b82f6;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), rgba(0, 0, 0, 0.2));
    color: #93c5fd;
}

.log-entry.paralysis {
    border-left-color: #fbbf24;
    background: linear-gradient(90deg, rgba(251, 191, 36, 0.15), rgba(0, 0, 0, 0.2));
    color: #fde68a;
}

/* Status badge animations */
@keyframes statusPulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.7; }
}

.creature-status-badge .badge-poison,
.creature-status-badge .badge-burn,
.creature-status-badge .badge-freeze,
.creature-status-badge .badge-sleep {
    animation: statusPulse 1.5s ease-in-out infinite;
    display: inline-block;
}

/* ============================================================================
   BATTLE LOSS EFFECTS
   ============================================================================ */

/* Screen darken/fade to black effect */
@keyframes fadeToBlack {
    0% { background-color: rgba(0, 0, 0, 0); }
    50% { background-color: rgba(0, 0, 0, 0.7); }
    100% { background-color: rgba(0, 0, 0, 0.9); }
}

@keyframes fadeFromBlack {
    0% { background-color: rgba(0, 0, 0, 0.9); }
    100% { background-color: rgba(0, 0, 0, 0); }
}

.screen-fade-out {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    z-index: 9999;
    pointer-events: none;
    animation: fadeToBlack 0.8s ease-out forwards;
}

.screen-fade-in {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    pointer-events: none;
    animation: fadeFromBlack 0.8s ease-out forwards;
}

/* Screen flash on defeat */
@keyframes defeatFlash {
    0% { background-color: rgba(239, 68, 68, 0); }
    20% { background-color: rgba(239, 68, 68, 0.5); }
    40% { background-color: rgba(239, 68, 68, 0.2); }
    100% { background-color: rgba(239, 68, 68, 0); }
}

.defeat-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    animation: defeatFlash 0.5s ease-out;
}

/* Shake effect specifically for loss */
@keyframes lossShake {
    0% { transform: translate(0, 0); }
    10% { transform: translate(-4px, -2px); }
    20% { transform: translate(4px, -2px); }
    30% { transform: translate(-4px, 2px); }
    40% { transform: translate(4px, 2px); }
    50% { transform: translate(-2px, -1px); }
    60% { transform: translate(2px, -1px); }
    70% { transform: translate(-2px, 1px); }
    80% { transform: translate(2px, 1px); }
    100% { transform: translate(0, 0); }
}

.loss-shake {
    animation: lossShake 0.4s ease-in-out;
}

/* Loss text animation */
@keyframes lossTextPulse {
    0% { transform: scale(1); opacity: 1; text-shadow: 0 0 0px #ef4444; }
    50% { transform: scale(1.3); opacity: 1; text-shadow: 0 0 20px #ef4444; }
    100% { transform: scale(1); opacity: 1; text-shadow: 0 0 0px #ef4444; }
}

.loss-text {
    animation: lossTextPulse 0.5s ease-out;
    color: #ef4444;
    font-weight: bold;
}

/* Defeat overlay notification */
.defeat-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    text-align: center;
    pointer-events: none;
}

.defeat-content {
    background: linear-gradient(135deg, #1a1a2e, #0f172a);
    border: 3px solid #ef4444;
    border-radius: 32px;
    padding: 24px 48px;
    text-align: center;
    color: white;
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.5);
    animation: defeatPopIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes defeatPopIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.defeat-icon {
    font-size: 64px;
    margin-bottom: 12px;
    animation: defeatIconShake 0.5s ease-in-out;
}

@keyframes defeatIconShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    75% { transform: rotate(15deg); }
}

.defeat-title {
    font-size: 28px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 8px;
    color: #ef4444;
}

.defeat-subtitle {
    font-size: 12px;
    opacity: 0.8;
}

/* Healing Center transition effect */
@keyframes healGlow {
    0% { box-shadow: 0 0 0px rgba(34, 197, 94, 0); }
    50% { box-shadow: 0 0 30px rgba(34, 197, 94, 0.5); }
    100% { box-shadow: 0 0 0px rgba(34, 197, 94, 0); }
}

.heal-glow {
    animation: healGlow 0.6s ease-out;
}

/* Player card fainting effect */
@keyframes faintEffect {
    0% { opacity: 1; transform: scale(1); filter: brightness(1); }
    50% { opacity: 0.5; transform: scale(0.95); filter: brightness(0.5); }
    100% { opacity: 0.3; transform: scale(0.9); filter: brightness(0.3); }
}

.fainted-card {
    animation: faintEffect 0.4s ease-out forwards;
}

/* Money loss notification */
.money-loss-notification {
    position: fixed;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 12px 24px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: bold;
    z-index: 10001;
    animation: moneyLossPop 0.3s ease-out, moneyLossFade 0.3s ease-out 2s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

@keyframes moneyLossPop {
    0% {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
    }
    70% {
        transform: translateX(-50%) scale(1.1);
    }
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

@keyframes moneyLossFade {
    to {
        opacity: 0;
        visibility: hidden;
    }
}