:root {
  --bg: #0a0912;
  --bg-soft: #0f0e1a;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-strong: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-soft: rgba(255, 255, 255, 0.05);
  --violet: #8b5cf6;
  --violet-dim: #6d28d9;
  --gold: #e8b84b;
  --teal: #2dd4bf;
  --text: #f2eff8;
  --text-dim: #9a93ac;
  --text-faint: #6b6480;
  --radius: 14px;
  --radius-sm: 8px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(45, 212, 191, 0.10), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

button, input, textarea { font-family: inherit; color: inherit; }

.app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---------- TOPBAR ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 9, 18, 0.7);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  font-size: 20px;
  color: var(--gold);
  filter: drop-shadow(0 0 6px rgba(232, 184, 75, 0.5));
}
.brand-text h1 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.2px;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

.global-progress { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 160px; max-width: 320px; }
.gp-track {
  flex: 1;
  height: 6px;
  border-radius: 4px;
  background: var(--panel-strong);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}
.gp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--violet), var(--teal));
  transition: width 0.5s ease;
}
.gp-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--border-soft); border-radius: 999px; padding: 3px; }
.tab {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tab.active { background: var(--panel-strong); color: var(--text); }
.tab:hover:not(.active) { color: var(--text); }

/* ---------- MAIN / VIEWS ---------- */
main { flex: 1; padding: 20px; max-width: 1180px; width: 100%; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

#view-plan.active { display: flex; gap: 20px; align-items: flex-start; }

/* ---------- TIMELINE (motif keyframes) ---------- */
.timeline {
  flex: 0 0 240px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 88px;
}
.tl-week-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 14px 0 6px 34px;
}
.tl-week-label:first-child { margin-top: 0; }

.tl-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
  position: relative;
}
.tl-item::before {
  content: '';
  position: absolute;
  left: 20px;
  top: -3px;
  width: 1px;
  height: 10px;
  background: var(--border);
}
.tl-item:first-child::before { display: none; }

.tl-diamond {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  transform: rotate(45deg);
  border: 2px solid var(--text-faint);
  border-radius: 3px;
  background: var(--bg-soft);
  transition: all 0.2s;
}
.tl-item.done .tl-diamond { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 8px rgba(232, 184, 75, 0.5); }
.tl-item.partial .tl-diamond { background: linear-gradient(135deg, var(--violet) 50%, var(--bg-soft) 50%); border-color: var(--violet); }
.tl-item.bonus .tl-diamond { border-color: var(--teal); }
.tl-item.bonus.done .tl-diamond { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 8px rgba(45, 212, 191, 0.5); }
.tl-item.active { background: var(--panel-strong); border-color: var(--border); }
.tl-item:hover { background: var(--panel); }

.tl-item-text { display: flex; flex-direction: column; gap: 1px; overflow: hidden; }
.tl-item-num { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }
.tl-item-title { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-item.active .tl-item-title { color: var(--text); }

/* ---------- DAY PANEL ---------- */
.day-panel {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 26px 28px;
  backdrop-filter: blur(16px);
  min-width: 0;
}

.day-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.day-header .day-num { font-family: var(--font-mono); color: var(--gold); font-size: 13px; }
.day-header h2 { font-family: var(--font-display); font-size: 21px; font-weight: 600; margin: 0; }
.bonus-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--teal);
  border: 1px solid rgba(45, 212, 191, 0.4);
  background: rgba(45, 212, 191, 0.08);
  padding: 3px 8px;
  border-radius: 999px;
}
.day-desc { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin: 10px 0 20px; max-width: 62ch; }

