/* Self Study. Its own look, not the hub's: blue-black ink, layered glass
   surfaces, a violet-to-cyan accent used sparingly (active state, primary
   action, the live orb). Geist for text, Geist Mono for counts and labels. */
:root {
  color-scheme: dark;
  --bg: #090b11;
  --bg-2: #0d1018;
  --panel: rgba(22, 26, 38, .72);
  --panel-solid: #141824;
  --panel-2: #1b2030;
  --panel-3: #252b3d;
  --text: #eef0f6;
  --dim: #b7bccb;
  --mute: #7d8396;
  --line: rgba(160, 175, 220, .10);
  --line-2: rgba(160, 175, 220, .18);
  --accent: #8b7cff;
  --accent-2: #4fd1e8;
  --accent-soft: rgba(139, 124, 255, .14);
  --grad: linear-gradient(135deg, #8b7cff 0%, #5fb4f5 60%, #4fd1e8 100%);
  --on-accent: #0a0b12;
  --good: #5ee0a8;
  --warn: #f5c264;
  --bad: #ff8d8d;
  --r: 14px;
  --r-sm: 9px;
  --body: "Geist", "Inter", system-ui, sans-serif;
  --tech: "Geist Mono", ui-monospace, monospace;
  --nav-w: 248px;
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px -12px rgba(0,0,0,.6);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 15.5px/1.55 var(--body); -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139,124,255,.10), transparent 60%),
    radial-gradient(700px 400px at 30% 110%, rgba(79,209,232,.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; letter-spacing: -.01em; }
p { margin: 0; }
::selection { background: var(--accent-soft); }
.mute { color: var(--mute); }
.dim { color: var(--dim); }
.tech { font-family: var(--tech); }
.boot { padding: 40vh 0; text-align: center; color: var(--mute); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---- shell ---- */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh; }
.nav { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 20px 14px; display: flex; flex-direction: column; gap: 2px; background: rgba(12, 14, 22, .7); backdrop-filter: blur(20px); border-right: 1px solid var(--line); }
.nav .brand { display: flex; gap: 11px; align-items: center; padding: 2px 8px 22px; }
.nav .logo { width: 34px; height: 34px; flex: none; margin: -2px; }
.nav .brand span { display: grid; line-height: 1.15; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; }
.nav .brand small { font: 500 11.5px var(--tech); color: var(--mute); }
.nav .sect { font: 500 11px var(--tech); color: var(--mute); letter-spacing: .08em; text-transform: uppercase; padding: 18px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-sm); text-decoration: none; color: var(--dim); font-size: 14.5px; position: relative; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255,255,255,.04); color: var(--text); }
.nav a.on { background: linear-gradient(90deg, var(--accent-soft), rgba(139,124,255,.03)); color: var(--text); }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav a .n { margin-left: auto; font: 500 11.5px var(--tech); color: var(--accent); background: var(--accent-soft); border-radius: 99px; padding: 1px 8px; }
.nav a .n.live { color: var(--on-accent); background: var(--grad); }
.nav a.add { color: var(--mute); }
.nav .foot { margin-top: auto; padding: 12px 10px; font: 500 12.5px var(--tech); color: var(--mute); border-top: 1px solid var(--line); }
.nav svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.mono { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; flex: none; font: 600 11px var(--tech); background: var(--panel-2); border: 1px solid var(--line-2); color: var(--dim); }
a.on .mono { background: var(--grad); border-color: transparent; color: var(--on-accent); }
main { padding: 34px 40px 72px; min-width: 0; max-width: 1140px; width: 100%; }
.page-head { display: flex; gap: 12px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p { margin-top: 6px; }

/* ---- pieces ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.subject-card { transition: border-color .2s, transform .2s; }
.subject-card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: rgba(255,255,255,.03); border-radius: var(--r-sm); padding: 8px 15px; cursor: pointer; text-decoration: none; font-weight: 500; font-size: 14.5px; transition: background .15s, border-color .15s, filter .15s; }
.btn:hover { background: rgba(255,255,255,.07); border-color: rgba(160,175,220,.28); }
.btn.primary { background: var(--grad); color: var(--on-accent); border-color: transparent; font-weight: 600; box-shadow: 0 8px 22px -10px rgba(139,124,255,.8); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: rgba(255,141,141,.4); }
.btn.small { padding: 5px 11px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 17px; height: 17px; }
input[type=text], textarea, select { width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--mute); }
textarea { resize: vertical; line-height: 1.6; }
label.f { display: grid; gap: 7px; font-size: 13.5px; color: var(--dim); font-weight: 500; }
.tabs { display: inline-flex; gap: 2px; padding: 4px; margin-bottom: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.tabs a { padding: 6px 14px; text-decoration: none; color: var(--mute); border-radius: 8px; font-size: 14px; font-weight: 500; transition: color .15s, background .15s; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); background: var(--panel-3); box-shadow: 0 1px 0 rgba(255,255,255,.06) inset; }
.tabs .n { font: 500 11.5px var(--tech); color: var(--accent); margin-left: 6px; }
.stat { font: 500 30px var(--tech); letter-spacing: -.03em; margin-top: 6px; }
.stat-card:first-child .stat { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.label { font: 500 11px var(--tech); color: var(--mute); letter-spacing: .08em; text-transform: uppercase; }
.empty { padding: 30px; text-align: center; color: var(--mute); border: 1px dashed var(--line-2); border-radius: var(--r); font-size: 14.5px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--panel-solid); border: 1px solid var(--line-2); padding: 10px 18px; border-radius: 99px; z-index: 50; font-size: 14px; box-shadow: 0 12px 30px -8px rgba(0,0,0,.7); }

/* ---- voice ---- */
.talk { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.stage { display: grid; place-items: center; gap: 16px; padding: 34px 18px 26px; text-align: center; }
.orb { width: 156px; height: 156px; border-radius: 50%; display: grid; place-items: center; position: relative; background: radial-gradient(circle at 50% 35%, #232a3f, #10131d 70%); border: 1px solid var(--line-2); transition: transform .08s linear; }
.orb::before { content: ""; position: absolute; inset: -14px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, rgba(139,124,255,.0), transparent); opacity: 0; transition: opacity .4s; z-index: -1; filter: blur(10px); }
.orb.live { border-color: rgba(139,124,255,.55); }
.orb.live::before { opacity: 1; background: conic-gradient(from 0deg, rgba(139,124,255,.55), rgba(79,209,232,.45), rgba(139,124,255,.1), rgba(139,124,255,.55)); animation: spin 6s linear infinite; }
.orb.speaking { box-shadow: 0 0 60px -6px rgba(110,160,255,.55); }
.orb svg { width: 42px; height: 42px; color: var(--mute); }
.orb.live svg { color: var(--text); }
@keyframes spin { to { transform: rotate(360deg); } }
.status { font: 500 12px var(--tech); letter-spacing: .08em; text-transform: uppercase; color: var(--mute); display: inline-flex; align-items: center; gap: 8px; }
.status.live { color: var(--accent-2); }
.status.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.transcript { display: grid; gap: 10px; max-height: 52vh; overflow-y: auto; padding: 4px 2px; }
.turn { padding: 10px 14px; border-radius: 14px; max-width: 85%; white-space: pre-wrap; line-height: 1.55; font-size: 15px; }
.turn.user { justify-self: end; background: linear-gradient(135deg, rgba(139,124,255,.22), rgba(95,180,245,.16)); border: 1px solid rgba(139,124,255,.25); border-bottom-right-radius: 4px; }
.turn.assistant { justify-self: start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.turn.tool { justify-self: center; font: 500 12.5px var(--tech); color: var(--accent-2); background: rgba(79,209,232,.08); border: 1px solid rgba(79,209,232,.2); padding: 3px 10px; border-radius: 99px; }
.turn.pending { color: var(--mute); }
.say { display: flex; gap: 8px; margin-top: 14px; }
.side .stack { gap: 8px; }
.side .card { padding: 15px 16px; }

/* ---- flashcards ---- */
.review { display: grid; place-items: center; gap: 20px; padding: 44px 24px; text-align: center; min-height: 320px; }
.review .front { font-size: 30px; font-weight: 600; letter-spacing: -.02em; white-space: pre-wrap; }
.review .back { font-size: 21px; color: var(--dim); white-space: pre-wrap; border-top: 1px solid var(--line); padding-top: 18px; width: 100%; }
.grades { display: flex; gap: 8px; }
kbd { font: 500 11px var(--tech); color: var(--mute); border: 1px solid var(--line-2); border-radius: 5px; padding: 0 5px; margin-left: 4px; background: rgba(0,0,0,.2); }
.btn.primary kbd { color: var(--on-accent); border-color: rgba(10,11,18,.25); background: transparent; }
table.list { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14.5px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
table.list td, table.list th { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: rgba(255,255,255,.02); }
table.list th { font: 500 11px var(--tech); color: var(--mute); letter-spacing: .08em; text-transform: uppercase; background: rgba(0,0,0,.15); }
table.list td.x { width: 1%; white-space: nowrap; }

details.sess { border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
details.sess[open] { border-color: var(--line-2); }
details.sess summary { padding: 13px 18px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; list-style: none; }
details.sess summary::-webkit-details-marker { display: none; }
details.sess .transcript { padding: 0 18px 18px; max-height: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(160,175,220,.15); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }

@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .nav .sect, .nav .foot, .nav .brand { display: none; }
  .nav a.on::before { display: none; }
  main { padding: 18px 16px; }
  .talk { grid-template-columns: minmax(0, 1fr); }
}

/* mic picker + level */
.microw { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 440px; margin-top: 4px; color: var(--mute); }
.microw svg { width: 16px; height: 16px; flex: none; }
.microw select { flex: 1; min-width: 0; padding: 6px 10px; font-size: 13.5px; }
.micbar { width: 90px; height: 6px; border-radius: 99px; background: var(--panel-3); overflow: hidden; flex: none; }
.micbar i { display: block; height: 100%; width: 0; background: var(--accent-2); border-radius: 99px; transition: width .06s linear; }

/* sign-in */
.signin-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin { width: 100%; max-width: 360px; padding: 28px 26px; }
input[type=password] { width: 100%; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 10px 12px; outline: none; }
input[type=password]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
