:root {
    --primary: #0f766e;
    --primary-dark: #0d5f58;
    --primary-light: #f0fdfa;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(0,0,0,0.07);
    --nav-height: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    min-height: 100vh;
    padding-bottom: var(--nav-height);
}

@media (min-width: 768px) {
    body {
        background:
            radial-gradient(circle at 10% 0%, rgba(15, 118, 110, 0.08), transparent 40%),
            radial-gradient(circle at 90% 100%, rgba(13, 95, 88, 0.06), transparent 40%),
            var(--gray-50);
    }
}

/* ── Header ── */
header {
    background: var(--primary);
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 10px rgba(15,118,110,0.4);
    position: sticky;
    top: 0;
    z-index: 20;
}

.logo { font-size: 26px; flex-shrink: 0; }
.header-text { flex: 1; min-width: 0; }
header h1 { font-size: 20px; font-weight: 700; line-height: 1.2; }
.tagline { font-size: 11px; opacity: 0.8; margin-top: 2px; }

.model-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    opacity: 0.9;
    flex-shrink: 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.loading { background: #fbbf24; animation: pulse-dot 1.5s infinite; }
.status-dot.ready   { background: #4ade80; }
.status-dot.demo    { background: #f97316; }

@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Main ── */
main {
    max-width: 560px;
    margin: 0 auto;
}

/* ── Bottom Nav ── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 560px;
    height: var(--nav-height);
    background: white;
    border-top: 1px solid var(--gray-200);
    display: flex;
    z-index: 20;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}

@media (min-width: 560px) {
    .bottom-nav {
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
    }
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    transition: color 0.15s;
    padding: 8px 0;
}

.nav-btn.active { color: var(--primary); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 11px; font-weight: 500; }

/* ── Tab Content ── */
.tab-content { display: none; padding: 16px 16px 24px; }
.tab-content.active { display: block; }

/* ── Upload Card ── */
.upload-card {
    background: white;
    border-radius: var(--radius);
    padding: 32px 20px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 2px dashed var(--gray-200);
    margin-bottom: 14px;
    transition: border-color 0.2s, background 0.2s;
}

.upload-card.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon { font-size: 48px; margin-bottom: 12px; }
.upload-card h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.upload-hint { color: var(--gray-600); font-size: 13px; margin-bottom: 20px; line-height: 1.5; }

/* ── Buttons ── */
.btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 10px;
    text-align: center;
    text-decoration: none;
}

.btn:last-child { margin-bottom: 0; }
.btn:active { transform: scale(0.98); }

.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray-100); color: var(--gray-800); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

/* ── ABCDE Info Card ── */
.info-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.info-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.info-desc { font-size: 13px; color: var(--gray-600); margin-bottom: 14px; line-height: 1.5; }

.abcde-grid { display: flex; flex-direction: column; gap: 12px; }

.abcde-item { display: flex; align-items: flex-start; gap: 12px; }

.abcde-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 800;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.abcde-item div { font-size: 13px; color: var(--gray-700); line-height: 1.5; }
.abcde-item div strong { color: var(--gray-900); }

/* ── Loading ── */
.center-section {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray-600);
    font-size: 15px;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

/* ── Canvas ── */
.canvas-wrapper {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    background: #000;
}

canvas { width: 100%; height: auto; display: block; }

/* ── Result Badge ── */
.result-badge {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

.result-badge.benign   { background: var(--success-light); color: var(--success); }
.result-badge.malignant { background: var(--danger-light);  color: var(--danger);  }
.result-badge.unknown  { background: var(--warning-light); color: var(--warning); }

.result-icon { font-size: 28px; flex-shrink: 0; }
.result-label { font-size: 17px; font-weight: 700; }
.result-sub { font-size: 13px; margin-top: 3px; opacity: 0.85; line-height: 1.4; }

/* ── Demo Notice ── */
.demo-notice {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 12px;
    color: #9a3412;
    margin-bottom: 12px;
    line-height: 1.6;
}

.demo-notice code {
    background: rgba(0,0,0,0.08);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
}

/* ── Disclaimer ── */
.disclaimer {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    color: #92400e;
    line-height: 1.6;
    margin-bottom: 14px;
}

/* ── Error ── */
.error-card {
    background: white;
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    box-shadow: var(--shadow);
}

.error-icon { font-size: 44px; margin-bottom: 14px; }
#analyze-error-msg {
    color: var(--gray-600);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-line;
}

/* ── Track Tab ── */
.track-header { margin-bottom: 16px; }
.track-header h2 { font-size: 20px; font-weight: 700; }
.track-date { font-size: 13px; color: var(--gray-600); margin-top: 3px; }

.track-form { display: flex; flex-direction: column; gap: 12px; }

.slider-card {
    background: white;
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
}

.slider-value { color: var(--primary); font-weight: 700; font-size: 15px; }

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--gray-200);
    outline: none;
    margin-bottom: 8px;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15,118,110,0.35);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--gray-400);
}

.checkbox-card {
    background: white;
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label div { font-size: 14px; font-weight: 600; }
.checkbox-label small {
    display: block;
    font-size: 12px;
    color: var(--gray-600);
    font-weight: 400;
    margin-top: 2px;
}

.score-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-light);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
}

.preview-num { font-size: 24px; font-weight: 800; }

.save-success {
    text-align: center;
    color: var(--success);
    font-size: 14px;
    font-weight: 600;
    padding: 12px;
    background: var(--success-light);
    border-radius: 10px;
}

