/* メインスタイル */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d44 100%);
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
}

/* 画面管理 */
.screen {
    display: none !important;
    height: 100vh;
    overflow: hidden;
}

.screen.active {
    display: flex !important;
    flex-direction: column;
}

/* タイトル画面 */
#title-screen {
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

#title-screen h1 {
    font-size: 2.5em;
    color: #ff6b6b;
    margin-bottom: 30px;
    flex-shrink: 0;
}

.character-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 900px;
    flex: 1;
    justify-content: center;
}

.character-selection h2 {
    margin-bottom: 25px;
    color: #4ecdc4;
    font-size: 1.5em;
    flex-shrink: 0;
}

.characters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 700px;
    flex-shrink: 0;
}

.loading-status {
    position: absolute;
    bottom: 20px;
    color: #888;
    font-size: 0.9em;
}

.character-card {
    background: rgba(0, 0, 0, 0.5);
    padding: 25px;
    border-radius: 10px;
    border: 2px solid #444;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.character-card:hover {
    border-color: #4ecdc4;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(78, 205, 196, 0.3);
}

.character-card h3 {
    color: #4ecdc4;
    margin-bottom: 12px;
    font-size: 1.3em;
}

.character-card p {
    margin: 8px 0;
    font-size: 0.95em;
}

/* マップ画面 */
#map-screen {
    padding: 8px;
    align-items: center;
    justify-content: flex-start;
    overflow: hidden;
}

.map-header {
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    flex-shrink: 0;
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-info {
    display: flex;
    gap: 25px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 1em;
}

.relics-display {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.75em;
}

.relic-item {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.5);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: help;
    white-space: nowrap;
}

.map-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    width: 100%;
    max-width: 1000px;
    flex-shrink: 0;
    padding: 5px 15px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(100vh - 120px);
    flex: 1;
    min-height: 0;
}

.map-floor {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
}

.map-floor-label {
    color: #888;
    font-size: 0.65em;
    font-weight: 400;
    margin-bottom: 1px;
    opacity: 0.6;
    height: 12px;
    line-height: 12px;
}

.map-floor-nodes {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.map-path {
    width: 2px;
    height: 8px;
    background: linear-gradient(to bottom, rgba(78, 205, 196, 0.5), rgba(78, 205, 196, 0.1));
    margin: 2px 0;
    border-radius: 1px;
    box-shadow: 0 0 4px rgba(78, 205, 196, 0.3);
}

.map-node {
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1.5px solid #444;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    font-size: 0.7em;
    font-weight: 500;
    min-width: 50px;
    max-width: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    position: relative;
}

.map-node-icon {
    font-size: 1em;
    line-height: 1;
}

.map-node-text {
    font-size: 0.65em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1;
}

.map-node.current {
    border-color: #fff;
    border-width: 3px;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 0 30px rgba(78, 205, 196, 0.4);
    animation: pulse 2s infinite;
    transform: scale(1.08);
    background: linear-gradient(135deg, rgba(78, 205, 196, 0.2) 0%, rgba(107, 207, 127, 0.2) 100%);
}

.map-node.current:hover {
    transform: scale(1.15);
    border-color: #4ecdc4;
    box-shadow: 0 0 20px rgba(78, 205, 196, 1), 0 0 40px rgba(78, 205, 196, 0.6);
}

.map-node.visited {
    opacity: 0.4;
    cursor: default;
}

.map-node.future {
    opacity: 0.25;
    cursor: not-allowed;
}

.map-node:hover:not(.visited):not(.future) {
    transform: translateY(-2px);
    border-color: #4ecdc4;
    box-shadow: 0 3px 8px rgba(78, 205, 196, 0.4);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    }
    50% {
        box-shadow: 0 0 18px rgba(255, 255, 255, 0.9);
    }
}

/* 戦闘画面 */
#battle-screen {
    height: 100vh;
    padding: 10px;
    overflow: hidden;
}

.battle-header {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(30, 30, 50, 0.7) 100%);
    padding: 12px 18px;
    border-radius: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(78, 205, 196, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.player-stats, .enemy-stats {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.95em;
}

.player-stats > div, .enemy-stats > div {
    white-space: nowrap;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    margin: 2px 0;
}

.player-stats strong, .enemy-stats strong {
    color: #4ecdc4;
    margin-right: 6px;
}

.battle-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 10px;
}

