@import url('../css/lingo-logo.css');

html {
    zoom: 1;
    overflow-x: clip;
}
/* --- Global & Reset --- */
:root {
    --primary-color: #344C64;
    --primary-light: #577399;
    --secondary-color: #495057;
    --accent-color: #FF8C42; /* Canlı turuncu aksan */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    
    --border-radius: 16px;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Oswald', sans-serif;
}

/* Özel İmleçler (Mevcut yapı korundu) */
* {
    cursor: url('../assets/slimicons/orange-pointer.svg'), auto !important;
    box-sizing: border-box;
}

button, a, input[type="button"], input[type="submit"], .clickable {
    cursor: url('../assets/slimicons/orange-hand-pointer.svg'), pointer !important;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    /* Arkaplan desenleri */
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(52, 76, 100, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 140, 66, 0.03) 0%, transparent 20%);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    padding-top: 60px;
    min-height: 100vh;
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
}

/* --- Layout & Grid --- */
.main-wrapper {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
    min-width: 0;
}

.tool-page-header {
    text-align: center;
    margin-bottom: 24px;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.tool-page-header h1 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-size: 1.65rem;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.4px;
    line-height: 1.25;
}

.tool-page-subtitle {
    margin: 0.4rem 0 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
    font-weight: 400;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px; /* Sol geniş, sağ sabit */
    gap: 24px;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr; /* Mobilde tek sütun */
    }
}

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.3s, background-color 0.3s;
    border: 1px solid rgba(0,0,0,0.02);
    margin-bottom: 20px;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.card-header h2, .card-header h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- Left Panel: Input Area --- */
.input-card {
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

/* Konuşma alanı: süre textarea'nın dışında sağ üstte */
.conversation-area-wrapper {
    position: relative;
    flex-grow: 1;
    margin-bottom: 20px;
}

.conversation-area-wrapper .elapsed-time-top-right {
    position: absolute;
    top: 0;
    right: 0;
    margin: 0;
    z-index: 2;
}

.conversation-area-wrapper .input-wrapper {
    margin-bottom: 0;
    padding-top: 32px; /* Konuşma süresi satırı textarea dışında üstte kalsın */
}

.input-wrapper {
    flex-grow: 1;
    position: relative;
    margin-bottom: 20px;
}

textarea {
    width: 100%;
    height: 100%;
    min-height: 300px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--text-main);
    font-family: var(--font-main);
    resize: vertical;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(52, 76, 100, 0.1);
}

textarea::placeholder {
    color: #9ca3af;
}

/* --- Speech Toggle Button --- */
.speech-toggle-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.speech-toggle-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 12px rgba(52, 76, 100, 0.25),
        0 0 0 0 rgba(52, 76, 100, 0);
    position: relative;
    overflow: hidden;
}

.speech-toggle-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.speech-toggle-button:hover::before {
    left: 100%;
}

.speech-toggle-button:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    box-shadow: 
        0 8px 20px rgba(52, 76, 100, 0.35),
        0 0 0 4px rgba(52, 76, 100, 0.1);
    transform: translateY(-2px) scale(1.02);
}

.speech-toggle-button:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 
        0 2px 8px rgba(52, 76, 100, 0.2),
        0 0 0 2px rgba(52, 76, 100, 0.1);
}

.speech-toggle-button .speech-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    position: relative;
    z-index: 1;
}

.speech-toggle-button:hover .speech-icon {
    transform: scale(1.15) rotate(5deg);
}

.speech-toggle-button .speech-button-text {
    position: relative;
    z-index: 1;
}

.speech-toggle-button.recording {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: recording-pulse 2s ease-in-out infinite;
    box-shadow: 
        0 4px 12px rgba(239, 68, 68, 0.4),
        0 0 0 0 rgba(239, 68, 68, 0.6);
}

.speech-toggle-button.recording:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 
        0 8px 20px rgba(239, 68, 68, 0.5),
        0 0 0 4px rgba(239, 68, 68, 0.2);
}

.speech-toggle-button.recording .speech-icon {
    animation: icon-recording-pulse 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
}

@keyframes recording-pulse {
    0%, 100% {
        box-shadow: 
            0 4px 12px rgba(239, 68, 68, 0.4),
            0 0 0 0 rgba(239, 68, 68, 0.6);
    }
    50% {
        box-shadow: 
            0 4px 12px rgba(239, 68, 68, 0.5),
            0 0 0 8px rgba(239, 68, 68, 0);
    }
}

@keyframes icon-recording-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.9;
    }
}

/* --- Action Buttons --- */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: auto; /* Push to bottom */
}

.btn-primary, .btn-secondary, .btn-outline {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    border: none;
    transition: all 0.2s;
    flex: 1;
}

.btn-primary {
    background-color: var(--success-color);
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #fee2e2; /* Açık kırmızı */
    color: var(--danger-color);
}

.btn-secondary:hover {
    background-color: #fecaca;
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* --- Right Panel: Feedback & Counters --- */

/* Speed Gauge & Info */
.speech-info-controls {
    position: relative;
    overflow: hidden;
    border: 2px solid transparent; /* Default border for feedback states */
}

/* Minimal Konuşma Butonu (speed-visual altında) */
.speech-toggle-minimal {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    margin-bottom: 8px;
}

.speech-toggle-minimal-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background-color: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    color: #3b82f6;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.speech-toggle-minimal-btn:hover {
    background-color: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.5);
    transform: translateY(-1px);
}

.speech-toggle-minimal-btn:active {
    transform: translateY(0);
}

.speech-toggle-minimal-btn svg {
    flex-shrink: 0;
}

.speech-toggle-minimal-text {
    font-size: 11px;
}

/* Aktif durum (konuşma devam ediyor) */
.speech-toggle-minimal-btn.active {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.speech-toggle-minimal-btn.active:hover {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
}

/* Feedback States for Speech Card */
.speech-info-controls.feedback-slow {
    border-color: var(--warning-color);
    background-color: rgba(245, 158, 11, 0.05);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.1);
}

.speech-info-controls.feedback-normal {
    border-color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.05);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.1);
}

.speech-info-controls.feedback-fast {
    border-color: var(--danger-color);
    background-color: rgba(239, 68, 68, 0.05);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.1);
}

.speed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.speed-header h3 {
    white-space: nowrap;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background-color: #f3f4f6;
    color: var(--primary-color);
}

