/* ============================================================
   Zen Text Reader — calm voice
   style.css
   ============================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background: #f5f0e8;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #2d3a2a;
}

.container {
    max-width: 560px;
    width: 100%;
    padding: 40px 32px 32px;
    background: rgba(255, 252, 245, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    border: 1px solid rgba(45, 90, 39, 0.08);
    box-shadow: 0 20px 60px rgba(45, 90, 39, 0.08), 0 8px 20px rgba(45, 90, 39, 0.04);
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    animation: fadeIn 0.8s ease-out;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.logo {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #4a7a42;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo span {
    font-size: 18px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.keep-awake-btn {
    background: rgba(45, 90, 39, 0.06);
    border: none;
    color: #4a7a42;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.keep-awake-btn:hover {
    background: rgba(45, 90, 39, 0.12);
}

.keep-awake-btn.active {
    background: rgba(45, 90, 39, 0.15);
    color: #2d5a27;
}

.keep-awake-btn .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(45, 58, 42, 0.2);
    display: inline-block;
    transition: all 0.3s ease;
}

.keep-awake-btn.active .indicator {
    background: #4CAF50;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.4);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.clear-btn {
    background: rgba(45, 90, 39, 0.06);
    border: none;
    color: #4a7a42;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.clear-btn:hover {
    background: rgba(45, 90, 39, 0.12);
    color: #2d5a27;
}

.clear-btn:active {
    transform: scale(0.95);
}

/* Text Input Area */
.text-input-area {
    margin-bottom: 20px;
}

.text-input-area label {
    display: block;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(45, 58, 42, 0.3);
    margin-bottom: 6px;
}

.text-input-area textarea {
    width: 100%;
    min-height: 160px;
    padding: 18px 20px;
    border-radius: 18px;
    border: 1.5px solid rgba(45, 90, 39, 0.1);
    background: rgba(255, 252, 245, 0.7);
    font-size: 15px;
    line-height: 1.7;
    font-family: inherit;
    color: #2d3a2a;
    resize: vertical;
    transition: all 0.3s ease;
    outline: none;
    letter-spacing: 0.2px;
}

.text-input-area textarea:focus {
    border-color: rgba(45, 90, 39, 0.3);
    background: rgba(255, 252, 245, 0.95);
    box-shadow: 0 0 0 4px rgba(45, 90, 39, 0.04);
}

.text-input-area textarea::placeholder {
    color: rgba(45, 58, 42, 0.25);
    font-style: italic;
}

.input-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.input-actions button {
    padding: 8px 18px;
    border-radius: 20px;
    border: none;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-paste {
    background: rgba(45, 90, 39, 0.08);
    color: #4a7a42;
}

.btn-paste:hover {
    background: rgba(45, 90, 39, 0.15);
}

.btn-clear {
    background: rgba(200, 50, 50, 0.06);
    color: #b34a4a;
}

.btn-clear:hover {
    background: rgba(200, 50, 50, 0.12);
}

.btn-sample {
    background: rgba(45, 90, 39, 0.04);
    color: #4a7a42;
    border: 1px solid rgba(45, 90, 39, 0.08);
}

.btn-sample:hover {
    background: rgba(45, 90, 39, 0.1);
}

/* Status */
.status {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    display: none;
    font-size: 13px;
    font-weight: 400;
    text-align: center;
    letter-spacing: 0.3px;
    transition: all 0.4s ease;
}

.status.active {
    display: block;
}

.status.info {
    background: rgba(45, 90, 39, 0.04);
    color: #4a7a42;
}

.status.error {
    background: rgba(200, 50, 50, 0.06);
    color: #b34a4a;
}

.status.success {
    background: rgba(45, 90, 39, 0.06);
    color: #3a6e33;
}

.status.warning {
    background: rgba(245, 230, 163, 0.3);
    color: #8a7a3a;
}

/* Voice Status */
.voice-status {
    text-align: center;
    font-size: 13px;
    color: rgba(45, 58, 42, 0.4);
    margin: 8px 0 4px;
    display: none;
    letter-spacing: 0.3px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(45, 90, 39, 0.04);
}

.voice-status.active {
    display: block;
}

.voice-status .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(45, 90, 39, 0.1);
    border-top: 2px solid #4a7a42;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.voice-status.ready {
    color: #4a7a42;
    background: rgba(45, 90, 39, 0.06);
}

.voice-status.ready .spinner {
    display: none;
}

.voice-status .enable-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 10px 32px;
    background: #2d5a27;
    color: #f5e6a3;
    border: none;
    border-radius: 24px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
    min-height: 48px;
}

.voice-status .enable-btn:hover {
    background: #3a6e33;
    transform: scale(1.02);
}

.voice-status .enable-btn:active {
    transform: scale(0.95);
}

/* Main Control */
.main-control {
    display: flex;
    justify-content: center;
    margin: 32px 0 24px;
    position: relative;
}

