/* Hikayeler & Makaleler: liste + okuyucu */
:root {
  --rd-ink: #e2e8f0; --rd-muted: #94a3b8; --rd-line: #334155;
  --rd-font-size: 1.15rem; --rd-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}

/* ---------- Ortak ---------- */
.rd-meta { display: flex; flex-wrap: wrap; gap: .45rem .8rem; align-items: center; color: var(--rd-muted); font-size: .85rem; }
.rd-meta .badge { font-weight: 600; }
.badge.level-C1 { background: #7c3aed; }
.badge.rd-source { background: #0f2a3f; color: #7dd3fc; border: 1px solid #164e63; max-width: 100%; white-space: normal; text-align: left; }
.badge.rd-topic { background: #2a2416; color: #fcd34d; border: 1px solid #78350f; text-transform: capitalize; }

/* ---------- Liste ---------- */
.rd-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.rd-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 56px; padding: .45rem 1rem; border-radius: 999px;
  background: var(--el-card); color: var(--rd-ink); border: 1px solid var(--rd-line); text-decoration: none; font-weight: 600; transition: background .15s, border-color .15s; }
.rd-chip:hover { border-color: var(--el-accent); color: #fff; }
.rd-chip.active { background: var(--el-accent); border-color: var(--el-accent); color: #082f49; }
.rd-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .rd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.el-card.rd-card { min-height: 0; padding: 18px 18px 16px; display: flex; flex-direction: column; color: var(--rd-ink); text-decoration: none;
  border: 1px solid transparent; transition: transform .15s, border-color .15s, box-shadow .3s; }
.el-card.rd-card:hover { transform: translateY(-2px); border-color: rgba(56,189,248,.5); color: #fff; }
.rd-card-title { font-weight: 700; line-height: 1.3; margin-bottom: .4rem; }
.rd-card-summary { color: #cbd5e1; font-size: .95rem; line-height: 1.5; margin-bottom: .75rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.rd-card .rd-meta { margin-top: auto; }
.el-card.rd-empty { min-height: 0; text-align: center; padding: 36px 20px; }

/* ---------- Okuyucu ---------- */
body.rd-reader-page { overflow-x: hidden; }
.rd-progress { position: fixed; top: 0; left: 0; right: 0; height: 4px; background: transparent; z-index: 1040; pointer-events: none; }
.rd-progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--el-accent), #a78bfa); transition: width .08s linear; }
.rd-reader { max-width: 68ch; margin: 0 auto; }
.rd-back { color: var(--rd-muted); text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; }
.rd-back:hover { color: var(--el-accent); }
.rd-title { font-size: clamp(1.6rem, 5.5vw, 2.4rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: .25rem 0 .5rem; }
.rd-summary { color: #cbd5e1; font-size: 1.05rem; line-height: 1.55; }

.rd-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; position: sticky; top: 0; z-index: 1030;
  background: rgba(15,23,42,.92); backdrop-filter: blur(8px); padding: .5rem 0; margin: .5rem 0 .75rem; border-bottom: 1px solid var(--rd-line); }
.btn.rd-tool { min-height: 44px; min-width: 44px; background: var(--el-card); color: var(--rd-ink); border: 1px solid var(--rd-line); border-radius: 12px; font-weight: 600; padding: .4rem .8rem; }
.btn.rd-tool:hover { border-color: var(--el-accent); color: #fff; }
.btn.rd-tool.active, .btn.rd-tool[aria-pressed="true"] { background: rgba(56,189,248,.18); border-color: var(--el-accent); color: #e0f2fe; }
.btn.rd-tool:disabled { opacity: .45; }
.btn.rd-tool small { font-size: .7em; vertical-align: super; }
.rd-sep { width: 1px; height: 28px; background: var(--rd-line); margin: 0 .25rem; }
.rd-hint { font-size: .9rem; }

.rd-article { font-size: var(--rd-font-size); line-height: 1.8; color: var(--rd-ink); }
.rd-article.serif { font-family: var(--rd-serif); }
.rd-p { margin-bottom: 1.35em; border-radius: 8px; padding: .1em .25em; margin-left: -.25em; margin-right: -.25em; transition: background .25s; }
.rd-p.speaking { background: rgba(56,189,248,.12); box-shadow: inset 3px 0 0 var(--el-accent); }
.rd-w { cursor: pointer; border-radius: 4px; padding: 0 .04em; transition: background .12s; }
.rd-w:hover { background: rgba(56,189,248,.18); }
.rd-w.hit { background: rgba(251,191,36,.3); color: #fef3c7; }
.rd-w.gl { text-decoration: underline dotted rgba(251,191,36,.6); text-underline-offset: .2em; }
.rd-p.speaking .rd-w.spoken { background: rgba(56,189,248,.35); }

.rd-attrib { border-left: 3px solid #a78bfa; background: rgba(167,139,250,.08); border-radius: 0 10px 10px 0; padding: 12px 14px; font-size: .9rem; color: #cbd5e1; margin: 1.5rem 0; }
.rd-attrib a { color: #c4b5fd; }

.rd-mark { text-align: center; margin: 1.5rem 0 2.5rem; }
.btn.rd-mark-btn { background: var(--el-ok); color: #052e16; border: 0; font-weight: 700; min-height: 48px; padding: .7rem 1.4rem; border-radius: 14px; }
.btn.rd-mark-btn:hover { background: #4ade80; color: #052e16; }
.btn.rd-mark-btn.done { background: #14532d; color: #bbf7d0; }

.rd-section { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rd-line); }
#btnAddAll { min-height: 44px; }
.rd-addmsg { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.4); color: #bbf7d0; border-radius: 10px; padding: 8px 12px; font-size: .9rem; margin-bottom: .75rem; }

/* Sözlük kartları (flip) */
.rd-gloss { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .rd-gloss { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.rd-flip { perspective: 900px; min-height: 120px; cursor: pointer; }
.rd-flip-inner { position: relative; width: 100%; min-height: 120px; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.rd-flip.flipped .rd-flip-inner { transform: rotateY(180deg); }
.rd-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; padding: 12px; display: flex; flex-direction: column; justify-content: center; background: var(--el-card); border: 1px solid var(--rd-line); }
.rd-face.front { font-weight: 800; font-size: 1.2rem; text-align: center; word-break: break-word; padding-bottom: 40px; }
.rd-face.back { padding-bottom: 44px; }
.rd-face.front .fa { font-size: .8rem; color: var(--rd-muted); position: absolute; right: 10px; top: 10px; }
.rd-face.back { transform: rotateY(180deg); background: #263347; border-color: rgba(251,191,36,.4); }
.rd-face.back .tr { color: #fbbf24; font-weight: 700; font-size: 1rem; line-height: 1.25; }
.rd-face.back .def { color: #cbd5e1; font-size: .78rem; line-height: 1.35; margin-top: .3rem; }
.rd-speak { position: absolute; right: 4px; bottom: 4px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(56,189,248,.18); color: #7dd3fc; display: grid; place-items: center; }
.rd-speak:hover { background: rgba(56,189,248,.35); }
.rd-flip.in-trainer .rd-face.front::after { content: "✓"; position: absolute; left: 10px; top: 6px; color: var(--el-ok); font-size: .85rem; }

/* Quiz */
.el-card.rd-quiz-card { min-height: 0; padding: 20px; }
.rd-q { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; line-height: 1.45; }
.rd-opts { display: grid; gap: .5rem; }
.btn.rd-opt { text-align: left; min-height: 48px; padding: .7rem .9rem; background: #0f172a; color: var(--rd-ink); border: 1px solid var(--rd-line); border-radius: 12px; font-size: 1rem; white-space: normal; }
.btn.rd-opt:hover { border-color: var(--el-accent); color: #fff; }
.btn.rd-opt kbd { background: #334155; color: #e2e8f0; border-radius: 4px; padding: 1px 7px; margin-right: .5rem; font-size: .8rem; }
.btn.rd-opt.ok { background: rgba(34,197,94,.2); border-color: var(--el-ok); color: #dcfce7; }
.btn.rd-opt.no { background: rgba(239,68,68,.2); border-color: var(--el-no); color: #fee2e2; }
.btn.rd-opt:disabled { opacity: 1; }
.rd-fb { margin-top: .75rem; font-weight: 600; min-height: 1.5rem; }
.rd-score { text-align: center; }
.rd-score .big { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--el-accent); }

/* Tartışma */
.rd-disc { background: var(--el-card); border-radius: 16px; padding: 16px; margin-bottom: 12px; border: 1px solid var(--rd-line); }
.rd-disc-q { font-size: 1.05rem; font-weight: 600; line-height: 1.45; margin-bottom: .75rem; }
.rd-timer { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.rd-timer .t { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.4rem; min-width: 3.2ch; }
.rd-timer .el-progress { flex: 1 1 120px; }
.rd-timer.running .t { color: var(--el-accent); }
.rd-timer.over .t { color: var(--el-ok); }
.btn.rd-timer-btn { min-height: 44px; min-width: 44px; }
.rd-disc textarea { background: #0f172a; color: var(--rd-ink); border: 1px solid var(--rd-line); border-radius: 10px; width: 100%; padding: 8px 10px; margin-top: .75rem; font-size: .95rem; resize: vertical; }
.rd-disc textarea:focus { outline: 0; border-color: var(--el-accent); }
.rd-disc .saved { font-size: .75rem; color: var(--rd-muted); }

/* Popover */
.rd-pop { position: fixed; z-index: 1060; width: min(320px, calc(100vw - 24px)); background: #0b1220; color: var(--rd-ink); border: 1px solid #334155; border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.55); padding: 10px 12px 12px; font-size: .95rem; }
.rd-pop-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; }
.rd-pop-word { font-size: 1.15rem; flex: 1; word-break: break-word; }
.rd-pop-speak, .rd-pop-close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: #94a3b8; display: grid; place-items: center; flex: none; }
.rd-pop-speak { color: #7dd3fc; } .rd-pop-speak:hover { background: rgba(56,189,248,.18); } .rd-pop-close:hover { background: #1e293b; color: #fff; }
.rd-pop-body .ipa { color: #94a3b8; font-family: "Charis SIL", "Doulos SIL", Georgia, serif; }
.rd-pop-body .tr { color: #fbbf24; font-weight: 700; font-size: 1.05rem; }
.rd-pop-body .def { color: #cbd5e1; font-size: .88rem; line-height: 1.4; }
.rd-pop-body .src { font-size: .72rem; color: #64748b; text-transform: uppercase; letter-spacing: .05em; margin-top: .35rem; }
.rd-pop-body .lvl { font-size: .7rem; padding: .15em .45em; margin-left: .3em; vertical-align: middle; }
.rd-pop-body a { color: #7dd3fc; }
.rd-pop-body .none { color: #94a3b8; }
.rd-pop .spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #334155; border-top-color: var(--el-accent); border-radius: 50%; animation: rd-spin .7s linear infinite; vertical-align: middle; margin-right: .4rem; }
@keyframes rd-spin { to { transform: rotate(360deg); } }

@media (max-width: 420px) {
  .btn.rd-tool span { display: none; }
  .btn.rd-tool#btnListen span { display: inline; }
  .rd-gloss { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { .rd-flip-inner, .rd-progress > div, .el-card.rd-card { transition: none; } }
