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

:root {
    --accent-color: #7c3aed;
    --accent-light: #a78bfa;
    --accent-dark: #5b21b6;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --accent-light: #8b5cf6;
    --bg-light: #1f2937;
    --bg-white: #111827;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #374151;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
}

body {
    display: flex;
    flex-direction: column;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-dark));
    color: white;
    padding: 1rem;
    text-align: center;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    flex-direction: column;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.header p {
    font-size: 0.875rem;
    opacity: 0.9;
}

.hud-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.hud-toggle:active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

.map-container {
    flex: 1;
    width: 100%;
    z-index: 1;
    background: #f0f0f0;
}

.controls-panel {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex-shrink: 0;
    max-height: 35vh;
    overflow-y: auto;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

.direction-display {
    display: flex;
    justify-content: center;
}

.direction-card {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    min-width: 200px;
    box-shadow: var(--shadow-md);
}

.direction-card .label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.big-arrow {
    font-size: 3rem;
    margin: 0.5rem 0;
    display: block;
    font-weight: bold;
}

.direction-text {
    font-size: 0.9rem;
    margin-top: 0.5rem;
    opacity: 0.95;
}

.button-group {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    justify-content: center;
}

.btn {
    flex: 1;
    max-width: 200px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:active {
    background: var(--border-color);
}

.stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    min-width: 100px;
}

.stat-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

.waypoints-panel {
    background: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    flex-shrink: 0;
    max-height: 30vh;
    overflow-y: auto;
    display: none;
}

.waypoints-panel.active {
    display: block;
}

.waypoints-panel h3 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.waypoint-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.waypoint-list li {
    padding: 0.5rem;
    background: var(--bg-light);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent-color);
    padding-left: 0.75rem;
}

.waypoint-list li.empty-state {
    text-align: center;
    border-left: none;
    color: var(--text-secondary);
    padding: 1rem;
}

/* Leaflet 地図のカスタマイズ */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.7) !important;
    font-size: 0.75rem;
}

.leaflet-top,
.leaflet-bottom {
    z-index: 100;
}

/* レスポンシブ */
@media (max-height: 600px) {
    .header {
        padding: 0.75rem;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .controls-panel {
        max-height: 40vh;
        padding: 0.75rem;
    }

    .big-arrow {
        font-size: 2rem;
    }
}

@media (min-width: 768px) {
    .container {
        flex-direction: row;
    }

    .header {
        writing-mode: horizontal-tb;
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        z-index: 200;
        height: 60px;
    }

    .map-container {
        margin-top: 60px;
    }
}

/* HUD モード */
.hud-display {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 500;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    transform: scaleX(-1);
}

.hud-display.active {
    display: flex;
}

.hud-direction-large {
    font-size: 15vw;
    line-height: 1;
    font-weight: bold;
    margin-bottom: 3rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.hud-info {
    display: flex;
    gap: 3rem;
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: 2px;
    position: absolute;
    bottom: 2rem;
    left: 0;
    right: 0;
    justify-content: center;
}

.hud-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.hud-label {
    font-size: 1rem;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-value {
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

body[data-mode="hud"] .map-container {
    filter: brightness(0.3);
}

body[data-mode="hud"] .controls-panel,
body[data-mode="hud"] .waypoints-panel,
body[data-mode="hud"] .header {
    display: none;
}

body[data-mode="hud"] .hud-display {
    display: flex;
}
