/* AI Voice Caddie - Golf Green Theme */
:root {
    --green-900: #14532d;
    --green-800: #166534;
    --green-700: #15803d;
    --green-600: #16a34a;
    --green-500: #22c55e;
    --green-400: #4ade80;
    --green-100: #dcfce7;
    --green-50: #f0fdf4;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --red-500: #ef4444;
    --blue-500: #3b82f6;
    --yellow-500: #eab308;
    --shadow: 0 1px 3px rgba(0,0,0,0.12);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --radius: 12px;
    --tab-bar-height: 50px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100dvh;
}

.screen { display: none; height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }

/* Login */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
    background: linear-gradient(135deg, var(--green-800), var(--green-600));
    color: white;
    text-align: center;
}
.login-logo { font-size: 4rem; margin-bottom: 1rem; }
.login-container h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
.login-subtitle { opacity: 0.9; margin-bottom: 2rem; font-size: 0.95rem; }

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--green-800);
    color: white;
    flex-shrink: 0;
}
.header-title { font-size: 1.1rem; font-weight: 700; }
.header-actions { display: flex; gap: 8px; align-items: center; }
.header-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
}
.header-btn:hover { opacity: 1; }

/* Tabs */
.tab-content {
    flex: 1;
    overflow: hidden;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0));
}
.tab-pane {
    display: none;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.tab-pane.active { display: flex; flex-direction: column; }

.tab-bar {
    display: flex;
    background: white;
    border-top: 1px solid var(--gray-200);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 9000;
}
.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 0.6rem;
    cursor: pointer;
    transition: color 0.2s;
    min-width: 0;
}
.tab-btn svg { width: 20px; height: 20px; }
.tab-btn.active { color: var(--green-700); }
.tab-btn svg { transition: stroke 0.2s; }

/* Chat */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-welcome {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}
.welcome-icon { font-size: 3rem; margin-bottom: 1rem; }
.chat-welcome p { line-height: 1.6; }

.chat-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 0.95rem;
    word-break: break-word;
}
.chat-bubble.user {
    background: var(--green-600);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
    background: white;
    color: var(--gray-900);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow);
}
.chat-bubble.assistant strong { color: var(--green-800); font-weight: 700; }
.chat-bubble.assistant em { color: var(--green-700); font-style: normal; font-weight: 600; }
.chat-bubble.assistant code {
    background: var(--green-100);
    color: var(--green-900);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.9em;
}
.chat-bullet {
    display: block;
    padding-left: 1em;
    text-indent: -0.7em;
}
.chat-bullet::before { content: "• "; color: var(--green-600); font-weight: 700; }
.chat-bubble.typing {
    background: white;
    align-self: flex-start;
    box-shadow: var(--shadow);
}
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
    width: 8px; height: 8px;
    background: var(--gray-300);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

.chat-quick-actions {
    display: flex;
    gap: 8px;
    padding: 8px 16px;
    overflow-x: auto;
    flex-shrink: 0;
}
.quick-btn {
    white-space: nowrap;
    padding: 6px 14px;
    background: var(--green-100);
    color: var(--green-800);
    border: 1px solid var(--green-400);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    flex-shrink: 0;
}
.quick-btn:active { background: var(--green-400); color: white; }

.chat-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border-top: 1px solid var(--gray-200);
    flex-shrink: 0;
}
#chat-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
}
#chat-input:focus { border-color: var(--green-500); }

