/* ==============================================
   Fortune Quest 統合CSS v1.0
   secure_fortune.css + fortune_essential.css
   全機能対応 + セキュリティ表示 + レスポンシブ
   ============================================== */

/* CSS変数 */
:root {
    --primary-gold: #ffd700;
    --primary-purple: #9966cc;
    --primary-blue: #001133;
    --secondary-blue: #87ceeb;
    --secondary-purple: #c084fc;
    --accent-orange: #ff6b35;
    --accent-violet: #6b46c1;
    --secure-green: #10b981;
    --warning-yellow: #f59e0b;
    --error-red: #ef4444;
    --text-main: #ffffff;
    
    --bg-main: linear-gradient(135deg, #1a0033 0%, #330066 50%, #1a0033 100%);
    --bg-window: linear-gradient(135deg, #4c1d95, #312e81);
    --bg-window-alt: linear-gradient(135deg, #2d4a8a, #1e3a5f);
}

/* ==============================================
   基本レイアウト
   ============================================== */

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

body {
    font-family: 'DotGothic16', monospace;
    background: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* ==============================================
   セキュリティ表示（必須）
   ============================================== */

.security-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(16, 185, 129, 0.1);
    border: 2px solid var(--secure-green);
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 12px;
    color: var(--secure-green);
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.security-indicator::before {
    content: '🔒 ';
}

/* ==============================================
   ヘッダー
   ============================================== */

.header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.8);
    border: 3px solid var(--primary-purple);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(153, 102, 204, 0.3);
}

.logo {
    font-size: 24px;
    color: var(--primary-purple);
    text-shadow: 2px 2px 0px var(--accent-violet);
    margin-bottom: 10px;
    font-family: 'Press Start 2P', cursive;
}

.subtitle {
    font-size: 14px;
    color: var(--secondary-purple);
}

/* 金色テーマ切り替え用 */
.theme-gold .header {
    border-color: var(--primary-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.theme-gold .logo {
    color: var(--primary-gold);
    text-shadow: 2px 2px 0px var(--accent-orange);
}

.theme-gold .subtitle {
    color: var(--secondary-blue);
}

/* ==============================================
   ナビゲーション
   ============================================== */

.nav-menu {
    text-align: center;
    margin-bottom: 20px;
}

.nav-link {
    color: var(--secondary-purple);
    text-decoration: none;
    margin: 0 15px;
    font-size: 12px;
    border: 1px solid transparent;
    padding: 8px 12px;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: inline-block;
}

.nav-link:hover {
    color: var(--primary-purple);
    border-color: var(--secondary-purple);
    background: rgba(192, 132, 252, 0.1);
}

.result-link {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid var(--primary-gold) !important;
}

.result-link:hover {
    background: rgba(255, 215, 0, 0.2);
}

/* ==============================================
   ゲームウィンドウ
   ============================================== */

.game-window {
    background: var(--bg-window);
    border: 4px solid var(--primary-purple);
    border-radius: 15px;
    margin: 20px 0;
    padding: 25px;
    box-shadow: 0 0 20px rgba(153, 102, 204, 0.3);
}

.theme-gold .game-window {
    background: var(--bg-window-alt);
    border-color: var(--primary-gold);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

/* ==============================================
   王様ポートレート
   ============================================== */

.king-portrait {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-violet));
    border: 3px solid #ffffff;
    border-radius: 50%;
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    animation: royal-glow 2s ease-in-out infinite alternate;
}

.theme-gold .king-portrait {
    background: linear-gradient(135deg, var(--primary-gold), var(--accent-orange));
}

@keyframes royal-glow {
    0% { box-shadow: 0 0 10px rgba(153, 102, 204, 0.5); }
    100% { box-shadow: 0 0 25px rgba(153, 102, 204, 0.8); }
}

.theme-gold .king-portrait {
    animation: royal-glow-gold 2s ease-in-out infinite alternate;
}

@keyframes royal-glow-gold {
    0% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    100% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.8); }
}

.king-speech {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--secondary-purple);
    border-radius: 10px;
    padding: 15px;
    margin: 15px 0;
    font-size: 14px;
    line-height: 1.6;
    min-height: 120px;
}