.play-pause-btn {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(145deg, #2d5a27, #3a6e33);
    color: #f5e6a3;
    font-size: 40px;
    cursor: pointer;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 8px 30px rgba(45, 90, 39, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.play-pause-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(from 0deg, #f5e6a3, rgba(45, 90, 39, 0.2), #f5e6a3, rgba(45, 90, 39, 0.2), #f5e6a3);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.6;
    transition: opacity 0.6s ease;
}

.play-pause-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 40px rgba(45, 90, 39, 0.3);
}

.play-pause-btn:active {
    transform: scale(0.94);
}

.play-pause-btn.playing {
    background: linear-gradient(145deg, #4a7a42, #2d5a27);
}

.play-pause-btn.playing::before {
    opacity: 0.8;
    background: conic-gradient(from 0deg, #f5e6a3, rgba(245, 230, 163, 0.3), #f5e6a3, rgba(245, 230, 163, 0.3), #f5e6a3);
}

.play-pause-btn .badge {
    position: absolute;
    bottom: -8px;
    font-size: 11px;
    font-weight: 500;
    color: #4a7a42;
    letter-spacing: 0.5px;
    background: rgba(255, 252, 245, 0.95);
    padding: 3px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(45, 90, 39, 0.08);
    border: 1px solid rgba(45, 90, 39, 0.06);
    display: none;
}

.play-pause-btn .badge.active {
    display: block;
}

.play-pause-btn .state-label {
    position: absolute;
    bottom: 20px;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    font-weight: 500;
    color: #f5e6a3;
}

/* Progress */
.progress-container {
    display: none;
    margin: 8px 0 20px;
    padding: 0 4px;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 3px;
    background: rgba(45, 90, 39, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2d5a27, #f5e6a3);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    border-radius: 3px;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    font-size: 12px;
    color: rgba(45, 58, 42, 0.3);
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* Settings */
.settings {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding: 20px 0 0;
    border-top: 1px solid rgba(45, 90, 39, 0.06);
}

.setting-group {
    flex: 1;
    min-width: 120px;
}

.setting-group label {
    display: block;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(45, 58, 42, 0.3);
    margin-bottom: 6px;
}

.setting-group select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(45, 90, 39, 0.1);
    font-size: 13px;
    background: rgba(255, 252, 245, 0.8);
    color: #2d3a2a;
    font-weight: 400;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.setting-group select:focus {
    border-color: rgba(45, 90, 39, 0.2);
    background: rgba(255, 252, 245, 0.95);
}

.setting-group select option {
    background: #f5f0e8;
    color: #2d3a2a;
}

.setting-group input[type="range"] {
    width: 100%;
    padding: 0;
    height: 3px;
    background: rgba(45, 90, 39, 0.1);
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    transition: all 0.3s ease;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2d5a27;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(45, 90, 39, 0.15);
}

.setting-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #3a6e33;
    transform: scale(1.1);
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2d5a27;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(45, 90, 39, 0.15);
}

.range-value {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    font-weight: 400;
    color: #4a7a42;
    min-width: 24px;
}

.storage-info {
    font-size: 10px;
    color: rgba(45, 58, 42, 0.2);
    text-align: center;
    margin-top: 20px;
    letter-spacing: 0.5px;
    display: none;
}

.storage-info.active {
    display: block;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

::selection {
    background: rgba(45, 90, 39, 0.1);
    color: #2d5a27;
}

/* Mobile */
@media (max-width: 480px) {
    body {
        padding: 12px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .container {
        padding: 28px 18px 24px;
        border-radius: 24px;
    }

    .header {
        margin-bottom: 20px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .logo {
        font-size: 11px;
    }

    .header-actions {
        gap: 6px;
    }

    .keep-awake-btn {
        font-size: 11px;
        padding: 4px 10px;
    }

    .text-input-area textarea {
        min-height: 120px;
        padding: 14px 16px;
        font-size: 14px;
    }

    .play-pause-btn {
        width: 100px;
        height: 100px;
        font-size: 34px;
    }

    .play-pause-btn .state-label {
        bottom: 16px;
        font-size: 8px;
    }

    .main-control {
        margin: 24px 0 18px;
    }

    .settings {
        gap: 12px;
        padding-top: 16px;
    }

    .setting-group {
        min-width: 100px;
    }

    .input-actions button {
        font-size: 11px;
        padding: 6px 14px;
    }

    .voice-status {
        font-size: 12px;
        padding: 8px 12px;
    }

    .voice-status .enable-btn {
        font-size: 14px;
        padding: 8px 24px;
        min-height: 44px;
    }
}

@media (max-width: 380px) {
    .container {
        padding: 20px 14px 20px;
    }

    .play-pause-btn {
        width: 84px;
        height: 84px;
        font-size: 28px;
    }

    .play-pause-btn .badge {
        font-size: 9px;
        padding: 2px 10px;
    }
}