.task-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.check-row:hover { background: var(--panel-strong); }
.check-row input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--text-faint);
  border-radius: 5px;
  margin-top: 1px;
  flex: 0 0 18px;
  cursor: pointer;
  position: relative;
  background: var(--bg-soft);
}
.check-row input[type="checkbox"]:checked {
  background: var(--teal);
  border-color: var(--teal);
}
.check-row input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #08211d;
  font-weight: 700;
}
.check-row span.task-label { font-size: 14px; line-height: 1.4; }
.check-row.done span.task-label { color: var(--text-faint); text-decoration: line-through; }
.task-kind {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: auto;
  padding-top: 2px;
  white-space: nowrap;
}
.task-del {
  background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 14px; padding: 0 4px;
  visibility: hidden;
}
.check-row:hover .task-del { visibility: visible; }
.task-del:hover { color: #e0716a; }

.add-task-row { display: flex; gap: 8px; margin-top: 6px; }
.add-task-row input {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
}
.add-task-row input:focus { outline: none; border-color: var(--violet); }

.notes-label { display: block; font-size: 12px; color: var(--text-dim); margin: 20px 0 6px; }
.notes-area {
  width: 100%;
  min-height: 90px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.6;
  resize: vertical;
}
.notes-area:focus { outline: none; border-color: var(--violet); }

.day-nav { display: flex; justify-content: space-between; margin-top: 22px; }

.btn {
  background: var(--panel-strong);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: rgba(255,255,255,0.1); }
.btn-primary { background: linear-gradient(135deg, var(--violet), var(--violet-dim)); border-color: transparent; }
.btn-primary:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.loading { color: var(--text-dim); }

/* ---------- SKILLS ---------- */
.panel-inner { background: var(--panel); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 26px 28px; backdrop-filter: blur(16px); }
.panel-inner h2 { font-family: var(--font-display); font-size: 20px; margin: 0 0 6px; }
.hint { color: var(--text-dim); font-size: 13px; margin: 0 0 20px; }

.skill-row { padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.skill-row:last-child { border-bottom: none; }
.skill-top { display: flex; align-items: center; gap: 12px; }
.skill-check {
  appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--text-faint); border-radius: 5px;
  cursor: pointer; flex: 0 0 18px; background: var(--bg-soft); position: relative;
}
.skill-check:checked { background: var(--gold); border-color: var(--gold); }
.skill-check:checked::after { content: '✓'; position: absolute; inset: 0; display:flex; align-items:center; justify-content:center; font-size: 12px; color: #2a1c00; font-weight: 700; }
.skill-label { font-size: 14px; flex: 1; }
.skill-row.done .skill-label { color: var(--text-faint); }
.skill-bars { display: flex; gap: 3px; }
.skill-bar { width: 16px; height: 6px; border-radius: 3px; background: var(--panel-strong); }
.skill-bar.filled { background: var(--teal); }

/* ---------- EXAM ---------- */
.exam-panel { max-width: 560px; margin: 0 auto; text-align: center; }
.exam-instructions { color: var(--text-dim); font-size: 14px; line-height: 1.7; margin-bottom: 26px; }
.exam-timer { margin-bottom: 24px; }
.exam-timer-display {
  font-family: var(--font-mono);
  font-size: 44px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--gold);
  margin-bottom: 14px;
}
.exam-timer-controls { display: flex; gap: 10px; justify-content: center; }
.exam-done-row { justify-content: center; margin-bottom: 14px; }
.exam-panel .notes-label { text-align: left; }

/* ---------- METHOD TIMER WIDGET ---------- */
.method-timer { position: fixed; right: 18px; bottom: 18px; z-index: 30; }
.mt-toggle {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--teal));
  border: none; color: #0a0912; font-size: 18px; cursor: pointer;
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}
.mt-panel {
  position: absolute; bottom: 58px; right: 0; width: 240px;
  background: rgba(15, 14, 26, 0.92);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; backdrop-filter: blur(20px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
}
.mt-panel h3 { font-size: 13px; margin: 0 0 10px; font-family: var(--font-display); }
.mt-steps { display: flex; flex-direction: column; gap: 6px; }
.mt-step {
  text-align: left; background: var(--panel-strong); border: 1px solid var(--border-soft);
  color: var(--text); padding: 8px 10px; border-radius: var(--radius-sm); font-size: 12.5px; cursor: pointer;
}
.mt-step:hover { background: rgba(255,255,255,0.1); }
.mt-active { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.mt-active-label { font-size: 12px; color: var(--text-dim); }
.mt-active-time { font-family: var(--font-mono); font-size: 26px; color: var(--teal); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 860px) {
  #view-plan.active { flex-direction: column; }
  .timeline {
    flex-direction: row;
    overflow-x: auto;
    position: static;
    width: 100%;
    padding-bottom: 6px;
    gap: 4px;
  }
  .tl-week-label { display: none; }
  .tl-item { flex: 0 0 auto; flex-direction: column; text-align: center; padding: 8px; }
  .tl-item::before { display: none; }
  .tl-item-text { display: none; }
  .day-panel, .panel-inner { padding: 18px 16px; }
  .topbar { padding: 12px 14px; }
  .global-progress { order: 3; max-width: none; flex-basis: 100%; }
}
