* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a2a6c;
    --secondary: #b21f1f;
    --accent: #fdbb2d;
    --gold: #ffd700;
    --trmp-coin: #ff6b35;
    --tier-1: #4a6572;
    --tier-2: #ff8a00;
    --tier-3: #e53935;
    --success: #28a745;
    --danger: #dc3545;
    --dark-bg: #0f1419;
    --card-bg: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);
    --bg-color: rgba(0, 0, 0, 0.5);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --error: #dc3545;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary), var(--secondary), var(--accent));
    color: white;
    width: 100vw;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px 0;
}

.container {
    width: 95vw;
    max-width: 500px;
    background: rgba(15, 20, 25, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--accent);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Header */
.header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.player-info {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.resource {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    border: 2px solid;
    font-weight: bold;
    font-size: 0.8rem;
}

.gold-resource {
    border-color: var(--gold);
    color: var(--gold);
}

.trmp-resource {
    border-color: var(--trmp-coin);
    color: var(--trmp-coin);
}

.player-id {
    opacity: 0.8;
    font-size: 0.7rem;
}

/* Battle Progression */
.battle-progression {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
}

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

.progression-title {
    font-size: 1rem;
    color: var(--accent);
    font-weight: 700;
}

.progression-stats {
    font-size: 0.8rem;
    opacity: 0.8;
}

.progression-bar-container {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
}

.progression-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--secondary));
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
}

.progression-milestones {
    display: flex;
    justify-content: space-between;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.milestone {
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
}

.milestone.active {
    background: var(--gold);
}

.progression-phases {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    opacity: 0.8;
}

.phase {
    text-align: center;
    flex: 1;
}

.phase.active {
    color: var(--accent);
    font-weight: bold;
}

.current-floor {
    text-align: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--gold);
    margin-top: 5px;
}

/* Main Game Area - PORTRAIT LAYOUT */
.main-game {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0;
}

/* Shop Section - 3 COLUMNS */
.shop-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    font-size: 1.1rem;
    color: var(--accent);
    font-weight: 700;
}

.section-icon {
    font-size: 1rem;
}

.shop-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    overflow-y: auto;
    padding: 3px;
}

/* Champion Cards */
.champion-card {
    background: linear-gradient(135deg, var(--tier-1), #2c3e50);
    border-radius: 10px;
    padding: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    min-height: 140px;
    display: flex;
    flex-direction: column;
}

.champion-card.tier-2 {
    background: linear-gradient(135deg, var(--tier-2), #e65100);
}

.champion-card.tier-3 {
    background: linear-gradient(135deg, var(--tier-3), #b71c1c);
}

.champion-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    border-color: var(--accent);
}

.champion-image {
    width: 100%;
    height: 50px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    overflow: hidden;
    position: relative;
}

.champion-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-image-btn {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.champion-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.champion-tier {
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 600;
}

.champion-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 5px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 800;
}

.stat.attack .stat-value {
    color: #ff6b6b;
}

.stat.hp .stat-value {
    color: #51cf66;
}

.stat-label {
    font-size: 0.55rem;
    opacity: 0.8;
    text-transform: uppercase;
}

.stars {
    text-align: center;
    margin: 4px 0;
    font-size: 0.7rem;
    color: var(--gold);
}

.cost {
    background: var(--gold);
    color: #000;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.65rem;
    text-align: center;
    margin-top: auto;
}

.action-text {
    font-size: 0.55rem;
    opacity: 0.7;
    text-align: center;
    margin-top: 3px;
}

/* Inventory Section */
.inventory-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.inventory-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    overflow-y: auto;
    padding: 3px;
}

/* Smaller inventory cards */
.inventory-card {
    background: linear-gradient(135deg, var(--tier-1), #2c3e50);
    border-radius: 8px;
    padding: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    min-height: 80px;
    display: flex;
    flex-direction: column;
}

.inventory-card.tier-2 {
    background: linear-gradient(135deg, var(--tier-2), #e65100);
}

.inventory-card.tier-3 {
    background: linear-gradient(135deg, var(--tier-3), #b71c1c);
}

.inventory-image {
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    overflow: hidden;
}

.inventory-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.inventory-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
}

.inventory-stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.6rem;
    margin-bottom: 3px;
}

/* Items Section */
.items-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.items-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    max-height: 120px;
    overflow-y: auto;
    padding: 3px;
}

.item-card {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    font-size: 0.7rem;
}

.item-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}

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