.mic-btn, .send-btn {
    width: 44px; height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.mic-btn {
    background: var(--green-600);
    color: white;
}
.mic-btn.listening {
    background: var(--red-500);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239,68,68,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.send-btn { background: var(--green-600); color: white; }

/* Score */
.score-section { padding: 16px; }
.primary-btn {
    width: 100%;
    padding: 14px;
    background: var(--green-600);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.primary-btn:active { background: var(--green-700); }
.secondary-btn {
    padding: 10px 20px;
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
}

.round-header {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}
.course-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.95rem;
}
.finish-btn {
    padding: 8px 16px;
    background: var(--gray-700);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.score-summary {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.summary-item {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.summary-label { display: block; font-size: 0.75rem; color: var(--gray-500); }
.summary-value { display: block; font-size: 1.5rem; font-weight: 700; color: var(--green-800); }

.voice-score-area { margin-bottom: 12px; }
.voice-score-btn {
    width: 100%;
    padding: 12px;
    background: var(--green-100);
    color: var(--green-800);
    border: 2px dashed var(--green-400);
    border-radius: var(--radius);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.voice-score-btn.listening {
    background: #fef2f2;
    border-color: var(--red-500);
    color: var(--red-500);
    animation: pulse 1.5s infinite;
}
.voice-status {
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-top: 6px;
    min-height: 1.2em;
}

.holes-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 4px;
    margin-bottom: 80px;
}
.hole-cell {
    text-align: center;
    padding: 6px 2px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: var(--shadow);
    min-width: 0;
}
.hole-cell .hole-num { font-size: 0.6rem; color: var(--gray-500); }
.hole-cell .hole-par { font-size: 0.55rem; color: var(--gray-400); }
.hole-cell .hole-score {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-900);
    min-height: 1.3em;
}
.hole-cell.birdie .hole-score { color: #dc2626; }
.hole-cell.eagle .hole-score { color: #dc2626; }
.hole-cell.bogey .hole-score { color: #2563eb; }
.hole-cell.double-bogey .hole-score { color: #7c3aed; }
.hole-cell.worse .hole-score { color: #7c3aed; }
.hole-cell.par-score .hole-score { color: var(--green-700); }
.hole-cell .hole-putts { font-size: 0.55rem; color: var(--gray-400); }

/* ── Quick Score Panel ── */
.quick-score-panel {
    position: fixed;
    bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0));
    left: 0; right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
    padding: 12px 16px 16px;
    z-index: 90;
    animation: qspSlideUp 0.2s ease-out;
}
@keyframes qspSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.qsp-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.qsp-hole-label {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-800);
}
.qsp-par-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}
.qsp-detail-btn {
    margin-left: auto;
    padding: 4px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    color: var(--gray-600);
    font-size: 0.8rem;
    cursor: pointer;
}
.qsp-close-btn {
    padding: 4px 8px;
    border: none;
    background: none;
    color: var(--gray-400);
    font-size: 1.1rem;
    cursor: pointer;
}
.qsp-scores {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}
.qsp-score-btn {
    min-width: 52px;
    padding: 10px 4px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    border: 2px solid var(--gray-200);
    background: white;
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
    transition: transform 0.1s;
}
.qsp-score-btn:active { transform: scale(0.95); }
.qsp-score-btn .qsp-strokes { display: block; font-size: 1rem; }
.qsp-score-btn.eagle { border-color: #dc2626; color: #dc2626; }
.qsp-score-btn.birdie { border-color: #dc2626; color: #dc2626; }
.qsp-score-btn.par-score { border-color: var(--green-600); color: var(--green-700); background: var(--green-50, #f0fdf4); }
.qsp-score-btn.bogey { border-color: #2563eb; color: #2563eb; }
.qsp-score-btn.double-bogey { border-color: #7c3aed; color: #7c3aed; }
.qsp-score-btn.worse { border-color: #7c3aed; color: #7c3aed; }
.qsp-score-btn.eagle.selected { background: #dc2626; color: white; }
.qsp-score-btn.birdie.selected { background: #dc2626; color: white; }
.qsp-score-btn.par-score.selected { background: var(--green-600); color: white; border-color: var(--green-600); }
.qsp-score-btn.bogey.selected { background: #2563eb; color: white; }
.qsp-score-btn.double-bogey.selected { background: #7c3aed; color: white; }
.qsp-score-btn.worse.selected { background: #7c3aed; color: white; }
.qsp-putts {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}
.qsp-putts-label {
    font-size: 0.85rem;
    color: var(--gray-500);
    font-weight: 600;
}
.qsp-putt-btns {
    display: flex;
    gap: 6px;
}
.qsp-putt-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    background: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
    color: var(--gray-700);
}
.qsp-putt-btn:active { transform: scale(0.95); }

/* ── Offline recording indicator ── */
.voice-score-btn.recording {
    background: #fef2f2;
    border-color: #ef4444;
    border-style: solid;
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

/* ── Dark mode: Quick Score Panel ── */
body.dark-mode .quick-score-panel { background: #1e293b; border-top-color: #334155; }
body.dark-mode .qsp-hole-label { color: #86efac; }
body.dark-mode .qsp-par-label { color: #94a3b8; }
body.dark-mode .qsp-detail-btn { background: #334155; border-color: #475569; color: #94a3b8; }
body.dark-mode .qsp-close-btn { color: #64748b; }
body.dark-mode .qsp-score-btn { background: #0f172a; border-color: #334155; }
body.dark-mode .qsp-score-btn.par-score { background: #14532d; }
body.dark-mode .qsp-score-btn.eagle.selected { background: #dc2626; color: white; }
body.dark-mode .qsp-score-btn.birdie.selected { background: #dc2626; color: white; }
body.dark-mode .qsp-score-btn.par-score.selected { background: var(--green-600); color: white; }
body.dark-mode .qsp-score-btn.bogey.selected { background: #2563eb; color: white; }
body.dark-mode .qsp-score-btn.double-bogey.selected { background: #7c3aed; color: white; }
body.dark-mode .qsp-score-btn.worse.selected { background: #7c3aed; color: white; }
body.dark-mode .qsp-putt-btn { background: #0f172a; border-color: #334155; color: #e2e8f0; }

.holes-label {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--green-800);
    padding: 6px 0 2px;
}

.round-history { margin-top: 20px; }
.round-history h3 { font-size: 0.95rem; margin-bottom: 8px; color: var(--gray-700); }
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: white;
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
}
.history-item .hi-course { font-weight: 600; }
.history-item .hi-date { font-size: 0.8rem; color: var(--gray-500); }
.history-item .hi-score { font-size: 1.2rem; font-weight: 700; color: var(--green-800); }

/* Distance */
.distance-display {
    text-align: center;
    padding: 3rem 1rem 2rem;
}
.distance-value {
    font-size: 5rem;
    font-weight: 800;
    color: var(--green-800);
    line-height: 1;
}
.distance-unit {
    font-size: 1.2rem;
    color: var(--gray-500);
    margin-top: 4px;
}
.distance-desc {
    font-size: 0.85rem;
    color: var(--gray-400);
    margin-top: 8px;
}
.distance-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 0 16px;
}
.distance-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.gps-status { font-size: 0.85rem; color: var(--gray-500); }
.pin-info { font-size: 0.85rem; color: var(--gray-500); }
.club-suggest {
    margin: 16px;
    padding: 16px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.club-suggest h3 { font-size: 0.95rem; margin-bottom: 8px; color: var(--green-800); }
#club-suggest-content { font-size: 0.9rem; line-height: 1.6; }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}
.stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--green-800); }
.stat-label { display: block; font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }
.recent-rounds { padding: 0 16px 80px; }
.recent-rounds h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--gray-700); }

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    padding-bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 0));
}
.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
}
.modal-content h3 { margin-bottom: 16px; font-size: 1.1rem; }
.modal-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.modal-fields label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--gray-700);
}
.modal-fields input, .modal-fields select {
    width: 120px;
    padding: 8px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 1rem;
    text-align: center;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
.modal-actions .primary-btn { width: auto; padding: 10px 24px; }
.modal-actions .secondary-btn { padding: 10px 20px; }

/* Settings */
.settings-content { max-width: 320px; }
.settings-group { margin-bottom: 20px; }
.settings-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}
.settings-value {
    font-weight: 700;
    color: var(--green-700);
    font-size: 1rem;
}
.settings-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--gray-200);
    border-radius: 3px;
    outline: none;
}
.settings-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--green-600);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: var(--shadow);
}
.settings-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray-400);
    margin-top: 4px;
}
.settings-select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}

/* Swing Tab */
.swing-main-view { padding: 0 0 80px; overflow-y: auto; }

.swing-upload-section { padding: 16px; }
.swing-upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 2px dashed var(--green-400);
    border-radius: var(--radius);
    background: var(--green-50);
    cursor: pointer;
    transition: background 0.2s;
}
.swing-upload-area:active { background: var(--green-100); }
.upload-text { font-size: 1rem; font-weight: 600; color: var(--green-800); margin-top: 8px; }
.upload-hint { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }

.swing-upload-btns {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.swing-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: white;
    border: 1px solid var(--green-400);
    border-radius: var(--radius);
    color: var(--green-800);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.swing-action-btn:active { background: var(--green-100); }

.swing-settings-row {
    display: flex;
    gap: 8px;
    padding: 0 16px 8px;
}
.swing-setting {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.75rem;
    color: var(--gray-500);
}
.swing-setting select {
    padding: 6px 4px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.8rem;
    background: white;
}

.swing-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 12px 16px;
}

.swing-history { padding: 0 16px 16px; }
.swing-history h3 { font-size: 0.95rem; margin-bottom: 12px; color: var(--gray-700); }

.swing-empty { text-align: center; padding: 2rem; color: var(--gray-500); }
.swing-empty-hint { font-size: 0.8rem; margin-top: 8px; color: var(--gray-400); }

/* Processing View */
.swing-processing-view {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
}
.swing-proc-content {
    text-align: center;
    width: 100%;
    max-width: 320px;
}
.swing-preview {
    width: 100%;
    max-height: 200px;
    border-radius: var(--radius);
    background: #000;
    margin-bottom: 16px;
    object-fit: cover;
}
.swing-progress-wrap {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}
.swing-progress-bar {
    height: 100%;
    background: var(--green-600);
    border-radius: 3px;
    transition: width 0.3s;
}
.swing-proc-status {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin-bottom: 12px;
}
.swing-proc-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--green-600);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton Section - full-bleed */
#swing-skeleton-section {
    margin-left: -16px;
    margin-right: -16px;
}
#swing-skeleton-section > h4 {
    padding: 0 16px;
}

/* Phase chips for video replay (PR #C) */
.phase-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 0 16px;
}
.phase-chip {
    flex: 1 1 auto;
    min-width: 64px;
    padding: 8px 4px;
    border-radius: 999px;
    border: 2px solid currentColor;
    background: #fff;
    color: var(--green-700);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.phase-chip:hover, .phase-chip.active { background: var(--green-50, #f0fdf4); }
.phase-chip.address { color: #2563eb; }
.phase-chip.top     { color: #16a34a; }
.phase-chip.impact  { color: #dc2626; }
.phase-chip.finish  { color: #9333ea; }
.phase-chips-hint {
    text-align: center;
    color: #6b7280;
    font-size: 0.75rem;
    margin: 6px 0 0;
}
body.dark-mode .phase-chip { background: #111827; }
body.dark-mode .phase-chip:hover, body.dark-mode .phase-chip.active { background: #1f2937; }
body.dark-mode .phase-chips-hint { color: #9ca3af; }

/* Skeleton Grid - horizontal scroll, each card ~85vw */
.skeleton-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 12px;
    margin-bottom: 4px;
}
.skeleton-grid::-webkit-scrollbar { display: none; }
.skeleton-grid { scrollbar-width: none; }

.skeleton-cell {
    position: relative;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    flex: 0 0 82vw;
    max-width: 400px;
    scroll-snap-align: center;
}
.skeleton-phase-label {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0,0,0,0.55);
    padding: 3px 12px;
    border-radius: 12px;
    z-index: 2;
    letter-spacing: 0.5px;
}
.skeleton-frame-img {
    display: block;
    width: 100%;
    height: auto;
}
.skeleton-canvas-sm {
    display: block;
    width: 100%;
    height: auto;
}
/* When img is present, canvas overlays on top */
.skeleton-cell.has-frame .skeleton-canvas-sm {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
/* Scroll indicator dots */
.skeleton-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding-bottom: 8px;
}
.skeleton-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--gray-300);
    transition: background 0.2s;
}
.skeleton-dot.active {
    background: var(--green-600);
}

.swing-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: var(--radius);
    margin-bottom: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
}
.shi-score {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.shi-score.score-good { background: var(--green-600); }
.shi-score.score-ok { background: var(--yellow-500); }
.shi-score.score-low { background: var(--red-500); }
.shi-info { flex: 1; }
.shi-club { font-weight: 600; font-size: 0.9rem; }
.shi-date { font-size: 0.8rem; color: var(--gray-500); }
.shi-delete-btn {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--gray-300);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}
.shi-delete-btn:active,
.shi-delete-btn.confirm { color: #fff; background: var(--red-500); }
.swing-history-item.delete-pending { background: #fef2f2; border: 1px solid var(--red-500); }
body.dark-mode .swing-history-item.delete-pending { background: #451a1a; border-color: #f87171; }

/* Swing Detail */
.swing-detail { padding: 16px; overflow-y: auto; }
.swing-score-card {
    text-align: center;
    padding: 24px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    color: white;
}
.swing-score-card.good { background: var(--green-600); }
.swing-score-card.ok { background: var(--yellow-500); }
.swing-score-card.low { background: var(--red-500); }
.swing-score-value { font-size: 3.5rem; font-weight: 800; line-height: 1; }
.swing-score-label { font-size: 0.9rem; opacity: 0.9; margin-top: 4px; }

.swing-section { margin-bottom: 16px; }
.swing-section h4 { font-size: 0.95rem; color: var(--green-800); margin-bottom: 8px; }
.swing-point {
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.swing-point.good { border-left: 3px solid var(--green-500); }
.swing-point.improve { border-left: 3px solid var(--yellow-500); }
.priority-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px; height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    margin-top: 2px;
}
.priority-badge.p1 { background: var(--red-500); }
.priority-badge.p2 { background: #f97316; }
.priority-badge.p3 { background: var(--gray-300); color: var(--gray-700); }

.swing-drill {
    padding: 10px 12px;
    background: var(--green-50);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}
.swing-drill strong { color: var(--green-800); }

.swing-advice {
    text-align: center;
    padding: 12px;
    font-style: italic;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.metrics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.metrics-table th, .metrics-table td {
    padding: 8px;
    border-bottom: 1px solid var(--gray-200);
    text-align: center;
}
.metrics-table th { background: var(--gray-50); color: var(--gray-700); font-weight: 600; }
.metrics-table td:first-child { text-align: left; }
.metric-good { color: var(--green-600); font-weight: 600; }
.metric-work { color: var(--yellow-500); font-weight: 600; }
.metric-desc { font-size: 0.72rem; color: #9ca3af; font-weight: normal; margin-top: 2px; line-height: 1.3; }
.metric-tap-hint { font-size: 0.75rem; color: #9ca3af; text-align: center; margin-bottom: 8px; }
.landmark-quality-banner { margin: 8px 0 12px; padding: 10px 12px; border-radius: 8px; font-size: 0.82rem; line-height: 1.4; }
.landmark-quality-banner.low { background: #fef3c7; color: #92400e; border-left: 3px solid #f59e0b; }
.landmark-quality-banner.medium { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }
.metric-row { cursor: pointer; transition: background 0.15s; }
.metric-row:active { background: #f0fdf4; }
.metric-row-active { background: #f0fdf4; }
.metric-drill-row td { padding: 0 !important; border-bottom: 1px solid #e5e7eb; }
.metric-drill-content { background: #f0fdf4; padding: 12px 14px; font-size: 0.8rem; color: #374151; line-height: 1.6; border-left: 3px solid #22c55e; }

/* Course Search */
.course-search-wrap { position: relative; }
.course-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: var(--shadow-lg);
}
#new-round-modal .modal-content { overflow: visible; }
.course-suggest-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
}
.course-suggest-item:last-child { border-bottom: none; }
.course-suggest-item:active { background: var(--green-50); }
.csi-name { font-weight: 600; font-size: 0.9rem; }
.csi-info { font-size: 0.75rem; color: var(--gray-500); margin-top: 2px; }

.par-preview {
    background: var(--green-50);
    border: 1px solid var(--green-400);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.8rem;
}
.pp-header {
    font-weight: 700;
    color: var(--green-800);
    margin-bottom: 6px;
    font-size: 0.85rem;
}
.pp-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.pp-label {
    font-weight: 600;
    color: var(--green-700);
    width: 28px;
    flex-shrink: 0;
}
.pp-pars {
    flex: 1;
    color: var(--gray-700);
    font-family: monospace;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}
.pp-total {
    font-weight: 700;
    color: var(--green-800);
    width: 24px;
    text-align: right;
}
.pp-ai-note {
    margin-top: 6px;
    font-size: 0.7rem;
    color: var(--gray-400);
    font-style: italic;
}

/* Skeleton Zoom Modal */
.skeleton-zoom-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 200;
    display: flex;
    flex-direction: column;
}
.skeleton-zoom-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    flex-shrink: 0;
}
.skeleton-zoom-title {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}
.skeleton-zoom-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.skeleton-zoom-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transform-origin: center center;
    touch-action: none;
}
.skeleton-zoom-wrap {
    position: relative;
    display: inline-block;
    transform-origin: center center;
    touch-action: none;
}
.skeleton-zoom-img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}
.skeleton-zoom-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}
.skeleton-zoom-hint {
    text-align: center;
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0));
    flex-shrink: 0;
}

/* Upload Guidance */
.upload-guidance {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 6px;
    text-align: center;
}

/* Voice + Advice Row */
.voice-advice-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.hole-advice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    background: var(--green-50);
    color: var(--green-800);
    border: 2px dashed var(--green-400);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.hole-advice-btn:active { background: var(--green-100); }

/* Chart Section */
.chart-section {
    padding: 0 16px 16px;
}
.chart-section h3 {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin-bottom: 8px;
}
.chart-section canvas {
    width: 100%;
    height: 180px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Swing Trend */
.swing-trend-section {
    padding: 12px 16px;
}

/* Practice Plan */
.practice-plan-section {
    padding: 0 16px 16px;
}
.practice-plan-section h3 {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin-bottom: 8px;
}
.practice-area-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    box-shadow: var(--shadow);
    font-size: 0.9rem;
}
.practice-area-item.p1 { border-left: 3px solid var(--red-500); }
.practice-area-item.p2 { border-left: 3px solid #f97316; }
.practice-area-item.p3 { border-left: 3px solid var(--gray-300); }
.practice-count-badge {
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: auto;
    flex-shrink: 0;
}
.practice-drill-item {
    padding: 10px 12px;
    background: var(--green-50);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}
.practice-drill-item strong { color: var(--green-800); }
.practice-drill-item .drill-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Swing Comparison */
.swing-comparison {
    margin-top: 12px;
}
.comparison-scores {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.comparison-card {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: var(--radius);
    background: white;
    box-shadow: var(--shadow);
}
.comparison-card .comp-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 4px;
}
.comparison-card .comp-score {
    font-size: 2rem;
    font-weight: 800;
}
.comparison-card .comp-date {
    font-size: 0.7rem;
    color: var(--gray-400);
    margin-top: 2px;
}
.comp-diff {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 8px;
}
.comp-diff.improved { color: var(--green-600); }
.comp-diff.worsened { color: var(--red-500); }
.comp-diff.same { color: var(--gray-500); }
.comparison-metrics {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 8px;
}
.comparison-metrics th, .comparison-metrics td {
    padding: 8px;
    border-bottom: 1px solid var(--gray-200);
    text-align: center;
}
.comparison-metrics th { background: var(--gray-50); color: var(--gray-700); font-weight: 600; }
.comparison-metrics td:first-child { text-align: left; }
.comp-better { color: var(--green-600); font-weight: 600; }
.comp-worse { color: var(--red-500); font-weight: 600; }

/* Round Summary Modal */
.round-summary-score {
    text-align: center;
    padding: 16px 0;
}
.round-summary-score .rs-score {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--green-800);
    line-height: 1;
}
.round-summary-score .rs-vs-par {
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 4px;
}
.rs-vs-par.over { color: var(--red-500); }
.rs-vs-par.under { color: var(--green-600); }
.rs-vs-par.even { color: var(--gray-500); }
.round-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin: 12px 0;
}
.rs-stat {
    text-align: center;
    padding: 8px;
    background: var(--gray-50);
    border-radius: 8px;
}
.rs-stat .rs-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--green-800);
}
.rs-stat .rs-stat-label {
    font-size: 0.7rem;
    color: var(--gray-500);
}
.round-summary-ai {
    padding: 12px;
    background: var(--green-50);
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--gray-700);
    margin-top: 8px;
}

/* Dark Mode */
body.dark-mode {
    background: #0f172a;
    color: #f1f5f9;
    --gray-50: #111827;
    --gray-100: #1f2937;
    --gray-200: #374151;
    --gray-300: #4b5563;
    --gray-500: #9ca3af;
    --gray-700: #d1d5db;
    --gray-900: #f9fafb;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}
body.dark-mode .app-header {
    background: #0c4a1e;
}
body.dark-mode .tab-bar {
    background: #1e293b;
    border-top-color: #334155;
}
body.dark-mode .chat-bubble.assistant {
    background: #1e293b;
    color: #e2e8f0;
}
body.dark-mode .chat-bubble.typing {
    background: #1e293b;
}
body.dark-mode .chat-input-area {
    background: #1e293b;
    border-top-color: #334155;
}
body.dark-mode #chat-input {
    background: #0f172a;
    color: #f1f5f9;
    border-color: #4b5563;
}
body.dark-mode .modal-content {
    background: #1e293b;
    color: #e2e8f0;
}
body.dark-mode .modal-fields input,
body.dark-mode .modal-fields select,
body.dark-mode .modal-fields textarea {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #4b5563;
}
.modal-notes-label {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px;
}
body.dark-mode .stat-card,
body.dark-mode .summary-item,
body.dark-mode .history-item,
body.dark-mode .swing-history-item,
body.dark-mode .swing-point,
body.dark-mode .comparison-card {
    background: #1e293b;
    color: #e2e8f0;
}
body.dark-mode .hole-cell {
    background: #1e293b;
}
body.dark-mode .course-input,
body.dark-mode .settings-select {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #4b5563;
}
body.dark-mode .secondary-btn {
    background: #1e293b;
    color: #d1d5db;
    border-color: #4b5563;
}
body.dark-mode .quick-btn {
    background: #1e3a2e;
    color: #86efac;
    border-color: #22c55e;
}
body.dark-mode .swing-upload-area {
    background: #0c2618;
    border-color: #16a34a;
}
body.dark-mode .swing-setting select {
    background: #0f172a;
    color: #e2e8f0;
    border-color: #4b5563;
}
body.dark-mode .voice-score-btn {
    background: #1e3a2e;
    border-color: #22c55e;
    color: #86efac;
}
body.dark-mode .hole-advice-btn {
    background: #0c2618;
    color: #86efac;
    border-color: #22c55e;
}
body.dark-mode .swing-drill,
body.dark-mode .practice-drill-item,
body.dark-mode .round-summary-ai {
    background: #1e3a2e;
}
body.dark-mode .chart-section canvas {
    background: #1e293b;
}
body.dark-mode .metrics-table th {
    background: #111827;
}
body.dark-mode .course-suggestions {
    background: #1e293b;
    border-color: #4b5563;
}
body.dark-mode .course-suggest-item:active {
    background: #0f172a;
}
body.dark-mode .skeleton-cell {
    background: #111827;
}
body.dark-mode .practice-area-item {
    background: #1e293b;
}
body.dark-mode .rs-stat {
    background: #111827;
}
body.dark-mode .comparison-metrics th {
    background: #111827;
}
body.dark-mode .par-preview {
    background: #1e3a2e;
    border-color: #22c55e;
}
body.dark-mode .login-container {
    background: linear-gradient(135deg, #0c4a1e, #14532d);
}

/* Round Detail */
.rd-section-label { font-weight: 600; font-size: 0.8rem; margin: 10px 0 4px; color: var(--green-700); }
.rd-holes-row { border: 1px solid var(--gray-200); border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.rd-header-row, .rd-data-row { display: flex; align-items: center; }
.rd-header-row { background: var(--gray-100); font-weight: 600; }
.rd-data-row { border-top: 1px solid var(--gray-200); }
.rd-h-label { width: 36px; text-align: center; flex-shrink: 0; padding: 4px 2px; font-weight: 600; }
.rd-h-num, .rd-h-val { flex: 1; text-align: center; padding: 4px 1px; min-width: 22px; }
.rd-h-total { width: 32px; text-align: center; flex-shrink: 0; font-weight: 600; padding: 4px 2px; background: var(--gray-50); }
.rd-h-val.eagle { color: #d97706; font-weight: 700; }
.rd-h-val.birdie { color: #dc2626; font-weight: 600; }
.rd-h-val.par-score { color: var(--green-700); }
.rd-h-val.bogey { color: #2563eb; }
.rd-h-val.double-bogey { color: #7c3aed; font-weight: 600; }

/* Delete Button */
.delete-btn {
    padding: 10px 20px;
    background: transparent;
    color: var(--red-500);
    border: 1px solid var(--red-500);
    border-radius: var(--radius);
    font-size: 0.9rem;
    cursor: pointer;
}
.delete-btn:active { background: var(--red-500); color: #fff; }
.delete-btn.confirm { background: var(--red-500); color: #fff; font-weight: 700; }
body.dark-mode .delete-btn { border-color: #f87171; color: #f87171; }
body.dark-mode .delete-btn.confirm { background: #dc2626; color: #fff; }

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: env(safe-area-inset-top, 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    padding-top: 12px;
}
.toast {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: auto;
    max-width: 90vw;
    text-align: center;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}
.toast-info { background: var(--green-700); }
.toast-error { background: var(--red-500); }
.toast-warning { background: #f59e0b; }
.toast-success { background: var(--green-600); }

/* ── TV Tab ── */
.tv-settings-bar {
    padding: 10px 12px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}
.tv-setting-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.tv-setting-row:last-child { margin-bottom: 0; }
.tv-setting-label {
    font-size: 0.8rem;
    color: var(--gray-700);
    white-space: nowrap;
    min-width: 32px;
}
.tv-select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.85rem;
    background: white;
}
.tv-checkboxes {
    gap: 12px;
}
.tv-cb-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--gray-700);
    cursor: pointer;
}
.tv-cb-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--green-600);
}
.tv-date-nav {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 8px 12px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    -webkit-overflow-scrolling: touch;
}
.tv-date-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 52px;
    padding: 6px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}
.tv-date-btn.active {
    background: var(--green-600);
    color: white;
    border-color: var(--green-600);
}
.tv-date-day {
    font-size: 0.85rem;
    font-weight: 600;
}
.tv-date-wd {
    font-size: 0.65rem;
    opacity: 0.8;
}
.tv-schedule-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}
.tv-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px;
    margin-bottom: 10px;
    position: relative;
}
.tv-live-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    animation: tv-pulse 2s infinite;
}
@keyframes tv-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
.tv-tournament {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
    padding-right: 50px;
}
.tv-tour-badge {
    display: inline-block;
    background: var(--green-100);
    color: var(--green-800);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    vertical-align: middle;
}
.tv-round {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 400;
}
.tv-broadcasts {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tv-broadcast-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 4px 0;
    border-top: 1px solid var(--gray-100);
}
.tv-broadcast-row:first-child { border-top: none; }
.tv-ch-icon {
    color: var(--gray-500);
    flex-shrink: 0;
    display: flex;
}
.tv-ch-name {
    font-weight: 500;
    color: var(--gray-700);
}
.tv-local {
    font-size: 0.75rem;
    color: var(--gray-500);
}
.tv-time {
    margin-left: auto;
    color: var(--green-700);
    font-weight: 500;
    font-size: 0.8rem;
    white-space: nowrap;
}
.tv-live-dot {
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
    flex-shrink: 0;
    animation: tv-pulse 2s infinite;
}
.tv-note {
    width: 100%;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}
.tv-empty, .tv-loading {
    text-align: center;
    padding: 40px 16px;
    color: var(--gray-500);
    font-size: 0.9rem;
}

/* TV Tab Dark Mode */
.dark-mode .tv-settings-bar { background: #1e293b; border-color: #334155; }
.dark-mode .tv-select { background: #0f172a; border-color: #475569; color: #e2e8f0; }
.dark-mode .tv-date-nav { background: #1e293b; border-color: #334155; }
.dark-mode .tv-date-btn { background: #0f172a; border-color: #475569; color: #e2e8f0; }
.dark-mode .tv-date-btn.active { background: var(--green-700); border-color: var(--green-700); }
.dark-mode .tv-card { background: #1e293b; }
.dark-mode .tv-tournament { color: #f1f5f9; }
.dark-mode .tv-tour-badge { background: #064e3b; color: #6ee7b7; }
.dark-mode .tv-ch-name { color: #cbd5e1; }
.dark-mode .tv-broadcast-row { border-color: #334155; }
.dark-mode .tv-setting-label, .dark-mode .tv-cb-label { color: #94a3b8; }

/* ── Booking Tab ── */
.booking-search-bar {
    padding: 10px 12px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}
.booking-search-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.booking-keyword-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
}
.booking-gps-btn {
    width: 38px;
    height: 38px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--green-700);
}
.booking-gps-btn:active {
    background: var(--green-50);
}
.booking-search-main-btn {
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: var(--green-600);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
}
.booking-search-main-btn:active {
    background: var(--green-700);
}
.booking-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: end;
}
.booking-filter {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.booking-filter span {
    font-size: 0.7rem;
    color: var(--gray-500);
    font-weight: 600;
}
.booking-date-input,
.booking-select {
    padding: 6px 8px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 0.8rem;
    background: white;
    width: 100%;
}
.booking-price-range {
    display: flex;
    align-items: center;
    gap: 2px;
}
.booking-price-select {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    padding: 6px 4px;
}
.booking-price-sep {
    color: var(--gray-500);
    font-size: 0.75rem;
    flex-shrink: 0;
}
.booking-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}
.booking-loading,
.booking-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--gray-500);
    font-size: 0.9rem;
    line-height: 1.6;
}
.booking-course-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    overflow: hidden;
}
.booking-course-header {
    display: flex;
    gap: 10px;
    padding: 12px;
}
.booking-course-img {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.booking-course-info {
    flex: 1;
    min-width: 0;
}
.booking-course-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-900);
    line-height: 1.3;
}
.booking-course-rating {
    font-size: 0.8rem;
    color: #f59e0b;
    font-weight: 600;
}
.booking-course-address {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}
.booking-plans {
    border-top: 1px solid var(--gray-100);
}
.booking-plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    gap: 8px;
}
.booking-plan-row:last-child { border-bottom: none; }
.booking-plan-info {
    min-width: 0;
    flex: 1;
}
.booking-plan-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.booking-plan-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}
.booking-plan-price {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--green-700);
}
.booking-plan-tags {
    font-size: 0.7rem;
    color: var(--gray-500);
}
.booking-plan-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.booking-badge-available {
    font-size: 0.65rem;
    font-weight: 700;
    color: #16a34a;
    background: #dcfce7;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.booking-badge-limited {
    font-size: 0.65rem;
    font-weight: 700;
    color: #ca8a04;
    background: #fef9c3;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.booking-badge-none {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}
.booking-reserve-btn {
    padding: 6px 12px;
    background: var(--green-600);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.booking-reserve-btn:active {
    background: var(--green-700);
}

/* Booking Tab Dark Mode */
.dark-mode .booking-search-bar { background: #1e293b; border-color: #334155; }
.dark-mode .booking-keyword-input { background: #0f172a; border-color: #475569; color: #e2e8f0; }
.dark-mode .booking-gps-btn { background: #0f172a; border-color: #475569; color: #86efac; }
.dark-mode .booking-search-main-btn { background: var(--green-700); }
.dark-mode .booking-date-input,
.dark-mode .booking-select { background: #0f172a; border-color: #475569; color: #e2e8f0; }
.dark-mode .booking-course-card { background: #1e293b; }
.dark-mode .booking-course-name { color: #f1f5f9; }
.dark-mode .booking-plan-name { color: #e2e8f0; }
.dark-mode .booking-plan-row { border-color: #334155; }
.dark-mode .booking-plans { border-color: #334155; }
.dark-mode .booking-filter span { color: #94a3b8; }

/* TTS Toggle Button */
.tts-toggle-btn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: none; border-radius: 50%;
    background: var(--green-100); color: var(--green-700); cursor: pointer;
    flex-shrink: 0; transition: opacity 0.2s, background 0.2s;
}
.tts-toggle-btn:active { background: var(--green-200); }
.tts-toggle-btn.off { opacity: 0.4; background: var(--gray-200); color: var(--gray-500); }
.dark-mode .tts-toggle-btn { background: #1e3a2f; color: #86efac; }
.dark-mode .tts-toggle-btn.off { background: #334155; color: #64748b; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 2px; }

/* ── Landing Page ── */
.landing-page {
    height: 100%;
    overflow-y: auto;
    background: linear-gradient(135deg, var(--green-800) 0%, var(--green-600) 100%);
    color: white;
}
.landing-hero {
    text-align: center;
    padding: 3rem 1.5rem 2rem;
}
.landing-hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.landing-tagline { font-size: 1rem; opacity: 0.9; margin-bottom: 1.5rem; line-height: 1.6; }
.landing-cta { margin-bottom: 0.5rem; display:flex; flex-direction:column; align-items:center; }
.landing-free { font-size: 0.8rem; opacity: 0.7; margin-top: 8px; }
.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    padding: 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}
.landing-feature {
    background: rgba(255,255,255,0.12);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    backdrop-filter: blur(4px);
}
.lf-icon { font-size: 2rem; margin-bottom: 8px; }
.landing-feature h3 { font-size: 0.9rem; margin-bottom: 6px; font-weight: 600; }
.landing-feature p { font-size: 0.75rem; opacity: 0.85; line-height: 1.5; }
.landing-bottom-cta {
    text-align: center;
    padding: 2rem 1.5rem;
}
.landing-bottom-cta p { font-size: 1rem; margin-bottom: 12px; font-weight: 600; }
.landing-start-btn {
    background: white;
    color: var(--green-800);
    border: none;
    border-radius: 8px;
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}
.landing-start-btn:active { transform: scale(0.95); }
.landing-footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    opacity: 0.5;
}
.dark-mode .landing-page { background: linear-gradient(135deg, #0c2a15 0%, #14532d 100%); }

/* ── Weather Tab ── */
.weather-forecast-list { padding: 8px 12px; overflow-y: auto; flex: 1; }
.weather-loading { text-align: center; padding: 2rem; color: var(--gray-500); }
.weather-card {
    background: white; border-radius: 12px; padding: 14px;
    margin-bottom: 10px; box-shadow: var(--shadow);
    display: flex; gap: 12px; align-items: flex-start;
}
.weather-card.today { border-left: 3px solid var(--green-600); }
.weather-left { display: flex; flex-direction: column; align-items: center; min-width: 64px; gap: 4px; }
.weather-golf-score {
    width: 50px; height: 50px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.1rem; color: white;
}
.golf-score-excellent { background: var(--green-600); }
.golf-score-good { background: #84cc16; }
.golf-score-fair { background: #f59e0b; }
.golf-score-poor { background: #ef4444; }
.weather-golf-label { font-size: 0.6rem; text-align: center; color: var(--gray-500); white-space: nowrap; }
.weather-right { flex: 1; min-width: 0; }
.weather-date-label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.weather-date-label > span:first-child { font-weight: 600; font-size: 0.95rem; white-space: nowrap; }
.weather-desc { font-size: 0.8rem; color: var(--gray-500); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weekend-sat { color: #2563eb; }
.weekend-sun { color: #dc2626; }
.weather-metrics {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 4px 12px; font-size: 0.8rem; color: var(--gray-700);
}
.weather-metric { display: flex; align-items: center; gap: 4px; }
.weather-metric svg { width: 14px; height: 14px; flex-shrink: 0; }
.rain-bar { height: 4px; border-radius: 2px; background: var(--gray-200); flex: 1; max-width: 50px; }
.rain-bar-fill { height: 100%; border-radius: 2px; background: #3b82f6; }

/* Weather Dark Mode */
.dark-mode .weather-card { background: #1e293b; }
.dark-mode .weather-metrics { color: #94a3b8; }
.dark-mode .weather-desc { color: #64748b; }
.dark-mode .weather-golf-label { color: #64748b; }
.dark-mode .rain-bar { background: #334155; }

/* ── SNS Share ── */
.share-sns-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    color: white;
    transition: opacity 0.2s;
}
.share-sns-btn:active { opacity: 0.8; }
.share-x { background: #000; }
.share-line { background: #06C755; }
.share-dl { background: var(--gray-700); }
.dark-mode .share-dl { background: #475569; }

/* === Swing Analysis UI Improvements (2026-03-23) === */

/* Score level message */
.score-level-msg {
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-top: 4px;
    padding: 4px 12px;
    background: var(--gray-50);
    border-radius: 8px;
}

/* Today's Focus (1つだけ！) */
.today-focus {
    background: linear-gradient(135deg, #e0f7fa, #e8f5e9);
    border: 2px solid var(--green-400);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
}
.today-focus h4 {
    margin: 0 0 8px 0;
    font-size: 1.05rem;
    color: var(--green-800);
}
.focus-area {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--green-700);
    margin-bottom: 8px;
}
.focus-why, .focus-effect, .focus-how {
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 4px 0;
    color: var(--gray-700);
}
.focus-how {
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 8px;
    font-weight: 500;
}

/* Metrics progress bars */
.metrics-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 8px 0;
}
.metric-bar-row {
    cursor: pointer;
}
.metric-bar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 2px;
}
.metric-bar-wrap {
    height: 10px;
    background: var(--gray-200);
    border-radius: 5px;
    overflow: hidden;
}
.metric-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease;
}
.metric-bar-value {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 1px;
}

/* YouTube drill link */
.drill-youtube {
    display: inline-block;
    margin-top: 6px;
    color: #c4302b;
    font-size: 0.8rem;
    text-decoration: none;
    font-weight: 500;
}
.drill-youtube:hover {
    text-decoration: underline;
}

/* Advice styling */
.advice-text {
    font-style: italic;
    color: var(--green-700);
    text-align: center;
    padding: 8px;
    background: var(--green-50);
    border-radius: 8px;
}

/* ===== Chat History Panel ===== */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
    background: var(--green-50);
}
.chat-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-header-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-header-btn:active { background: var(--gray-200); }
.chat-header-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-700);
}

.chat-history-panel {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: white;
    z-index: 20;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
}
.chat-history-panel.open {
    transform: translateX(0);
}
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--green-50);
}
.history-header h3 {
    font-size: 1rem;
    color: var(--gray-900);
    font-weight: 700;
}
.history-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--gray-100);
}
.history-tab {
    padding: 6px 14px;
    border: 1px solid var(--gray-200);
    background: white;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--gray-500);
}
.history-tab.active {
    background: var(--green-600);
    color: white;
    border-color: var(--green-600);
}
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}
.history-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
    font-size: 0.9rem;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    border: 1px solid var(--gray-100);
    margin-bottom: 6px;
    transition: background 0.15s;
}
.history-item:active { background: var(--green-50); }
.history-item-body {
    flex: 1;
    min-width: 0;
}
.history-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}
.history-fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    font-size: 1.1rem;
    color: var(--gray-300);
    flex-shrink: 0;
}
.history-fav-btn.favorited { color: #eab308; }
.history-fav-btn:hover { color: #eab308; }
.history-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--gray-300);
    flex-shrink: 0;
}
.history-delete-btn:hover { color: var(--red-500); }
.history-delete-btn:active { color: var(--red-500); }

/* Dark mode - Chat History */
body.dark-mode .chat-header {
    background: #1e293b;
    border-bottom-color: #334155;
}
body.dark-mode .chat-header-btn { color: #94a3b8; }
body.dark-mode .chat-header-title { color: #e2e8f0; }
body.dark-mode .chat-history-panel { background: #0f172a; }
body.dark-mode .history-header { background: #1e293b; border-bottom-color: #334155; }
body.dark-mode .history-header h3 { color: #f1f5f9; }
body.dark-mode .history-tabs { border-bottom-color: #334155; }
body.dark-mode .history-tab { background: #1e293b; border-color: #334155; color: #94a3b8; }
body.dark-mode .history-tab.active { background: var(--green-600); color: white; border-color: var(--green-600); }
body.dark-mode .history-item { border-color: #334155; }
body.dark-mode .history-item:active { background: #1e293b; }
body.dark-mode .history-item-title { color: #f1f5f9; }
body.dark-mode .history-item-meta { color: #64748b; }
body.dark-mode .history-fav-btn { color: #4b5563; }
body.dark-mode .history-fav-btn:hover { color: #eab308; }
body.dark-mode .history-fav-btn.favorited { color: #eab308; }
body.dark-mode .history-delete-btn { color: #4b5563; }
body.dark-mode .history-delete-btn:hover { color: #ef4444; }
