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

:root {
    --primary: #007AFF;
    --primary-hover: #0051D5;
    --secondary: #5856D6;
    --success: #34C759;
    --danger: #FF3B30;
    --warning: #FF9500;
    
    /* iOS-style dark mode colors */
    --bg-main: #000000;
    --bg-grouped: #1C1C1E;
    --bg-card: #2C2C2E;
    --bg-elevated: #3A3A3C;
    --text-primary: #FFFFFF;
    --text-secondary: #AEAEB2;
    --text-tertiary: #636366;
    --separator: rgba(84, 84, 88, 0.65);
    --fill-tertiary: rgba(118, 118, 128, 0.24);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--bg-main);
    min-height: 100vh;
    padding: 16px;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

header {
    background: transparent;
    color: var(--text-primary);
    padding: 32px 0 24px 0;
    text-align: center;
    border-bottom: none;
    margin-bottom: 24px;
}

header h1 {
    font-size: 2.25rem;
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -1px;
}

.tagline {
    font-size: 1.0625rem;
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.3px;
}

main {
    padding: 0;
}

section {
    margin-bottom: 32px;
}

h3 {
    font-size: 0.8125rem;
    font-weight: 400;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: -0.08px;
    padding: 0 20px;
}

.desktop-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.desktop-row > section {
    margin-bottom: 0;
}

@media (min-width: 768px) {
    body {
        padding: 32px;
    }
    
    header {
        padding: 40px 0 32px 0;
    }
    
    header h1 {
        font-size: 2.75rem;
        margin-bottom: 12px;
    }
    
    .tagline {
        font-size: 1.125rem;
    }
    
    main {
        padding: 0;
    }
    
    section {
        margin-bottom: 40px;
    }

    .desktop-row {
        flex-direction: row;
        gap: 16px;
        margin-bottom: 40px;
    }

    .desktop-row > section {
        flex: 1;
        width: 50%;
    }
}

.control-panel {
    text-align: center;
    padding: 10px 0;
}

.main-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

@media (min-width: 768px) {
    .main-controls {
        flex-direction: row;
        gap: 15px;
    }
}

.main-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 24px;
    border-radius: 14px;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    max-width: 280px;
    letter-spacing: -0.4px;
    min-height: 50px;
}

.page-turn-btn {
    background: var(--fill-tertiary);
    color: var(--text-primary);
    border: none;
    padding: 15px 24px;
    border-radius: 14px;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    max-width: 280px;
    letter-spacing: -0.4px;
    min-height: 50px;
}

@media (min-width: 768px) {
    .main-btn,
    .page-turn-btn {
        width: auto;
        min-width: 170px;
    }
}

.page-turn-btn:hover {
    background: rgba(118, 118, 128, 0.32);
}

.main-btn:hover {
    background: var(--primary-hover);
}

.main-btn:active,
.page-turn-btn:active {
    transform: scale(0.96);
}

.main-btn.active {
    background: var(--danger);
    animation: pulse 2s infinite;
}

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

.mic-icon {
    font-size: 1.5rem;
    animation: none;
}

.main-btn.active .mic-icon {
    animation: bounce 1.5s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 8px 16px;
    background: var(--light);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
}

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

.status-indicator.listening .status-dot {
    background: var(--success);
    animation: blink 1.5s infinite;
}

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

.mood-indicator {
    display: none !important; /* Hidden - user finds mood indicators distracting */
}

.mood-indicator.mood-pulse {
    animation: moodPulse 0.5s ease;
}

@keyframes moodPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.ai-mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 15px;
    padding: 10px 20px;
    background: var(--primary);
    border-radius: 25px;
    color: white;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

