* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #eee;
    min-height: 100vh;
    padding: 20px;
}
.container { max-width: 600px; margin: 0 auto; }
h1 {
    text-align: center;
    margin-bottom: 10px;
    font-size: 1.8em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.subtitle {
    text-align: center;
    font-size: 0.9em;
    opacity: 0.7;
    margin-bottom: 20px;
}
.chat-box {
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    padding: 15px;
    height: 50vh;
    overflow-y: auto;
    margin-bottom: 20px;
}
.message {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 12px;
    max-width: 85%;
}
.sora {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-right: auto;
}
.user {
    background: #3a6351;
    margin-left: auto;
}
.sora.enhanced {
    background: linear-gradient(135deg, #b8860b 0%, #daa520 50%, #b8860b 100%);
    border: 2px solid #ffd700;
    animation: enhancedFadeIn 0.6s ease-out;
}
.sora.enhanced .role { color: #fff; }
.enhanced-label {
    font-size: 0.7em;
    background: rgba(255,215,0,0.3);
    padding: 2px 8px;
    border-radius: 8px;
    margin-left: 8px;
}
@keyframes enhancedFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.role { font-size: 0.8em; opacity: 0.7; margin-bottom: 5px; }
.message-header { display: flex; justify-content: space-between; align-items: center; }
.play-audio-btn, .good-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    min-width: 28px;
    max-width: 28px;
    padding: 0;
    flex: none;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.play-audio-btn:hover, .good-btn:hover { background: rgba(255,255,255,0.3); }
.play-audio-btn:active, .good-btn:active { transform: scale(0.95); }
.good-btn.saved { background: rgba(39, 174, 96, 0.5); }
.message-buttons { display: flex; gap: 5px; }
.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.toggle-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.toggle-container span {
    font-size: 0.75em !important;
    margin-left: 4px !important;
}
.toggle-btn {
    padding: 5px 10px;
    border: 2px solid #667eea;
    border-radius: 15px;
    background: transparent;
    color: #667eea;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 36px;
}
.toggle-btn.active {
    background: #667eea;
    color: white;
}
.toggle-btn:disabled {
    opacity: 0.5;
}
button {
    flex: 1;
    min-width: 100px;
    padding: 18px;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}
button:active { transform: scale(0.95); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
#recordBtn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    flex: 2;
}
#recordBtn.recording {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    animation: pulse 1s infinite;
}
#playBtn {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}
#endBtn {
    background: linear-gradient(135deg, #e67e22, #d35400);
    color: white;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.status {
    text-align: center;
    padding: 10px;
    font-size: 0.9em;
    opacity: 0.8;
}
.loading { color: #f39c12; }
.provider-info {
    text-align: center;
    font-size: 0.75em;
    opacity: 0.6;
    margin-bottom: 10px;
}
.provider-info span {
    margin: 0 8px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
}
.provider-info .openai { color: #10a37f; }
.provider-info .google { color: #4285f4; }
.progress-container {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    height: 8px;
    margin: 10px 0;
    overflow: hidden;
    display: none;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}
.steps {
    display: flex;
    justify-content: space-between;
    font-size: 0.7em;
    opacity: 0.6;
    margin-bottom: 10px;
    display: none;
}
.steps span { transition: opacity 0.3s; }
.steps span.active { opacity: 1; color: #667eea; font-weight: bold; }
.steps span.done { opacity: 1; color: #27ae60; }
audio { width: 100%; margin-top: 10px; display: none; }
.context-info {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.85em;
}
#issueBtn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    font-size: 0.9em;
    padding: 12px;
}
.text-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}
#textInput {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #667eea;
    border-radius: 25px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 1em;
    outline: none;
}
#textInput::placeholder {
    color: rgba(255,255,255,0.5);
}
#sendBtn {
    width: 50px;
    min-width: 50px;
    padding: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    font-size: 1.2em;
}
/* 画像/動画アップロード */
.media-upload-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    justify-content: center;
}
.media-btn {
    display: inline-block;
    padding: 10px 16px;
    border: 2px solid #667eea;
    border-radius: 20px;
    background: rgba(102, 126, 234, 0.15);
    color: #b8c5ff;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.media-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: #764ba2;
}
.media-btn:active { transform: scale(0.95); }
.media-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Gemini Live mode */
.live-active {
    background: rgba(231, 76, 60, 0.3) !important;
    border-color: #e74c3c !important;
    animation: live-pulse 1.5s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { box-shadow: 0 0 5px rgba(231, 76, 60, 0.3); }
    50% { box-shadow: 0 0 15px rgba(231, 76, 60, 0.6); }
}
.message.sora.streaming {
    border-left: 3px solid #e74c3c;
    opacity: 0.8;
}
.emergency-stop-btn {
    display: inline-block;
    padding: 10px 16px;
    border: 2px solid #e74c3c;
    border-radius: 20px;
    background: rgba(231, 76, 60, 0.15);
    color: #ff6b6b;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.emergency-stop-btn:hover {
    background: rgba(231, 76, 60, 0.4);
    border-color: #c0392b;
}
.emergency-stop-btn:active { transform: scale(0.95); }
/* ファイル入力を視覚的に隠す（iOS Safariで動作するように） */
#imageInput, #videoInput, #fileInput {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.file-loaded-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(52, 152, 219, 0.15);
    border: 1px solid rgba(52, 152, 219, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.85em;
    color: #5dade2;
}
.autofix-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: rgba(243, 156, 18, 0.15);
    border: 1px solid rgba(243, 156, 18, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.85em;
    color: #f39c12;
    animation: autofixPulse 2s ease-in-out infinite;
}
.autofix-banner.success {
    background: rgba(39, 174, 96, 0.15);
    border-color: rgba(39, 174, 96, 0.4);
    color: #27ae60;
    animation: none;
}
.autofix-banner.failed {
    background: rgba(231, 76, 60, 0.15);
    border-color: rgba(231, 76, 60, 0.4);
    color: #e74c3c;
    animation: none;
}
@keyframes autofixPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.file-remove-btn {
    background: none;
    border: none;
    color: #5dade2;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 4px;
}
.image-preview {
    position: relative;
    margin-bottom: 15px;
    border-radius: 12px;
    display: none;
}
.image-preview img, .image-preview video {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 12px;
}
.preview-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
}
.preview-prompt {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.preview-prompt input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #667eea;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.9em;
    outline: none;
}
.preview-prompt input::placeholder { color: rgba(255,255,255,0.5); }
.preview-prompt button {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    border-radius: 20px;
    color: white;
    cursor: pointer;
}
.message img.msg-image {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    margin-top: 8px;
}
.quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
    margin-bottom: 15px;
    justify-content: center;
    padding-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.quick-btn {
    padding: 8px 12px;
    border: 1px solid rgba(102, 126, 234, 0.5);
    border-radius: 20px;
    background: rgba(102, 126, 234, 0.15);
    color: #b8c5ff;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
    flex: none;
}
.quick-btn:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}
.quick-btn:active {
    transform: scale(0.95);
}
.quick-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}
.modal.show { display: flex; }
.modal-content {
    background: #1a1a2e;
    padding: 20px;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
}
.modal-content h3 { margin-bottom: 15px; }
.modal-content textarea {
    width: 100%;
    height: 100px;
    background: rgba(255,255,255,0.1);
    border: 1px solid #667eea;
    border-radius: 8px;
    color: white;
    padding: 10px;
    font-size: 1em;
    resize: none;
}
.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}
.modal-buttons button { flex: 1; }
/* リマインダー通知モーダル */
.reminder-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.reminder-modal.show { display: flex; }
.reminder-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    animation: reminderPulse 0.5s ease;
}
@keyframes reminderPulse {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}
.reminder-icon { font-size: 3em; margin-bottom: 15px; }
.reminder-message {
    font-size: 1.2em;
    margin-bottom: 20px;
    line-height: 1.5;
}
.reminder-time {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 20px;
}
.reminder-dismiss {
    background: white;
    color: #764ba2;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
}
.map-container {
    width: 100%;
    border-radius: 10px;
    margin-top: 10px;
    overflow: hidden;
}
.map-container iframe {
    width: 100%;
    height: 200px;
    border: 0;
    border-radius: 10px 10px 0 0;
}
.map-open-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    border-radius: 0 0 10px 10px;
    border: none;
    cursor: pointer;
}
.map-open-btn:active {
    opacity: 0.8;
}
.nav-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: rgba(26, 26, 46, 0.95);
    padding: 10px 15px;
    border-bottom: 2px solid #667eea;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    gap: 10px;
}
.nav-bar.active { display: flex; }
.nav-bar .nav-dest { flex: 1; font-size: 0.9em; color: #b8c5ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-bar .nav-dist { font-size: 0.95em; color: #667eea; font-weight: bold; min-width: 60px; text-align: right; }
.nav-bar .nav-close {
    background: rgba(231, 76, 60, 0.3);
    border: 1px solid #e74c3c;
    color: #ff6b6b;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 0.9em;
    flex-shrink: 0;
}
/* === Camera Overlay === */
.camera-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #000; z-index: 9999; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.camera-overlay video {
    max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px;
}
.camera-countdown {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 120px; font-weight: bold; color: #fff; text-shadow: 0 0 40px rgba(0,0,0,0.8);
    animation: countPulse 1s ease-in-out infinite;
    pointer-events: none;
}
@keyframes countPulse {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 0.7; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.camera-controls {
    display: flex; gap: 16px; margin-top: 16px; align-items: center;
}
.camera-btn {
    padding: 12px 28px; border: none; border-radius: 25px;
    font-size: 16px; font-weight: bold; cursor: pointer;
}
.camera-btn.cancel { background: #ff4444; color: #fff; }
.camera-btn.switch { background: rgba(255,255,255,0.2); color: #fff; }
.camera-rec-indicator {
    position: absolute; top: 20px; right: 20px;
    display: flex; align-items: center; gap: 8px;
    color: #ff4444; font-size: 18px; font-weight: bold;
}
.camera-rec-dot {
    width: 14px; height: 14px; border-radius: 50%; background: #ff4444;
    animation: recBlink 1s ease-in-out infinite;
}
@keyframes recBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
.camera-status {
    color: #aaa; font-size: 14px; margin-top: 8px;
}
.camera-tap-btn {
    display: inline-block; margin: 8px 0; padding: 14px 24px;
    background: linear-gradient(135deg, #4a90d9, #357abd);
    color: #fff; border-radius: 25px; font-size: 15px; font-weight: bold;
    cursor: pointer; text-align: center;
    box-shadow: 0 2px 8px rgba(74,144,217,0.4);
    animation: tapPulse 2s ease-in-out infinite;
}
.camera-tap-btn:active { transform: scale(0.95); }
@keyframes tapPulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(74,144,217,0.4); }
    50% { box-shadow: 0 2px 16px rgba(74,144,217,0.7); }
}

/* === レシート確認モーダル === */
.receipt-modal-content {
    max-width: 580px; width: 92%;
    max-height: 85vh; overflow-y: auto;
}
.receipt-meta { margin-bottom: 12px; }
.receipt-row {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.receipt-row label {
    width: 78px; font-size: 0.9em; color: #ccc; flex-shrink: 0;
}
.receipt-row select, .receipt-row input[type="text"], .receipt-row input[type="date"] {
    flex: 1; padding: 8px 10px; border-radius: 6px;
    background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.2);
    font-size: 0.95em;
}
.receipt-items-header {
    display: grid; grid-template-columns: 32px 1fr 70px 60px;
    gap: 6px; padding: 6px 4px; font-size: 0.8em; color: #888;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.receipt-item-row {
    display: grid; grid-template-columns: 32px 1fr 70px 60px;
    gap: 6px; padding: 8px 4px; align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.receipt-item-row input[type="checkbox"] {
    width: 20px; height: 20px; cursor: pointer;
}
.receipt-item-row input[type="text"], .receipt-item-row input[type="number"] {
    width: 100%; padding: 6px 8px; border-radius: 4px;
    background: rgba(255,255,255,0.08); color: #fff;
    border: 1px solid rgba(255,255,255,0.15); font-size: 0.9em;
    box-sizing: border-box;
}
.receipt-item-row input[type="number"] { text-align: right; }
.receipt-item-row.excluded { opacity: 0.4; }
.receipt-item-row.excluded input[type="text"],
.receipt-item-row.excluded input[type="number"] {
    text-decoration: line-through;
}
.receipt-total {
    text-align: right; padding: 12px 4px;
    font-weight: bold; font-size: 1.05em; color: #fff;
    border-top: 1px solid rgba(255,255,255,0.2);
    margin-top: 4px;
}