.item-name {
    font-weight: bold;
    font-size: 10px;
    margin-bottom: 2px;
}

.item-effect {
    font-size: 9px;
    color: var(--text-secondary);
}

/* Battle Section - 5 COLUMNS 1 ROW */
.battle-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.battle-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: 1fr;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 8px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    min-height: 80px;
    max-height: 100px;
    overflow: hidden;
}

.board-slot {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.6rem;
    min-height: 60px;
    position: relative;
    padding: 4px;
}

.board-slot:hover {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.15);
}

.board-slot.empty::before {
    content: '➕';
    font-size: 1rem;
    opacity: 0.5;
}

.board-slot.has-champion {
    padding: 3px;
}

.board-champion {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    text-align: center;
}

.board-champion-image {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    margin-bottom: 2px;
}

.sell-price {
    font-size: 0.5rem;
    color: var(--gold);
    margin: 2px 0;
}

.board-actions {
    display: flex;
    gap: 3px;
    justify-content: center;
    margin-top: 3px;
}

.remove-champion,
.sell-champion {
    padding: 2px 4px;
    font-size: 0.5rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 20px;
}

.remove-champion {
    background: var(--accent);
    color: white;
}

.remove-champion:hover {
    background: #45a049;
}

.sell-champion {
    background: var(--gold);
    color: black;
}

.sell-champion:hover {
    background: #d4af37;
}

