﻿:root {
    --cor-fundo: #ffede0;
    --cor-laranja: #ff8c42;
    --cor-laranja-escuro: #e07b39;
    --cor-texto: #333;
    --cor-hp: #d9534f;
    --cor-energia: #5bc0de;
    --cor-adrenalina: #f0ad4e;
    --cor-borda: #ccc;
    --cor-defesa: #888;
}

body.theme-coliseu {
    --cor-laranja: #ff8c42;
    --cor-laranja-escuro: #e07b39;
}

body.theme-aquatico {
    --cor-laranja: #1e88e5;
    --cor-laranja-escuro: #1565c0;
}

body.theme-roma {
    --cor-laranja: #9aa0a6;
    --cor-laranja-escuro: #6f757a;
}

body.theme-necropole {
    --cor-laranja: #ff9500;
    --cor-laranja-escuro: #e65c00;
}

body.theme-terra-media {
    --cor-fundo: #e6ecdc;
    --cor-laranja: #7e9f64;
    --cor-laranja-escuro: #4b6a46;
    --cor-texto: #26332a;
    --cor-borda: #8b9b7c;
}

body.theme-faroeste {
    --cor-fundo: #e9dfca;
    --cor-laranja: #b95432;
    --cor-laranja-escuro: #793b30;
    --cor-texto: #203b3d;
    --cor-borda: #9b7856;
}

body.theme-russia {
    --cor-fundo: #dce6f2;
    --cor-laranja: #8b1e3f;
    --cor-laranja-escuro: #5a1228;
    --cor-texto: #1f2a3a;
    --cor-borda: #7a8fa6;
}

body.theme-egito {
    --cor-fundo: #f3e7c9;
    --cor-laranja: #c9a227;
    --cor-laranja-escuro: #8a6f1a;
    --cor-texto: #3b2f1a;
    --cor-borda: #b89b5e;
}

body.theme-selva-tropical {
    --cor-fundo: #d9f0e0;
    --cor-laranja: #2e7d32;
    --cor-laranja-escuro: #1b5e20;
    --cor-texto: #1b3a24;
    --cor-borda: #6fbf73;
}

body.theme-espaco {
    --cor-fundo: #1a1f3a;
    --cor-laranja: #7c4dff;
    --cor-laranja-escuro: #5e35b1;
    --cor-texto: #e6e9ff;
    --cor-borda: #4a5580;
}

body.night-mode {
    --cor-fundo: #211f1f;
    --cor-texto: #e0e0e0;
    --cor-borda: #333;
    background: #000;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    background: linear-gradient(180deg, #ffb74d, #ff9800);
    color: var(--cor-texto);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    transition: background 0.3s, color 0.3s;
}

