/* ============================================
   R69project2026 - スタイルシート
   iPhone 15 縦画面最適化 (393x852)
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: #000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
}

/* ============================================
   メインコンテナ（全画面）
   ============================================ */
#app-container {
    position: relative;
    width: 100%;
    height: 100%;
    height: 100dvh;
}

/* ============================================
   動画表示エリア（全画面背景）
   ============================================ */
#video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
}

.character-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.05s ease;
}

.character-video.active {
    z-index: 1;
    opacity: 1;
}

/* ============================================
   ローディング
   ============================================ */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin-top: 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
   レスポンス表示（動画の上にオーバーレイ）
   ============================================ */
#response-display {
    position: absolute;
    bottom: 80px;
    left: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
    z-index: 20;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ============================================
   モード表示インジケーター
   ============================================ */
#mode-indicator {
    position: absolute;
    top: env(safe-area-inset-top, 16px);
    right: 16px;
    display: flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    z-index: 20;
    cursor: default;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#mode-indicator.armor-mode {
    background: rgba(30, 100, 200, 0.5);
    border: 1px solid rgba(60, 140, 255, 0.3);
}

#mode-indicator.normal-mode {
    background: rgba(200, 60, 30, 0.5);
    border: 1px solid rgba(255, 100, 60, 0.3);
}

/* ============================================
   ステータス表示
   ============================================ */
#status-indicator {
    position: absolute;
    top: env(safe-area-inset-top, 16px);
    left: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.4);
    font-size: 11px;
    z-index: 20;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf50;
    animation: pulse 1.2s ease-in-out infinite;
}

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

/* ============================================
   入力エリア（動画の上にスケルトン表示）
   ============================================ */
#input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    z-index: 30;
}

#input-container {
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 24px;
    padding: 0 6px 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

#user-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 16px;
    padding: 10px 0;
}

#user-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

/* ============================================
   ボタン（スケルトン・動画の上）
   ============================================ */
#mic-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.8);
    background: transparent;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

#mic-button:active {
    background: rgba(255, 255, 255, 0.15);
}

#mic-button.recording {
    color: #ff4444;
    background: rgba(255, 50, 50, 0.2);
    animation: recording-pulse 1s ease-in-out infinite;
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 50, 50, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(255, 50, 50, 0); }
}

#send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    background: rgba(30, 100, 200, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 0.2s;
    flex-shrink: 0;
}

#send-button:active {
    background: rgba(30, 100, 200, 0.85);
}

/* ============================================
   スタートオーバーレイ（iOS音声アンロック用）
   ============================================ */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.overlay-content {
    text-align: center;
    padding: 0 32px;
}

.overlay-title {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.overlay-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
}

.overlay-url {
    margin-top: 20px;
    font-size: 13px;
    color: rgba(100, 180, 255, 0.9);
    font-weight: 600;
}

/* ============================================
   マイク無効状態
   ============================================ */
#mic-button.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ============================================
   ユーティリティ
   ============================================ */
.hidden {
    display: none !important;
}
