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

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #ffffff;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* モバイルコンテナ */
.mobile-container {
    max-width: 414px;
    min-height: 100vh;
    margin: 0 auto;
    background: linear-gradient(180deg, #2a2a2a 0%, #1e1e1e 100%);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

/* ヘッダー */
.header {
    background: rgba(42, 42, 42, 0.95);
    backdrop-filter: blur(10px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: 56px;
}

.back-btn {
    background: none;
    border: none;
    color: #60a5fa;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: rgba(96, 165, 250, 0.1);
}


.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 44px;
}

.name-selector, .emotion-selector {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    max-width: 120px;
    flex: 1;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6"><path fill="%23ffffff" d="M5 6L0 0h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px 6px;
    padding-right: 24px;
}

.name-selector:hover, .emotion-selector:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.name-selector:focus, .emotion-selector:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(96, 165, 250, 0.5);
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);
}

.name-selector option, .emotion-selector option {
    background: #2a2a2a;
    color: white;
    padding: 8px 12px;
    border: none;
}

.name-selector option:hover, .emotion-selector option:hover {
    background: #3a3a3a;
}

.name-selector option:checked, .emotion-selector option:checked {
    background: #60a5fa;
    color: white;
}

.test-voice-btn {
    background: rgba(96, 165, 250, 0.2);
    border: 1px solid rgba(96, 165, 250, 0.4);
    color: #60a5fa;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    flex-shrink: 0;
}

.test-aoyama-btn {
    background: rgba(255, 165, 0, 0.2) !important;
    border: 1px solid rgba(255, 165, 0, 0.4) !important;
    color: #ffa500 !important;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    min-width: 50px !important;
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    font-weight: 600 !important;
}

.test-aoyama-btn:hover {
    background: rgba(255, 165, 0, 0.3) !important;
    border-color: rgba(255, 165, 0, 0.6) !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(255, 165, 0, 0.3) !important;
}

.test-voice-btn:hover {
    background: rgba(96, 165, 250, 0.3);
}

/* 心理パラメーター */
.psychology-panel {
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.psychology-header {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 12px;
    color: #ffffff;
}

.psychology-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.param-row {
    display: grid;
    grid-template-columns: 50px 60px 1fr 30px;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.param-label {
    color: #ffffff;
    font-weight: 400;
}

.param-name {
    color: #a0a0a0;
    font-size: 10px;
}

.param-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.param-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease;
    position: relative;
}

.param-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.param-fill.trust {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.param-fill.alert {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.param-fill.isolation {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.param-fill.judgment {
    background: linear-gradient(90deg, #06b6d4, #67e8f9);
}

.param-fill.pride {
    background: linear-gradient(90deg, #f59e0b, #fcd34d);
}

.param-value {
    color: #ffffff;
    font-weight: 500;
    text-align: right;
    font-size: 11px;
}

/* フェーズセクション */
.phase-section {
    padding: 20px 16px;
    flex: 1;
}

.phase-title {
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* キャラクター表示 */
.character-container {
    position: relative;
    margin-bottom: 20px;
}

.character-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.character-subtitle {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.3;
    text-align: center;
}

/* ストーリーテキスト */
.story-text {
    font-size: 14px;
    line-height: 1.6;
    color: #e0e0e0;
    margin-bottom: 16px;
    padding: 0 4px;
}

/* システムメッセージ */
.system-message {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.system-header {
    font-size: 12px;
    color: #60a5fa;
    font-weight: 500;
    margin-bottom: 8px;
}

.system-content {
    font-size: 13px;
    line-height: 1.5;
    color: #d0d0d0;
}

/* 選択肢ボタン */
.choice-buttons {
    padding: 16px;
    display: flex;
    gap: 12px;
    background: rgba(42, 42, 42, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    bottom: 0;
}

.choice-btn {
    flex: 1;
    padding: 16px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: inherit;
}

.choice-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.choice-btn:hover::before {
    left: 100%;
}

.choice-btn.secondary {
    background: rgba(107, 114, 128, 0.3);
    color: #d1d5db;
    border: 1px solid rgba(107, 114, 128, 0.5);
}

.choice-btn.secondary:hover {
    background: rgba(107, 114, 128, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(107, 114, 128, 0.3);
}

.choice-btn.primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
}

.choice-btn.primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(59, 130, 246, 0.4);
}

.choice-btn:active {
    transform: translateY(0);
}

/* レスポンシブ対応 */
@media (max-width: 375px) {
    .mobile-container {
        max-width: 100%;
    }
    
    .header {
        padding: 8px 10px;
        gap: 6px;
    }
    
    .header-controls {
        gap: 4px;
        flex-wrap: wrap;
    }
    
    .name-selector, .emotion-selector {
        font-size: 10px;
        padding: 6px 8px;
        min-width: 80px;
        max-width: 90px;
        padding-right: 20px;
    }
    
    .test-voice-btn {
        padding: 6px 8px;
        font-size: 12px;
        min-width: 32px;
    }
    
    .test-aoyama-btn {
        padding: 6px 8px !important;
        font-size: 9px !important;
        min-width: 40px !important;
    }
    
    .psychology-panel {
        padding: 12px;
    }
    
    .phase-section {
        padding: 16px 12px;
    }
    
    .choice-buttons {
        padding: 12px;
        gap: 8px;
    }
    
    .choice-btn {
        padding: 14px 16px;
        font-size: 13px;
    }
}

/* 中サイズスマホ対応 */
@media (min-width: 376px) and (max-width: 414px) {
    .header {
        padding: 10px 14px;
        gap: 10px;
    }
    
    .name-selector, .emotion-selector {
        font-size: 12px;
        min-width: 120px;
    }
    
    .test-voice-btn {
        font-size: 15px;
    }
}

@media (min-width: 415px) {
    .mobile-container {
        border-radius: 20px;
        margin: 20px auto;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }
}

/* 縦長画面対応 */
@media (max-height: 667px) {
    .character-image {
        height: 160px;
    }
    
    .phase-section {
        padding: 16px;
    }
}

@media (max-height: 568px) {
    .character-image {
        height: 140px;
    }
    
    .psychology-panel {
        padding: 12px;
    }
    
    .psychology-bars {
        gap: 6px;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: light) {
    body {
        background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    }
    
    .mobile-container {
        background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
        color: #1f2937;
    }
    
    .header {
        background: rgba(255, 255, 255, 0.95);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .title-main {
        color: #1f2937;
    }
    
    .title-sub {
        color: #6b7280;
    }
    
    .psychology-panel {
        background: rgba(0, 0, 0, 0.05);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .psychology-header {
        color: #1f2937;
    }
    
    .param-label {
        color: #1f2937;
    }
    
    .param-value {
        color: #1f2937;
    }
    
    .phase-title {
        color: #1f2937;
    }
    
    .story-text {
        color: #374151;
    }
    
    .system-message {
        background: rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .system-content {
        color: #4b5563;
    }
    
    .choice-buttons {
        background: rgba(255, 255, 255, 0.95);
        border-top: 1px solid rgba(0, 0, 0, 0.1);
    }
}