.ai-mode-indicator.keyword-mode {
    background: var(--primary);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.audio-control-section,
.transcript-section,
.keywords-info {
    background: var(--bg-grouped);
    padding: 16px;
    border-radius: 10px;
    border: none;
}

.audio-control-section {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.audio-main {
    flex: 1;
}

.active-sounds-container h3 {
    margin-top: 12px;
}

.volume-controls {
    display: flex;
    gap: 20px;
    padding: 10px;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.volume-slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.volume-slider-container label {
    font-size: 0.75rem;
    margin: 0;
}

.slider-vertical {
    writing-mode: bt-lr;
    -webkit-appearance: slider-vertical;
    width: 8px;
    height: 120px;
    padding: 0;
    background: var(--border-color);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.slider-vertical::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-vertical::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

.slider-vertical::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.slider-vertical::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

.volume-value {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.audio-notice {
    background: rgba(245, 158, 11, 0.15);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(245, 158, 11, 0.3);
    margin-bottom: 15px;
}

.audio-notice h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.audio-notice p {
    margin-bottom: 8px;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.85rem;
}

.audio-notice p:last-child {
    margin-bottom: 0;
}

.audio-notice code {
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--text-primary);
}

.control-group {
    margin-bottom: 12px;
}

.control-group:last-child {
    margin-bottom: 0;
}

label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8125rem;
    font-weight: 400;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: -0.08px;
}

.icon {
    font-size: 1.1rem;
}

select,
.slider {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 1.0625rem;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 400;
    letter-spacing: -0.4px;
}

select:focus,
.slider:focus {
    outline: none;
    background: var(--bg-elevated);
}

.slider {
    -webkit-appearance: none;
    height: 6px;
    background: var(--border-color);
    border: none;
    padding: 0;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

.sounds-list {
    min-height: 60px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.sound-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sound-badge.oneshot {
    background: var(--warning);
    animation: slideIn 0.3s ease, fadeOut 2s ease 0.5s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.8);
    }
}

.placeholder {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.85rem;
}

.reset-btn {
    width: 100%;
    padding: 14px;
    background: var(--fill-tertiary);
    color: var(--text-primary);
    border: none;
    border-radius: 10px;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 16px;
    letter-spacing: -0.4px;
}

.reset-btn:hover:not(:disabled) {
    background: rgba(118, 118, 128, 0.32);
}

.reset-btn:disabled {
    background: var(--fill-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.5;
}

.transcript {
    background: var(--bg-card);
    padding: 16px;
    border-radius: 10px;
    min-height: 100px;
    max-height: 150px;
    overflow-y: auto;
    border: none;
    font-size: 1.0625rem;
    line-height: 1.47;
    letter-spacing: -0.4px;
}

.transcript-line {
    margin-bottom: 8px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.transcript-line:last-child {
    margin-bottom: 0;
}

.highlight {
    background: rgba(99, 102, 241, 0.2);
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
    color: var(--primary);
}

.keywords-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.keyword-item {
    background: var(--bg-card);
    padding: 12px 16px;
    border-radius: 10px;
    border: none;
    font-size: 0.9375rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    font-weight: 400;
    letter-spacing: -0.3px;
}

.keyword-item:hover {
    background: var(--bg-elevated);
    transform: scale(1.01);
}

.tip {
    background: rgba(0, 122, 255, 0.12);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 400;
    color: var(--text-secondary);
    border: none;
    line-height: 1.47;
    letter-spacing: -0.3px;
}

.story-script {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 10px;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    max-height: 400px;
    overflow-y: auto;
}

.story-script p {
    margin-bottom: 16px;
    line-height: 1.6;
}

.story-script p:last-child {
    margin-bottom: 0;
}

.story-script strong {
    color: var(--text-primary);
    font-weight: 600;
}

.story-script em {
    color: var(--primary);
    font-style: italic;
    font-weight: 500;
}

.story-script .tip {
    margin-top: 16px;
}

.accordion-section {
    background: var(--bg-grouped);
    border-radius: 10px;
    margin-bottom: 0;
    overflow: hidden;
    border: none;
}

.accordion-header {
    width: 100%;
    background: var(--bg-grouped);
    border: none;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.4px;
}

.accordion-header:hover {
    background: rgba(118, 118, 128, 0.18);
}

.accordion-icon {
    transition: transform 0.2s ease;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.6;
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 15px;
}

.accordion-content.active {
    max-height: 1000px;
    padding: 0 15px 12px 15px;
}

footer {
    background: var(--bg-main);
    color: var(--text-secondary);
    padding: 12px 20px;
    text-align: center;
    font-size: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.reset-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px 50px;
    border-radius: 20px;
    font-size: 2rem;
    font-weight: 700;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.reset-indicator.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-elevated);
    padding: 25px;
    border-radius: 16px;
    max-width: 400px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.modal-content h2 {
    margin-bottom: 12px;
    color: var(--danger);
    font-size: 1.3rem;
}

.modal-content p {
    margin-bottom: 18px;
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 0.9rem;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover {
    background: var(--primary-dark);
}

/* Save Dialog Styles */
.save-dialog-info {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 12px;
}

.save-dialog-info p {
    margin: 8px 0;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.save-dialog-info span {
    color: var(--primary);
    font-weight: 600;
}

.save-dialog-input {
    margin: 20px 0;
    text-align: left;
}

.save-dialog-input label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.save-dialog-input input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--separator);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.save-dialog-input input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-elevated);
}

.save-dialog-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.save-dialog-buttons button {
    flex: 1;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--separator);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
}

.conversion-progress {
    margin: 20px 0;
    text-align: center;
}

.conversion-progress p {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.conversion-progress.hidden {
    display: none;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    width: 0%;
}

/* Playback Page Styles */
.playback-section {
    max-width: 600px;
    margin: 0 auto;
}

.recording-info {
    text-align: center;
    margin-bottom: 32px;
}

.recording-info h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.recording-meta {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.audio-player {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

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

.progress-container {
    width: 100%;
}

.progress-bar-playback {
    width: 100%;
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 8px;
}

.progress-played {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.1s ease;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.playback-buttons {
    text-align: center;
}

.control-btn {
    background: var(--primary);
    border: none;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.05);
}

.volume-control-playback {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-control-playback label {
    font-size: 1.2rem;
}

.volume-control-playback input {
    flex: 1;
}

.volume-control-playback span {
    min-width: 45px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.action-buttons button {
    flex: 1;
}

.back-button {
    text-align: center;
}

.back-button button {
    width: 100%;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #E02020;
}

@media (max-width: 768px) {
    .main-btn {
        padding: 12px 30px;
        font-size: 1.1rem;
    }

    .keywords-grid {
        grid-template-columns: 1fr;
    }

    .reset-indicator {
        font-size: 1.5rem;
        padding: 20px 40px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 30px 20px;
    }

    header h1 {
        font-size: 1.8rem;
    }

    main {
        padding: 15px;
    }

    .main-btn {
        width: 100%;
        padding: 16px 30px;
        font-size: 1rem;
    }
}
