:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f6;
  --line: #e2e6ed;
  --text: #0f1728;
  --muted: #5a6475;
  --primary: #1f4fd8;
  --primary-ink: #ffffff;
  --primary-soft: #e9efff;
  --ok: #0c8f5b;
  --ok-soft: #e4f6ee;
  --warn: #b25e09;
  --warn-soft: #fdf1e1;
  --bad: #d43c3c;
  --stage: #0b0d11;
  --shadow: 0 1px 2px rgb(15 23 40 / .05), 0 8px 28px rgb(15 23 40 / .06);
  --top: 58px;
  --r: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #171b22;
    --surface-2: #1f242d;
    --line: #2a303b;
    --text: #eef1f6;
    --muted: #9aa4b5;
    --primary: #5b8cff;
    --primary-ink: #071028;
    --primary-soft: #1a2540;
    --ok: #3ecf8e;
    --ok-soft: #12291f;
    --warn: #f0b04a;
    --warn-soft: #2c2212;
    --bad: #f07070;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 28px rgb(0 0 0 / .25);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
h1, h2, h3, p { margin: 0; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* ------------------------------------------------------------ üst çubuk */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top);
  display: flex; align-items: center; gap: 12px;
  padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 6px 4px; cursor: pointer; font-weight: 700; font-size: 17px; letter-spacing: -.01em; border-radius: 8px; }
.logo { width: 30px; height: 30px; color: var(--primary); }
.brand span { white-space: nowrap; }
.pill-privacy {
  margin-left: auto; display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--ok); background: var(--ok-soft);
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.pill-privacy .ic { width: 15px; height: 15px; }
.type-select { margin-left: auto; display: none; min-width: 0; }
.type-select select {
  max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 30px 8px 12px; font-size: 14px; font-weight: 600; text-overflow: ellipsis;
}
body:not([data-view="home"]) .type-select { display: block; }
body:not([data-view="home"]) .pill-privacy { margin-left: 0; }

/* ------------------------------------------------------------ düğmeler */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px; padding: 10px 18px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 15px;
  text-align: left; transition: transform .06s, filter .15s, background .15s; -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.lg { min-height: 54px; font-size: 16.5px; padding: 12px 22px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 30%, transparent); }
.btn.primary:hover:not(:disabled) { background: var(--primary); filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn small { display: block; font-weight: 500; font-size: 12.5px; color: var(--muted); }
.btn small b { font-weight: 600; }
kbd { font-family: inherit; font-size: 11px; font-weight: 500; line-height: 1; padding: 3px 6px; border-radius: 5px; border: 1px solid currentColor; opacity: .6; }

/* ------------------------------------------------------------ ana sayfa */
.wrap { max-width: 1040px; margin: 0 auto; padding: 44px 20px 28px; display: flex; flex-direction: column; gap: 22px; }
.hero { text-align: center; max-width: 720px; margin: 0 auto 6px; }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--primary); margin-bottom: 12px; }
h1 { font-size: clamp(30px, 5.2vw, 46px); line-height: 1.12; letter-spacing: -.025em; font-weight: 800; }
.lead { margin-top: 16px; font-size: clamp(16px, 2vw, 18.5px); color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); }
.card h2 { font-size: 17px; font-weight: 700; margin-bottom: 14px; letter-spacing: -.01em; }
.card p + p { margin-top: 10px; }
.card p { color: var(--muted); }
.picker h2:not(:first-child) { margin-top: 26px; }

