
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
:root { color-scheme: light; }
img { max-width: 100%; }
a.skip { position: absolute; left: -9999px; }
a.skip:focus { left: 16px; top: 12px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.defter .sys div { padding-left: 2.2em; text-indent: -2.2em; }
.cover { height: auto; }

  :root {
    --bg: #F1F2F4;
    --surface: #FFFFFF;
    --ink: #141922;
    --ink-2: #353C49;
    --muted: #636C7B;
    --rule: #D7DBE2;
    --thread: #AE2530;
    --thread-soft: rgba(174, 37, 48, .10);
    --lamp: #A8690F;
    --sys: #2E5FC4;
    --sys-bg: rgba(46, 95, 196, .06);
    --sys-rule: rgba(46, 95, 196, .35);
    --shadow: 0 1px 2px rgba(20, 25, 34, .06), 0 10px 28px rgba(20, 25, 34, .10);
    --read-size: 19px;

    --f-serif: "Newsreader", "Iowan Old Style", "Georgia", serif;
    --f-ui: "Figtree", "Segoe UI", "Roboto", system-ui, sans-serif;
    --f-mono: "IBM Plex Mono", "SFMono-Regular", "Menlo", "Consolas", monospace;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --bg: #0D1118;
      --surface: #151A23;
      --ink: #E6E8EC;
      --ink-2: #C4C9D2;
      --muted: #8D96A6;
      --rule: #262D3A;
      --thread: #E0474F;
      --thread-soft: rgba(224, 71, 79, .14);
      --lamp: #E6B45E;
      --sys: #86ADFF;
      --sys-bg: rgba(134, 173, 255, .07);
      --sys-rule: rgba(134, 173, 255, .32);
      --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0D1118;
    --surface: #151A23;
    --ink: #E6E8EC;
    --ink-2: #C4C9D2;
    --muted: #8D96A6;
    --rule: #262D3A;
    --thread: #E0474F;
    --thread-soft: rgba(224, 71, 79, .14);
    --lamp: #E6B45E;
    --sys: #86ADFF;
    --sys-bg: rgba(134, 173, 255, .07);
    --sys-rule: rgba(134, 173, 255, .32);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .45);
  }

  [hidden] { display: none !important; }
  body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--f-ui);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  a { color: inherit; }
  button { font: inherit; color: inherit; }
  :focus-visible { outline: 2px solid var(--thread); outline-offset: 3px; border-radius: 4px; }

  /* ---------- top bar ---------- */
  .bar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 20;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rule);
  }
  .bar-in {
    max-width: 1040px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .wordmark {
    font-family: var(--f-serif);
    font-style: italic;
    font-weight: 500;
    font-size: 26px;
    letter-spacing: -.01em;
    text-decoration: none;
    line-height: 1;
    padding-bottom: 6px;
    background-image: repeating-linear-gradient(90deg, var(--thread) 0 7px, transparent 7px 11px);
    background-size: 100% 2px;
    background-repeat: no-repeat;
    background-position: 0 100%;
  }
  .crumb {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .crumb:hover { color: var(--ink); }
  .bar-spacer { flex: 1; }
  .icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--rule);
    background: var(--surface);
    cursor: pointer;
    font-family: var(--f-serif);
    font-size: 17px;
  }
  .icon-btn:hover { border-color: var(--muted); }

  .thread-progress {
    position: absolute;
    left: 0;
    bottom: -1px;
    height: 2px;
    width: 100%;
    background: var(--thread);
    transform-origin: 0 50%;
    transform: scaleX(0);
  }

  /* ---------- settings sheet ---------- */
  .sheet {
    position: absolute;
    right: 16px;
    top: calc(100% + 8px);
    width: min(300px, calc(100vw - 32px));
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 16px;
    display: grid;
    gap: 14px;
  }
  .sheet-row { display: grid; gap: 8px; }
  .label {
    font-family: var(--f-mono);
    font-size: 11.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .seg button {
    height: 38px;
    border-radius: 9px;
    border: 1px solid var(--rule);
    background: var(--bg);
    cursor: pointer;
    font-size: 14px;
  }
  .seg button[aria-pressed="true"] {
    border-color: var(--thread);
    background: var(--thread-soft);
    color: var(--ink);
    font-weight: 600;
  }
  .seg .a-small { font-family: var(--f-serif); font-size: 15px; }
  .seg .a-big { font-family: var(--f-serif); font-size: 21px; }
  .size-read { font-family: var(--f-mono); font-size: 13px; color: var(--muted); display: flex; align-items: center; justify-content: center; }

  /* ---------- layout ---------- */
  main { max-width: 1040px; margin: 0 auto; padding-inline: 16px; padding-block: 28px 64px; }
  .serif { font-family: var(--f-serif); }
  h1, h2, h3 { text-wrap: balance; margin: 0; font-weight: 500; }

  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
  }
  .btn-primary { background: var(--ink); color: var(--bg); }
  .btn-primary:hover { background: var(--thread); color: #fff; }
  .btn-ghost { border-color: var(--rule); background: var(--surface); }
  .btn-ghost:hover { border-color: var(--muted); }
  .btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

  /* ---------- home ---------- */
  .intro { display: grid; gap: 14px; max-width: 36em; padding-block: 12px 36px; }
  .intro h1 {
    font-family: var(--f-serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(44px, 9vw, 72px);
    line-height: 1;
    letter-spacing: -.02em;
  }
  .intro p { margin: 0; font-family: var(--f-serif); font-size: 19px; line-height: 1.55; color: var(--ink-2); }

  .shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
  .feature {
    display: grid;
    grid-template-columns: minmax(104px, 200px) 1fr;
    gap: clamp(16px, 4vw, 36px);
    align-items: start;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 18px;
    padding: clamp(14px, 3vw, 28px);
  }
  .cover {
    display: block;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: var(--shadow);
    background: #111;
  }
  .feature-body { display: grid; gap: 12px; min-width: 0; }
  .feature-body h2 { font-family: var(--f-serif); font-size: clamp(28px, 5vw, 40px); line-height: 1.05; letter-spacing: -.01em; }
  .feature-body h2 a { text-decoration: none; }
  .byline { color: var(--muted); font-size: 14px; }
  .byline b { color: var(--ink); font-weight: 600; }
  .blurb { margin: 0; font-family: var(--f-serif); font-size: 17.5px; line-height: 1.55; color: var(--ink-2); max-width: 34em; }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
  .chips li {
    font-size: 12.5px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--rule);
    color: var(--ink-2);
  }
  .note { color: var(--muted); font-size: 14px; margin: 18px 2px 0; }

  @media (max-width: 520px) {
    .feature { grid-template-columns: 104px 1fr; }
    .feature .blurb, .feature .btn-row { grid-column: 1 / -1; }
    .feature-body { display: contents; }
    .feature-head { display: grid; gap: 8px; align-content: start; }
  }
  @media (min-width: 521px) {
    .feature-head { display: grid; gap: 8px; }
  }

  /* ---------- book page ---------- */
  .book-top {
    display: grid;
    grid-template-columns: minmax(150px, 260px) 1fr;
    gap: clamp(20px, 5vw, 48px);
    align-items: start;
  }
  .book-info { display: grid; gap: 14px; min-width: 0; }
  .book-info h1 { font-family: var(--f-serif); font-size: clamp(38px, 7vw, 60px); line-height: 1; letter-spacing: -.02em; }
  .facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
  .facts b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
  .status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--lamp); margin-right: 6px; vertical-align: 1px; }
  .warn {
    font-size: 13.5px;
    color: var(--ink-2);
    border-left: 2px solid var(--thread);
    padding: 2px 0 2px 12px;
  }
  .author-box { display: grid; gap: 4px; padding-top: 14px; border-top: 1px dashed var(--rule); }
  .author-box .name { font-family: var(--f-serif); font-style: italic; font-size: 20px; }
  .author-box p { margin: 0; color: var(--muted); font-size: 14px; }

  .toc { margin-top: 44px; max-width: 44em; }
  .toc h2 { font-family: var(--f-serif); font-size: 28px; margin-bottom: 6px; }
  .part { margin-top: 22px; }
  .part-title { display: flex; gap: 10px; align-items: baseline; padding-bottom: 8px; border-bottom: 1px solid var(--rule); }
  .part-title .serif { font-size: 19px; font-style: italic; }
  .toc ol { list-style: none; margin: 0; padding: 0; }
  .toc li { border-bottom: 1px solid var(--rule); }
  .ch-row {
    display: grid;
    grid-template-columns: 3.2em 1fr auto;
    gap: 12px;
    align-items: baseline;
    padding: 14px 4px;
    text-decoration: none;
  }
  a.ch-row:hover .ch-title { color: var(--thread); }
  .ch-no { font-family: var(--f-mono); font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .ch-title { font-family: var(--f-serif); font-size: 18.5px; line-height: 1.3; }
  .ch-meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
  .ch-row.is-locked .ch-title { color: var(--muted); }
  .pill {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px dashed var(--rule);
    color: var(--muted);
  }
  .pill-here { border-style: solid; border-color: var(--thread); color: var(--thread); }
  .disclaimer { margin-top: 36px; max-width: 44em; font-size: 13px; color: var(--muted); }

  @media (max-width: 560px) {
    .book-top { grid-template-columns: 1fr; }
    .book-top .cover { width: 62%; margin: 0 auto; }
  }

  /* ---------- reader ---------- */
  .reader { max-width: 36em; margin: 0 auto; }
  .reader-head { display: grid; gap: 10px; padding-block: 18px 30px; }
  .reader-head h1 { font-family: var(--f-serif); font-size: clamp(34px, 7vw, 50px); line-height: 1.05; letter-spacing: -.015em; }
  .reader-head .meta { color: var(--muted); font-size: 14px; }
  .prose {
    font-family: var(--f-serif);
    font-size: var(--read-size);
    line-height: 1.72;
    color: var(--ink);
    hyphens: manual;
  }
  .prose p { margin: 0 0 1.05em; }
  .prose p.solo { margin-block: 1.4em; }
  .prose em { font-style: italic; color: var(--ink-2); }
  .prose .choice {
    font-family: var(--f-mono);
    font-weight: 500;
    font-size: .8em;
    letter-spacing: .08em;
    color: var(--sys);
  }
  .sys {
    font-family: var(--f-mono);
    font-size: max(13px, calc(var(--read-size) * .74));
    line-height: 1.7;
    color: var(--ink-2);
    background: var(--sys-bg);
    border: 1px solid var(--sys-rule);
    border-radius: 6px;
    padding: 14px 16px;
    margin: 1.5em 0;
    position: relative;
  }
  .sys::before {
    content: "";
    position: absolute;
    inset: 4px;
    border: 1px solid var(--sys-rule);
    border-radius: 3px;
    opacity: .45;
    pointer-events: none;
  }
  .sys div { min-height: .9em; }
  .sys strong { color: var(--sys); font-weight: 500; letter-spacing: .04em; }

  .prose .scene {
    width: 72px;
    height: 2px;
    margin: 2.2em auto;
    background-image: repeating-linear-gradient(90deg, var(--thread) 0 7px, transparent 7px 12px);
    opacity: .8;
  }
  .card {
    font-weight: 500;
    margin-right: 4px;
  }
  .card::before {
    content: "";
    display: inline-block;
    vertical-align: -1px;
    margin-right: 6px;
    width: 9px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid currentColor;
    background: currentColor;
  }
  .card-gri { color: var(--muted); }
  .card-mavi { color: var(--sys); }
  .card-kirmizi { color: var(--thread); }
  .card-siyah { color: var(--ink); }
  .card-no {
    display: inline-block;
    min-width: 2.2em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
  }
  .defter {
    border: 1px solid var(--sys-rule);
    border-radius: 10px;
    background: var(--sys-bg);
  }
  .defter summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
  }
  .defter summary::-webkit-details-marker { display: none; }
  .defter summary .label { color: var(--sys); }
  .defter summary::after {
    content: "Aç";
    font-family: var(--f-mono);
    font-size: 11.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .defter[open] summary::after { content: "Kapat"; }
  .defter-range {
    flex: 1;
    font-family: var(--f-mono);
    font-size: 12px;
    color: var(--muted);
  }
  .defter .sys { margin: 0 12px 12px; }
  .defter .sys div { padding-left: 2.2em; text-indent: -2.2em; }
  .end { margin-top: 2.4em; display: grid; gap: 22px; }
  .stitch {
    height: 2px;
    background-image: repeating-linear-gradient(90deg, var(--thread) 0 9px, transparent 9px 15px);
  }
  .arkasi {
    font-family: var(--f-serif);
    font-style: italic;
    font-size: 22px;
    color: var(--ink-2);
    text-align: center;
    margin: 0;
  }
  .pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .pager a, .pager span {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--rule);
    background: var(--surface);
    text-decoration: none;
    min-width: 0;
  }
  .pager .next { text-align: right; }
  .pager a:hover { border-color: var(--thread); }
  .pager span { opacity: .6; }
  .pager small { font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .pager b { font-family: var(--f-serif); font-weight: 500; font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .back-toc { justify-self: center; }

  footer {
    border-top: 1px solid var(--rule);
    color: var(--muted);
    font-size: 13px;
  }
  footer .in { max-width: 1040px; margin: 0 auto; padding: 22px 16px 32px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
  footer .serif { font-style: italic; font-size: 16px; color: var(--ink-2); }

  @media (prefers-reduced-motion: no-preference) {
    .view { animation: rise .35s ease-out both; }
    @keyframes rise { from { opacity: .001; transform: translateY(6px); } to { opacity: 1; transform: none; } }
    .thread-progress { transition: transform .12s linear; }
  }
