/* ===================================
   ほぼいえクエスト メインスタイル
   =================================== */

/* リセット & ベース設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* カラーパレット */
    --primary-color: #ff6b35;
    --secondary-color: #f7931e;
    --accent-color: #ffd23f;
    --dark-bg: #1a1a2e;
    --dark-secondary: #16213e;
    --light-text: #ffffff;
    --gray-text: #b8b8b8;
    --success-color: #4ecca3;
    --danger-color: #e84545;

    /* フォント */
    --font-main: 'Inter', sans-serif;
    --font-pixel: 'Press Start 2P', cursive;

    /* スペーシング */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
    --spacing-xl: 4rem;

    /* ボーダー半径 */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;

    /* シャドウ */
    --shadow-sm: 0 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 0 rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 10px rgba(255, 255, 255, 0.6);

    /* RPG Theme Colors */
    --rpg-green: #74a33f;
    --rpg-blue: #639bff;
    --rpg-brown: #c88147;
    --rpg-border: #ffffff;
    --rpg-bg-window: #000000;
}

body {
    font-family: var(--font-main);
    background: var(--dark-bg);
    color: var(--light-text);
    line-height: 1.6;
    overflow-x: hidden;
    /* スマホ等での不自然な文字の改行を防ぐ（日本語の自然な文節での改行） */
    word-break: auto-phrase;
    overflow-wrap: break-word;
}

/* 最後の行に1文字や1単語だけがぽつんと改行されて残るのを防ぐ */
p, h1, h2, h3, h4, h5, h6, li, span, a, div, th, td {
    text-wrap: pretty;
}

/* ===================================
   ヘッダー & ナビゲーション
   =================================== */
.header {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 2px solid var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.header-container {
    max-width: 96%;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-pixel);
    font-size: 1.2rem;
    color: var(--primary-color);
    text-decoration: none;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.logo:hover {
    color: var(--accent-color);
    transform: scale(1.05);
}

.nav-menu {
    display: flex;
    gap: 0;
    list-style: none;
    align-items: center;
}

.nav-menu li {
    padding: 0 1.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
}

.nav-menu li:last-child {
    border-right: none;
    padding-right: 0;
}

/* Header specific button adjustment */
.header .pixel-btn {
    text-align: center !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.nav-menu a {
    color: var(--light-text);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    padding: 0.5rem 0;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: #ffd23f;
    /* Gold for active/hover */
}

.nav-menu a::after {
    display: none;
}

/* Remove underline bar */

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--light-text);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ===================================
   ヒーローセクション
   =================================== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding-top: 80px;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Pixel Art Map Pattern */
    background-image: url('../img/bg-map.png');
    background-repeat: repeat;
    background-size: 512px;
    image-rendering: pixelated;
    opacity: 1;
    /* Fully opaque background */
    z-index: -1;
    animation: mapScroll 60s linear infinite;
}

/* Ensure ALL section text is readable by forcing window containment */
.section {
    position: relative;
    z-index: 1;
}

/* Override default card hover */
.card:hover,
.quest-card:hover {
    transform: none !important;
    border-color: #ffd23f !important;
    /* Gold border on highlight */
}

@keyframes mapScroll {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 512px 512px;
    }
}

.pixel-char {
    image-rendering: pixelated;
    height: 120px;
    width: auto;
    display: inline-block;
}

.hero-visual {
    margin-bottom: 2rem;
    position: relative;
    height: 140px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2rem;
}

.floating-item {
    height: 80px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* RPG Window Style - Dragon Quest Authentic */
.rpg-window,
.card,
.quest-card,
.form-container,
.video-card {
    background: #000000 !important;
    border: 2px solid #ffffff !important;
    border-radius: 4px !important;
    /* Slight radius for SNES look, or 0 */
    box-shadow:
        0 0 0 2px #000000,
        /* Inner black spacing */
        0 0 0 4px #ffffff,
        /* Outer white border */
        0 4px 8px rgba(0, 0, 0, 0.5) !important;
    padding: 1.5rem !important;
    margin-bottom: 2rem;
    color: #ffffff;
    position: relative;
    overflow: visible !important;
    /* Allow cursor to stick out */
}

/* Ensure text readability */
.rpg-window p,
.card p,
.quest-card p {
    color: #ffffff !important;
    text-shadow: none !important;
    font-family: var(--font-pixel);
    line-height: 2;
    font-size: 0.9rem;
}

.rpg-text {
    font-family: var(--font-pixel);
    font-size: 1rem;
    line-height: 2;
    color: #ffffff;
    text-align: left;
}

/* Command Cursor Style for Links/Buttons */
a.btn,
.nav-menu a {
    position: relative;
    padding-left: 2rem !important;
    transition: none !important;
    /* Instant response for retro feel */
    font-family: var(--font-pixel) !important;
    text-decoration: none !important;
}

a.btn:hover::before,
.nav-menu a:hover::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 12px solid #ffffff;
    /* CSS Triangle Cursor */
    animation: blink 0.5s step-end infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.highlight-bg {
    color: #ffd23f;
    font-family: var(--font-pixel);
    background-color: rgba(0, 0, 0, 0.6);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.pixel-btn {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
    box-shadow: none !important;
    /* Handled by rpg-window style */
    text-align: left;
}

.pixel-btn:hover {
    transform: none !important;
    background: #222 !important;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    padding: 2rem;
    animation: fadeInUp 1s ease-out;
}

.hero-title {
    font-family: var(--font-pixel);
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-shadow: 4px 4px 0 rgba(0, 0, 0, 0.5);
    line-height: 1.4;
}

.hero-subtitle {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--gray-text);
}

.hero-description {
    font-size: 1.1rem;
    margin-bottom: 3rem;
    line-height: 1.8;
}

/* ===================================
   ボタンスタイル
   =================================== */
.btn {
    display: inline-block;
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--light-text);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--light-text);
}

