/* ============================================
   R4 — KYUROKU.ainas スタイルシート
   R69project2026 と同構造
   iPhone縦画面最適化
   ============================================ */

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

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

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

/* ============================================
   3D キャラクター表示（全画面 Three.js canvas）
   ============================================ */
#character-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #060e1e;
}

#three-canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ============================================
   ローディング
   ============================================ */
.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); }
}

/* ============================================
   モード表示（右上）
   ============================================ */
#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: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    letter-spacing: 0.05em;
}

#mode-indicator.castoff-mode {
    background: rgba(20, 80, 180, 0.5);
    border: 1px solid rgba(60, 140, 255, 0.35);
    color: #9dd4ff;
}

#mode-indicator.caston-mode {
    background: rgba(20, 50, 120, 0.55);
    border: 1px solid rgba(30, 100, 200, 0.4);
    color: #c0d8ff;
}

#mode-indicator.aqua-mode {
    background: rgba(0, 100, 130, 0.55);
    border: 1px solid rgba(0, 200, 220, 0.4);
    color: #80f0ff;
}

#mode-indicator.heat-mode {
    background: rgba(160, 40, 20, 0.55);
    border: 1px solid rgba(255, 80, 40, 0.4);
    color: #ffb090;
}

#mode-indicator.marine-mode {
    background: rgba(140, 70, 10, 0.55);
    border: 1px solid rgba(255, 140, 20, 0.4);
    color: #ffd090;
}

#mode-indicator.sight-mode {
    background: rgba(20, 100, 30, 0.55);
    border: 1px solid rgba(40, 200, 60, 0.4);
    color: #90ff90;
}

#mode-indicator.bug-mode {
    background: rgba(20, 20, 80, 0.55);
    border: 1px solid rgba(80, 80, 255, 0.4);
    color: #b0b0ff;
}

/* ============================================
   ステータス表示（左上）
   ============================================ */
#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; }
}

/* ============================================
   レスポンス表示（入力欄の直上）
   ============================================ */
#response-display {
    position: absolute;
    bottom: 72px;
    left: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.52);
    color: #fff;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    max-height: 130px;
    overflow-y: auto;
    z-index: 20;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(60, 140, 255, 0.18);
    word-break: break-word;
}

/* ============================================
   入力エリア（下部固定）
   ============================================ */
#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.38);
    border-radius: 24px;
    padding: 0 6px 0 16px;
    border: 1px solid rgba(60, 140, 255, 0.22);
    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: 11px 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.12);
}

#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.35); }
    50%       { box-shadow: 0 0 0 8px rgba(255, 50, 50, 0); }
}

#mic-button.disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ============================================
   送信ボタン
   ============================================ */
#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.65);
    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.9);
}

/* ============================================
   スタートオーバーレイ
   ============================================ */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 10, 24, 0.88);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

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

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

.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;
}

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