.enemy-display {
    flex: 0 0 auto;
    height: 200px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.5) 0%, rgba(30, 30, 50, 0.5) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px solid rgba(255, 107, 107, 0.3);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    position: relative;
}

.enemy-display::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 107, 107, 0.1) 0%, transparent 70%);
    border-radius: 12px;
    pointer-events: none;
}

.hand {
    flex: 1;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    min-height: 0;
}

.hand::-webkit-scrollbar {
    height: 8px;
}

.hand::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.hand::-webkit-scrollbar-thumb {
    background: #4ecdc4;
    border-radius: 4px;
}

/* カード表示 */
.card {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border: 3px solid #555;
    border-radius: 12px;
    padding: 14px;
    width: 170px;
    min-height: 220px;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4ecdc4, #6bcf7f);
    opacity: 0.6;
}

.card:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 8px 24px rgba(78, 205, 196, 0.5);
    border-color: #4ecdc4;
    z-index: 10;
}

.card[data-card-type="attack"] {
    border-left-color: #ff6b6b;
}

.card[data-card-type="attack"]::before {
    background: linear-gradient(90deg, #ff6b6b, #ff8787);
}

.card[data-card-type="skill"] {
    border-left-color: #4ecdc4;
}

.card[data-card-type="skill"]::before {
    background: linear-gradient(90deg, #4ecdc4, #6bcf7f);
}

.card[data-card-type="power"] {
    border-left-color: #ffd93d;
}

.card[data-card-type="power"]::before {
    background: linear-gradient(90deg, #ffd93d, #ffe066);
}

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

.card-cost {
    background: linear-gradient(135deg, #ffd93d 0%, #ffed4e 100%);
    color: #000;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 50%;
    font-size: 1.3em;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.card-name {
    color: #fff;
    font-weight: bold;
    font-size: 1.15em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 0.5px;
}

.card-description {
    color: #ccc;
    font-size: 0.85em;
    margin-bottom: 8px;
    line-height: 1.3;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.card-damage {
    color: #ff6b6b;
    font-weight: bold;
    margin-top: 5px;
}

.card-block {
    color: #6bcf7f;
    font-weight: bold;
    margin-top: 5px;
}

/* 敵表示の改善 */
.enemy-info {
    text-align: center;
    width: 100%;
}

.enemy-name {
    color: #ff6b6b;
    font-size: 1.8em;
    margin-bottom: 12px;
    text-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
    font-weight: bold;
    letter-spacing: 1px;
}

.enemy-hp {
    font-size: 1.6em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.hp-label {
    color: #ccc;
    font-weight: normal;
}

.hp-current {
    color: #4ecdc4;
    font-weight: bold;
    font-size: 1.2em;
}

.hp-separator {
    color: #888;
}

.hp-max {
    color: #888;
}

.enemy-stat {
    margin: 6px 0;
    font-size: 1.1em;
}

.stat-label {
    color: #ccc;
    margin-right: 6px;
}

.stat-value {
    font-weight: bold;
}

.stat-strength {
    color: #ffd93d;
}

.stat-block {
    color: #6bcf7f;
}

.enemy-status-effects {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.status-effect {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: bold;
    border: 2px solid;
}

.status-weak {
    background: rgba(255, 165, 0, 0.2);
    border-color: rgba(255, 165, 0, 0.6);
    color: #ffa500;
}

.status-vulnerable {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.6);
    color: #ff6b6b;
}

.status-poison {
    background: rgba(138, 43, 226, 0.2);
    border-color: rgba(138, 43, 226, 0.6);
    color: #8a2be2;
}

.battle-controls {
    text-align: center;
    padding: 10px 0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.potions-display {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.potion-item {
    background: rgba(138, 43, 226, 0.3);
    border: 2px solid rgba(138, 43, 226, 0.6);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 100px;
    text-align: center;
}

.potion-item:hover {
    background: rgba(138, 43, 226, 0.5);
    border-color: rgba(138, 43, 226, 0.8);
    transform: translateY(-2px);
}

.potion-item:active {
    transform: translateY(0);
}

.potion-name {
    font-weight: bold;
    font-size: 0.85em;
    color: #e0b0ff;
    margin-bottom: 4px;
}

.potion-description {
    font-size: 0.7em;
    color: #ccc;
    line-height: 1.2;
}

.end-turn-btn {
    padding: 12px 30px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s ease;
}

.end-turn-btn:hover {
    background: #ff5252;
}

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

/* 休憩所画面 */
#rest-screen {
    padding: 30px 20px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#rest-screen h2 {
    margin-bottom: 30px;
    color: #4ecdc4;
    text-align: center;
    flex-shrink: 0;
    font-size: 1.8em;
}

.rest-options {
    display: flex;
    gap: 30px;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.rest-option {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #444;
    border-radius: 10px;
    padding: 30px;
    min-width: 250px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.rest-option:hover {
    border-color: #4ecdc4;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(78, 205, 196, 0.3);
}

.rest-option h3 {
    color: #4ecdc4;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.rest-option p {
    color: #ccc;
    font-size: 0.95em;
}

/* カード選択画面 */
#card-reward-screen {
    padding: 30px 20px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#card-reward-screen h2 {
    margin-bottom: 30px;
    color: #4ecdc4;
    text-align: center;
    flex-shrink: 0;
    font-size: 1.8em;
}

.card-reward-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    max-width: 1000px;
    margin-bottom: 25px;
    flex-shrink: 0;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding: 10px;
}

.card-reward-container::-webkit-scrollbar {
    width: 8px;
}

.card-reward-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.card-reward-container::-webkit-scrollbar-thumb {
    background: #4ecdc4;
    border-radius: 4px;
}

.card-reward-item {
    cursor: pointer;
    flex-shrink: 0;
}

.skip-btn {
    padding: 15px 40px;
    background: #666;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.3s ease;
    font-weight: 500;
}

.skip-btn:hover {
    background: #777;
}

/* ショップ画面 */
#shop-screen {
    padding: 20px;
    overflow-y: auto;
    align-items: center;
    justify-content: flex-start;
}

#shop-screen h2 {
    margin-bottom: 25px;
    color: #4ecdc4;
    text-align: center;
    flex-shrink: 0;
    font-size: 1.8em;
}

.shop-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.shop-section {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    flex-shrink: 0;
}

.shop-section h3 {
    color: #4ecdc4;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.shop-items {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.shop-card-item {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.shop-card-item:hover {
    transform: translateY(-5px);
}

.shop-card-price {
    margin-top: 10px;
    padding: 8px;
    background: rgba(255, 215, 61, 0.2);
    border-radius: 5px;
    text-align: center;
    color: #ffd93d;
    font-size: 0.9em;
}

.leave-btn {
    padding: 15px 40px;
    background: #666;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1em;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.3s ease;
    font-weight: 500;
    margin-top: 20px;
}

.leave-btn:hover {
    background: #777;
}

/* デバッグパネル */
.debug-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.debug-toggle {
    padding: 10px 15px;
    background: #333;
    color: white;
    border: 1px solid #555;
    border-radius: 5px;
    cursor: pointer;
}

.debug-content {
    position: absolute;
    bottom: 40px;
    right: 0;
    width: 400px;
    max-height: 300px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #555;
    border-radius: 5px;
    padding: 10px;
    overflow-y: auto;
    font-size: 0.9em;
}

#debug-log {
    font-family: monospace;
    white-space: pre-wrap;
    word-break: break-all;
}

/* レスポンシブ */
@media (max-width: 768px) {
    #title-screen h1 {
        font-size: 2em;
        margin-bottom: 20px;
    }
    
    .character-selection h2 {
        font-size: 1.2em;
        margin-bottom: 20px;
    }
    
    .characters {
        grid-template-columns: 1fr;
        gap: 15px;
        max-width: 300px;
    }
    
    .character-card {
        padding: 20px;
    }
    
    .battle-header {
        flex-direction: column;
        gap: 8px;
        font-size: 0.9em;
    }
    
    .enemy-display {
        height: 150px;
    }
    
    .card {
        width: 140px;
        padding: 10px;
    }
    
    .card-name {
        font-size: 1em;
    }
    
    .card-description {
        font-size: 0.8em;
    }
    
    .hand {
        gap: 6px;
    }
    
    .debug-content {
        width: 300px;
        max-height: 200px;
    }
    
    #map-screen {
        padding: 15px;
    }
    
    .map-container {
        max-width: 100%;
    }
    
    #card-reward-screen {
        padding: 20px 10px;
    }
    
    .card-reward-container {
        gap: 15px;
        max-height: calc(100vh - 180px);
    }
}