.speed-content-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.speed-visual {
    position: relative;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.speed-gauge--arc {
    width: 100%;
    aspect-ratio: 2 / 1;
    height: auto;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    padding: 0;
    border-radius: 50% 50% 0 0;
    background: conic-gradient(from -90deg at 50% 100%, #f59e0b 0deg 90deg, #10b981 90deg 135deg, #ef4444 135deg 180deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.speed-gauge--linear {
    display: none;
    width: 100%;
    padding: 0 2px;
    box-sizing: border-box;
}

.speed-linear-value {
    text-align: center;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.1;
    margin-bottom: 10px;
}

.speed-linear-track-wrap {
    position: relative;
    padding-top: 6px;
    padding-bottom: 2px;
}

.speed-linear-track {
    position: relative;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.speed-linear-zones {
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.speed-linear-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    border-radius: inherit;
    opacity: 0.45;
    pointer-events: none;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.speed-linear-marker {
    position: absolute;
    top: 0;
    left: 0%;
    width: 4px;
    height: 22px;
    background: var(--primary-color);
    border-radius: 3px;
    transform: translateX(-50%);
    z-index: 2;
    transition: left 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    border: 1.5px solid #fff;
}

.gauge-background {
    display: none;
}

.gauge-fill {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    pointer-events: none;
    z-index: 2;
}

.gauge-center {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.gauge-needle {
    position: absolute;
    top: 100%;
    left: 50%;
    width: 5px;
    height: 94%;
    background: var(--primary-color);
    transform-origin: bottom center;
    transform: translate(-50%, -100%) rotate(-90deg);
    z-index: 4;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}

.gauge-value {
    position: absolute;
    top: 62%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.25rem, 8vw, 2rem);
    font-weight: 700;
    color: var(--primary-color);
    z-index: 3;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85);
}

.speed-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

.speed-numeric {
    text-align: center;
}

.speed-value-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 5px 0;
}

.speed-unit {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.speed-status-badge {
    display: inline-block;
    padding: 6px 14px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 5px;
    border: 1px solid transparent;
    transition: all 0.3s;
}

/* Badge Feedback Colors */
.speech-info-controls.feedback-slow .speed-status-badge {
    background-color: #fffbeb;
    color: #b45309;
    border-color: #fcd34d;
}

.speech-info-controls.feedback-normal .speed-status-badge {
    background-color: #ecfdf5;
    color: #047857;
    border-color: #6ee7b7;
}

.speech-info-controls.feedback-fast .speed-status-badge {
    background-color: #fef2f2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* --- GIF Feedback Styles --- */
.gif-feedback-container {
    margin-top: 15px;
    height: 100px; /* Sabit yükseklik */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.speed-feedback-img {
    max-height: 100%;
    max-width: 100px;
    display: none; /* JS ile kontrol edilecek */
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin-top: 20px;
    overflow: hidden;
}

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

/* --- Counters Card --- */
.counters-card {
    padding: 20px;
}

.counters-grid {
    display: grid;
    gap: 16px;
}

.counter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px dashed #e5e7eb;
}

.counter-item:last-child {
    border-bottom: none;
}

.counter-item label {
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.counter-control {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f8fafc;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    width: 100%;
}

.counter-control input {
    width: 50px;
    text-align: center;
    border: none;
    background: transparent;
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
    padding: 0;
    flex-shrink: 0;
}

.count-btn {
    flex: 1;
    min-width: 40px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    transition: all 0.1s;
}

.count-btn.minus {
    background-color: #fee2e2;
    color: var(--danger-color);
}

.count-btn.plus {
    background-color: #d1fae5;
    color: var(--success-color);
}

.count-btn:active {
    transform: scale(0.9);
}

/* --- PDF Section --- */
.danisan-input-container {
    margin-bottom: 15px;
}

.modern-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.modern-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* --- Elapsed Time Minimal --- */
.elapsed-time-container-minimal {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.conversation-area-wrapper .elapsed-time-container-minimal {
    margin-bottom: 0;
}

.time-value-wrapper {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    padding: 4px 12px;
    border-radius: 20px;
}

.time-value-wrapper input {
    width: 40px;
    border: none;
    background: transparent;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
    margin-right: 4px;
}

/* --- User Header --- */
.user-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 60px;
    z-index: 1000;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 8px 20px;
    box-sizing: border-box;
    background: var(--site-chrome-bg-alpha, rgba(50, 67, 94, 0.98)) !important;
    border-bottom: 1px solid var(--site-chrome-border, rgba(255, 255, 255, 0.12)) !important;
    box-shadow: var(--site-chrome-shadow, 0 2px 8px rgba(0, 0, 0, 0.18));
    color: var(--site-chrome-text, rgba(255, 255, 255, 0.88));
}

.user-header-left {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.user-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
}

.user-header .logo-container-header {
    display: flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
}

.user-header .header-logo-img {
    display: block;
    object-position: center;
}

.user-header .araclarim-back,
.user-header .tool-watermark-btn {
    --tool-watermark-color: #ffffff;
    --araclarim-back-color: #ffffff;
}

#userEmail {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--site-chrome-text, rgba(255, 255, 255, 0.88)) !important;
    margin: 0;
    max-width: min(220px, 36vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Modal Base (Yeniden Düzenlendi) --- */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
}

/* --- Settings Modal Improvements --- */
.speed-settings-backdrop {
    opacity: 0;
    transition: opacity 0.25s ease;
}

.speed-settings-backdrop.is-open {
    display: block;
    opacity: 1;
}

.settings-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10001;
    padding: 16px;
    font-family: var(--font-main);
}

.settings-modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-modal-inner {
    position: relative;
    width: min(100%, 540px);
    max-height: min(92vh, 820px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: settingsModalIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes settingsModalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.settings-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 22px 16px;
    border-bottom: 1px solid #eef2f7;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.settings-modal-heading {
    min-width: 0;
}

.settings-modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.35rem;
    line-height: 1.25;
}

.settings-modal-subtitle {
    margin: 6px 0 0;
    font-size: 0.86rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.close-settings-btn {
    flex-shrink: 0;
    background: #f3f4f6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.25rem;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s;
}

.close-settings-btn:hover {
    background-color: #e5e7eb;
}

.close-settings-btn:active {
    transform: scale(0.96);
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px 22px 10px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-section-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-section-head--row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.settings-section-title {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-main);
}

.settings-section-desc {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.settings-section--preview {
    gap: 14px;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
    border: 1px solid #e8edf3;
}

.settings-preview-label {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
}

.speed-scale {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.speed-scale__track {
    display: flex;
    height: 18px;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.speed-scale__zone {
    transition: flex-grow 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.speed-scale__zone-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.speed-scale__zone--slow { background: #fbbf24; }
.speed-scale__zone--normal { background: #34d399; }
.speed-scale__zone--fast { background: #f87171; }

.speed-scale__markers {
    position: relative;
    height: 18px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #4b5563;
}

.speed-scale__marker {
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.speed-scale__marker::after {
    content: " sn";
    font-weight: 600;
    opacity: 0.85;
}

.speed-scale__unit-hint {
    margin: 0;
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: center;
}

.mode-segment {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px;
    border-radius: 14px;
    background: #f1f5f9;
}

.mode-segment__btn {
    border: none;
    background: transparent;
    color: #64748b;
    font-family: var(--font-main);
    font-size: 0.84rem;
    font-weight: 700;
    padding: 10px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.mode-segment__btn:hover {
    color: #334155;
}

.mode-segment__btn.is-active {
    background: #fff;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.threshold-mode-hint {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e8edf3;
    font-size: 0.82rem;
    line-height: 1.45;
    color: #64748b;
}

.settings-subpanel-title {
    margin: 0 0 12px;
    font-size: 0.86rem;
    font-weight: 700;
    color: #374151;
}

.settings-subpanel {
    animation: settingsSubpanelIn 0.2s ease;
}

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

.chip-group-wrap + .chip-group-wrap {
    margin-top: 12px;
}

.chip-group-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #6b7280;
}

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-chip {
    border: 1.5px solid #dbe3ee;
    background: #fff;
    color: #374151;
    border-radius: 999px;
    padding: 8px 14px;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.settings-chip:hover {
    border-color: #94a3b8;
}

.settings-chip.is-active {
    border-color: var(--primary-color);
    background: rgba(52, 76, 100, 0.08);
    color: var(--primary-color);
}

.threshold-input-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.threshold-input-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.threshold-input-row__label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.threshold-input-row__label strong {
    font-size: 0.88rem;
    color: #111827;
}

.threshold-input-row__label span {
    font-size: 0.78rem;
    color: #6b7280;
}

.threshold-stepper {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    gap: 8px;
    align-items: center;
}

.threshold-stepper__btn {
    width: 44px;
    height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #f9fafb;
    color: #374151;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.threshold-stepper__btn:hover {
    background: #f3f4f6;
    border-color: #94a3b8;
}

.threshold-stepper__btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.threshold-stepper__btn:disabled:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.threshold-stepper__btn:not(:disabled):active {
    transform: scale(0.96);
}

.threshold-stepper .threshold-input-wrap {
    min-width: 0;
}

.speed-measurement-switch {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.speed-measurement-switch__option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    text-align: center;
    transition: opacity 0.2s;
    cursor: pointer;
}

.speed-measurement-switch__option[data-measurement-mode="general"] {
    justify-content: flex-end;
}

.speed-measurement-switch__option[data-measurement-mode="last5"] {
    justify-content: flex-start;
}

.speed-measurement-switch.is-last5 .speed-measurement-switch__option[data-measurement-mode="general"],
.speed-measurement-switch:not(.is-last5) .speed-measurement-switch__option[data-measurement-mode="last5"] {
    opacity: 0.55;
}

.speed-measurement-switch.is-last5 .speed-measurement-switch__option[data-measurement-mode="last5"],
.speed-measurement-switch:not(.is-last5) .speed-measurement-switch__option[data-measurement-mode="general"] {
    opacity: 1;
}

.speed-measurement-switch__label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
}

.speed-measurement-switch__toggle {
    position: relative;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
    border: none;
    border-radius: 999px;
    background: #cbd5e1;
    cursor: pointer;
    padding: 0;
    transition: background-color 0.2s;
}

.speed-measurement-switch__toggle[aria-checked="true"] {
    background: var(--primary-color);
}

.speed-measurement-switch__knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
    transition: transform 0.2s;
}

.speed-measurement-switch__toggle[aria-checked="true"] .speed-measurement-switch__knob {
    transform: translateX(22px);
}

.measurement-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    flex-shrink: 0;
    transition: color 0.15s, background-color 0.15s;
}

.measurement-info-btn:hover,
.measurement-info-btn[aria-expanded="true"] {
    color: var(--primary-color);
    background: #eff6ff;
}

.measurement-info-popover {
    margin: 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #475569;
}

.measurement-info-popover[hidden] {
    display: none;
}

.chart-caption {
    margin-top: 10px;
    font-size: 0.85em;
    color: #9ca3af;
    text-align: center;
    line-height: 1.4;
}

.chart-final-speed {
    margin-top: 6px;
    font-size: 0.88em;
    color: #374151;
    text-align: center;
    font-weight: 600;
}

.pause-correction-summary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: grid;
    gap: 6px;
    font-size: 0.82rem;
}

.pause-correction-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: #374151;
}

.pause-correction-row span {
    color: #6b7280;
}

.pause-correction-row strong {
    color: #111827;
    text-align: right;
}

.pause-correction-meta {
    font-size: 0.78rem;
}

.pause-correction-intervals {
    margin: 4px 0 2px;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
}

.pause-correction-intervals--empty {
    background: rgba(107, 114, 128, 0.06);
    border-color: rgba(107, 114, 128, 0.12);
}

.pause-correction-intervals__label {
    display: block;
    font-size: 0.76rem;
    color: #6b7280;
    margin-bottom: 4px;
}

.pause-correction-intervals__list {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 2px;
}

.pause-correction-intervals__list li {
    font-size: 0.8rem;
    color: #1f2937;
    font-weight: 600;
}

.threshold-preview-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.threshold-preview-card {
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid transparent;
    text-align: left;
    min-height: auto;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px;
}

.threshold-preview-card--slow {
    background: #fffbeb;
    border-color: #fde68a;
}

.threshold-preview-card--normal {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.threshold-preview-card--fast {
    background: #fef2f2;
    border-color: #fecaca;
}

.threshold-preview-card__badge {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.threshold-preview-card--slow .threshold-preview-card__badge { color: #b45309; }
.threshold-preview-card--normal .threshold-preview-card__badge { color: #047857; }
.threshold-preview-card--fast .threshold-preview-card__badge { color: #b91c1c; }

.threshold-preview-card__value {
    font-size: 0.78rem;
    line-height: 1.35;
    color: #1f2937;
    font-weight: 600;
}

.threshold-preview-card__value .threshold-value-main {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
}

.threshold-preview-card__value .threshold-value-alt {
    display: block;
    margin-top: 2px;
    font-size: 0.72rem;
    font-weight: 500;
    color: #6b7280;
}

.threshold-mode-options {
    display: none !important;
}

.threshold-mode-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.threshold-mode-card:hover {
    border-color: #cbd5e1;
    background: #fafbfc;
}

.threshold-mode-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.threshold-mode-input:checked + .threshold-mode-card__body {
    color: var(--primary-color);
}

.threshold-mode-card:has(.threshold-mode-input:checked) {
    border-color: var(--primary-color);
    background: #f8fafc;
    box-shadow: 0 0 0 3px rgba(52, 76, 100, 0.1);
}

.threshold-mode-card__body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.threshold-mode-card__title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-main);
}

.threshold-mode-card__desc {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.settings-subpanel {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    animation: settingsPanelIn 0.2s ease;
}

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

.settings-subpanel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.custom-thresholds-intro {
    margin: 0 0 12px;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.threshold-range-visual {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr;
    gap: 4px;
    margin-bottom: 14px;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}

.threshold-range-segment {
    padding: 8px 4px;
}

.threshold-range-segment--slow { background: #fef3c7; color: #92400e; }
.threshold-range-segment--normal { background: #d1fae5; color: #065f46; }
.threshold-range-segment--fast { background: #fee2e2; color: #991b1b; }

.settings-reference {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 14px;
    background: #fafbfc;
    font-size: 0.8rem;
    color: #6b7280;
    line-height: 1.55;
}

.settings-reference summary {
    cursor: pointer;
    font-weight: 600;
    color: #374151;
    list-style: none;
}

.settings-reference summary::-webkit-details-marker {
    display: none;
}

.settings-reference summary::after {
    content: '＋';
    float: right;
    color: #9ca3af;
}

.settings-reference[open] summary::after {
    content: '－';
}

.settings-reference p {
    margin: 10px 0 0;
}

.settings-reference a {
    color: #3b82f6;
}

.settings-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 22px calc(14px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eef2f7;
    background: #fff;
}

.settings-modal-footer__actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.cancel-settings-btn {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.cancel-settings-btn:hover {
    background: #f9fafb;
    border-color: #94a3b8;
}

body.speed-settings-open {
    overflow: hidden;
}

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

.setting-group label {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.86rem;
}

/* Toggles */
.toggle-group {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
    width: 100%;
}

.toggle-label--compact {
    width: auto;
    flex-shrink: 0;
}

.toggle-checkbox {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background-color: #cbd5e1;
    border-radius: 24px;
    position: relative;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-checkbox:checked + .toggle-slider {
    background-color: var(--success-color);
}

.toggle-checkbox:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-description {
    margin: 8px 0 0 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Select Inputs */
.settings-select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background-color: white;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-main);
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none; /* Remove default arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

.settings-select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(52, 76, 100, 0.1);
}

.settings-select:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Thresholds Info (legacy) */
.speed-thresholds-info {
    display: none;
}

.custom-thresholds-editor {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
}

.threshold-range-editor__hint {
    margin: 0 0 10px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #6b7280;
}

.threshold-range-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 12px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
}

.threshold-range-editor__track {
    position: relative;
    height: 44px;
    margin: 22px 10px 4px;
    touch-action: none;
    cursor: pointer;
    user-select: none;
}

.threshold-range-editor__zones {
    display: flex;
    height: 100%;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

.threshold-range-editor__zone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    transition: flex-grow 0.12s ease;
}

.threshold-range-editor__zone span {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.threshold-range-editor__zone--slow { background: #fbbf24; }
.threshold-range-editor__zone--normal { background: #34d399; }
.threshold-range-editor__zone--fast { background: #f87171; }

.threshold-range-editor__handle {
    position: absolute;
    top: 50%;
    width: 22px;
    height: 52px;
    margin: 0;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 999px;
    background: #1e293b;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.28);
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 2;
    touch-action: none;
}

.threshold-range-editor__handle:active,
.threshold-range-editor__handle.is-dragging {
    cursor: grabbing;
    z-index: 3;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.35);
}

.threshold-range-editor__handle-value {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 44px;
    padding: 3px 6px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid #dbe3ee;
    font-size: 0.76rem;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    pointer-events: none;
}

.threshold-range-editor__handle-value::after {
    content: " sn";
    font-weight: 600;
    color: #6b7280;
}

.threshold-range-editor__scale {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}

.threshold-range-editor__scale-unit {
    margin-left: auto;
    margin-right: auto;
    font-weight: 500;
}

.threshold-range-editor.is-disabled {
    opacity: 0.55;
    pointer-events: none;
}

.threshold-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.threshold-input-item label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.threshold-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 10px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.threshold-input-wrap:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(52, 76, 100, 0.1);
}

.threshold-input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 0.95rem;
    font-family: var(--font-main);
    color: var(--text-main);
    outline: none;
}

.threshold-input:disabled {
    color: #9ca3af;
}

.threshold-input-unit {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.threshold-input-hint {
    margin: 6px 0 0;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.threshold-input-error {
    margin: 10px 0 0;
    font-size: 0.82rem;
    color: #b91c1c;
    line-height: 1.4;
}

@media (max-width: 560px) {
    .settings-modal {
        padding: 0;
    }

    .settings-modal-inner {
        width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .mode-segment__btn {
        font-size: 0.78rem;
        padding: 9px 6px;
    }

    .speed-measurement-switch {
        gap: 8px;
        padding: 12px 10px;
    }

    .speed-measurement-switch__label {
        font-size: 0.74rem;
    }

    .speed-measurement-switch__toggle {
        width: 46px;
        height: 28px;
    }

    .speed-measurement-switch__knob {
        width: 22px;
        height: 22px;
    }

    .speed-measurement-switch__toggle[aria-checked="true"] .speed-measurement-switch__knob {
        transform: translateX(18px);
    }

    .threshold-preview-cards {
        grid-template-columns: 1fr;
    }

    .settings-modal-footer {
        flex-wrap: wrap;
    }

    .reset-settings-btn {
        width: 100%;
    }

    .settings-modal-footer__actions {
        width: 100%;
    }

    .settings-modal-footer__actions .cancel-settings-btn,
    .settings-modal-footer__actions .save-settings-btn {
        flex: 1;
    }

    .speed-scale__zone-label {
        font-size: 0.58rem;
    }

    .threshold-range-editor__track {
        margin-top: 26px;
    }

    .threshold-range-editor__zone span {
        font-size: 0.6rem;
    }

    .threshold-range-editor__handle {
        width: 26px;
        height: 56px;
    }

    .settings-subpanel-grid,
    .threshold-input-grid {
        grid-template-columns: 1fr;
    }
}

/* Actions */
.settings-actions {
    display: none;
}

.save-settings-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.2s, transform 0.15s;
    cursor: pointer;
    min-width: 96px;
}

.save-settings-btn:hover {
    background-color: #2c4055;
}

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

.save-settings-btn.is-saved {
    background-color: var(--success-color);
}

.reset-settings-btn {
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid #d1d5db;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.reset-settings-btn:hover {
    background-color: #f3f4f6;
    color: var(--text-main);
    border-color: #cbd5e1;
}

/* --- Splash Screen Modernized --- */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f6f8fb 0%, #e2e8f0 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    animation: splashEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes splashEntrance {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.splash-logo {
    margin-bottom: 20px;
    display: inline-block;
}

.splash-logo .logo-circle {
    width: 100px;
    height: 100px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(52, 76, 100, 0.15);
    position: relative;
    overflow: hidden;
}

.logo-inner {
    position: relative;
    z-index: 2;
}

.logo-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.splash-title {
    margin-bottom: 30px;
}

.title-main {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--primary-color);
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.title-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin: 0;
    font-weight: 400;
}

.splash-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(52, 76, 100, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 0.9rem;
    color: var(--primary-light);
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: pulseText 2s infinite ease-in-out;
}

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

@keyframes pulseText {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* --- Animations --- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.card { animation: fadeIn 0.5s ease-out forwards; }
.panel-right .card:nth-child(2) { animation-delay: 0.1s; }
.panel-right .card:nth-child(3) { animation-delay: 0.2s; }

/* Büyük ekranlarda konuşma hızı ve takılma sayaçları yan yana */
@media (min-width: 1025px) {
    .panel-right {
        display: grid;
        grid-template-columns: 2fr 1fr; /* Konuşma hızı daha geniş, takılma sayaçları daha dar */
        gap: 24px;
        align-items: start;
    }

    /* Dar sütunda yarım daire yerine yatay gösterge */
    .speech-info-controls:not(.fullscreen) .speed-gauge--arc {
        display: none;
    }

    .speech-info-controls:not(.fullscreen) .speed-gauge--linear {
        display: block;
    }

    .speech-info-controls:not(.fullscreen) .speed-visual {
        max-width: none;
        width: 100%;
    }

    .speech-info-controls:not(.fullscreen) .speed-content-wrapper {
        gap: 14px;
    }

    .speech-info-controls:not(.fullscreen) .gauge-value,
    .speech-info-controls:not(.fullscreen) #gaugeValue {
        font-size: 1.5rem;
    }
    
    /* PDF kartı tam genişlikte */
    .panel-right .pdf-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1024px) {
    .panel-right {
        display: block;
    }
}

/* Results Modal Specific */
#resultsModal {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    padding: 0;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 10001; /* Backdrop (10000) üzerinde olmalı */
    width: min(94vw, 600px);
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-overflow-scrolling: touch;
}

#resultsModal.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

#resultsModal h2 {
    padding: 24px;
    background: #fff;
    margin: 0;
    font-size: 1.4rem;
    color: var(--primary-color);
    text-align: center;
    border-bottom: none;
}

#modalContent {
    padding: 0 24px 24px;
    min-width: 0;
}

@media (min-width: 768px) {
    #resultsModal {
        width: min(92vw, 760px);
        max-width: 760px;
    }

    #modalContent {
        padding: 0 28px 28px;
    }

    #resultsModal h2 {
        padding: 26px 28px;
    }
}

@media (min-width: 1024px) {
    #resultsModal {
        width: min(90vw, 920px);
        max-width: 920px;
    }

    #modalContent {
        padding: 0 32px 32px;
    }

    #resultsModal h2 {
        padding: 28px 32px;
        font-size: 1.5rem;
    }

    .results-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 18px;
    }

    .result-card {
        grid-column: span 2;
    }

    .speed-chart-canvas-wrap {
        height: 340px;
    }
}

@media (min-width: 1280px) {
    #resultsModal {
        width: min(88vw, 1040px);
        max-width: 1040px;
    }
}
#closeModalButton {
    position: absolute; top: 20px; right: 20px; border: none; 
    background: #f3f4f6; width: 36px; height: 36px; border-radius: 50%;
    font-size: 1.5rem; color: #6b7280;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.2s;
}
#closeModalButton:hover { background: #e5e7eb; color: #374151; }
#modalBackdrop { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 10000; /* Fullscreen (9999) modundan yüksek olmalı */ }

/* Responsive Adjustments */
@media (max-width: 768px) {
    body {
        padding-top: 56px;
    }

    .user-header {
        height: 56px;
        padding: 8px 12px;
    }

    #userEmail {
        font-size: 0.82rem;
        max-width: min(160px, 42vw);
    }

    .speech-toggle-button { 
        width: 100%; 
        justify-content: center; 
        padding: 12px 24px;
        font-size: 0.9rem;
    }
    .input-card { min-height: auto; }
    textarea { min-height: 200px; }
    .main-wrapper { padding: 12px 14px; }
    .tool-page-header h1 { font-size: 1.3rem; }
    .tool-page-subtitle { font-size: 0.88rem; padding: 0 0.25rem; }

    #resultsModal {
        width: min(96vw, 100%);
        max-width: none;
        max-height: 92dvh;
        border-radius: 18px;
    }

    #resultsModal h2 {
        padding: 16px 44px 16px 16px;
        font-size: 1.15rem;
    }

    #modalContent {
        padding: 0 14px 16px;
    }

    #closeModalButton {
        top: 14px;
        right: 14px;
        width: 32px;
        height: 32px;
        font-size: 1.25rem;
    }

    .results-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 14px;
    }

    .stat-card,
    .result-card {
        padding: 14px;
    }

    .speed-chart-card {
        margin-top: 14px;
        padding: 12px;
        border-radius: 12px;
    }

    .speed-chart-card__head {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 12px;
    }

    .speed-chart-card__title {
        font-size: 0.95rem;
    }

    .speed-chart-card__subtitle {
        font-size: 0.76rem;
    }

    .speed-chart-legend {
        justify-content: flex-start;
        gap: 5px;
    }

    .speed-chart-legend__item {
        font-size: 0.68rem;
        padding: 3px 8px;
    }

    .speed-chart-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 12px;
    }

    .speed-chart-stat {
        padding: 10px;
        border-radius: 10px;
    }

    .speed-chart-stat__label {
        font-size: 0.66rem;
    }

    .speed-chart-stat__value {
        font-size: 0.88rem;
    }

    .speed-chart-stat__unit {
        display: block;
        margin-top: 1px;
        font-size: 0.64rem;
    }

    .speed-chart-canvas-wrap {
        height: 220px;
        padding: 6px 2px 2px;
        border-radius: 10px;
    }

    .speed-chart-footnote {
        font-size: 0.72rem;
        text-align: left;
        padding: 0 2px;
    }
}