.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===================================
   セクション共通スタイル
   =================================== */
.section {
    padding: var(--spacing-xl) 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-family: var(--font-pixel);
    font-size: 2rem;
    text-align: center;
    margin-bottom: var(--spacing-lg);
    color: var(--primary-color);
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: var(--gray-text);
    margin-bottom: var(--spacing-md);
}

/* ===================================
   カードスタイル
   =================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card {
    background: var(--dark-secondary);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-glow);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.card-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.card-description {
    color: var(--gray-text);
    line-height: 1.8;
}

/* ===================================
   クエストステータス
   =================================== */
.quest-card {
    background: var(--dark-secondary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
}

.quest-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-lg);
}

.quest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.quest-title {
    font-size: 1.3rem;
    color: var(--accent-color);
    font-weight: 600;
}

.quest-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.status-planning {
    background: rgba(200, 200, 200, 0.2);
    color: #cccccc;
    border: 1px solid #cccccc;
}

.status-researching {
    background: rgba(100, 200, 255, 0.2);
    color: #64c8ff;
    border: 1px solid #64c8ff;
}

.status-appointing {
    background: rgba(255, 210, 63, 0.2);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.status-presenting {
    background: rgba(247, 147, 30, 0.2);
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
}

.status-executing {
    background: rgba(255, 107, 53, 0.2);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.status-completed {
    background: rgba(78, 204, 163, 0.2);
    color: var(--success-color);
    border: 1px solid var(--success-color);
    animation: pulse 2s infinite;
}

.quest-info {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    color: var(--gray-text);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.quest-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===================================
   フォームスタイル
   =================================== */
.form-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--dark-secondary);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--accent-color);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--dark-bg);
    border: 2px solid var(--dark-secondary);
    border-radius: var(--radius-sm);
    color: var(--light-text);
    font-family: var(--font-main);
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-checkbox-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

/* ===================================
   ビデオセクション
   =================================== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.video-card {
    background: var(--dark-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.video-card:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.video-wrapper {
    position: relative;
    padding-bottom: 177.78%;
    /* 9:16 ratio for reels */
    height: 0;
    overflow: hidden;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.video-caption {
    padding: 1rem;
    font-size: 0.9rem;
    color: var(--gray-text);
}

/* ===================================
   フッター
   =================================== */
.footer {
    background: var(--dark-secondary);
    padding: var(--spacing-lg) 2rem;
    margin-top: var(--spacing-xl);
    border-top: 2px solid var(--primary-color);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-family: var(--font-pixel);
    font-size: 1rem;
}

.footer-links {
    list-style: none;
}

.footer-links a {
    color: var(--gray-text);
    text-decoration: none;
    transition: color 0.3s ease;
    display: block;
    padding: 0.3rem 0;
}

.footer-links a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    text-align: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--gray-text);
    font-size: 0.9rem;
}

/* ===================================
   レスポンシブデザイン
   =================================== */
@media (max-width: 768px) {
    /* PC用の改行（br）がスマホで不自然な位置で切れるのを防ぐため、スマホ表示時は文章内の改行を原則非表示に */
    p br, h1 br, h2 br, h3 br, h4 br, h5 br, h6 br, .card-title br, .card-description br, .section-subtitle br {
        display: none;
    }
    
    /* スマホでも確実に残したいbrには <br class="keep-br"> と追記することで対応可能 */
    br.keep-br {
        display: inline !important;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--dark-bg);
        flex-direction: column;
        padding: 1rem;
        gap: 0;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu a {
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .quest-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .section {
        padding: var(--spacing-md) 1rem;
    }

    .header-container {
        padding: 1rem;
    }
}

/* ===================================
   ユーティリティクラス
   =================================== */
.text-center {
    text-align: center;
}


.mt-1 {
    margin-top: var(--spacing-xs);
}

/* ===================================
   BGM Control Button
   =================================== */
.bgm-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    /* Ensure it's above everything */
    padding: 10px 15px !important;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-pixel);
    background: var(--dark-bg) !important;
    border: 2px solid #ffffff !important;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.5) !important;
    transition: all 0.1s ease;
    color: #ffffff !important;
    touch-action: manipulation;
    /* Optimize for touch */
    -webkit-tap-highlight-color: transparent;
    /* Remove tap highlight */
}

.bgm-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.5) !important;
}

.bgm-btn i {
    width: 20px;
    text-align: center;
}

.bgm-label {
    font-size: 0.8rem;
}

.bgm-btn.playing {
    border-color: var(--accent-color) !important;
    color: var(--accent-color) !important;
}


.mt-2 {
    margin-top: var(--spacing-sm);
}

.mt-3 {
    margin-top: var(--spacing-md);
}

.mt-4 {
    margin-top: var(--spacing-lg);
}

.mb-1 {
    margin-bottom: var(--spacing-xs);
}

.mb-2 {
    margin-bottom: var(--spacing-sm);
}

.mb-3 {
    margin-bottom: var(--spacing-md);
}

.mb-4 {
    margin-bottom: var(--spacing-lg);
}

.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}