/* digitar spor — stil */
:root, html[data-theme="dark"] {
  --bg: #0b0b0b;
  --surface: #151515;
  --surface-2: #1e1e1e;
  --surface-3: #2a2a2a;
  --line: #2c2c2a;
  --text: #ece8dc;
  --muted: #a7a396;
  --faint: #6f6c63;
  --accent: #c6f24e;
  --accent-ink: #c6f24e;      /* vurgu rengini metin olarak kullanırken */
  --on-accent: #0b0b0b;
  --viz: #c6f24e;             /* grafik/ilerleme dolgusu */
  --series-2: #8f8a7c;        /* grafikte ikinci seri (yakılan) */
  --muscle-off: #2b2b29;
  --muscle-line: #3a3a36;
  --body: #1f1f1d;
  --danger: #ff8a7a;
  --danger-bg: #3a1714;
  --warn: #f2c94e;
  --warn-bg: #3a3014;
  --ok: #c6f24e;
  --ok-bg: #26310f;
  --shadow: 0 1px 0 rgba(255,255,255,.03), 0 8px 24px rgba(0,0,0,.35);
  --radius: 18px;
  --radius-sm: 12px;
  color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --surface-2: #f0ede4;
  --surface-3: #e4e0d4;
  --line: #dcd7c9;
  --text: #151515;
  --muted: #55524a;
  --faint: #7c786d;
  --accent: #c6f24e;
  --accent-ink: #3d5a00;
  --on-accent: #0b0b0b;
  --viz: #6b8f00;
  --series-2: #8a8270;
  --muscle-off: #e4e0d4;
  --muscle-line: #c9c4b5;
  --body: #ece8dc;
  --danger: #b3261e;
  --danger-bg: #fbe4e1;
  --warn: #7a5a00;
  --warn-bg: #fbf0cf;
  --ok: #3d5a00;
  --ok-bg: #ecf8cf;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5; overflow-x: hidden;
}
img, svg { max-width: 100%; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.15; font-weight: 600; }
h1, .serif { font-family: "Instrument Serif", Georgia, serif; font-style: italic; font-weight: 400; }
h1 { font-size: clamp(2rem, 6vw, 2.75rem); letter-spacing: -.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent-ink); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
html[data-theme="light"] :focus-visible { outline-color: #3d5a00; }

/* ---------- düzen ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .5rem;
  padding: .5rem 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); min-height: 44px; }
.brand img { height: 22px; width: auto; display: block; }
.brand .tag { font-family: "Instrument Serif", serif; font-style: italic; font-size: 1.35rem; color: var(--accent-ink); line-height: 1; }
.logo-light { display: none !important; }
html[data-theme="light"] .logo-dark { display: none !important; }
html[data-theme="light"] .logo-light { display: block !important; }
.topbar .spacer { flex: 1; }

.main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1180px; margin: 0 auto; }
.main:focus, .main h1:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.page-head p { margin: 0; color: var(--muted); }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; color: var(--muted); text-decoration: none; font-size: .68rem; font-weight: 500;
  border-radius: 12px; padding: 4px 2px; text-align: center; letter-spacing: -.01em;
}
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--text); }
.nav a[aria-current="page"] svg { color: var(--accent-ink); }
.nav a[aria-current="page"] .nav-dot { background: var(--accent); }
.nav .nav-dot { width: 18px; height: 3px; border-radius: 3px; background: transparent; margin-top: 1px; }
.nav .nav-profil { display: none; }
.nav-foot { display: none; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 248px 1fr; }
  .topbar { display: none; }
  .nav {
    position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line); padding: 20px 14px; grid-column: 1;
  }
  .nav .brand { padding: 0 10px 18px; }
  .nav a:not(.brand) { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: .95rem; padding: 10px 14px; min-height: 46px; }
  .nav a[aria-current="page"] { background: var(--surface-2); }
  .nav .nav-dot { display: none; }
  .nav .nav-profil { display: flex; }
  .nav-foot { display: block; margin-top: auto; padding: 0 6px; }
  .main { grid-column: 2; padding: 28px 36px 48px; width: 100%; }
}
.nav .brand-side { display: none; }
@media (min-width: 960px) { .nav .brand-side { display: flex; } }

/* ---------- bileşenler ---------- */
.grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .grid.cols-3-lg { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child, .card > header:first-child { margin-bottom: .75rem; }
.card header { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.card header h2 { margin: 0; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.between { justify-content: space-between; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: .875rem; }
.btn.icon { width: 44px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

label.field, .field { display: flex; flex-direction: column; gap: 6px; font-size: .875rem; color: var(--muted); font-weight: 500; min-width: 0; }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); min-height: 44px; padding: 8px 12px; width: 100%; min-width: 0;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.form-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
@media (min-width: 720px) { .form-grid.wide { grid-template-columns: repeat(4, 1fr); } }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button, .seg label { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg [aria-selected="true"], .seg [aria-pressed="true"], .seg input:checked + span { background: var(--accent); color: var(--on-accent); }
.seg label { position: relative; padding: 0; }
.seg label span { padding: 0 16px; min-height: 40px; display: inline-flex; align-items: center; border-radius: 999px; }
.seg label input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg label input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.accent { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }

.notice { border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: .92rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.notice.error { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .serif { font-size: 1.5rem; color: var(--text); display: block; margin-bottom: .25rem; }

.stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat .v { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: .8rem; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: .75rem; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.list > li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow-wrap: anywhere; }
.list .meta { font-size: .82rem; color: var(--muted); }

/* ilerleme çubukları (makro) */
.bar { height: 8px; background: var(--surface-3); border-radius: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--viz); border-radius: 8px; }
.bar.over > i { background: var(--warn); }
.macro { display: grid; gap: 4px; }
.macro .top { display: flex; justify-content: space-between; font-size: .88rem; }
.macro .top b { font-variant-numeric: tabular-nums; }

/* grafikler */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .s1 { fill: var(--viz); }
.chart .s2 { fill: var(--series-2); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + g rect, .chart .col:hover rect { opacity: .85; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.ring-wrap { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
@media (max-width: 420px) { .ring-wrap { grid-template-columns: 1fr; justify-items: center; } .ring-wrap .stats { width: 100%; } }
.ring { width: 168px; height: 168px; }
.ring .track { stroke: var(--surface-3); }
.ring .val { stroke: var(--viz); transition: stroke-dasharray .6s ease; }
.ring .val.over { stroke: var(--warn); }
.ring .big { fill: var(--text); font-size: 30px; font-weight: 700; }
.ring .lbl { fill: var(--muted); font-size: 11px; }
.tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--text); color: var(--bg); font-size: .8rem;
  padding: 6px 10px; border-radius: 8px; font-weight: 600; white-space: nowrap; transform: translate(-50%, -110%);
}
.table-toggle { margin-top: 8px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.data-table th, .data-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* vücut haritası */
.bodymap { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto; }
.bodymap .sil { fill: var(--body); stroke: var(--muscle-line); stroke-width: 1.2; }
.bodymap .m { fill: var(--muscle-off); stroke: var(--muscle-line); stroke-width: 1; transition: fill .2s; }
.bodymap .m.on { fill: var(--viz); stroke: color-mix(in srgb, var(--viz) 60%, #000); }
.bodymap .m.sec { fill: color-mix(in srgb, var(--viz) 38%, var(--muscle-off)); }
.bodymap.interactive .m { cursor: pointer; }
.bodymap.interactive .m:hover { fill: color-mix(in srgb, var(--viz) 55%, var(--muscle-off)); }
.bodymap.interactive .m.on:hover { fill: var(--viz); }
.bodymap .m:focus { outline: none; }
.bodymap .m:focus-visible { stroke: var(--text); stroke-width: 2.5; }
.bodymap .cap { fill: var(--muted); font-size: 11px; text-anchor: middle; letter-spacing: .08em; }
.map-legend { display: flex; justify-content: center; gap: 14px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.map-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 6px; vertical-align: -2px; }

/* hareket kartları */
.ex-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .ex-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .ex-grid { grid-template-columns: repeat(3, 1fr); } }
.ex-card { text-align: left; display: flex; flex-direction: column; gap: 8px; cursor: pointer; font: inherit; color: inherit; width: 100%; }
.ex-card:hover { border-color: var(--faint); }
.ex-card .name { font-weight: 650; font-size: 1rem; overflow-wrap: anywhere; }
.ex-card .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filters { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.filters .search { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters { grid-template-columns: repeat(4, 1fr); } }
.lib-layout { display: grid; gap: 16px; }
@media (min-width: 1000px) { .lib-layout { grid-template-columns: 320px 1fr; align-items: start; } .lib-layout > .card:first-child { position: sticky; top: 24px; } }

/* diyaloglar */
dialog {
  border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--text); padding: 0;
  width: min(680px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(0,0,0,.6); }
.dlg-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; gap: .5rem; padding: 16px 16px 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dlg-head h2 { flex: 1; margin: 6px 0 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.dlg-body { padding: 16px 20px 20px; }
.dlg-body ol, .dlg-body ul { padding-left: 1.25rem; margin: .25rem 0 1rem; }
.dlg-body li { margin: .3rem 0; }
.pick-list { list-style: none; padding: 0; margin: 8px 0 0; max-height: 52vh; overflow: auto; }
.pick-list button { width: 100%; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--line); color: var(--text); font: inherit; padding: 10px 6px; min-height: 48px; cursor: pointer; display: flex; flex-direction: column; border-radius: 8px; }
.pick-list li:first-child button { border-top: 0; }
.pick-list button:hover, .pick-list button[aria-selected="true"] { background: var(--surface-2); }
.pick-list .meta { font-size: .8rem; color: var(--muted); }

/* program düzenleyici / antrenman ögeleri */
.day { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: var(--surface); }
.day + .day { margin-top: 12px; }
.day-head { display: flex; align-items: center; gap: .5rem; justify-content: space-between; flex-wrap: wrap; }
.day-head h3 { margin: 0; font-family: "Instrument Serif", serif; font-style: italic; font-weight: 400; font-size: 1.35rem; }
.item { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-of-type { border-top: 0; }
.item-head { display: flex; align-items: center; gap: .5rem; }
.item-head .name { flex: 1; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.item-fields { display: grid; gap: 8px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) { .item-fields { grid-template-columns: repeat(4, 1fr); } }
.item-fields .wide { grid-column: 1 / -1; }
@media (min-width: 900px) { .item-fields.five { grid-template-columns: repeat(4, 1fr) 2fr; } .item-fields.five .wide { grid-column: auto; } }
.item .calc { font-size: .82rem; color: var(--muted); }
.sticky-sum {
  position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 10; margin-top: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow);
}
@media (min-width: 960px) { .sticky-sum { bottom: 16px; } }
.sticky-sum .stat .v { font-size: 1.25rem; }

/* OCR */
.drop {
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; display: grid; gap: 10px; justify-items: center;
  background: var(--surface-2);
}
.drop.over { border-color: var(--accent); }
.drop img { max-height: 260px; border-radius: 10px; }
progress { width: 100%; height: 10px; appearance: none; border: 0; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 8px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 8px; }
progress::-moz-progress-bar { background: var(--accent); }
.ocr-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.ocr-table th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.ocr-table td { padding: 6px; vertical-align: top; border-bottom: 1px solid var(--line); }
.ocr-table input { min-height: 40px; padding: 6px 8px; }
.ocr-table .c-gun { width: 200px; } .ocr-table .c-num { width: 80px; } .ocr-table .c-del { width: 52px; }
.ocr-table .match { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.ocr-table tr.unmatched td { background: color-mix(in srgb, var(--warn-bg) 55%, transparent); }
@media (max-width: 760px) {
  .ocr-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .ocr-table, .ocr-table tbody, .ocr-table tr, .ocr-table td { display: block; width: 100% !important; }
  .ocr-table tr { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; margin-bottom: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .ocr-table td { border: 0; padding: 0; }
  .ocr-table td.c-gun, .ocr-table td.c-ad, .ocr-table td.c-not { grid-column: 1 / -1; }
  .ocr-table td.c-del { grid-column: 1 / -1; }
  .ocr-table td::before { content: attr(data-label); display: block; font-size: .72rem; color: var(--muted); margin-bottom: 2px; font-weight: 600; }
  .ocr-table td.c-del::before { content: none; }
}

/* giriş */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%), var(--bg); }
.auth-card { width: min(420px, 100%); }
.auth-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.auth-logo img { height: 34px; width: auto; }
.auth-logo .serif { font-size: 2.4rem; color: var(--accent-ink); line-height: 1; }
.auth form { display: grid; gap: 12px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.tabs button { min-height: 44px; }

/* bildirim */
.toast-wrap { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 80; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
@media (min-width: 960px) { .toast-wrap { bottom: 24px; } }
.toast { background: var(--text); color: var(--bg); border-radius: 14px; padding: 12px 16px; font-weight: 600; font-size: .92rem; box-shadow: 0 10px 30px rgba(0,0,0,.35); animation: tin .25s ease; pointer-events: auto; }
.toast.error { background: var(--danger); color: #fff; }
html[data-theme="light"] .toast.error { background: #b3261e; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite linear; border-radius: 10px; min-height: 120px; }
@keyframes sk { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- mobil uygulama davranışı (SPEC-EK) ---------- */
html, body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
button, a, input, select, textarea, label { touch-action: manipulation; }
.topbar { padding-top: calc(.5rem + env(safe-area-inset-top)); }
.auth { padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--on-accent); padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.skip:focus { top: calc(8px + env(safe-area-inset-top)); }

/* alt sekme çubuğu: 5 sekme telefonda; masaüstünde tüm sayfalar yan menüde */
.nav { grid-template-columns: repeat(5, 1fr); }
.nav .brand-side, .nav .d-only { display: none; }
.nav .m-only { display: flex; }
@media (min-width: 960px) {
  .nav .d-only { display: flex; }
  .nav .m-only { display: none; }
  .nav .brand-side { display: flex; }
}

/* sayfa geçişi */
.main.enter > * { animation: pagein .22s ease both; }
@keyframes pagein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* alttan açılan sheet (telefon) */
@media (max-width: 640px) {
  dialog {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0; border-bottom: 0;
    max-height: 92dvh; padding-bottom: env(safe-area-inset-bottom); animation: sheetup .26s cubic-bezier(.2,.8,.2,1);
  }
  dialog.tall { height: 92dvh; }
  .dlg-head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; border-radius: 4px; background: var(--surface-3); transform: translateX(-50%); }
}
@keyframes sheetup { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

/* daha fazla listesi */
.more-list { list-style: none; margin: 0; padding: 0; }
.more-item { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 6px 4px; color: var(--text); text-decoration: none; border-top: 1px solid var(--line); font-weight: 550; }
.more-list li:first-child .more-item { border-top: 0; }
.more-item svg { width: 22px; height: 22px; color: var(--muted); flex: none; }
.more-item span { flex: 1; }
.more-item:hover svg:first-child { color: var(--accent-ink); }

/* onay kutuları */
.consents { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px 12px; margin: 0; display: grid; gap: 10px; }
.consents legend { font-size: .82rem; color: var(--muted); padding: 0 4px; font-weight: 600; }
.consent { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; font-size: .9rem; }
.consent input { margin-top: 2px; width: 22px; height: 22px; }
.consent label { cursor: pointer; }

/* kurulum yönergesi */
.install { margin-bottom: 14px; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.install h2 { margin-bottom: .35rem; }
.install .grow { flex: 1; min-width: 0; }
.kbd { display: inline-flex; align-items: center; gap: 3px; padding: 1px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-weight: 600; }
.kbd svg { width: 15px; height: 15px; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.ex-detail { display: grid; gap: 16px; }
@media (min-width: 600px) { .ex-detail { grid-template-columns: 1fr 1fr; align-items: center; } }
.list > li > input[type="checkbox"] { flex: none; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); font-weight: 600; }
details[open] > summary { color: var(--text); }
.btn[aria-busy="true"] { opacity: .7; }
.field .seg { align-self: flex-start; }

/* ===== TIMER ===== */
.tm { display: grid; gap: 14px; }
.tm-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.tm-tabs button { flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tm-tabs button[aria-selected="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tm-panel { display: grid; gap: 14px; justify-items: stretch; }
.tm-panel[hidden] { display: none; }
.tm-ring { position: relative; width: min(74vw, 270px); aspect-ratio: 1; margin: 4px auto; }
.tm-ring svg { width: 100%; height: 100%; display: block; }
.tm-ring .track { stroke: var(--line); }
.tm-ring .val { stroke: var(--viz); transition: stroke .2s; }
.tm-ring.faz-dinlenme .val, .tm-ring.faz-hazirlik .val { stroke: var(--warn); }
.tm-ring.faz-bitti .val { stroke: var(--ok-ink, var(--viz)); }
.tm-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; padding: 0 14%; }
.tm-time { font-size: clamp(2.5rem, 13vw, 3.8rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; color: var(--text); }
.tm-sub { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; min-height: 1.1em; }
.tm-ctl { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tm-ctl .btn { min-height: 48px; min-width: 96px; justify-content: center; }
.tm-ctl .tm-main { min-width: 132px; font-size: 1.05rem; }
.tm-presets { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tm-pill { min-height: 44px; min-width: 64px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.tm-pill[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.tm-custom { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.tm-check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-size: .9rem; }
.tm-check input { width: 22px; height: 22px; flex: none; }
.tm-check.strong { font-weight: 600; color: var(--text); }
.tm-note { margin: 0; }
.tm-h3 { font-size: .95rem; margin: .5rem 0 0; }
.tm-laps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-height: 40vh; overflow-y: auto; }
.tm-laps li, .tm-hist li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tm-laps .no { min-width: 52px; color: var(--muted); }
.tm-laps .ara { font-weight: 700; font-size: 1.05rem; }
.tm-laps .top { margin-left: auto; }
.tm-hist { list-style: none; margin: 0; padding: 0; }
.tm-hist li strong { margin-left: auto; font-variant-numeric: tabular-nums; }
.tm-rec { text-align: center; color: var(--accent-ink); font-weight: 600; }
.tm-res { text-align: center; font-weight: 700; min-height: 1.2em; }
.tm-info { text-align: center; }
.tm-sec { display: grid; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); }
.tm-days { display: flex; gap: 6px; flex-wrap: wrap; }
.tm-days .tm-pill { min-width: 48px; padding: 0 10px; }
.tm-setrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tm-top { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); top: calc(8px + env(safe-area-inset-top)); width: min(440px, calc(100vw - 20px)); display: grid; gap: 8px; pointer-events: none; }
.tm-top > * { pointer-events: auto; }
.tm-banner { display: flex; align-items: center; gap: 10px; padding: 10px 6px 10px 14px; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); }
.tm-banner .grow { flex: 1; min-width: 0; }
.tm-banner .btn { color: var(--on-accent); }
.tm-dock { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tm-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--accent); color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.tm-chip .l { color: var(--muted); font-size: .8rem; font-weight: 600; }
.tm-chip .v { font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 380px) { .form-grid.three { grid-template-columns: 1fr 1fr; } .tm-custom { grid-template-columns: 1fr 1fr; } .tm-custom .btn { grid-column: 1 / -1; } }
@media (prefers-reduced-motion: reduce) { .tm-ring .val { transition: none; } }
@media (max-width: 959px) { .tm-top { top: calc(64px + env(safe-area-inset-top)); } }

/* ===== 3D ===== */
.ex-media { margin: 0 0 14px; }
.exp-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 10px; }
.exp-tab { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.exp-tab[aria-selected="true"] { background: var(--accent); color: var(--on-accent); }
.exp-pane[hidden] { display: none; }
.a3d-skel { aspect-ratio: 4 / 3; min-height: 220px; border-radius: var(--radius); }
.a3d { display: grid; gap: 10px; }
.a3d-stage { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 62vh; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 50% 20%, var(--surface-2), var(--bg) 85%); }
@media (max-width: 640px) { .a3d-stage { aspect-ratio: 1 / 1; } }
.a3d-canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; outline: none; }
.a3d-canvas:active { cursor: grabbing; }
.a3d-canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--accent); }
.a3d-hud { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.a3d-phase, .a3d-count { padding: 5px 11px; border-radius: 999px; font-size: .82rem; font-weight: 650; background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--line); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62%; }
.a3d-phase { color: var(--accent-ink); }
.a3d-count { font-variant-numeric: tabular-nums; }
.a3d-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.a3d-group { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.a3d-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.a3d-group .a3d-btn { border: 0; border-radius: 0; padding: 0 12px; }
.a3d-group .a3d-btn + .a3d-btn { border-left: 1px solid var(--line); }
.a3d-btn svg { width: 18px; height: 18px; }
.a3d-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.a3d-play { background: var(--text); color: var(--bg); border-color: var(--text); }
.a3d-foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between; }
.a3d-legend { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.a3d-key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.a3d-key.t { background: #c6f24e; }
.a3d-key.s { background: #d9e8a6; margin-left: 6px; }
html[data-theme="light"] .a3d-key.s { background: #d6e6a0; outline: 1px solid var(--line); }
.a3d-note { margin: 0; font-size: .78rem; color: var(--muted); flex: 1 1 220px; }
.a3d-fallback { border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface-2); }
.a3d-fallback p { margin: 6px 0 0; font-size: .9rem; color: var(--muted); }
.exp-photo { position: relative; width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #fff; }
.exp-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .45s ease; }
.exp-photo img.on { opacity: 1; }
.exp-photo.static { display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: auto; }
.exp-photo.static img { position: static; opacity: 1; height: auto; aspect-ratio: 4 / 3; }
.exp-credit { margin: 6px 0 0; }

/* ===== OCR ===== */
.ocr-thumb-wrap:empty { display: none; }
.drop img.ocr-thumb, .ocr-thumb { max-height: 120px; max-width: 100%; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.ocr-summary { margin: 4px 0 8px; font-weight: 650; }
.ocr-table input.ocr-low { background: var(--warn-bg); border-color: var(--warn); }
.ocr-table input.ocr-guess { border: 2px solid #ff8a2b; background: color-mix(in srgb, #ff8a2b 12%, transparent); }
.ocr-table tr.ocr-check td.c-ad { box-shadow: inset 3px 0 0 var(--warn); }
.ocr-table tr.ocr-rest td { background: color-mix(in srgb, var(--ok-bg) 55%, transparent); }
.ocr-tag { display: inline-block; margin-top: 4px; padding: 1px 8px; border-radius: 999px; font-size: .72rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.ocr-tag.guess, .chip.guess { background: color-mix(in srgb, #ff8a2b 16%, transparent); color: #c25a00; border: 1px solid #ff8a2b; }
html[data-theme="dark"] .ocr-tag.guess, html[data-theme="dark"] .chip.guess { color: #ffb066; }
.ocr-q { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); }
.ocr-raw-hint { margin-top: 2px; font-size: .72rem; color: var(--muted); word-break: break-all; }
.ocr-why { margin-top: 4px; font-size: .74rem; color: var(--warn); }
.ocr-acts { display: flex; gap: 2px; }
.ocr-table .c-del { width: 132px; }
.ocr-table td.c-rest { vertical-align: middle; }
.ocr-rawbox { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--surface-2); }
.ocr-rawbox summary { cursor: pointer; font-weight: 600; min-height: 32px; display: flex; align-items: center; }
.ocr-raw { margin: 8px 0 0; max-height: 280px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: .78rem; }
@media (max-width: 760px) {
  .ocr-table td.c-rest { grid-column: 1 / -1; }
  .ocr-table .c-del { width: 100% !important; }
  .ocr-acts { justify-content: flex-end; }
}

/* ===== VIDEO (hareket döngü videosu) ===== */
.exp-photo.has-video{position:relative}
.exp-photo.has-video .exp-video{display:block;width:100%;height:auto;border-radius:inherit}
.exp-photo.has-video img{display:none}
.exp-photo.has-video.static{display:block;aspect-ratio:4/3}