/* Controls */
.controls {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.btn {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn.trmp {
    background: linear-gradient(135deg, var(--trmp-coin), #ff8a5c);
    color: #000;
}

.btn.fight {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
}

.btn.danger {
    background: var(--error);
}

.btn.danger:hover {
    background: #d32f2f;
}

/* Show New Game button */
#startGame {
    display: block !important;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(135deg, var(--primary), var(--dark-bg));
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    max-width: 350px;
    width: 90%;
    border: 3px solid var(--accent);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
}

.modal h3 {
    color: var(--accent);
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.modal p {
    margin-bottom: 12px;
    line-height: 1.4;
    font-size: 0.8rem;
}

.wallet-input {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--trmp-coin);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    margin-bottom: 12px;
    font-size: 0.8rem;
}

.modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Items Modal */
.available-items {
    margin-bottom: 15px;
}

.item-selectable {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 10px;
    border: 2px solid transparent;
    cursor: pointer;
}

.item-selectable.selected {
    border-color: var(--accent);
}

.champions-list {
    max-height: 200px;
    overflow-y: auto;
}

.champion-selectable {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 5px;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.champion-selectable.selected {
    border-color: var(--accent);
}

.champion-selectable .champion-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

/* New Game Modal */
.reset-list {
    text-align: left;
    margin: 15px 0;
    padding-left: 20px;
}

.reset-list li {
    margin: 8px 0;
    font-size: 14px;
}

/* Transaction Notification */
.transaction-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: none;
    animation: slideDown 0.3s ease;
    max-width: 300px;
    text-align: center;
}

.transaction-notification.success {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.1);
}

.transaction-notification.error {
    border-color: var(--error);
    background: rgba(244, 67, 54, 0.1);
}

.transaction-notification.info {
    border-color: var(--accent);
    background: rgba(33, 150, 243, 0.1);
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

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

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

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Loading & Empty States */
.loading {
    text-align: center;
    padding: 15px;
    grid-column: 1 / -1;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid var(--accent);
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto 8px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 15px;
    opacity: 0.7;
    grid-column: 1 / -1;
}

.empty-state .icon {
    font-size: 1.5rem;
    margin-bottom: 6px;
    opacity: 0.5;
}

/* Fight Animation */
.fight-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.fight-text {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.7;
    }
}

/* Image Upload */
.image-upload-input {
    display: none;
}

/* Battle Modal Styles */
.battle-modal .modal-content {
    width: 90%;
    max-width: 600px;
    text-align: center;
    position: relative;
}

.battle-field {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
}

.player-board,
.enemy-board {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.battle-unit {
    width: 60px;
    height: 80px;
    border: 2px solid var(--accent);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 5px;
    position: relative;
    font-size: 14px;
}

.battle-unit .health-bar {
    width: 100%;
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
}

.battle-unit .health-bar-inner {
    height: 100%;
    background: red;
    width: 100%;
    transition: width 0.3s;
}

.battle-log {
    max-height: 120px;
    overflow-y: auto;
    background: #f9f9f9;
    padding: 5px;
    margin-top: 10px;
    border-radius: 5px;
    font-size: 12px;
    text-align: left;
}

/* Mobile Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 10px;
        width: 98vw;
    }

    /* Shop - Keep 3 columns but make them smaller */
    .shop-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }

    .champion-card {
        min-height: 120px;
        padding: 6px;
    }

    .champion-image {
        height: 40px;
    }

    .champion-name {
        font-size: 0.7rem;
    }

    .stat-value {
        font-size: 0.8rem;
    }

    /* Battle Board - Keep 5 columns but make them fit */
    .battle-board {
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: 1fr;
        gap: 4px;
        padding: 6px;
        min-height: 70px;
        max-height: 80px;
    }

    .board-slot {
        min-height: 50px;
        font-size: 0.5rem;
    }

    .board-champion {
        font-size: 0.5rem;
    }

    .board-champion-image {
        width: 16px;
        height: 16px;
        font-size: 0.6rem;
    }

    .sell-price {
        font-size: 0.45rem;
    }

    .board-actions {
        gap: 2px;
    }

    .remove-champion,
    .sell-champion {
        padding: 1px 3px;
        font-size: 0.45rem;
        min-width: 18px;
    }

    .controls {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .items-container {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 6px;
    }

    .transaction-notification {
        left: 10px;
        right: 10px;
        transform: none;
        max-width: none;
    }
}

/* Very Small Screens */
@media (max-width: 320px) {
    .shop-cards {
        gap: 4px;
    }

    .champion-card {
        min-height: 110px;
        padding: 4px;
    }

    .champion-image {
        height: 35px;
    }

    .battle-board {
        min-height: 65px;
        max-height: 75px;
    }

    .board-slot {
        min-height: 45px;
    }
}

/* Prevent horizontal scrolling */
body {
    overflow-x: hidden;
    max-width: 100vw;
}

.container {
    max-width: 100vw;
    overflow-x: hidden;
}
/* Fuel System Styles - Genshin Style */
.fuel-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 12px;
    border-radius: 15px;
    border: 2px solid #00b4d8;
    margin-top: 5px;
}

.fuel-label {
    font-size: 0.7rem;
    font-weight: bold;
    color: #00b4d8;
}

.fuel-container {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fuel-icon {
    font-size: 1rem;
    transition: all 0.3s ease;
}

.fuel-icon.active {
    color: #00b4d8;
    text-shadow: 0 0 8px rgba(0, 180, 216, 0.7);
}

.fuel-icon.empty {
    color: rgba(255, 255, 255, 0.3);
}

.fuel-next-recharge {
    font-size: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 6px;
}

/* Fuel Refresh Modal */
.fuel-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 8px;
    margin: 10px 0;
    text-align: center;
}

.fuel-info div {
    margin: 5px 0;
    font-size: 0.9rem;
}

/* Mobile Responsive for Fuel */
@media (max-width: 480px) {
    .fuel-display {
        flex-direction: column;
        gap: 4px;
        padding: 6px 8px;
    }

    .fuel-container {
        gap: 3px;
    }

    .fuel-icon {
        font-size: 0.9rem;
    }

    .fuel-next-recharge {
        font-size: 0.45rem;
        margin-left: 4px;
    }
}