:root {
  --bg: #0b1120; --bg2: #0f172a; --card: #131c30; --card2: #1a2540;
  --line: rgba(255,255,255,0.08); --txt: #e2e8f0; --muted: #94a3b8;
  --accent: #38bdf8; --accent2: #22d3ee; --green: #22c55e; --red: #ef4444;
  --amber: #fbbf24; --radius: 14px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: radial-gradient(1200px 600px at 70% -10%, #16223f 0%, var(--bg) 55%);
  color: var(--txt); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}
header.top {
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px);
  background: rgba(11,17,32,0.85); border-bottom: 1px solid var(--line);
  padding: 10px 18px;
}
.brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand h1 { font-size: 18px; margin: 0; letter-spacing: .3px; }
.brand .countdown { color: var(--accent); font-weight: 700; }
.spacer { flex: 1; }
.tools button, .tools #cloud {
  background: var(--card2); color: var(--txt); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 10px; cursor: pointer; font-size: 13px;
}
#tabs { display: flex; gap: 4px; overflow-x: auto; margin-top: 10px; padding-bottom: 2px; }
.tab {
  white-space: nowrap; text-decoration: none; color: var(--muted);
  padding: 8px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
}
.tab.active { background: var(--accent); color: #04243a; }
.tab:hover { color: var(--txt); }

main { max-width: 1100px; margin: 0 auto; padding: 18px; }
.card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 16px; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.kpis { grid-template-columns: repeat(6, 1fr); margin-bottom: 16px; }
.kpi {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; text-align: center;
}
.kpi-val { font-size: 24px; font-weight: 800; }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.accent .kpi-val { color: var(--accent); }
.kpi.danger .kpi-val { color: var(--red); }

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.badge { background: var(--card2); border: 1px solid var(--line); padding: 4px 10px; border-radius: 20px; font-size: 12px; }
.badge.warn { background: #3a2a0a; color: var(--amber); border-color: #6b4e10; }

.bar { height: 12px; background: var(--card2); border-radius: 8px; overflow: hidden; margin: 8px 0; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); }

.btn { display: inline-block; background: var(--card2); color: var(--txt); border: 1px solid var(--line);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; text-decoration: none; font-size: 14px; }
.btn.primary { background: var(--accent); color: #04243a; border: none; font-weight: 700; }
.btn:hover { filter: brightness(1.1); }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 0; }
.field span { font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: var(--bg2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 11px; font: inherit; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.tbl tr.total td { border-top: 2px solid var(--accent); }
.link-del { background: none; border: none; color: var(--red); cursor: pointer; font-size: 13px; }

.deneme-grid { margin: 12px 0; }
.deneme-row { display: grid; grid-template-columns: 1fr 90px 90px; gap: 8px; align-items: center; margin-bottom: 6px; }
.deneme-row.head { color: var(--muted); font-size: 12px; }
.deneme-row.head span:not(:first-child) { text-align: center; }

.topic { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center;
  padding: 7px 4px; border-bottom: 1px solid var(--line); }
.topic.done .tname, .topic.review .tname { color: var(--green); }
.topic.learning .tname { color: var(--amber); }
.pr { text-align: center; font-size: 13px; }
.tname { font-size: 14px; }
.due { color: var(--amber); font-size: 12px; }
.st-group { display: flex; gap: 4px; }
.st-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg2); color: var(--muted); cursor: pointer; }
.st-btn.on { background: var(--accent); color: #04243a; border: none; }

.tag { padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.tag-bilgi { background: #3a0f0f; color: #fca5a5; }
.tag-dikkat { background: #3a2a0a; color: var(--amber); }
.tag-hiz { background: #0a2a3a; color: var(--accent); }
.tag-tuzak { background: #2a0a3a; color: #c4b5fd; }

.bullets { margin: 0; padding-left: 18px; }
.bullets li { margin-bottom: 6px; }
.phases, .phase { display: block; }
.phase { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 8px; }
.phase.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.chart-box { position: relative; width: 100%; height: 240px; }
.chart-box.sm { height: 200px; }
.chart-box canvas { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; }

/* Konular */
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.lg { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.p1 { background: #ef4444; } .dot.p2 { background: #fb923c; } .dot.p3 { background: #facc15; }
.dot.p4 { background: #64748b; } .dot.p5 { background: #475569; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--bg2); color: var(--muted); border: 1px solid var(--line); padding: 6px 12px; border-radius: 20px; cursor: pointer; font-size: 13px; font-weight: 600; }
.chip.on { background: var(--accent); color: #04243a; border-color: transparent; }

.due-card { border-color: #6b4e10; }
.due-card h3 { color: var(--amber); }
.due-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.due-row:last-child { border-bottom: none; }

.subj-head { margin-bottom: 10px; }
.bar.thin { height: 6px; margin: 6px 0 2px; }

.topic-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.topic-row:last-child { border-bottom: none; }
.t-main { display: flex; align-items: center; gap: 8px; flex: 1 1 200px; min-width: 0; }
.t-name { font-size: 14px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg-btn { border: none; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.seg-btn.on { background: #475569; color: #fff; }
.seg-btn.on.learning { background: var(--amber); color: #3a2a0a; }
.seg-btn.on.done { background: var(--green); color: #04243a; }
.t-rev { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.rev-badge { font-size: 12px; padding: 3px 9px; border-radius: 14px; white-space: nowrap; }
.rev-badge.ok { background: var(--card2); color: var(--muted); }
.rev-badge.due { background: #3a2a0a; color: var(--amber); }
.small-btn { padding: 5px 11px; font-size: 12px; }

/* Metrik sekmeleri (saat/video/soru) */
.metric-tabs { display: inline-flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 8px; }
.mt-btn { border: none; background: transparent; color: var(--muted); padding: 7px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; }
.mt-btn.on { background: var(--accent); color: #04243a; }

/* Günlük hedef satırları */
.goal-row { display: grid; grid-template-columns: 1fr 120px 110px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.goal-row span { font-size: 14px; }

/* Öncelik / odak rozetleri */
.gap { font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.gap.hi { background: #3a0f0f; color: #fca5a5; }
.gap.mid { background: #3a2a0a; color: var(--amber); }
.gap.lo { background: #0a2a1a; color: #6ee7b7; }
.btn.danger { background: #3a0f0f; color: #fca5a5; border: 1px solid #6b1d1d; }

/* Onboarding */
.onboard { display: flex; justify-content: center; padding: 10px; }
.onboard-card { max-width: 600px; width: 100%; }
.onboard-card h2 { margin: 0 0 6px; }

/* Auth gate */
body.gated #tabs, body.gated .tools { display: none; }
.authgate { display: none; min-height: calc(100vh - 60px); align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; }
.auth-card h2 { margin: 0 0 6px; }
.auth-card .field { margin-bottom: 14px; }
.btn.block { width: 100%; text-align: center; margin-top: 6px; }
.auth-err { color: var(--red); font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.auth-links { margin-top: 14px; }
.auth-links a { color: var(--accent); font-size: 13px; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
#userbox .umail { font-size: 13px; color: var(--muted); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#userbox button { background: var(--card2); color: var(--txt); border: 1px solid var(--line); padding: 6px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; }

/* Soru Havuzu */
.question-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.question-card {
  background: linear-gradient(180deg, var(--card), var(--bg2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.question-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.q-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.q-author {
  font-weight: 700;
  color: var(--txt);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.q-date {
  color: var(--muted);
  margin-left: auto;
}
.q-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.q-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--txt);
  word-break: break-word;
}
.q-img-wrapper {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.q-img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  transition: transform 0.2s ease;
}
.q-img:hover {
  transform: scale(1.02);
}

.q-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: auto;
}
.btn-action {
  background: transparent;
  color: var(--accent);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 0;
}
.btn-action:hover {
  filter: brightness(1.2);
}
.q-answers-section {
  border-top: 1px dashed var(--line);
  margin-top: 10px;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.q-answers-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  padding-right: 4px;
}
/* Scrollbar styles for answers list */
.q-answers-list::-webkit-scrollbar {
  width: 4px;
}
.q-answers-list::-webkit-scrollbar-track {
  background: transparent;
}
.q-answers-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}
.answer-item {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ans-header {
  display: flex;
  align-items: center;
  font-size: 11px;
}
.ans-author {
  font-weight: 700;
  color: var(--accent);
}
.ans-date {
  color: var(--muted);
  margin-left: 8px;
}
.ans-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ans-text {
  margin: 0;
  font-size: 13px;
  color: var(--txt);
  line-height: 1.4;
  word-break: break-word;
}
.ans-img-wrapper {
  position: relative;
  width: 100%;
  max-height: 140px;
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.ans-img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  transition: transform 0.2s ease;
}
.ans-img:hover {
  transform: scale(1.02);
}
.q-ans-form {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 4px;
}
.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

/* Lightbox Modal */
.lightbox {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(11, 17, 32, 0.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(8px);
}
.lightbox-content {
  max-width: 90%;
  max-height: 80%;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: zoom 0.25s ease;
}
@keyframes zoom {
  from {transform:scale(0.85); opacity: 0;}
  to {transform:scale(1); opacity: 1;}
}
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: var(--muted);
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
}
.lightbox-close:hover {
  color: var(--txt);
}
.lightbox-caption {
  margin-top: 15px;
  color: var(--txt);
  font-size: 16px;
  font-weight: 600;
}

/* Touch Targets accessibility */
button, input, select, textarea {
  min-height: 42px;
}
.small-btn, .link-del, .seg-btn, .chip, .tab {
  min-height: auto;
}

@media (max-width: 760px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi { padding: 10px; }
  .kpi-val { font-size: 20px; }
  main { padding: 8px; }
  .card { padding: 12px; border-radius: 12px; margin-bottom: 12px; }
  header.top { padding: 8px 12px; }
  .brand { gap: 6px; }
  .brand h1 { font-size: 15px; width: 100%; }
  .brand .countdown { font-size: 13px; }
  .tools { width: 100%; justify-content: flex-end; }
  #tabs {
    gap: 2px;
    padding-bottom: 4px;
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
  }
  .tab { padding: 6px 10px; font-size: 13px; }
  .question-grid { grid-template-columns: 1fr; gap: 12px; }
  .lightbox-content { max-width: 95%; max-height: 75%; }
  .lightbox-close { top: 15px; right: 20px; font-size: 36px; }
}

