@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

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

body {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    color: #e0e6ed;
    font-family: 'Orbitron', monospace;
    overflow: hidden;
    height: 100vh;
}

/* ヘッダーとコントロール */
.game-header {
    background: linear-gradient(90deg, #2d3561 0%, #1e2749 100%);
    padding: 8px 20px;
    border-bottom: 2px solid #00d4ff;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-title {
    font-size: 18px;
    font-weight: 900;
    background: linear-gradient(45deg, #00d4ff, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.currency-display-game {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 15px;
    padding: 5px 10px;
}

.currency-label {
    font-size: 14px;
    font-weight: 700;
}

.currency-amount {
    font-size: 14px;
    font-weight: 900;
    color: #00d4ff;
    min-width: 40px;
}

.speed-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.speed-btn {
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.5);
    color: #e0e6ed;
    padding: 4px 8px;
    border-radius: 5px;
    font-family: 'Orbitron', monospace;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.speed-btn.active,
.speed-btn:hover {
    background: rgba(0, 212, 255, 0.5);
    border-color: #00d4ff;
    color: #ffffff;
}

/* Music Controls */
.music-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.volume-slider {
    width: 60px;
    height: 4px;
    background: rgba(0, 212, 255, 0.3);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 12px;
    height: 12px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: #00d4ff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
}

.btn-small {
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 600;
}

/* ゲーム画面のレイアウト */
#gameScreen {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.game-content {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

/* ゲームコンテナ */
#gameContainer {
    position: relative;
    flex: 1;
    background: linear-gradient(45deg, #1a1a2e, #16213e);
    border: 3px solid #00d4ff;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
    overflow: hidden;
    min-width: 800px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    background: linear-gradient(135deg, #0d2946 0%, #1e3c72 100%);
}

/* アクティブアイテム表示 */
.active-items {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 200px;
}

.active-item {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #00d4ff;
    border-radius: 8px;
    padding: 8px;
    font-size: 10px;
    color: #e0e6ed;
    display: flex;
    align-items: center;
    gap: 8px;
}

.active-item-icon {
    font-size: 16px;
}

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

.active-item-timer {
    color: #00d4ff;
    font-weight: 700;
}

/* UI パネル */
.ui-panel {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: linear-gradient(135deg, #1e2749 0%, #2d3561 100%);
    border: 2px solid #00d4ff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
}

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

.memory-stat {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(255, 107, 107, 0.1) 100%);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.memory-stat:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    border-color: #00d4ff;
}

.memory-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.love { background: radial-gradient(circle, #ff69b4, #ff1493); }
.knowledge { background: radial-gradient(circle, #4169e1, #0000cd); }
.adventure { background: radial-gradient(circle, #ff8c00, #ff6347); }
.peace { background: radial-gradient(circle, #98fb98, #00ff7f); }
.nostalgia { background: radial-gradient(circle, #dda0dd, #9370db); }
.courage { background: radial-gradient(circle, #dc143c, #b22222); }

.stat-label {
    font-size: 10px;
    font-weight: 700;
    color: #a0a8b0;
}

.stat-value {
    font-size: 14px;
    font-weight: 900;
    color: #00d4ff;
}

.game-stats {
    display: flex;
    justify-content: space-between;
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.1), rgba(255, 107, 107, 0.1));
    border: 1px solid rgba(0, 212, 255, 0.5);
    border-radius: 10px;
    padding: 15px;
    margin-top: 10px;
}

.game-stats > div {
    text-align: center;
    flex: 1;
}

/* オーバーレイ共通スタイル */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.menu-panel {
    background: linear-gradient(135deg, #1e2749 0%, #2d3561 100%);
    border: 3px solid #00d4ff;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 212, 255, 0.5);
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.menu-title {
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(45deg, #00d4ff, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.menu-subtitle {
    font-size: 14px;
    color: #a0a8b0;
    margin-bottom: 30px;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ログインフォーム */
.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #e0e6ed;
    font-size: 12px;
    font-weight: 700;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    background: rgba(0, 212, 255, 0.1);
    color: #e0e6ed;
    font-family: 'Orbitron', monospace;
    font-size: 12px;
}

.form-group input:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.feature-info {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 10px;
    text-align: center;
}

.feature-info h3 {
    color: #00d4ff;
    margin-bottom: 15px;
    font-size: 16px;
}

.feature-info ul {
    list-style: none;
    margin-bottom: 15px;
}

.feature-info li {
    padding: 5px 0;
    font-size: 12px;
}

.guest-note {
    font-size: 10px;
    color: #ff6b6b;
    font-style: italic;
}

/* ボタンスタイル */
.btn {
    background: linear-gradient(45deg, #00d4ff, #0099cc);
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    font-family: 'Orbitron', monospace;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
    font-size: 12px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.5);
    background: linear-gradient(45deg, #00e6ff, #00aadd);
}

.btn-secondary {
    background: linear-gradient(45deg, #ff6b6b, #ee5a5a);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(45deg, #ff7d7d, #ff5252);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.btn-guest {
    background: linear-gradient(45deg, #9370db, #8a2be2);
    box-shadow: 0 4px 15px rgba(147, 112, 219, 0.3);
}

.btn-guest:hover {
    background: linear-gradient(45deg, #a080e0, #9932cc);
    box-shadow: 0 6px 20px rgba(147, 112, 219, 0.5);
}

.btn-shop {
    background: linear-gradient(45deg, #ffd700, #ffb347);
    color: #333;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-shop:hover {
    background: linear-gradient(45deg, #ffe135, #ffc266);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.btn-ranking {
    background: linear-gradient(45deg, #32cd32, #228b22);
    box-shadow: 0 4px 15px rgba(50, 205, 50, 0.3);
}

.btn-ranking:hover {
    background: linear-gradient(45deg, #40e040, #2e8b2e);
    box-shadow: 0 6px 20px rgba(50, 205, 50, 0.5);
}

.btn-logout {
    background: linear-gradient(45deg, #dc143c, #b22222);
    box-shadow: 0 4px 15px rgba(220, 20, 60, 0.3);
}

.btn-logout:hover {
    background: linear-gradient(45deg, #e63946, #c42e3a);
    box-shadow: 0 6px 20px rgba(220, 20, 60, 0.5);
}

/* ショップスタイル */
.shop-panel {
    background: linear-gradient(135deg, #1e2749 0%, #2d3561 100%);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.5);
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.shop-title {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(45deg, #ffd700, #ffb347);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

.currency-display {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.5);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.shop-categories {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.shop-category h3 {
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 18px;
}

.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.shop-item {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
}

.shop-item:hover {
    transform: translateY(-2px);
    border-color: #ffd700;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.shop-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.item-icon {
    font-size: 24px;
    width: 40px;
    text-align: center;
}

.item-info {
    flex: 1;
}

.item-info h4 {
    color: #e0e6ed;
    margin-bottom: 5px;
    font-size: 14px;
}

.item-info p {
    color: #a0a8b0;
    font-size: 12px;
    margin-bottom: 8px;
}

.item-price {
    color: #ffd700;
    font-weight: 700;
    font-size: 12px;
}

.shop-actions {
    margin-top: 20px;
}

/* ランキングスタイル */
.ranking-panel {
    background: linear-gradient(135deg, #1e2749 0%, #2d3561 100%);
    border: 3px solid #32cd32;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 0 50px rgba(50, 205, 50, 0.5);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.ranking-title {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(45deg, #32cd32, #228b22);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.ranking-item {
    background: rgba(50, 205, 50, 0.1);
    border: 1px solid rgba(50, 205, 50, 0.3);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ranking-item.top3 {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.ranking-position {
    font-size: 18px;
    font-weight: 900;
    color: #32cd32;
    width: 40px;
}

.ranking-item.top3 .ranking-position {
    color: #ffd700;
}

.ranking-player {
    flex: 1;
    text-align: left;
    margin-left: 15px;
}

.ranking-score {
    font-weight: 700;
    color: #00d4ff;
}

/* 現在のユーザーのランキングアイテム */
.ranking-item.current-user {
    border-color: #ff6b6b;
    background: rgba(255, 107, 107, 0.15);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

.ranking-item.current-user .ranking-position {
    color: #ff6b6b;
}

.ranking-item.current-user .ranking-score {
    color: #ff6b6b;
}

/* プレースホルダーのランキングアイテム */
.ranking-item.placeholder {
    opacity: 0.7;
    border-style: dashed;
}

.ranking-item.placeholder .ranking-player {
    font-style: italic;
}

/* ランク外のユーザー */
.ranking-item.not-ranked {
    margin-top: 15px;
    border-top: 2px solid rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.05);
}

/* PC向けワイドスクリーン対応（16:9 aspect ratio） */
@media screen and (min-width: 1200px) {
    .game-screen {
        min-height: calc(100vh - 80px); /* ヘッダー分を考慮 */
    }
    
    .game-content {
        max-width: 1600px;
        margin: 0 auto;
        gap: 30px;
    }
    
    .gameContainer {
        max-width: 1200px;
    }
    
    .ui-panel {
        width: 350px;
        min-height: 700px;
    }
    
    .memory-stats {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .game-stats {
        padding: 20px;
    }

    .control-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* 超ワイドスクリーン対応 */
@media screen and (min-width: 1600px) {
    .game-content {
        max-width: 1800px;
        gap: 40px;
    }
    
    .ui-panel {
        width: 400px;
    }
}

.ranking-actions {
    margin-top: 20px;
}

/* チュートリアルスタイル */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tutorial-overlay.active {
    opacity: 1;
    visibility: visible;
}

.tutorial-panel {
    background: linear-gradient(135deg, #1e2749 0%, #2d3561 100%);
    border: 3px solid #00d4ff;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    box-shadow: 0 0 50px rgba(0, 212, 255, 0.5);
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.tutorial-overlay.active .tutorial-panel {
    transform: scale(1);
}

.tutorial-title {
    font-size: 28px;
    font-weight: 900;
    background: linear-gradient(45deg, #00d4ff, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 20px;
}

.tutorial-content {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 25px;
    color: #e0e6ed;
}

.tutorial-step {
    background: rgba(0, 212, 255, 0.1);
    border-left: 4px solid #00d4ff;
    padding: 15px;
    margin: 15px 0;
    border-radius: 0 8px 8px 0;
    text-align: left;
}

.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

/* ツールチップ */
.building-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    pointer-events: none;
    z-index: 100;
    border: 1px solid #00d4ff;
    white-space: pre-line;
}

/* アニメーション */
.tutorial-indicator {
    position: absolute;
    background: #ff6b6b;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.5);
    animation: bounce 1s infinite;
}

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

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .header-controls {
        justify-content: center;
    }
    
    .menu-panel,
    .shop-panel,
    .ranking-panel {
        margin: 20px;
        padding: 20px;
        max-width: 90vw;
    }
    
    .shop-items {
        grid-template-columns: 1fr;
    }
    
    .ui-panel {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}