.theme-gold .king-speech {
    border-color: var(--secondary-blue);
}

/* ==============================================
   フォーム（セキュリティ表示付き）
   ============================================== */

.fortune-form {
    background: rgba(153, 102, 204, 0.1);
    border: 2px solid var(--primary-purple);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
}

.fortune-form::before {
    content: 'セキュア接続 🔒';
    position: absolute;
    top: -12px;
    left: 20px;
    background: var(--secure-green);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
}

.theme-gold .fortune-form {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--primary-gold);
}

.form-group {
    margin: 15px 0;
}

.form-label {
    display: block;
    color: var(--primary-purple);
    font-size: 14px;
    margin-bottom: 8px;
}

.theme-gold .form-label {
    color: var(--primary-gold);
}

.form-input, .form-textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid var(--secondary-purple);
    border-radius: 8px;
    color: white;
    font-family: 'DotGothic16', monospace;
    font-size: 16px;
    box-sizing: border-box;
}

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

.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 10px rgba(153, 102, 204, 0.3);
}

.theme-gold .form-input, .theme-gold .form-textarea {
    border-color: var(--secondary-blue);
}

.theme-gold .form-input:focus, .theme-gold .form-textarea:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

/* ==============================================
   ボタン（統合版）
   ============================================== */

.start-button, .fortune-start-button {
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-violet));
    border: none;
    border-radius: 10px;
    padding: 15px 30px;
    color: white;
    font-family: 'DotGothic16', monospace;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 0 #4c1d95;
    margin: 10px;
    width: 100%;
    max-width: 300px;
    display: block;
    margin: 20px auto 10px auto;
    position: relative;
}

.theme-gold .start-button, .theme-gold .fortune-start-button {
    background: linear-gradient(135deg, var(--primary-gold), var(--accent-orange));
    color: var(--primary-blue);
    box-shadow: 0 4px 0 #cc9900;
}

.start-button:hover:not(:disabled), .fortune-start-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #4c1d95;
}

.theme-gold .start-button:hover:not(:disabled), .theme-gold .fortune-start-button:hover:not(:disabled) {
    box-shadow: 0 6px 0 #cc9900;
}

.start-button:active:not(:disabled), .fortune-start-button:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #4c1d95;
}

.theme-gold .start-button:active:not(:disabled), .theme-gold .fortune-start-button:active:not(:disabled) {
    box-shadow: 0 2px 0 #cc9900;
}

.start-button:disabled, .fortune-start-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    transform: none;
    box-shadow: 0 4px 0 #4b5563;
}

.fortune-start-button.secure::after {
    content: ' 🔒';
    font-size: 12px;
}

.secondary-button {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    border: 2px solid #9ca3af;
    padding: 12px 24px;
    font-family: 'DotGothic16', monospace;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.secondary-button:hover {
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-violet));
    border-color: var(--secondary-purple);
}

.theme-gold .secondary-button:hover {
    background: linear-gradient(135deg, var(--primary-gold), var(--accent-orange));
    border-color: var(--secondary-blue);
}

/* ==============================================
   結果表示
   ============================================== */

.fortune-result {
    background: rgba(153, 102, 204, 0.1);
    border: 2px solid var(--primary-purple);
    border-radius: 10px;
    padding: 25px;
    margin: 20px 0;
    min-height: 200px;
    font-size: 14px;
    line-height: 1.7;
    animation: slideIn 0.5s ease;
}

.theme-gold .fortune-result {
    background: rgba(255, 215, 0, 0.1);
    border-color: var(--primary-gold);
}

.result-section {
    color: var(--primary-purple);
    font-family: 'Press Start 2P', cursive;
    font-size: 16px;
    margin: 20px 0 10px 0;
    border-bottom: 2px solid var(--secondary-purple);
    padding-bottom: 8px;
}