/* --- Yeni Modal Sonuç Kartları --- */

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #f8fafc;
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #e2e8f0;
}

.stat-icon {
    font-size: 1.5rem;
    background: #fff;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.result-card {
    grid-column: span 2; /* Tam genişlik */
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.result-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: rgba(0,0,0,0.7);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-value {
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-icon-large {
    font-size: 1.8rem;
}

/* Konuşma Hızı Sonuç Kartı */
.speech-result-card {
    grid-column: 1 / -1;
    border-radius: 18px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    background: #fff;
    box-shadow: var(--card-shadow);
    min-width: 0;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.speech-result-card--slow {
    border-color: #fde68a;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 72%);
}

.speech-result-card--normal {
    border-color: #a7f3d0;
    background: linear-gradient(180deg, #ecfdf5 0%, #ffffff 72%);
}

.speech-result-card--fast {
    border-color: #fecaca;
    background: linear-gradient(180deg, #fef2f2 0%, #ffffff 72%);
}

.speech-result-card--unknown {
    border-color: #e5e7eb;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 72%);
}

.speech-result-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.speech-result-card__heading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.speech-result-card__title-icon {
    font-size: 1rem;
    line-height: 1;
}

.speech-result-card__title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #374151;
    letter-spacing: 0.01em;
}

.speech-result-card__status {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border: 1px solid transparent;
    flex-shrink: 0;
}

.speech-result-card--slow .speech-result-card__status {
    color: #b45309;
    background: #fffbeb;
    border-color: #fde68a;
}

.speech-result-card--normal .speech-result-card__status {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.speech-result-card--fast .speech-result-card__status {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.speech-result-card__hero {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.speech-result-card__hero--empty {
    justify-content: center;
    min-height: 72px;
}

.speech-result-card__emoji {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.speech-result-card__numbers {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.speech-result-card__rate {
    margin: 0;
    font-size: clamp(1.45rem, 4vw, 1.85rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: #111827;
}

.speech-result-card--slow .speech-result-card__rate { color: #92400e; }
.speech-result-card--normal .speech-result-card__rate { color: #065f46; }
.speech-result-card--fast .speech-result-card__rate { color: #991b1b; }

.speech-result-card__unit {
    font-size: 0.62em;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0;
}

.speech-result-card__rate-alt {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #64748b;
}

.speech-result-card__mode {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    padding: 0 2px;
}

.speech-result-card__empty-text {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #64748b;
}

.speech-result-card__details {
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.speech-metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.speech-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.06);
    min-width: 0;
}

.speech-metric--highlight {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.speech-metric--meta {
    background: rgba(248, 250, 252, 0.9);
}

.speech-metric__label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.speech-metric__hint {
    display: inline-flex;
    padding: 1px 6px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.speech-metric__value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
    word-break: break-word;
}

.speech-metric__sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}

.speech-intervals {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
}

.speech-intervals--empty {
    background: rgba(248, 250, 252, 0.95);
    border-color: #e5e7eb;
    text-align: center;
}

.speech-intervals__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 6px;
}

.speech-intervals__empty {
    font-size: 0.78rem;
    font-weight: 600;
    color: #94a3b8;
}

.speech-intervals__list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.speech-intervals__list li {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid rgba(59, 130, 246, 0.18);
    font-size: 0.76rem;
    font-weight: 700;
    color: #1e40af;
}

@media (min-width: 1024px) {
    .results-grid .speech-result-card {
        grid-column: span 2;
    }

    .speech-metrics-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .speech-result-card {
        padding: 14px;
        gap: 12px;
        border-radius: 14px;
    }

    .speech-result-card__hero {
        padding: 12px;
        gap: 12px;
    }

    .speech-result-card__emoji {
        font-size: 1.65rem;
    }

    .speech-metrics-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .speech-metric {
        padding: 9px 10px;
    }

    .speech-metric__value {
        font-size: 0.9rem;
    }
}

@media (max-width: 420px) {
    .speech-result-card__header {
        flex-direction: column;
        align-items: flex-start;
    }

    .speech-result-card__hero {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
}

/* Durum Renkleri (Background & Text) */
.low-bg { background-color: #d1fae5; border-color: #a7f3d0; color: #065f46; } /* Yeşilimsi */
.medium-bg { background-color: #fef3c7; border-color: #fde68a; color: #92400e; } /* Sarımsı */
.high-bg { background-color: #fee2e2; border-color: #fecaca; color: #991b1b; } /* Kırmızımsı */

.low-text { color: #059669; }
.medium-text { color: #d97706; }
.high-text { color: #dc2626; }

/* Grafik Alanı */
.chart-container {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px dashed #e5e7eb;
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.speed-chart-card {
    margin-top: 24px;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: var(--card-shadow);
    min-width: 0;
    max-width: 100%;
}

.speed-chart-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.speed-chart-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.01em;
}

.speed-chart-card__subtitle {
    margin: 4px 0 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.speed-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.speed-chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #475569;
}

.speed-chart-legend__item::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.speed-chart-legend__item--slow::before { background: #f59e0b; }
.speed-chart-legend__item--normal::before { background: #10b981; }
.speed-chart-legend__item--fast::before { background: #ef4444; }

.speed-chart-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.speed-chart-stat {
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.speed-chart-stat__label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.speed-chart-stat__value {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.speed-chart-stat__unit {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}

.speed-chart-chip--slow { color: #b45309; }
.speed-chart-chip--normal { color: #047857; }
.speed-chart-chip--fast { color: #b91c1c; }

.speed-chart-canvas-wrap {
    position: relative;
    height: 300px;
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eef2f7;
    padding: 8px 4px 4px;
    min-width: 0;
}

.speed-chart-footnote {
    margin: 12px 0 0;
    font-size: 0.78rem;
    color: #94a3b8;
    text-align: center;
    line-height: 1.45;
    word-break: break-word;
}

@media (max-width: 420px) {
    .speed-chart-stats {
        grid-template-columns: 1fr;
    }

    .speed-chart-canvas-wrap {
        height: 200px;
    }

    .speed-chart-stat__value {
        font-size: 0.92rem;
    }
}

/* --- Fullscreen Controls --- */
/* Kart üst başlığı: Ayarlar ve Tam ekran butonları */
.speech-card-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 10px 15px;
    margin: -24px -24px 0 -24px; /* Kart padding'ini üstte ve yanlarda iptal et */
    border-bottom: 1px solid #e5e7eb;
    background: #fafafa;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.speech-card-header .fullscreen-controls {
    position: static;
}

.speech-info-controls.fullscreen .speech-card-header {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    flex-shrink: 0;
    margin: 0;
    border-radius: 0;
    background: rgba(250, 250, 250, 0.95);
    padding-top: max(10px, env(safe-area-inset-top, 0px));
}

.fullscreen-controls {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.fullscreen-button {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.fullscreen-button:hover {
    background: #fff;
    color: var(--primary-color);
    transform: scale(1.1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* --- Fullscreen Mode --- */
.speech-info-controls.fullscreen {
    position: fixed;
    inset: 0;
    width: 100%;
    height: var(--fs-vh, 100dvh);
    z-index: 9999;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: #fff;
    overflow: hidden;
    transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

/* Tam ekran modunda dinamik arka plan renkleri (şeffaf değil) */
.speech-info-controls.fullscreen.feedback-slow {
    background-color: #fef3c7; /* Açık sarı - şeffaf değil */
    border-color: var(--warning-color);
    box-shadow: 0 0 60px rgba(245, 158, 11, 0.3);
}

.speech-info-controls.fullscreen.feedback-normal {
    background-color: #d1fae5; /* Açık yeşil - şeffaf değil */
    border-color: var(--success-color);
    box-shadow: 0 0 60px rgba(16, 185, 129, 0.3);
}

.speech-info-controls.fullscreen.feedback-fast {
    background-color: #fee2e2; /* Açık kırmızı - şeffaf değil */
    border-color: var(--danger-color);
    box-shadow: 0 0 60px rgba(239, 68, 68, 0.3);
}

.speech-info-controls.fullscreen .speed-content-wrapper {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: clamp(10px, 2vh, 20px);
    padding: clamp(8px, 1.5vh, 16px) clamp(16px, 4vw, 32px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: none;
}

.speech-info-controls.fullscreen .speed-header {
    display: none;
}

.speech-info-controls.fullscreen .fullscreen-controls {
    position: static;
}

.speech-info-controls.fullscreen .fullscreen-button {
    width: clamp(36px, 8vmin, 48px);
    height: clamp(36px, 8vmin, 48px);
    font-size: clamp(1.1rem, 3vmin, 1.5rem);
}

.speech-info-controls.fullscreen .speed-visual {
    --fs-gauge-size: clamp(240px, min(62vw, 54vh), 440px);
    width: var(--fs-gauge-size);
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.speech-info-controls.fullscreen .speed-gauge--arc {
    --gauge-size: var(--fs-gauge-size);
    width: var(--gauge-size);
    height: calc(var(--gauge-size) / 2);
    aspect-ratio: auto;
    margin-left: auto;
    margin-right: auto;
}

.speech-info-controls.fullscreen .speed-gauge--linear {
    display: none;
}

.speech-info-controls.fullscreen .gauge-value {
    font-size: clamp(1.85rem, 7vmin, 3.25rem);
}

.speech-info-controls.fullscreen .speed-labels {
    width: 100%;
    max-width: var(--fs-gauge-size, 100%);
    margin-left: auto;
    margin-right: auto;
    font-size: clamp(0.7rem, 2vmin, 0.85rem);
    margin-top: clamp(6px, 1vh, 10px);
}

.speech-info-controls.fullscreen .speech-toggle-minimal {
    margin-top: clamp(6px, 1.2vh, 12px);
    margin-bottom: clamp(4px, 0.8vh, 8px);
}

.speech-info-controls.fullscreen .speech-toggle-minimal-btn {
    padding: clamp(6px, 1.2vh, 8px) clamp(12px, 2.5vw, 16px);
    font-size: clamp(11px, 2.2vmin, 13px);
}

.speech-info-controls.fullscreen .speed-value-display {
    font-size: clamp(1.5rem, 6vmin, 2.4rem);
    margin: clamp(2px, 0.5vh, 5px) 0;
}

.speech-info-controls.fullscreen .label-text {
    font-size: clamp(0.8rem, 2.2vmin, 0.95rem);
}

.speech-info-controls.fullscreen .speed-status-badge {
    font-size: clamp(0.8rem, 2.2vmin, 0.95rem);
    padding: clamp(4px, 1vh, 6px) clamp(10px, 2.5vw, 14px);
}

.speech-info-controls.fullscreen .gif-feedback-container {
    height: clamp(50px, 10vh, 90px);
    margin-top: clamp(6px, 1.2vh, 12px);
}

.speech-info-controls.fullscreen .progress-bar-container {
    flex-shrink: 0;
    width: 100%;
    margin: 0;
    padding: clamp(6px, 1vh, 10px) clamp(16px, 4vw, 32px);
    box-sizing: border-box;
}

/* --- Fullscreen: Son 3 sözcük önizleme --- */
.last-words-preview {
    display: none;
}

.speech-info-controls.fullscreen .last-words-preview {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    flex-shrink: 0;
    width: min(880px, calc(100% - 32px));
    margin: 0 auto clamp(8px, 1.5vh, 14px);
    padding: 8px 10px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    pointer-events: auto;
}

.last-words-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.last-words-toggle {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.8);
    color: rgba(31, 41, 55, 0.75);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
    cursor: pointer;
}

.last-words-toggle:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.14);
    transform: translateY(-1px);
}

.last-words-toggle .eye-icon {
    width: 14px;
    height: 14px;
    display: block;
}

.speech-info-controls.fullscreen.last-words-collapsed .last-words-toggle .eye-icon {
    opacity: 0.6;
}

.last-words-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(31, 41, 55, 0.75);
    letter-spacing: 0.2px;
}

/* Önizleme açıkken başlık metnini gizle; kapalıyken tekrar göster */
.speech-info-controls.fullscreen:not(.last-words-collapsed) .last-words-label {
    display: none;
}

.speech-info-controls.fullscreen.last-words-collapsed .last-words-label {
    display: block;
}

.last-words-chips {
    display: flex;
    align-items: baseline;
    gap: 10px;
    min-height: 28px;
    overflow: hidden;
    flex: 1;
}

.last-words-context {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(0.78rem, 1.0vw, 0.92rem);
    font-weight: 600;
    letter-spacing: 0.1px;
    color: rgba(31, 41, 55, 0.62);
}

.last-words-focus {
    flex: 0 0 auto;
    max-width: 24ch;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(52, 76, 100, 0.08);
    border: 1px solid rgba(52, 76, 100, 0.22);
    color: #111827;
    font-weight: 800;
    font-size: clamp(0.92rem, 1.25vw, 1.08rem);
    line-height: 1;
    transition: background-color 260ms ease, border-color 260ms ease, box-shadow 260ms ease;
}

.speech-info-controls.fullscreen.feedback-slow .last-words-focus {
    background: rgba(245, 158, 11, 0.16);
    border-color: rgba(245, 158, 11, 0.30);
}

.speech-info-controls.fullscreen.feedback-normal .last-words-focus {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.30);
}

.speech-info-controls.fullscreen.feedback-fast .last-words-focus {
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(239, 68, 68, 0.30);
}

.speech-info-controls.fullscreen.last-words-collapsed .last-words-chips {
    gap: 0;
}

.speech-info-controls.fullscreen.last-words-collapsed .last-words-row {
    gap: 0;
}

.speech-info-controls.fullscreen.last-words-collapsed .last-words-context {
    display: none;
}

.speech-info-controls.fullscreen.last-words-collapsed .last-words-preview {
    padding-top: 8px;
    padding-bottom: 8px;
}

/* Kısa ekranlarda tam ekran içeriğini sıkıştır */
@media (max-height: 640px) {
    .speech-info-controls.fullscreen .speed-visual {
        --fs-gauge-size: clamp(200px, min(52vw, 42vh), 320px);
        width: var(--fs-gauge-size);
        max-width: none;
    }

    .speech-info-controls.fullscreen .speed-gauge--arc {
        --gauge-size: var(--fs-gauge-size);
        width: var(--gauge-size);
        height: calc(var(--gauge-size) / 2);
        aspect-ratio: auto;
    }

    .speech-info-controls.fullscreen .gif-feedback-container {
        height: clamp(40px, 8vh, 70px);
        margin-top: 6px;
    }

    .speech-info-controls.fullscreen .speed-content-wrapper {
        gap: 8px;
        padding: 6px 16px;
    }
}

@media (max-height: 500px) {
    .speech-info-controls.fullscreen .gif-feedback-container {
        display: none;
    }

    .speech-info-controls.fullscreen .speed-status-badge {
        display: none;
    }
}

.last-words-preview.highlight .last-words-focus {
    background: rgba(52, 76, 100, 0.18);
    border-color: rgba(52, 76, 100, 0.34);
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.10);
}

@media (prefers-reduced-motion: reduce) {
    .last-words-toggle,
    .last-words-focus,
    .last-words-preview.highlight .last-words-focus {
        transition: none !important;
        box-shadow: none !important;
    }
}

/* Danışan Dropdown Stilleri */
.danisan-input-wrapper {
    position: relative;
    width: 100%;
}

.danisan-input-wrapper input[type="text"] {
    padding-right: 45px;
}

.danisan-dropdown-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main, #1f2937);
    transition: all 0.2s ease;
    border-radius: 4px;
    z-index: 1;
}

.danisan-dropdown-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--primary-color, #344C64);
}

.danisan-dropdown-btn.active {
    color: var(--primary-color, #344C64);
}

.danisan-dropdown-btn.active svg {
    transform: rotate(180deg);
}

.danisan-dropdown-btn svg {
    transition: transform 0.2s ease;
}

.danisan-dropdown-menu {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    max-height: min(300px, calc(100vh - 200px));
    overflow: hidden;
    flex-direction: column;
}

.danisan-dropdown-menu.show {
    display: flex;
}

.danisan-dropdown-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.danisan-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.danisan-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #344C64);
    box-shadow: 0 0 0 2px rgba(52, 76, 100, 0.1);
}

.danisan-dropdown-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 4px 0;
}

.danisan-dropdown-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.95rem;
    color: var(--text-main, #1f2937);
}

.danisan-dropdown-item:hover {
    background-color: #f3f4f6;
    color: var(--primary-color, #344C64);
}

.danisan-dropdown-item.selected {
    background-color: var(--primary-color, #344C64);
    color: white;
    font-weight: 600;
}

.danisan-dropdown-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted, #6b7280);
    font-size: 0.9rem;
    font-style: italic;
}

.danisan-dropdown-list::-webkit-scrollbar {
    width: 8px;
}

.danisan-dropdown-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.danisan-dropdown-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.danisan-dropdown-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}
/* --- CLEAN MODAL REDESIGN --- */

.modal-header-clean {
    padding: 24px 48px 24px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 24px;
}

.modal-title-clean {
    font-size: 1.25rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
    text-align: left;
}

.results-grid-clean {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.summary-cards-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stat-card-clean {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.stat-label-clean {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.stat-value-clean {
    font-size: 1.5rem;
    font-weight: 600;
    color: #0f172a;
}

.severity-card-clean {
    position: relative;
    overflow: hidden;
}

.severity-card-clean::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.low-severity::before { background-color: #10b981; }
.medium-severity::before { background-color: #f59e0b; }
.high-severity::before { background-color: #ef4444; }

/* Speech Speed Card */
.speech-card-clean {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.speech-card-header-clean {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.speech-card-title-clean {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #334155;
}

.speech-card-badge-clean {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge--slow { background: #fef3c7; color: #b45309; }
.badge--normal { background: #d1fae5; color: #047857; }
.badge--fast { background: #fee2e2; color: #b91c1c; }
.badge--unknown { background: #f1f5f9; color: #64748b; }

.speech-card-body-clean {
    padding: 24px 20px;
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.speech-card-main-value-clean {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.speech-rate-clean {
    font-size: 2.25rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1;
}

.speech-unit-clean {
    font-size: 1rem;
    font-weight: 500;
    color: #64748b;
}

.speech-card-sub-value-clean {
    font-size: 1rem;
    color: #94a3b8;
    font-weight: 500;
    border-left: 1px solid #e2e8f0;
    padding-left: 16px;
}

.speech-card-empty-clean {
    color: #64748b;
    font-size: 0.9375rem;
    margin: 0;
}

.speech-card-footer-clean {
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.speech-mode-label-clean {
    font-size: 0.8125rem;
    color: #64748b;
}

/* Pause Correction Details */
.speech-card-details-clean {
    border-top: 1px solid #e2e8f0;
    padding: 20px;
}

.speech-metrics-grid-clean {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.speech-metric-clean {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.speech-metric-label-clean {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

.speech-metric-value-clean {
    font-size: 1rem;
    font-weight: 600;
    color: #334155;
}

.speech-metric-sub-clean {
    font-size: 0.75rem;
    color: #94a3b8;
}

.metric-highlight .speech-metric-value-clean {
    color: #0ea5e9;
}

.speech-intervals-clean {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed #e2e8f0;
}

.speech-intervals-label-clean {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    display: block;
}

.speech-intervals-list-clean {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.speech-intervals-list-clean li {
    font-size: 0.75rem;
    background: #f1f5f9;
    color: #475569;
    padding: 4px 8px;
    border-radius: 6px;
}

.speech-intervals-empty-clean {
    font-size: 0.8125rem;
    color: #94a3b8;
}

/* Speed Chart Card */
.speed-chart-card-clean {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
    margin-top: 24px;
}

.speed-chart-card-head-clean {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.speed-chart-card-title-clean {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 4px 0;
}

.speed-chart-card-subtitle-clean {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

.speed-chart-legend-clean {
    display: flex;
    gap: 12px;
}

.speed-chart-legend-item-clean {
    font-size: 0.75rem;
    font-weight: 500;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.speed-chart-legend-item-clean::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-slow::before { background: #f59e0b; }
.legend-normal::before { background: #10b981; }
.legend-fast::before { background: #ef4444; }

.speed-chart-stats-clean {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
}

.speed-chart-stat-clean {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.speed-chart-stat-label-clean {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
}

.speed-chart-stat-value-clean {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
}

.speed-chart-stat-unit-clean {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 400;
}

.speed-chart-canvas-wrap-clean {
    height: 300px;
    width: 100%;
    margin-bottom: 16px;
}

.speed-chart-footnote-clean {
    font-size: 0.75rem;
    color: #94a3b8;
    text-align: center;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .summary-cards-wrapper {
        grid-template-columns: 1fr;
    }
    
    .speed-chart-card-head-clean {
        flex-direction: column;
        gap: 16px;
    }
    
    .speed-chart-stats-clean {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .speech-card-body-clean {
        flex-direction: column;
        gap: 8px;
    }
    
    .speech-card-sub-value-clean {
        border-left: none;
        padding-left: 0;
    }
}

