:root {
    --accent: #b45309;
    --accent-soft: #d97706;
    --accent-subtle: rgba(180, 83, 9, 0.08);
    --accent-border: rgba(180, 83, 9, 0.2);

    --bg: #faf9f6;
    --bg-card: #ffffff;
    --bg-hover: #f5f4f1;

    --text: #1c1917;
    --text-secondary: #78716c;
    --text-muted: #a8a29e;
    --text-verse: #1c1917;

    --border: #e7e5e4;
    --border-light: #f5f5f4;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-verse: 'Playfair Display', Georgia, serif;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.app {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 32px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 16px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.brand-icon svg {
    width: 30px;
    height: 30px;
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--accent);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: all 0.3s var(--ease);
}

.status-badge.listening {
    background: var(--accent-subtle);
    border-color: var(--accent-border);
    color: var(--accent);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.status-badge.listening .status-dot {
    background: var(--accent);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(1.4);
    }
}

.btn-listen {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 100px;
    border: 1px solid var(--border);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    background: var(--text);
    color: var(--bg);
}

.btn-listen:hover {
    opacity: 0.85;
}

.btn-listen:active {
    transform: scale(0.98);
}

.btn-listen.active {
    background: #dc2626;
    border-color: #dc2626;
    color: white;
}

.btn-listen svg {
    width: 14px;
    height: 14px;
}

.content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    flex: 1;
}

.main-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.verse-card {
    position: relative;
    padding: 36px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: border-color 0.4s var(--ease);
    overflow: hidden;
}

.verse-card.has-verse {
    border-color: var(--accent-border);
}

.verse-card .empty-state {
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 0;
}

.verse-card .empty-state svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
    opacity: 0.35;
}

.verse-card .empty-state p {
    font-size: 0.9rem;
    line-height: 1.6;
}

.verse-accent-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s var(--ease);
}

.verse-card.has-verse .verse-accent-bar {
    transform: scaleX(1);
}

.verse-reference {
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 14px;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.4s var(--ease);
}

.verse-card.has-verse .verse-reference {
    opacity: 1;
    transform: translateY(0);
}

.verse-text {
    font-family: var(--font-verse);
    font-size: 1.4rem;
    line-height: 1.8;
    color: var(--text-verse);
    font-weight: 400;
}

.verse-text .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s var(--ease);
}

.verse-text .word.visible {
    opacity: 1;
    transform: translateY(0);
}

.verse-translation {
    margin-top: 18px;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 0.4s var(--ease) 0.8s;
}

.verse-card.has-verse .verse-translation {
    opacity: 1;
}

.transcript-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 160px;
}

.section-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-label .label-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-muted);
}

.section-label .label-dot.live {
    background: #16a34a;
    animation: pulse 1.5s ease-in-out infinite;
}

.transcript-content {
    flex: 1;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-secondary);
    max-height: 220px;
    scroll-behavior: smooth;
}

.transcript-content::-webkit-scrollbar {
    width: 3px;
}

.transcript-content::-webkit-scrollbar-track {
    background: transparent;
}

.transcript-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.transcript-content .interim {
    color: var(--text-muted);
    font-style: italic;
}

.transcript-content .detected-ref {
    color: var(--accent);
    font-weight: 600;
    background: var(--accent-subtle);
    padding: 1px 5px;
    border-radius: 3px;
}

.transcript-placeholder {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 36px 0;
    font-size: 0.85rem;
}

.history-panel {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 16px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 120px);
    position: sticky;
    top: 20px;
}

.history-panel .section-label {
    margin-bottom: 12px;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-list::-webkit-scrollbar {
    width: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.history-item {
    padding: 10px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    animation: slideIn 0.3s var(--ease);
}

.history-item:hover {
    border-color: var(--border);
    background: var(--bg-hover);
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(-4px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.history-item .hist-ref {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}

.history-item .hist-preview {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-empty {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 36px 0;
    font-style: italic;
}

.notification {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 100;
    transition: transform 0.4s var(--ease);
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

.notification.error {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #991b1b;
}

.notification.success {
    border-color: #d6d3d1;
    background: var(--bg-card);
    color: var(--text);
}

@media (max-width: 900px) {
    .content {
        grid-template-columns: 1fr;
    }

    .history-panel {
        position: static;
        max-height: 280px;
    }

    .verse-text {
        font-size: 1.2rem;
    }

    .verse-card {
        padding: 24px;
    }
}

@media (max-width: 500px) {
    .app {
        padding: 12px 16px;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .verse-text {
        font-size: 1.05rem;
    }
}

.app.presentation .header,
.app.presentation .transcript-section,
.app.presentation .history-panel {
    display: none;
}

.app.presentation {
    background: #0f0f0f;
    max-width: 100%;
    padding: 0;
}

.app.presentation .content {
    grid-template-columns: 1fr;
    height: 100vh;
    place-items: center;
    padding: 60px;
}

.app.presentation .verse-card {
    min-height: auto;
    max-width: 900px;
    background: transparent;
    border: none;
    text-align: center;
    padding: 40px;
}

.app.presentation .verse-accent-bar {
    display: none;
}

.app.presentation .verse-text {
    font-size: var(--fontSizePresentation, 2.6rem);
    color: #fafaf9;
    line-height: 1.6;
}

.app.presentation .verse-reference {
    font-size: 1rem;
    color: var(--accent-soft);
}

.app.presentation .verse-translation {
    color: #57534e;
}

.app.presentation .empty-state {
    color: #44403c;
}

.app.presentation .empty-state svg {
    color: #44403c;
}

/* NEW: Icons & Actions */
.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--ease);
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: var(--text-muted);
}

.manual-input-section {
    margin-top: 10px;
}

.manual-input-section form {
    display: flex;
    gap: 10px;
}

.manual-input-section input {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.manual-input-section input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-manual,
.btn-export {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s var(--ease);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-manual:hover,
.btn-export:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-export {
    margin-top: 12px;
    width: 100%;
}

/* Settings Panel */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease);
    z-index: 900;
}

.settings-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 100vw;
    background: var(--bg-card);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease);
    display: flex;
    flex-direction: column;
}

.settings-panel.show {
    transform: translateX(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.settings-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.settings-header .btn-icon {
    border: none;
    background: transparent;
}

.settings-header .btn-icon:hover {
    background: var(--bg-hover);
}

.settings-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.setting-input,
.setting-select {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 0.2s;
}

.setting-input:focus,
.setting-select:focus {
    outline: none;
    border-color: var(--accent);
}

.color-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.color-swatch:hover {
    transform: scale(1.1);
}

.color-swatch.active {
    border-color: var(--text);
    box-shadow: 0 0 0 2px var(--bg-card) inset;
}

.color-custom {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-custom::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-custom::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

/* Presentation Idle */
.presentation-idle {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0f0f0f;
    z-index: 800;
    align-items: center;
    justify-content: center;
}

.app.presentation.idle .presentation-idle {
    display: flex;
}

.idle-church-name {
    font-size: 3rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.15);
    letter-spacing: 0.05em;
    font-family: var(--font-ui);
}

.brand-name-watermark {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 40px;
    font-size: 1.2rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.1);
    z-index: 10;
    pointer-events: none;
}

.app.presentation .brand-name-watermark {
    display: block;
}