.theme-gold .result-section {
    color: var(--primary-gold);
    border-bottom-color: var(--secondary-blue);
}

/* ==============================================
   ローディング
   ============================================== */

.loading-section, .loading-indicator {
    display: none;
    text-align: center;
    padding: 40px;
}

.loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    border: 3px solid var(--primary-purple);
    border-radius: 15px;
    padding: 30px;
    z-index: 10000;
    backdrop-filter: blur(10px);
}

.theme-gold .loading-indicator {
    border-color: var(--primary-gold);
}

.spinner, .loading-spinner {
    border: 4px solid rgba(153, 102, 204, 0.3);
    border-top: 4px solid var(--primary-purple);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.theme-gold .spinner, .theme-gold .loading-spinner {
    border: 4px solid var(--secondary-blue);
    border-top: 4px solid var(--primary-gold);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--secondary-purple);
    font-size: 14px;
    margin: 15px 0;
}

.theme-gold .loading-text {
    color: var(--primary-gold);
}

/* ==============================================
   エラー表示
   ============================================== */

.error-message {
    color: var(--error-red);
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--error-red);
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    display: none;
    font-size: 14px;
    line-height: 1.5;
}

.error-message.show {
    display: block;
    animation: slideIn 0.3s ease;
}

/* ==============================================
   通知システム
   ============================================== */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 300px;
    max-width: 400px;
    padding: 15px 20px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 9999;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideInRight 0.3s ease;
}

.notification-success {
    background: rgba(16, 185, 129, 0.9);
    border: 2px solid var(--secure-green);
    color: white;
}

.notification-error {
    background: rgba(239, 68, 68, 0.9);
    border: 2px solid var(--error-red);
    color: white;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==============================================
   星空エフェクト
   ============================================== */

.stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.star {
    position: absolute;
    width: 2px;
    height: 2px;
    background: white;
    border-radius: 50%;
    animation: twinkle 3s infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ==============================================
   フッター
   ============================================== */

.footer {
    text-align: center; 
    padding: 30px 20px; 
    color: var(--secondary-purple); 
    font-size: 12px; 
    margin-top: 40px;
    border-top: 1px solid rgba(192, 132, 252, 0.3);
}

.theme-gold .footer {
    color: var(--secondary-blue);
    border-top-color: rgba(135, 206, 235, 0.3);
}

.footer-links {
    margin-bottom: 15px;
}

.footer-link {
    color: var(--secondary-purple);
    text-decoration: none;
    margin: 0 10px;
    font-size: 11px;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--primary-purple);
}

.theme-gold .footer-link {
    color: var(--secondary-blue);
}

.theme-gold .footer-link:hover {
    color: var(--primary-gold);
}

.footer-divider {
    margin: 0 5px;
    color: #666;
}

/* ==============================================
   レスポンシブ対応
   ============================================== */

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo {
        font-size: 20px;
    }
    
    .king-portrait {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }
    
    .game-window {
        padding: 20px 15px;
    }
    
    .fortune-form {
        padding: 15px;
    }
    
    .nav-link {
        margin: 5px;
        font-size: 11px;
    }
    
    .security-indicator {
        top: 5px;
        right: 5px;
        padding: 6px 10px;
        font-size: 10px;
    }
    
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 18px;
    }
    
    .king-portrait {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
    
    .form-input, .form-textarea {
        font-size: 14px;
    }
    
    .start-button, .fortune-start-button {
        font-size: 12px;
        padding: 12px 20px;
    }
    
    .result-section {
        font-size: 14px;
    }
}

/* ==============================================
   ユーティリティクラス
   ============================================== */

.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hide { display: none; }
.show { display: block; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==============================================
   アニメーション
   ============================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ==============================================
   ダークモード・アクセシビリティ
   ============================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --primary-blue: #000011;
        --bg-main: linear-gradient(135deg, #000011 0%, #000033 50%, #000011 100%);
    }
}

/* モーション軽減 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
