:root {
    /* 雷蒙三十品牌色系 */
    --primary: #21A4B1;
    --primary-light: #2ec4d4;
    --primary-dark: #007481;
    --primary-glow: rgba(33, 164, 177, 0.3);
    --accent: #E77E47;
    --accent-light: #F6B85A;
    --accent-dark: #C85A2F;
    --bg-cream: #F7F5F0;
    --bg-white: #ffffff;
    --text-dark: #1a1a1a;
    --text-medium: #555555;
    --text-light: #888888;
    --border: rgba(0, 0, 0, 0.1);
    --font-sans: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
    --shadow-card: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.08);
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-cream);
    color: var(--text-dark);
    line-height: 1.7;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 2rem 1rem;
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    max-width: 600px;
}

/* ── Header ── */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.brand {
    margin-bottom: 1rem;
}

.logo {
    height: 32px;
    opacity: 0.7;
}

h1 {
    font-size: 2rem;
    color: var(--text-dark);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-medium);
    margin-top: 0.25rem;
}

/* ── Card ── */
.card {
    background-color: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 2rem;
}

@media (max-width: 640px) {
    .card { padding: 1.5rem; }
    h1 { font-size: 1.5rem; }
}

/* ── Form ── */
.form-group {
    margin-bottom: 1.5rem;
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-medium);
    font-weight: 500;
    font-size: 0.9rem;
}

.textarea-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 60px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    transition: var(--transition);
    resize: vertical;
    background: var(--bg-white);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.char-counter {
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-family: var(--font-mono);
    color: var(--text-light);
    font-size: 0.75rem;
}

/* ── Controls Grid ── */
.controls-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

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

.select-wrapper {
    position: relative;
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    appearance: none;
    background-color: var(--bg-white);
    cursor: pointer;
    transition: var(--transition);
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.select-wrapper::after {
    content: '\25BC';
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-light);
    font-size: 0.7rem;
}

/* ── Speed ── */
.speed-badge {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    background: rgba(33, 164, 177, 0.1);
    color: var(--primary-dark);
    padding: 0.1rem 0.4rem;
    border-radius: 6px;
    margin-left: 0.25rem;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    margin-top: 0.5rem;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 6px rgba(33, 164, 177, 0.3);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(33, 164, 177, 0.3);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--primary-light);
    transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--primary-light);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    text-align: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(33, 164, 177, 0.3);
}

.btn-primary:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-secondary:hover {
    background-color: rgba(33, 164, 177, 0.08);
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

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

/* ── Result ── */
.result-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

audio {
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 8px;
}

/* ── Error ── */
.error-message {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background-color: rgba(231, 126, 71, 0.08);
    color: var(--accent-dark);
    border: 1px solid rgba(231, 126, 71, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
}

/* ── Footer ── */
.footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-light);
    font-size: 0.8rem;
}