.types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.type {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left;
  padding: 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.type:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.type[aria-checked="true"] { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.type .thumb { height: 54px; border: 1.5px solid currentColor; border-radius: 4px; position: relative; margin-bottom: 10px; color: var(--muted); background: var(--surface); }
.type[aria-checked="true"] .thumb { color: var(--primary); }
.type .thumb::after { content: ""; position: absolute; left: 50%; top: 16%; width: 44%; height: 58%; transform: translateX(-50%); border: 1.5px solid currentColor; border-radius: 50%; }
.type strong { font-size: 15px; line-height: 1.3; }
.type span { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.cta { display: flex; gap: 12px; flex-wrap: wrap; }
.cta .btn { flex: 1 1 220px; }
.cta .primary { flex-grow: 2; }
.assure { display: flex; gap: 8px; align-items: flex-start; margin-top: 16px; font-size: 14px; color: var(--muted); }
.assure .ic { width: 17px; height: 17px; margin-top: 3px; color: var(--ok); }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { padding: 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.fi { display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 14px; }
.feature h3 { font-size: 16px; margin-bottom: 6px; letter-spacing: -.01em; }
.feature p { font-size: 14.5px; color: var(--muted); }

.two { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }
.two .card { box-shadow: none; }
.tips { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: 15px; }
.tips li { padding-left: 26px; position: relative; }
.tips li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 9px; height: 5px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
footer { padding: 8px 4px 20px; font-size: 13px; color: var(--muted); text-align: center; max-width: 760px; margin: 0 auto; }

/* ------------------------------------------------------------ kamera + sonuç ortak */
#camera, #result {
  display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 20px;
  height: calc(100dvh - var(--top)); padding: 20px;
}
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow);
  padding: 22px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; min-height: 0;
}
.panel-title { font-size: 12.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checks li { display: grid; grid-template-columns: 22px 1fr; align-items: center; column-gap: 10px; padding: 7px 0; color: var(--muted); font-size: 15px; }
.checks li::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2) center / 12px no-repeat; border: 1.5px solid var(--line);
}
.checks li.ok { color: var(--text); }
.checks li.ok::before { border-color: var(--ok); background-color: var(--ok); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.3 5 8.6l4.5-5' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.checks li.bad { color: var(--text); }
.checks li.bad::before { border-color: var(--warn); background-color: var(--warn); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2.8v4M6 9.2v.1' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); }
.checks .s { display: none; }
.checks .note { grid-column: 2; font-size: 13px; color: var(--warn); line-height: 1.35; }

.opts { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.switch { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 12px; cursor: pointer; font-weight: 600; font-size: 15px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 42px; height: 25px; border-radius: 999px; background: var(--line); position: relative; transition: background .18s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .18s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(17px); }
.switch input:focus-visible + i { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
.switch input:disabled + i { opacity: .4; }
.switch small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------ kamera */
#stage { position: relative; background: var(--stage); border-radius: 20px; overflow: hidden; min-height: 0; }
#video, #overlay { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transform: scaleX(-1); }
#stage.unmirror #video, #stage.unmirror #overlay { transform: none; }
#hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 3;
  max-width: calc(100% - 28px); width: max-content; text-align: center;
  padding: 11px 20px; border-radius: 999px; font-size: 17px; font-weight: 700; line-height: 1.3; color: #fff;
  background: rgb(15 18 24 / .78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgb(255 255 255 / .18); box-shadow: 0 8px 30px rgb(0 0 0 / .35);
}
#hint.ok { background: rgb(12 143 91 / .92); border-color: rgb(255 255 255 / .35); }
#hint.warn::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #ffb84a; margin-right: 10px; vertical-align: 1px; }
#countdown {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  font-size: min(34vh, 240px); font-weight: 800; color: #fff; text-shadow: 0 6px 40px rgb(0 0 0 / .6); pointer-events: none;
}
#flash { position: absolute; inset: 0; z-index: 4; background: #fff; opacity: 0; pointer-events: none; }
#flash.on { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }
#loading {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  text-align: center; padding: 28px; color: #d6dbe6; background: rgb(11 13 17 / .92); white-space: pre-line; font-size: 15.5px;
}
#loading.error .spin { display: none; }
.spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .22); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.actions { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; grid-template-areas: "shoot shoot" "back flip"; }
#shoot { grid-area: shoot; }
#back { grid-area: back; }
#flip { grid-area: flip; }
.actions .ghost { font-size: 14px; min-height: 42px; padding: 8px 10px; }

/* ------------------------------------------------------------ sonuç */
.result-photo { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 0; min-width: 0; }
.photo-wrap { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
#photo { max-width: 100%; max-height: 100%; background: #fff; border-radius: 6px; box-shadow: 0 2px 6px rgb(15 23 40 / .12), 0 18px 50px rgb(15 23 40 / .18); }
#busy {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 999px; background: rgb(15 18 24 / .82); color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap;
}
#busy .spin { width: 16px; height: 16px; border-width: 2px; }
#resultNote { font-size: 13.5px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }

.verdict { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; }
.verdict .ic { width: 22px; height: 22px; margin-top: 2px; stroke-width: 2.2; }
.verdict strong { display: block; font-size: 16px; }
.verdict span { font-size: 14px; color: var(--muted); }
.verdict.ok { background: var(--ok-soft); }
.verdict.ok .ic { color: var(--ok); }
.verdict.warn { background: var(--warn-soft); }
.verdict.warn .ic { color: var(--warn); }
.verdict.ok .v-warn, .verdict.warn .v-ok { display: none; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack .btn { width: 100%; }
.fine { font-size: 13px; color: var(--muted); }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: #161a22; color: #fff; font-size: 15px; font-weight: 500;
  box-shadow: 0 10px 40px rgb(0 0 0 / .35);
}

/* ------------------------------------------------------------ dar ekran */
@media (max-width: 900px) {
  :root { --top: 52px; }
  .brand span { font-size: 16px; }
  body:not([data-view="home"]) .pill-privacy { display: none; }
  .pill-privacy { font-size: 12px; padding: 5px 10px; }

  .wrap { padding: 28px 16px 20px; gap: 16px; }
  .card { padding: 20px; border-radius: 18px; }
  .types { grid-template-columns: repeat(2, 1fr); }
  .features, .two { grid-template-columns: 1fr; gap: 12px; }

  #camera { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; gap: 0; padding: 0; }
  #stage { border-radius: 0; }
  #hint { top: 12px; font-size: 16px; padding: 9px 16px; }
  #camera .panel {
    border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; gap: 10px; overflow: visible;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }
  #camera .panel-title { display: none; }
  #camera .checks { flex-direction: row; flex-wrap: wrap; gap: 6px; justify-content: center; }
  #camera .checks li { display: flex; gap: 5px; padding: 4px 9px 4px 5px; border-radius: 999px; background: var(--surface-2); font-size: 12.5px; font-weight: 600; }
  #camera .checks li::before { width: 14px; height: 14px; background-size: 9px; border-width: 1px; }
  #camera .checks .l { display: none; }
  #camera .checks .s { display: inline; }
  #camera .opts { flex-direction: row; justify-content: center; gap: 22px; padding-top: 0; border: 0; }
  #camera .switch { font-size: 13.5px; column-gap: 8px; }
  #camera .switch small { display: none; }
  #camera .switch i { width: 36px; height: 22px; }
  #camera .switch i::after { width: 16px; height: 16px; }
  #camera .switch input:checked + i::after { transform: translateX(14px); }

  .actions { grid-template-columns: 1fr auto 1fr; grid-template-areas: "back shoot flip"; align-items: center; margin-top: 2px; }
  .actions .ghost { border: 0; width: 48px; height: 48px; min-height: 0; padding: 0; border-radius: 50%; background: var(--surface-2); color: var(--text); }
  .actions .ghost span { display: none; }
  #back { justify-self: start; }
  #flip { justify-self: end; }
  .shutter {
    width: 70px; height: 70px; min-height: 0; padding: 0; border-radius: 50%;
    border: 4px solid var(--surface); outline: 3px solid var(--primary); box-shadow: none;
  }
  .shutter span, .shutter kbd { display: none; }
  .shutter .ic { width: 28px; height: 28px; }

  #result { display: flex; flex-direction: column; height: auto; min-height: calc(100dvh - var(--top)); padding: 16px 14px calc(18px + env(safe-area-inset-bottom)); gap: 14px; }
  .photo-wrap { flex: none; }
  #photo { max-height: 46dvh; }
  #result .panel { overflow: visible; padding: 18px; }
  kbd { display: none; }
}
@media (max-width: 560px) {
  body:not([data-view="home"]) .brand span { display: none; }
  .type-select { flex: 1; }
  .type-select select { width: 100%; }
}
@media (max-width: 380px) {
  .pill-privacy { display: none; }
}
@media (max-height: 520px) and (min-width: 600px) and (max-width: 900px) {
  /* yatay telefon: panel sağda */
  #camera { grid-template-columns: minmax(0, 1fr) 210px; grid-template-rows: 1fr; }
  #camera .panel { border-top: 0; border-left: 1px solid var(--line); justify-content: center; }
  #camera .opts { flex-direction: column; gap: 8px; align-items: flex-start; }
}