/* ── Results Tab ── */
#tab-results h2 { font-size: 20px; font-weight: 700; margin-bottom: 16px; }
#tab-results h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }

.score-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.score-ring-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.score-ring {
    width: 100px;
    height: 100px;
    transform: rotate(-90deg);
}

.ring-bg { fill: none; stroke: var(--gray-100); stroke-width: 10; }
.ring-fill {
    fill: none;
    stroke: var(--primary);
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease, stroke 0.4s ease;
}

.score-center {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number { font-size: 26px; font-weight: 800; color: var(--gray-900); }
.score-label  { font-size: 11px; color: var(--gray-400); }

.score-breakdown { flex: 1; display: flex; flex-direction: column; gap: 10px; }

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-100);
}

.breakdown-item:last-child { border-bottom: none; padding-bottom: 0; }
.breakdown-item span:last-child { font-weight: 700; color: var(--primary); font-size: 14px; }

.rec-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px 16px;
    box-shadow: var(--shadow);
}

.rec-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 13px;
    line-height: 1.6;
    color: var(--gray-700);
}

.rec-item:last-child { border-bottom: none; padding-bottom: 0; }
.rec-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }

/* ── Metrics Grid ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.metric-card {
    background: white;
    border-radius: 12px;
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.metric-label {
    font-size: 11px;
    color: var(--gray-600);
    margin-bottom: 6px;
    line-height: 1.3;
    font-weight: 500;
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

/* ── Report Sections (Analiz Detayları / Günlük Faktörler) ── */
.report-section {
    background: white;
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.report-section h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--gray-900);
}

/* ── Reason Rows (ABCDE Detayları) ── */
.reason-row {
    border-left: 3px solid var(--gray-200);
    padding: 10px 0 10px 12px;
    margin-bottom: 10px;
    background: var(--gray-50);
    border-radius: 0 8px 8px 0;
}

.reason-row:last-child { margin-bottom: 0; }

.reason-row.reason-low    { border-left-color: var(--success); background: var(--success-light); }
.reason-row.reason-medium { border-left-color: var(--warning); background: var(--warning-light); }
.reason-row.reason-high   { border-left-color: var(--danger);  background: var(--danger-light);  }

.reason-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.reason-icon { font-size: 16px; flex-shrink: 0; }

.reason-title {
    flex: 1;
    font-size: 13px;
    font-weight: 700;
    color: var(--gray-900);
}

.reason-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-low    { background: var(--success); color: white; }
.badge-medium { background: var(--warning); color: white; }
.badge-high   { background: var(--danger);  color: white; }

.reason-desc {
    font-size: 12px;
    color: var(--gray-700);
    line-height: 1.5;
    margin: 0;
}

/* ── Daily Factor Rows ── */
.factor-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: var(--gray-50);
    border-left: 3px solid var(--gray-200);
}

.factor-row:last-child { margin-bottom: 0; }

.factor-row.factor-good { background: var(--success-light); border-left-color: var(--success); }
.factor-row.factor-ok   { background: var(--warning-light); border-left-color: var(--warning); }
.factor-row.factor-bad  { background: var(--danger-light);  border-left-color: var(--danger);  }

.factor-icon { font-size: 20px; flex-shrink: 0; }

.factor-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.factor-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
}

.factor-note {
    font-size: 11px;
    color: var(--gray-600);
    line-height: 1.4;
}

.factor-value {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    flex-shrink: 0;
}

/* ── Combined Score Card ── */
.combined-card:not(:empty) {
    background: linear-gradient(135deg, #f0fdfa 0%, #ecfeff 100%);
    border: 1px solid #99f6e4;
    border-radius: var(--radius);
    padding: 18px 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

.combined-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    flex-wrap: wrap;
    gap: 8px;
}

.combined-score-num {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.combined-score-num small {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-400);
    margin-left: 2px;
}

.combined-formula {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--gray-700);
    padding-top: 10px;
    border-top: 1px dashed #99f6e4;
}

.combined-formula span { line-height: 1.3; }
.combined-formula strong { color: var(--gray-900); }

.formula-op {
    color: var(--gray-400);
    font-weight: 600;
}

.formula-result {
    width: 100%;
    text-align: right;
    font-weight: 800;
    font-size: 13px;
    margin-top: 4px;
}

/* ── No-Data Note (Track sekmesine yönlendirme) ── */
.no-data-note {
    background: var(--gray-50);
    border: 1px dashed var(--gray-200);
    border-radius: 10px;
    padding: 14px;
    font-size: 13px;
    color: var(--gray-600);
    text-align: center;
    line-height: 1.6;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 6px;
    margin-left: 4px;
    border-radius: 6px;
    transition: background 0.15s;
}

.link-btn:hover { background: var(--primary-light); }
.link-btn:active { transform: scale(0.97); }

/* ── Model Needed ── */
.model-needed-card {
    background: white;
    border-radius: var(--radius);
    padding: 32px 20px;
    box-shadow: var(--shadow);
    text-align: center;
}

.model-needed-icon { font-size: 52px; margin-bottom: 14px; }

.model-needed-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--gray-900);
}

.model-needed-card > p {
    font-size: 14px;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: 20px;
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    margin-bottom: 24px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.5;
}

.step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.step code {
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    color: var(--primary-dark);
}

.hidden { display: none !important; }