body.theme-aquatico { background: linear-gradient(180deg, #64b5f6, #1e88e5); }
body.theme-roma { background: linear-gradient(180deg, #f5f5f5, #bdbdbd); }
body.theme-coliseu { background: linear-gradient(180deg, #ffb74d, #ff9800); }
body.theme-necropole { background: linear-gradient(180deg, #ff9500, #7b1fa2 55%, #30223b); }
body.theme-terra-media { background: linear-gradient(160deg, #a5b784 0%, #607c58 42%, #355446 72%, #203a34 100%); }
body.theme-faroeste { background: linear-gradient(165deg, #86a79d 0%, #d5bd85 48%, #b95432 100%); }
body.theme-russia { background: linear-gradient(165deg, #9bb7d4 0%, #5f7ea6 48%, #8b1e3f 100%); }
body.theme-egito { background: linear-gradient(165deg, #f5e6b8 0%, #d9bf7a 48%, #c9a227 100%); }
body.theme-selva-tropical { background: linear-gradient(165deg, #b7e4c7 0%, #52b788 48%, #2d6a4f 100%); }
body.theme-espaco { background: linear-gradient(165deg, #0b1026 0%, #1a237e 48%, #4a148c 100%); }
body.night-mode { background: #000; }

.game-container {
    width: 100%;
    max-width: 480px;
    background-color: var(--cor-fundo);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 95vh;
    max-height: 95vh;
    transition: background-color 0.3s;
}

.layout-switch { display: flex; justify-content: center; gap: 4px; padding: 8px; }
.layout-option { border: 1px solid var(--cor-borda); border-radius: 6px; padding: 6px 12px; color: var(--cor-texto); background: transparent; cursor: pointer; }
.layout-option[aria-pressed="true"] { background: var(--cor-laranja-escuro); color: white; }
body.pc-mode .game-container { max-width: min(1200px, 96vw); }

.screen {
    padding: 20px;
    box-sizing: border-box;
    display: none !important;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}
.screen.active { display: flex !important; }

h1, h2, h3 { color: var(--cor-laranja-escuro); margin-top: 0; }

#start-screen { justify-content: center; }
.game-title { font-size: 2.5em; font-weight: bold; margin-bottom: 20px; }

.btn {
    background-color: var(--cor-laranja); color: white; border: none;
    padding: 15px 30px; border-radius: 8px; font-size: 1.2em;
    cursor: pointer; margin: 5px; transition: 0.2s; min-width: 200px;
}
.btn:hover { background-color: var(--cor-laranja-escuro); }
.btn:active { transform: scale(0.98); }
.btn:disabled { background-color: #888; cursor: not-allowed; }

.btn-delete { background-color: #a9a9a9; }
.btn-delete:hover { background-color: #8b8b8b; }
.btn-night { background-color: #333; }

.history-panel, .achievements-panel {
    width: 90%; background: rgba(0,0,0,0.1); border-radius: 8px;
    padding: 10px; margin-top: 15px; text-align: left; max-height: 150px; overflow-y: auto;
    font-size: 0.9em;
}

.input-group { margin: 10px 0; width: 100%; }
.input-group select { width: 85%; padding: 10px; font-size: 1.1em; }
input[type="text"] { width: 80%; padding: 10px; font-size: 1.1em; border-radius: 5px; border: 1px solid var(--cor-borda); }
.emoji-selector { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.avatar-group, .achievement-group { padding-top: 8px; border-top: 1px solid rgba(0,0,0,0.16); }
.avatar-group:first-child, .achievement-group:first-child { padding-top: 0; border-top: 0; }
.avatar-group h4, .achievement-group h4 { margin: 0 0 6px; color: var(--cor-laranja-escuro); font-size: 0.82em; text-transform: uppercase; }
.avatar-group-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.emoji-btn { font-size: 2em; padding: 5px; border: 2px solid transparent; border-radius: 50%; cursor: pointer; background: none; }
.emoji-btn.selected { border-color: var(--cor-laranja); background-color: rgba(255,140,66,0.2); }
.emoji-btn.world-clear-avatar, .emoji-btn.world-clear-avatar.selected { border-color: #d4aa32; box-shadow: 0 0 8px rgba(212,170,50,0.45); }
.emoji-btn.locked, .emoji-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.6); }
.achievement-entry.world-clear-achievement { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 5px 0; padding: 6px 8px; border: 1px solid rgba(212,170,50,0.55); border-radius: 6px; background: linear-gradient(110deg, rgba(212,170,50,0.14), rgba(255,255,255,0.08)); }
.achievement-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.achievement-group .achievement-entry { margin: 3px 0; }
.world-clear-title::before, .world-clear-title::after { content: '✦'; color: #b8860b; font-size: 0.78em; }
.world-clear-icon { display: inline-grid; place-items: center; width: 1.65em; height: 1.65em; border: 1px solid #d4aa32; border-radius: 50%; background: rgba(212,170,50,0.12); }
.enemy-skill { font-size: 0.9em; font-weight: bold; color: var(--cor-laranja-escuro); margin: 4px 0; }
.enemy-attack-mode { display: inline-block; margin: 4px 0; padding: 3px 8px; border: 1px solid var(--cor-borda); border-radius: 5px; font-size: 0.78em; font-weight: 800; cursor: help; }
.enemy-attack-mode:focus-visible { outline: 2px solid var(--cor-laranja-escuro); outline-offset: 2px; }
.enemy-category { display: inline-block; padding: 3px 8px; margin-bottom: 4px; border-radius: 4px; font-size: 0.72em; font-weight: 800; }
.enemy-category-normal { color: #174b35; background: #d7f0df; }
.enemy-category-elite { color: #681d1d; background: #f7d8d5; }
.enemy-category-boss { color: #503b08; background: #f4e3a9; }
.toast { position: fixed; top: 16px; right: 16px; background: rgba(0,0,0,0.85); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 9999; font-size: 0.95em; opacity: 1; transition: opacity 0.3s ease; max-width: 280px; }
.toast-hide { opacity: 0; }
.toast-hide { opacity: 0; }

.battle-area { width: 100%; display: flex; flex-direction: column; justify-content: space-between; flex-grow: 1; }
.character-display { border: 2px solid var(--cor-borda); border-radius: 10px; padding: 10px; margin: 5px auto; background-color: rgba(255,255,255,0.1); width: 90%; position: relative; }
.character-name { font-weight: bold; font-size: 1.2em; margin-bottom: 5px; }
.character-art { font-size: 4.5em; margin: 5px 0; line-height: 1; transition: transform 0.1s; }
.hit-anim { transform: scale(1.2) rotate(5deg); color: red; }

.stat-bars { width: 100%; }
.stat-bar { width: 100%; background-color: rgba(0,0,0,0.2); border-radius: 20px; margin: 5px 0; position: relative; height: 25px; overflow: hidden; border: 1px solid var(--cor-borda); }
.stat-bar > div { height: 100%; border-radius: 20px; transition: width 0.1s linear; text-align: right; padding-right: 5px; color: white; font-weight: bold; font-size: 0.9em; line-height: 25px; text-shadow: 1px 1px 2px rgba(0,0,0,0.5); }
.bar-label { position: absolute; left: 10px; top: 0; line-height: 25px; color: var(--cor-texto); font-weight: bold; font-size: 0.9em; z-index: 2; }

#hp-bar-fill, #enemy-hp-bar-fill { background-color: var(--cor-hp); }
#energy-bar-fill { background-color: var(--cor-energia); }
#adrenaline-bar-fill { background-color: var(--cor-adrenalina); }

.status-effects { display: flex; justify-content: center; gap: 5px; height: 20px; margin-top: 5px; font-size: 0.9em; color: red; font-weight: bold; }
.defending { border-color: var(--cor-defesa) !important; box-shadow: 0 0 10px var(--cor-defesa); }

.action-panel { margin-top: 10px; width: 100%; }
.action-buttons { display: flex; justify-content: space-around; gap: 10px; }
.action-buttons .btn { flex-grow: 1; padding: 15px; font-weight: bold; }

.consumable-slots { display: flex; justify-content: center; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.slot { width: 45px; height: 45px; border: 2px dashed var(--cor-borda); border-radius: 8px; display: flex; justify-content: center; align-items: center; font-size: 1.5em; cursor: pointer; background-color: rgba(255,255,255,0.1); position: relative; }
.slot:hover { border-color: var(--cor-laranja-escuro); }

.log-message { margin-top: 5px; font-style: italic; font-size: 0.9em; height: 1.2em; color: var(--cor-texto); font-weight: bold; }

.money-display { font-size: 1.5em; font-weight: bold; color: #e69100; margin-bottom: 15px; }
.shop-category { width: 100%; margin-bottom: 15px; border: 1px solid var(--cor-borda); border-radius: 8px; padding: 10px; box-sizing: border-box; }
.shop-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,0.1); text-align: left; }
.shop-item-info { width: 70%; }
.item-name { font-size: 1.1em; font-weight: bold; }
.item-desc { font-size: 0.8em; opacity: 0.8; }
.btn-buy { padding: 8px; font-size: 0.9em; min-width: 80px; margin: 0; }
.currency-exchange { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; margin: -6px 0 10px; font-size: 0.9em; }
.combo-limit-note { margin: 0 0 10px; font-size: 0.85em; }
.combo-offer .item-desc { line-height: 1.4; }

#game-over-screen h1 { color: var(--cor-hp); }
.stats-summary { text-align: left; margin: 20px 0; background: rgba(0,0,0,0.1); padding: 15px; border-radius: 10px; }

.card-hand { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; }
.battle-card { position: relative; min-height: 110px; padding: 8px; border: 2px solid var(--cor-borda); border-radius: 8px; background: rgba(255,255,255,0.7); color: var(--cor-texto); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.battle-card:disabled { opacity: 0.55; cursor: not-allowed; }
.battle-card.rarity-normal, .shop-card-preview.rarity-normal { border-color: #a65f3e; }
.battle-card.rarity-rare, .shop-card-preview.rarity-rare { border-color: #c6ccd2; box-shadow: inset 0 0 0 1px #edf0f2; }
.battle-card.rarity-gold, .shop-card-preview.rarity-gold { border: 2px solid #d4aa32; box-shadow: inset 0 0 0 1px #f4df9b, 0 0 9px rgba(212,170,50,0.35); }
.card-badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 3px; }
.card-badge { padding: 2px 5px; border-radius: 4px; font-size: 0.62em; font-weight: 800; line-height: 1.2; }
.card-badge-attack { background: #f6d6d1; color: #7d2721; }
.card-badge-defense { background: #d9e8ef; color: #174d63; }
.card-badge-strategy, .card-badge-preparation { background: #f2e6c6; color: #664911; }
.card-badge-recovery { background: #dcebd8; color: #2e5a36; }
.card-badge-combination { background: #e4e6dc; color: #3d4c35; }
.card-badge-magic { background: #dce5ee; color: #2c435a; }
.card-badge-class, .card-badge-universal { background: rgba(0,0,0,0.1); color: var(--cor-texto); }
.card-symbol { font-size: 1.5em; }
.card-cost { font-weight: bold; }
.shop-card-preview { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 76px; padding: 6px; border: 2px solid var(--cor-borda); border-radius: 6px; }
.passive-tooltip { cursor: help; border-bottom: 1px dotted currentColor; }
.path-choices { display: grid; grid-template-columns: 1fr; gap: 10px; width: 100%; }
.path-choice { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; box-sizing: border-box; }
.path-choice small { line-height: 1.4; }
.first-run-guide { width: 100%; box-sizing: border-box; margin: 10px 0; padding: 12px; border: 1px solid var(--cor-borda); border-left: 4px solid var(--cor-laranja-escuro); border-radius: 6px; text-align: left; background: rgba(255,255,255,0.55); }
.first-run-guide[hidden] { display: none; }
.first-run-guide h3 { margin: 0 0 6px; font-size: 1em; }
.first-run-guide p { margin: 6px 0; line-height: 1.4; }
.room-trail { display: block; width: 100%; margin: 8px 0; }
.trail-rooms { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px; }
.trail-node { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 0.75em; min-width: 28px; }
.empty-card { opacity: 0.5; }
#enemy-intent, #enemy-weaknesses, #player-shield, #enemy-shield, #active-passives, #deck-count, #combo-status { margin: 4px 0; font-size: 0.9em; }
#combo-status { font-weight: 700; color: var(--cor-laranja-escuro); }
.double-attack-intent { color: #a12616; font-weight: 800; animation: intent-strike 0.7s ease-in-out infinite alternate; }

@keyframes player-strike { 0%, 100% { transform: translateX(0); } 45% { transform: translateX(12px) scale(1.04); } }
@keyframes special-strike { 0%, 100% { transform: translateX(0) scale(1); } 35% { transform: translateX(16px) scale(1.1); filter: brightness(1.5); } 65% { transform: translateX(-3px) scale(0.98); } }
@keyframes damage-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }
@keyframes double-windup { 0%, 100% { filter: none; } 50% { filter: drop-shadow(0 0 12px #fa4b32); transform: scale(1.04); } }
@keyframes intent-strike { to { text-shadow: 0 0 8px #f0ad4e; } }
.player-attack { animation: player-strike 0.35s ease-out; }
.special-attack { animation: special-strike 0.5s ease-out; }
.damage-flash { animation: damage-shake 0.3s ease-in-out; }
.double-attack-windup { animation: double-windup 0.65s ease-in-out; }
.combat-effect.special-attack { color: #b51e12; font-weight: 900; }

@media (min-width: 700px) {
    .path-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .card-hand { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    body.pc-mode #battle-screen .battle-area { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "enemy player" "log log" "actions actions"; align-items: start; gap: 12px; }
    body.pc-mode #enemy-display { grid-area: enemy; }
    body.pc-mode #player-display { grid-area: player; }
    body.pc-mode #log-message { grid-area: log; }
    body.pc-mode #battle-screen .action-panel { grid-area: actions; }
}
@media (max-width: 480px) {
    .room-trail { width: min(100%, 340px); margin: 8px auto; }
    .trail-rooms { gap: 2px; }
    .trail-rooms .trail-node { flex: 0 0 24px; min-width: 24px; }
}
.shop-tabs { display: flex; gap: 6px; margin: 8px 0; }
.shop-tab { flex: 1; padding: 8px; border: 1px solid var(--cor-borda); border-radius: 6px; background: transparent; color: var(--cor-texto); cursor: pointer; }
.shop-tab.active { background: var(--cor-laranja-escuro); color: #fff; }
.shop-reroll-row { display: flex; gap: 6px; margin: 8px 0; flex-wrap: wrap; justify-content: center; }
.btn-small { min-width: auto; padding: 8px 12px; font-size: 0.9em; }
.music-controls { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 10px; font-size: 0.9em; }
.music-controls input { width: min(180px, 42vw); accent-color: var(--cor-laranja-escuro); }
.shop-tab:active, .shop-tab:focus { background: var(--cor-laranja); color: #fff; }
.btn-buy:active, .btn-buy:focus { background-color: var(--cor-laranja-escuro); color: #fff; }
.btn-small:active, .btn-small:focus { background-color: var(--cor-laranja-escuro); color: #fff; }
#active-passives { font-size: 0.85em; padding: 4px 6px; background: rgba(0,0,0,0.08); border-radius: 6px; }
.debuff-icon { display: inline-flex; align-items: center; gap: 2px; padding: 2px 6px; border-radius: 10px; background: rgba(0,0,0,0.15); font-size: 0.85em; font-weight: bold; }
.btn { box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(0,0,0,0.25); }
.character-display { transition: box-shadow 0.2s, transform 0.2s; }
.inventory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; width: 100%; margin: 10px 0; }
.inventory-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border: 2px solid var(--cor-borda); border-radius: 8px; background: var(--cor-fundo); }
.inventory-qty { font-weight: bold; font-size: 0.9em; }
.passive-tooltip { cursor: help; }
/* Contraste no modo noturno: caixas claras com texto escuro -> fundo escuro + texto claro */
body.night-mode .battle-card,
body.night-mode input[type="text"],
body.night-mode .input-group select,
body.night-mode .first-run-guide,
body.night-mode .stats-summary {
    background: #2a2a2a;
    color: #e0e0e0;
    border-color: #555;
}
body.night-mode input[type="text"]::placeholder {
    color: #aaa;
}
body.night-mode .battle-card .card-cost,
body.night-mode .battle-card span,
body.night-mode .battle-card strong {
    color: #e0e0e0;
}

.ui-emoji-image, .card-image, .passive-image, .skill-image, .monster-image, .achievement-image, .avatar-achievement-image { width: 1em; height: 1em; object-fit: contain; vertical-align: -0.15em; display: inline-block; image-rendering: crisp-edges; image-rendering: pixelated; }
.ui-emoji-image.inline { margin: 0 0.05em; }
.character-art .avatar-achievement-image { width: 1.5em; height: 1.5em; vertical-align: middle; }
.character-art .monster-image { width: 1.5em; height: 1.5em; vertical-align: middle; }
#player-art .ui-emoji-image, #enemy-art .ui-emoji-image { width: 1.4em; height: 1.4em; }
.card-symbol .card-image, .shop-card-preview .card-image { width: 1.8em; height: 1.8em; }
.passive-image { width: 1.2em; height: 1.2em; vertical-align: -0.2em; margin-right: 2px; }
.skill-image { width: 1.1em; height: 1.1em; vertical-align: -0.15em; margin-right: 2px; }
.achievement-icon .ui-emoji-image, .emoji-btn .ui-emoji-image, .achievement-icon .achievement-image, .emoji-btn .avatar-achievement-image { width: 1.35em; height: 1.35em; object-fit: contain; display: inline-block; vertical-align: middle; }
.achievement-image, .avatar-achievement-image { image-rendering: crisp-edges; image-rendering: pixelated; }
.hp-label .ui-emoji-image, .hp-label img { width: 1.1em; height: 1.1em; vertical-align: -0.15em; }
.bar-label.hp-label { display: inline-flex; align-items: center; }
.enemy-skill .skill-image, .enemy-skill .ui-emoji-image { width: 1.15em; height: 1.15em; vertical-align: -0.2em; margin-right: 2px; }
.enemy-skill .skill-name { vertical-align: middle; }
.enemy-skill small { opacity: 0.85; font-size: 0.9em; }
.path-icon .ui-emoji-image, .trail-node .ui-emoji-image { width: 1.1em; height: 1.1em; }
#currency-display .ui-emoji-image, .money-display .ui-emoji-image { width: 1.15em; height: 1.15em; }
.enemy-weakness-marker .ui-emoji-image, .debuff-icon .ui-emoji-image, #enemy-shield .ui-emoji-image, #player-shield .ui-emoji-image, #enemy-status .ui-emoji-image, #player-status .ui-emoji-image, #enemy-intent .ui-emoji-image { width: 1em; height: 1em; }
