/* LR AgriPrep: clean, neutral theme (light + dark), inspired by ChatGPT / Claude */
:root {
  --bg: #ffffff;
  --sidebar: #f9f9f9;
  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --hover: #ececec;
  --line: #e5e5e5;
  --line-2: #d4d4d4;
  --text: #0d0d0d;
  --text-2: #3d3d3d;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --btn: #0d0d0d;
  --btn-text: #ffffff;
  --accent: #1a7f5a;
  --accent-soft: #e8f3ee;
  --good: #1a7f5a;
  --good-soft: #e8f3ee;
  --warn: #b26b00;
  --warn-soft: #fdf3e1;
  --bad: #c2362b;
  --bad-soft: #fbeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #212121; --sidebar: #171717; --surface: #2a2a2a; --surface-2: #2f2f2f; --hover: #333333;
    --line: #383838; --line-2: #4a4a4a; --text: #ececec; --text-2: #d4d4d4; --muted: #a3a3a3; --faint: #7a7a7a;
    --btn: #ececec; --btn-text: #0d0d0d; --accent: #4cc38a; --accent-soft: rgba(76, 195, 138, .12);
    --good: #4cc38a; --good-soft: rgba(76, 195, 138, .12); --warn: #e0a84a; --warn-soft: rgba(224, 168, 74, .12);
    --bad: #f07a6e; --bad-soft: rgba(240, 122, 110, .12); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #212121; --sidebar: #171717; --surface: #2a2a2a; --surface-2: #2f2f2f; --hover: #333333;
  --line: #383838; --line-2: #4a4a4a; --text: #ececec; --text-2: #d4d4d4; --muted: #a3a3a3; --faint: #7a7a7a;
  --btn: #ececec; --btn-text: #0d0d0d; --accent: #4cc38a; --accent-soft: rgba(76, 195, 138, .12);
  --good: #4cc38a; --good-soft: rgba(76, 195, 138, .12); --warn: #e0a84a; --warn-soft: rgba(224, 168, 74, .12);
  --bad: #f07a6e; --bad-soft: rgba(240, 122, 110, .12); --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Telugu", "Noto Sans Devanagari", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.hidden, [hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 6px; line-height: 1.25; letter-spacing: -.01em; font-weight: 600; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); font-size: .92rem; margin: 0; }
.error { color: var(--bad); font-size: .88rem; min-height: 1.2em; margin: 8px 0 0; }
.ok { color: var(--good); font-size: .88rem; min-height: 1.2em; margin: 8px 0 0; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; font-weight: 600; color: var(--muted); margin: 0 0 4px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Brand / logo: LR badge + AgriPrep wordmark + green full stop */
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-family: "Inter", system-ui, sans-serif; line-height: 1; user-select: none; }
.logo-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--text); color: var(--bg); font-weight: 800; font-size: 13px; letter-spacing: -.02em; flex: none; }
.logo-word { font-weight: 700; font-size: 19px; letter-spacing: -.03em; }
.logo-dot { color: #16a34a; }
.brand.big { gap: 10px; }
.brand.big .logo-badge { width: 40px; height: 40px; border-radius: 11px; font-size: 18px; }
.brand.big .logo-word { font-size: 28px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px; padding: 10px 18px; font: inherit; font-weight: 500; font-size: .92rem; cursor: pointer;
  transition: background .15s, opacity .15s, border-color .15s;
}
.btn.primary { background: var(--btn); color: var(--btn-text); }
.btn.primary:hover { opacity: .85; }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--text); }
.btn.ghost:hover { background: var(--hover); }
.btn.block { width: 100%; }
.btn.lg { padding: 13px 20px; font-size: .98rem; }
.btn:disabled { opacity: .4; cursor: default; }
.link { background: none; border: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px; font: inherit; font-size: .88rem; cursor: pointer; padding: 0; }
.icon-btn { width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); font: inherit; cursor: pointer; display: inline-grid; place-items: center; flex: none; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* Forms */
label { display: block; font-size: .85rem; font-weight: 500; color: var(--text-2); margin: 14px 0 0; }
.opt-tag { font-weight: 400; color: var(--faint); font-size: .78rem; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--text);
  font: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 1px var(--text); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-42%); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: end; }

/* Segmented control */
.seg { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin: 16px 0 4px; }
.seg.small { margin: 6px 0 0; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 8px; font: inherit; font-size: .88rem; font-weight: 500; color: var(--muted); cursor: pointer; transition: .15s; }
.seg button.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.badge { background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: .75rem; font-weight: 500; white-space: nowrap; }
.pill { font-size: .78rem; color: var(--muted); padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.pill b { color: var(--text); font-weight: 600; }

/* ============ AUTH / LANDING ============ */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px; align-items: center; max-width: 1120px; margin: 0 auto; padding: 40px 32px; }
.hero-title { font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 600; margin: 28px 0 14px; letter-spacing: -.03em; line-height: 1.12; }
.grad { color: var(--accent); }
.hero-sub { color: var(--muted); font-size: 1.05rem; max-width: 540px; margin: 0 0 26px; }
.hero-points { list-style: none; padding: 0; margin: 0 0 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 24px; }
.hero-points li { display: flex; gap: 12px; align-items: flex-start; }
.hero-points .ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; background: var(--surface-2); border-radius: 9px; color: var(--text); }
.hero-points b { display: block; font-size: .93rem; font-weight: 600; }
.hero-points small { color: var(--muted); font-size: .84rem; }
.exam-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.exam-chips span { font-size: .78rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: var(--shadow); }
.auth-card .btn.block { margin-top: 18px; }
.fine { color: var(--faint); font-size: .78rem; text-align: center; margin: 14px 0 0; }

/* ============ APP SHELL ============ */
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; transition: grid-template-columns .2s ease; }
.shell.side-collapsed { grid-template-columns: 0 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; width: 260px; padding: 10px 10px 12px; background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; overflow: hidden; z-index: 40; transition: transform .2s ease, opacity .2s ease; }
.shell.side-collapsed .sidebar { transform: translateX(-100%); opacity: 0; pointer-events: none; }
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 2px 8px; height: 44px; }
.new-chat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 10px; border: 0; background: none; color: var(--text); font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer; transition: background .15s; }
.new-chat:hover { background: var(--hover); }
.side-section { display: flex; flex-direction: column; min-height: 0; }
.side-section.grow { flex: 1; }
.side-label { font-size: .75rem; font-weight: 500; color: var(--faint); margin: 10px 10px 4px; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-nav button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: inherit; font-size: .92rem; cursor: pointer; text-align: left; transition: background .15s; }
.side-nav button:hover { background: var(--hover); }
.side-nav button.active { background: var(--hover); color: var(--text); font-weight: 500; }
.chat-list { overflow-y: auto; display: flex; flex-direction: column; gap: 1px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.chat-item { display: flex; align-items: center; border-radius: 10px; transition: background .15s; }
.chat-item:hover, .chat-item.active { background: var(--hover); }
.chat-item button.open { flex: 1; min-width: 0; text-align: left; border: 0; background: none; color: var(--text-2); font: inherit; font-size: .9rem; padding: 8px 4px 8px 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.active button.open { color: var(--text); }
.chat-item button.del { flex: none; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; margin-right: 4px; border-radius: 6px; opacity: 0; font: inherit; font-size: .75rem; }
.chat-item:hover button.del, .chat-item.active button.del { opacity: 1; }
.chat-item button.del:hover { color: var(--bad); }
.chat-item button.del svg.i { width: 15px; height: 15px; }
.chat-list .empty { padding: 6px 10px; text-align: left; font-size: .85rem; color: var(--faint); }
.side-plan { border-top: 1px solid var(--line); padding: 12px 10px 4px; font-size: .78rem; color: var(--muted); }
.side-plan b { display: block; margin-bottom: 4px; font-size: .8rem; font-weight: 500; color: var(--text-2); }
.meter { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 4px 0 8px; }
.meter > div { height: 100%; background: var(--text); border-radius: 99px; transition: width .4s; }
.side-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; transition: background .15s; }
.side-user:hover, .side-user.active { background: var(--hover); }
.side-user .avatar { width: 30px; height: 30px; font-size: .75rem; }
.side-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.side-user-text b { font-size: .88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text small { color: var(--muted); font-size: .75rem; }
.scrim { display: none; }

.main-col { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 6px; height: 56px; padding: 0 12px; background: var(--bg); }
.page-title { font-size: 1rem; font-weight: 500; margin: 0 0 0 6px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.top-right { display: flex; align-items: center; gap: 4px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font: inherit; font-weight: 600; font-size: .85rem; display: grid; place-items: center; flex: none; }
.avatar.xl { width: 56px; height: 56px; font-size: 1.2rem; }
.page { width: 100%; max-width: 1000px; margin: 0 auto; padding: 16px 32px 60px; }
.mobile-only { display: none !important; }
.collapsed-only { display: none !important; }
.shell.side-collapsed .collapsed-only { display: inline-grid !important; }

/* Chat view */
.chat-view { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 780px; margin: 0 auto; padding: 8px 24px 0; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 22px; padding: 12px 0 24px; }
.composer-wrap { position: sticky; bottom: 0; padding: 8px 0 10px; background: var(--bg); }
.composer { background: var(--surface); border: 1px solid var(--line-2); border-radius: 24px; padding: 12px 10px 8px 18px; box-shadow: var(--shadow); }
.composer:focus-within { border-color: var(--line-2); }
.composer textarea { margin: 0; padding: 4px 0; border: 0; background: none; resize: none; max-height: 200px; font-size: 1rem; box-shadow: none !important; }
.composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.composer-opts { display: flex; gap: 6px; min-width: 0; }
.composer-opts select { margin: 0; padding: 5px 28px 5px 12px; font-size: .8rem; width: auto; max-width: 220px; min-width: 0; border-radius: 999px; border-color: var(--line); background-color: transparent; color: var(--text-2); }
.composer-opts select:focus { box-shadow: none; border-color: var(--line-2); }
.send { padding: 0; width: 34px; height: 34px; flex: none; border-radius: 50%; }
.send svg.i { width: 18px; height: 18px; stroke-width: 2.2; }
.composer-wrap .error { min-height: 0; }
.composer-wrap .fine { margin-top: 8px; font-size: .72rem; }

.msg-row { display: flex; gap: 14px; }
.msg-row.user { justify-content: flex-end; }
.bot-av { flex: none; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; margin-top: 2px; border: 1px solid var(--line); }
.bot-av img { width: 100%; height: 100%; display: block; }
.msg { max-width: 100%; }
.msg.user { max-width: 75%; background: var(--surface-2); padding: 10px 16px; border-radius: 20px; white-space: pre-wrap; }
.msg.bot { flex: 1; min-width: 0; }
.msg .meta { font-size: .72rem; color: var(--muted); margin-bottom: 4px; }
.answer { font-size: 1rem; line-height: 1.7; color: var(--text); }
.answer ul, .answer ol { padding-left: 1.3em; margin: 8px 0; }
.answer li { margin: 4px 0; }
.answer p { margin: 10px 0; }
.answer p:first-child { margin-top: 0; }
.answer strong { font-weight: 600; }
.msg-actions { display: flex; gap: 2px; margin-top: 4px; margin-left: -6px; }
.msg-actions button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: .78rem; padding: 5px 7px; border-radius: 6px; cursor: pointer; }
.msg-actions button:hover { background: var(--hover); color: var(--text); }
.msg-actions svg.i { width: 15px; height: 15px; }
.typing { display: inline-flex; gap: 4px; padding-top: 10px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }

.chat-hero { margin: auto 0; text-align: center; padding: 20px 0 10px; }
.chat-hero .logo-big { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 16px; }
.chat-hero h2 { font-size: clamp(1.5rem, 3.2vw, 1.9rem); font-weight: 600; letter-spacing: -.02em; }
.chat-hero > p { margin-bottom: 24px; }
.suggest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.suggest { background: transparent; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; color: var(--text); font: inherit; cursor: pointer; transition: background .15s; text-align: left; }
.suggest:hover { background: var(--surface-2); }
.suggest b { display: block; font-size: .9rem; font-weight: 500; margin-bottom: 1px; }
.suggest small { color: var(--muted); font-size: .84rem; }
.tutor-badge { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; background: var(--surface-2); border: 1px solid var(--line); }

/* Explore */
.explore { max-width: 840px; margin: 0 auto; }
.explore-head { text-align: center; padding: 18px 0 6px; }
.explore-head h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 600; letter-spacing: -.03em; }
.explore-head > .muted { font-size: 1rem; margin-bottom: 22px; }
.search-box { display: flex; align-items: center; gap: 10px; max-width: 620px; margin: 0 auto; background: var(--surface-2); border: 1px solid transparent; border-radius: 12px; padding: 0 14px; color: var(--muted); transition: border-color .15s, background .15s; }
.search-box:focus-within { border-color: var(--line-2); background: var(--bg); }
.search-box input { border: 0; background: none; margin: 0; padding: 12px 0; box-shadow: none !important; }
.cat-row { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin: 18px 0 4px; }
.cat { border: 0; background: none; color: var(--muted); font: inherit; font-size: .9rem; font-weight: 500; padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: .15s; }
.cat:hover { color: var(--text); background: var(--hover); }
.cat.active { background: var(--btn); color: var(--btn-text); }
.ex-featured { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 6px; }
.ex-feature { display: flex; gap: 16px; align-items: center; text-align: left; padding: 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
.ex-feature:hover { border-color: var(--line-2); background: var(--hover); }
.ex-feature b { display: block; font-size: 1.02rem; font-weight: 600; margin-bottom: 3px; }
.ex-feature small { color: var(--muted); font-size: .86rem; line-height: 1.45; display: block; }
.ex-section { margin-top: 30px; }
.ex-sec-head { padding-bottom: 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.ex-sec-head h3 { font-size: 1.1rem; margin: 0 0 2px; }
.ex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.ex-item { display: flex; gap: 14px; align-items: center; text-align: left; padding: 12px; border: 0; border-radius: 12px; background: none; color: var(--text); font: inherit; cursor: pointer; transition: background .15s; min-width: 0; }
.ex-item:hover:not(:disabled) { background: var(--surface-2); }
.ex-item.soon { opacity: .5; cursor: default; }
.ex-ic { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; background: var(--surface-2); border: 1px solid var(--line); }
.ex-ic.big { width: 60px; height: 60px; font-size: 1.7rem; background: var(--bg); }
.ex-text { min-width: 0; display: flex; flex-direction: column; }
.ex-text b { font-size: .94rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-text small { color: var(--muted); font-size: .84rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ex-text em { font-style: normal; font-size: .72rem; color: var(--faint); margin-top: 3px; }
#explore-body .empty { padding: 40px 10px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .num { font-size: 1.7rem; font-weight: 600; letter-spacing: -.02em; }
.stat .lbl { font-size: .8rem; color: var(--muted); }
.stat .ico { display: none; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head h3 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.empty { text-align: center; padding: 18px 8px; color: var(--muted); font-size: .9rem; }

/* Bars */
.bar-row { margin: 12px 0; }
.bar-label { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; }
.bar-label span:last-child { color: var(--muted); white-space: nowrap; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar > div { height: 100%; border-radius: 99px; transition: width .6s ease; }
.lvl-good { background: var(--good); }
.lvl-mid { background: var(--warn); }
.lvl-bad { background: var(--bad); }

/* Practice setup */
.setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.choice { border: 1px solid var(--line-2); background: transparent; color: var(--text-2); border-radius: 999px; padding: 7px 13px; font: inherit; font-size: .85rem; cursor: pointer; transition: .15s; }
.choice:hover { background: var(--hover); }
.choice.active { border-color: var(--btn); background: var(--btn); color: var(--btn-text); }
.setup .btn.block { margin-top: 22px; }

/* Quiz runner */
.quiz-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.quiz-top .meta { font-size: .85rem; color: var(--muted); }
.progress-line { height: 4px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress-line > div { height: 100%; background: var(--text); transition: width .3s ease; }
.q-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.q-num { font-size: .75rem; color: var(--muted); font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.q-text { font-size: 1.08rem; font-weight: 600; margin: 8px 0 18px; line-height: 1.5; }
.opt { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; padding: 12px 14px; margin: 8px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; cursor: pointer; transition: .15s; }
.opt:hover:not(:disabled) { background: var(--surface-2); }
.opt .letter { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: .8rem; color: var(--muted); border: 1px solid var(--line-2); }
.opt.selected { border-color: var(--text); }
.opt.selected .letter { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.correct .letter { background: var(--good); color: #fff; border-color: var(--good); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .letter { background: var(--bad); color: #fff; border-color: var(--bad); }
.opt:disabled { cursor: default; }
.q-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 18px; }
.dot { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--muted); font: inherit; font-size: .78rem; cursor: pointer; }
.dot.answered { background: var(--surface-2); color: var(--text); }
.dot.current { border-color: var(--text); color: var(--text); font-weight: 600; }
.explain { margin-top: 12px; padding: 12px 14px; background: var(--surface-2); border-radius: 10px; font-size: .92rem; color: var(--text-2); }
.review-item { margin-bottom: 14px; }
.review-item .q-text { font-size: 1rem; margin-bottom: 8px; }
.status { font-size: .75rem; font-weight: 600; }
.status.c { color: var(--good); } .status.w { color: var(--bad); } .status.s { color: var(--muted); }

/* Result */
.result { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 26px; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--good) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.ring::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; z-index: 1; font-size: 1.6rem; font-weight: 600; }
.result-stats { display: flex; gap: 24px; margin: 10px 0 18px; flex-wrap: wrap; }
.result-stats div b { display: block; font-size: 1.25rem; font-weight: 600; }
.result-stats div small { color: var(--muted); font-size: .78rem; }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Progress */
.recent-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.recent-item:last-child { border-bottom: 0; }
.recent-item b { font-weight: 500; }
.recent-item small { color: var(--muted); }
.score-chip { font-weight: 600; padding: 3px 10px; border-radius: 999px; font-size: .82rem; white-space: nowrap; }
.score-chip.good { background: var(--good-soft); color: var(--good); }
.score-chip.mid { background: var(--warn-soft); color: var(--warn); }
.score-chip.bad { background: var(--bad-soft); color: var(--bad); }

/* Profile */
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head h2 { margin: 0; }
.plan-card ul { padding-left: 1.2em; color: var(--text-2); font-size: .92rem; }
.plan-card .price { font-size: 1.4rem; font-weight: 600; margin: 6px 0; }
#view-profile > .btn.block { margin-top: 4px; }

/* Loader & toast */
.loader { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: grid; place-items: center; z-index: 90; padding: 16px; }
.loader-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 26px 32px; text-align: center; box-shadow: var(--shadow); max-width: 320px; }
.loader-card p { font-weight: 500; margin: 14px 0 2px; }
.orb { width: 32px; height: 32px; margin: 0 auto; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--text); animation: spin .8s linear infinite; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--btn); color: var(--btn-text); padding: 10px 16px; border-radius: 10px; font-size: .88rem; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* User menu (above the name in the sidebar) */
.sidebar { position: sticky; }
.user-menu { position: absolute; left: 10px; right: 10px; bottom: 62px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 6px; box-shadow: var(--shadow); z-index: 5; }
.user-menu .um-email { font-size: .78rem; color: var(--muted); padding: 8px 10px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; text-align: left; }
.user-menu button:hover { background: var(--hover); }

/* Settings modal */
.modal { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.modal-card { position: relative; width: 100%; max-width: 720px; max-height: min(640px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); overflow: hidden; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 12px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { display: grid; grid-template-columns: 190px 1fr; min-height: 0; flex: 1; }
.set-tabs { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-right: 1px solid var(--line); }
.set-tabs button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 9px; background: none; color: var(--text-2); font: inherit; font-size: .9rem; cursor: pointer; text-align: left; white-space: nowrap; }
.set-tabs button:hover { background: var(--hover); }
.set-tabs button.active { background: var(--hover); color: var(--text); font-weight: 500; }
.set-panels { overflow-y: auto; padding: 6px 22px 22px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row > div:first-child { min-width: 0; }
.set-row b, .set-block b { display: block; font-size: .92rem; font-weight: 500; }
.set-row small, .set-block small { display: block; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.set-row select { width: auto; min-width: 140px; margin: 0; }
.set-row .btn { white-space: nowrap; flex: none; }
.set-block { padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-block form { display: grid; gap: 8px; margin-top: 10px; }
.set-block input { margin: 0; }
.set-block .btn { justify-self: start; }
.set-block.danger b { color: var(--bad); }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { margin: 0; width: 180px; }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.armed { background: var(--bad); color: #fff; }
.about-brand { display: flex; align-items: baseline; gap: 12px; padding: 16px 0 10px; }
.about-brand small { color: var(--muted); font-size: .82rem; }
/* Toggle switch */
.switch { position: relative; display: inline-block; width: 40px; height: 24px; margin: 0; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; cursor: pointer; transition: background .15s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; gap: 28px; padding: 28px 16px; }
  .hero-title { margin-top: 20px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .ex-featured { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell, .shell.side-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); transform: translateX(-102%); opacity: 1; box-shadow: var(--shadow); }
  .shell.side-collapsed .sidebar { transform: translateX(-102%); opacity: 1; }
  .shell.side-open .sidebar { transform: none; pointer-events: auto; }
  .shell.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 30; }
  .mobile-only { display: inline-grid !important; }
  .collapsed-only { display: none !important; }
  .shell.side-collapsed .collapsed-only { display: none !important; }
  .desktop-only { display: none !important; }
  .page { padding: 12px 16px 40px; }
  .chat-view { padding: 4px 14px 0; }
  .two-col, .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > label { grid-column: 1 / -1; }
  .pill { display: none; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-card { max-width: none; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .modal-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .set-tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; scrollbar-width: none; }
  .set-panels { padding: 4px 16px 24px; }
  .set-row { flex-wrap: wrap; }
  .inline-form { width: 100%; }
  .inline-form input { flex: 1; width: auto; }
}
@media (max-width: 520px) {
  .hero-points { display: none; }
  .hero-title { font-size: 2rem; margin: 18px 0 10px; }
  .hero-sub { font-size: .98rem; margin-bottom: 16px; }
  .auth { gap: 22px; padding-top: 22px; }
  .suggest-grid { grid-template-columns: 1fr; }
  .suggest-grid .suggest:nth-child(n+4) { display: none; }
  .ex-featured, .ex-grid { grid-template-columns: 1fr; }
  .ex-feature { padding: 16px; }
  .cat-row { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .cat { white-space: nowrap; }
  .composer-opts select { max-width: 130px; }
  .result { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .result-stats, .result-actions { justify-content: center; }
  .q-card { padding: 18px; }
  .card { padding: 16px; }
  .auth-card { padding: 22px; }
  .msg.user { max-width: 85%; }
}

/* ---------- attachments (photo, camera, file) ---------- */
.attach-wrap { position: relative; flex: none; }
.attach-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); color: var(--text-2); }
.attach-btn:hover, .attach-btn.open { background: var(--hover); color: var(--text); }
.attach-btn svg.i { width: 18px; height: 18px; }
.attach-menu { position: absolute; bottom: calc(100% + 8px); left: -6px; z-index: 30; min-width: 210px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .18); padding: 6px; }
.attach-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: var(--text); font: inherit; font-size: .9rem; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.attach-menu button:hover { background: var(--hover); }
.attach-menu small { margin-left: auto; color: var(--muted); font-size: .72rem; }
.attach-menu svg.i { width: 18px; height: 18px; color: var(--text-2); }
.attach-strip { display: flex; gap: 8px; flex-wrap: wrap; padding: 2px 0 10px; }
.att { position: relative; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.att.img { width: 64px; height: 64px; }
.att.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att.doc { padding: 8px 30px 8px 10px; max-width: 240px; font-size: .82rem; }
.att.doc svg.i { width: 20px; height: 20px; flex: none; color: var(--text-2); }
.att.doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .rm { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; }
.att .rm svg.i { width: 12px; height: 12px; stroke-width: 2.6; }
.att.busy::after { content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, .35); }
.composer.drag { border-color: var(--accent, #16a34a); box-shadow: 0 0 0 3px rgba(22, 163, 74, .15); }

/* attachments inside sent messages */
.msg-files { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 6px; }
.msg-files img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); display: block; cursor: zoom-in; }
.msg-files .file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: .82rem; color: var(--text-2); }
.msg-files .file-chip svg.i { width: 16px; height: 16px; }
.msg-row.user .msg-col { display: flex; flex-direction: column; align-items: flex-end; max-width: 75%; }
.msg-row.user .msg-col .msg.user { max-width: 100%; }

/* follow-up suggestions after an answer */
.followups { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-top: 10px; }
.followups .fu-label { font-size: .75rem; color: var(--muted); }
.followup { display: inline-flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: background .15s, border-color .15s; }
.followup:hover { background: var(--hover); border-color: var(--line-2); }
.followup::before { content: '↳'; color: var(--muted); }
#chat-log > .msg-row.bot:not(:last-child) .followups { display: none; }

/* camera (laptops) */
#camera { background: rgba(0, 0, 0, .85); }
.camera-box { width: 100%; max-width: 720px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.camera-box video { width: 100%; max-height: 70vh; border-radius: 16px; background: #000; object-fit: contain; }
.camera-bar { display: flex; align-items: center; justify-content: center; gap: 40px; }
.camera-bar .icon-btn { color: #fff; background: rgba(255, 255, 255, .12); width: 44px; height: 44px; border-radius: 50%; }
.shutter { width: 68px; height: 68px; border-radius: 50%; border: 4px solid #fff; background: rgba(255, 255, 255, .25); cursor: pointer; }
.shutter:hover { background: rgba(255, 255, 255, .45); }

/* full-size photo viewer */
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .88); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

@media (max-width: 520px) {
  .composer-opts #doubt-subject { max-width: 110px; }
  .msg-files img { width: 96px; height: 96px; }
  .msg-row.user .msg-col { max-width: 85%; }
}
.hero-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 4px 0 18px; }
.hero-actions .btn { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; font-size: .88rem; padding: 8px 16px; }
.hero-actions svg.i { width: 17px; height: 17px; }

/* ---------- message actions: copy, edit, listen, like, answer again, stop ---------- */
.msg-actions button span { margin-left: 2px; }
.msg-actions button.on { color: var(--text); background: var(--hover); }
.msg-actions [data-like].on { color: var(--accent); }
#chat-log > .msg-row.bot:not(:last-child) .regen { display: none; }
.user-actions { justify-content: flex-end; margin: 2px -4px 0 0; opacity: 0; transition: opacity .15s; }
.msg-row.user:hover .user-actions, .msg-row.user:focus-within .user-actions { opacity: 1; }
@media (hover: none) { .user-actions { opacity: 1; } }
.edit-box { width: min(560px, 100%); background: var(--surface-2); border-radius: 18px; padding: 10px 12px; }
.edit-box textarea { margin: 0; border: 0; background: none; resize: vertical; width: 100%; min-height: 70px; font: inherit; box-shadow: none !important; padding: 4px; }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.edit-actions .btn { padding: 7px 16px; border-radius: 999px; font-size: .88rem; }
.send.stop { background: var(--text); color: var(--bg); }
.send.stop svg.i { width: 16px; height: 16px; }
.stopped { margin: 6px 0 0; font-size: .88rem; font-style: italic; }

/* richer answers: headings, tables, code */
.answer h4 { font-size: 1.02rem; font-weight: 600; margin: 18px 0 6px; }
.answer h4:first-child { margin-top: 0; }
.answer em { font-style: italic; }
.answer code { font-size: .9em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.answer hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.table-wrap { overflow-x: auto; margin: 10px 0; }
.answer table { border-collapse: collapse; font-size: .92rem; min-width: 60%; }
.answer th, .answer td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
.answer th { background: var(--surface-2); font-weight: 600; }

/* ---------- AI "working" box: animated spark, live steps, timer ---------- */
.work { margin: 0 0 10px; }
.work-head { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 8px 4px 2px; margin-left: -2px; border-radius: 8px; font: inherit; font-size: .88rem; color: var(--muted); cursor: pointer; }
button.work-head:hover { color: var(--text); background: var(--hover); }
.work-mark { width: 20px; height: 20px; display: grid; place-items: center; color: var(--accent); flex: none; }
.work-mark svg.i { width: 18px; height: 18px; stroke-width: 2.4; }
.work .chev { width: 15px; height: 15px; transition: transform .2s; }
.work-head.open .chev { transform: rotate(90deg); }
.work-time { font-variant-numeric: tabular-nums; font-size: .78rem; color: var(--faint); }
.work-steps { list-style: none; margin: 6px 0 4px 9px; padding: 2px 0 2px 16px; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: 7px; }
.work-steps li { display: flex; align-items: flex-start; gap: 8px; font-size: .85rem; color: var(--text-2); animation: stepIn .35s ease both; }
.work-steps li svg.i { width: 15px; height: 15px; margin-top: 2px; color: var(--muted); flex: none; }
@keyframes stepIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* live: the spark spins and breathes, the text shimmers */
.work.live .work-head { cursor: default; color: var(--text-2); }
.work.live .work-mark svg.i { animation: sparkSpin 2.6s cubic-bezier(.45, .05, .55, .95) infinite; transform-origin: 50% 50%; }
@keyframes sparkSpin {
  0% { transform: rotate(0deg) scale(.8); opacity: .75; }
  50% { transform: rotate(180deg) scale(1.15); opacity: 1; }
  100% { transform: rotate(360deg) scale(.8); opacity: .75; }
}
.shimmer {
  background: linear-gradient(90deg, var(--muted) 0%, var(--muted) 35%, var(--text) 50%, var(--muted) 65%, var(--muted) 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.8s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.answer.streaming > :last-child::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%; background: var(--accent); vertical-align: middle; animation: blink 1s infinite; }
.answer.streaming:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .work.live .work-mark svg.i, .shimmer { animation: none; } .shimmer { color: var(--text-2); } }

/* web sources */
.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 2px; }
.src-label { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--muted); margin-right: 2px; }
.src-label svg.i { width: 14px; height: 14px; }
.sources a { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 4px 10px 4px 5px; border: 1px solid var(--line); border-radius: 999px; font-size: .78rem; color: var(--text-2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sources a:hover { background: var(--hover); color: var(--text); }
.sources a b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-2); font-size: .68rem; flex: none; }
.g-search { display: block; width: 100%; height: 58px; border: 0; margin-top: 6px; color-scheme: normal; }
.work-steps:empty { display: none; }

/* ---------- model picker (LR Doha · Kavya · Mahakavya) ---------- */
.composer-right { display: flex; align-items: center; gap: 6px; flex: none; }
.model-wrap { position: relative; }
.model-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--text-2); font: inherit; font-size: .85rem; font-weight: 500; padding: 6px 8px 6px 10px; border-radius: 999px; cursor: pointer; }
.model-btn:hover, .model-btn.open { background: var(--hover); color: var(--text); }
.model-btn svg.i { width: 14px; height: 14px; transform: rotate(90deg); transition: transform .2s; }
.model-btn.open svg.i { transform: rotate(-90deg); }
.model-menu { position: absolute; bottom: calc(100% + 8px); right: -40px; z-index: 30; width: 330px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); padding: 6px; }
.mm-title { margin: 6px 10px 6px; font-size: .75rem; color: var(--muted); }
.model-opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; border: 0; background: none; color: var(--text); font: inherit; text-align: left; padding: 10px; border-radius: 10px; cursor: pointer; }
.model-opt:hover { background: var(--hover); }
.model-opt.active { background: var(--surface-2); }
.model-opt.locked .mo-text { opacity: .55; }
.mo-ic { font-size: 1.1rem; line-height: 1.3; }
.mo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mo-text b { font-size: .92rem; font-weight: 600; }
.mo-text small { font-size: .78rem; color: var(--muted); line-height: 1.35; }
.mtag { font-size: .68rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; }
.model-opt em { font-style: normal; font-size: .7rem; color: var(--muted); white-space: nowrap; margin-top: 3px; }
.model-opt em.lock { color: #b7791f; font-weight: 600; }
.model-opt > svg.i { width: 16px; height: 16px; color: var(--accent); margin-top: 3px; flex: none; }
.work-text b { font-weight: 600; color: var(--text-2); }
@media (max-width: 520px) {
  .composer-opts .lang-select { max-width: 92px; }
  .composer-opts #doubt-subject { max-width: 92px; }
  .model-btn { padding: 6px 4px 6px 6px; font-size: .8rem; }
  .model-menu { right: -44px; }
}

/* ---------- plans / pricing ---------- */
.plans-card { max-width: 1040px; max-height: min(860px, calc(100vh - 32px)); }
.plans-body { overflow-y: auto; padding: 18px 22px 20px; }
.plans-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.plan-card { position: relative; border: 1px solid var(--line); border-radius: 16px; padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.plan-card.popular { border: 2px solid var(--accent); padding: 19px 17px; }
.plan-card.current { background: var(--surface-2); }
.plan-card h3 { margin: 0; font-size: 1.15rem; }
.plan-tag { margin: -6px 0 0; font-size: .82rem; }
.plan-price { display: flex; align-items: baseline; gap: 4px; margin: 4px 0; }
.plan-price b { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
.plan-price span { color: var(--muted); font-size: .85rem; }
.plan-badge { position: absolute; top: -11px; left: 16px; background: var(--accent); color: #fff; font-size: .7rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.plan-card ul { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-direction: column; gap: 8px; }
.plan-card li { display: flex; gap: 8px; font-size: .86rem; line-height: 1.4; color: var(--text-2); }
.plan-card li svg.i { width: 16px; height: 16px; color: var(--accent); flex: none; margin-top: 2px; }
.plan-until { margin: -4px 0 0; font-size: .78rem; color: var(--accent); text-align: center; }
.plans-note, .plans-off { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; font-size: .88rem; background: var(--accent-soft); color: var(--text); }
.plans-off { background: var(--warn-soft); }
.plans-body .fine { margin-top: 16px; text-align: center; }
.upgrade-btn { margin-top: 8px; padding: 8px 12px; font-size: .85rem; }
.pay-row { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pay-row:last-child { border-bottom: 0; }
#pay-history:empty { display: none; }
.legal-links a { color: inherit; }
@media (max-width: 960px) { .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .plans-grid { grid-template-columns: 1fr; } .plans-body { padding: 14px; } }

/* ---------- sidebar bottom: user + small upgrade button ---------- */
.side-bottom { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); padding-top: 8px; }
.side-bottom .side-user { flex: 1; min-width: 0; }
.up-chip { flex: none; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: .78rem; font-weight: 500; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.up-chip:hover { background: var(--hover); }

/* ---------- settings: full page ---------- */
.settings-page { max-width: 920px; margin: 0 auto; padding-top: 12px; }
.settings-title { font-size: 1.6rem; font-weight: 600; margin: 8px 0 22px; }
.settings-layout { display: grid; grid-template-columns: 210px 1fr; gap: 36px; align-items: start; }
.settings-layout .set-tabs { position: sticky; top: 72px; border-right: 0; padding: 0; }
.settings-layout .set-panels { padding: 0; overflow: visible; min-width: 0; }
.set-h { font-size: 1.1rem; font-weight: 600; margin: 4px 0 6px; }
.set-panels .set-h + .muted { margin-bottom: 10px; }

.plan-now-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin: 10px 0 6px; }
.plan-now-card h4 { margin: 4px 0 2px; font-size: 1.25rem; font-weight: 600; }
.plan-now-card h4 .muted { font-size: .9rem; font-weight: 400; }
.plan-now-card .btn { flex: none; }
.plan-now-feat { list-style: none; padding: 4px 4px 8px; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.plan-now-feat li { display: flex; gap: 8px; font-size: .86rem; color: var(--text-2); }
.plan-now-feat svg.i { width: 16px; height: 16px; color: var(--accent); flex: none; margin-top: 2px; }

.usage-list { display: flex; flex-direction: column; gap: 6px; }
.usage-row { border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; }
.u-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: .88rem; color: var(--text-2); }
.u-head b { display: block; font-size: .95rem; font-weight: 500; color: var(--text); }
.u-head small { color: var(--muted); font-size: .78rem; }
.u-head span b { display: inline; }
.u-unl { color: var(--accent); font-weight: 500; }
.meter.big { height: 8px; margin: 12px 0 2px; }
.meter > div.full { background: var(--bad); }
.u-reset { margin: 10px 0 14px; font-size: .82rem; }
.usage-list .link, .error .link { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; gap: 14px; }
  .settings-layout .set-tabs { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 8px; border-bottom: 1px solid var(--line); }
  .settings-title { font-size: 1.35rem; margin-bottom: 12px; }
  .plan-now-card { flex-direction: column; align-items: flex-start; }
  .plan-now-feat { grid-template-columns: 1fr; }
}

/* ---------- new chat screen: greeting + centered box + chips (like Claude) ---------- */
.chat-view.empty { justify-content: center; min-height: calc(100vh - 56px); padding-bottom: 12vh; }
.chat-view.empty .chat-log { flex: 0 0 auto; padding: 0 0 26px; }
.chat-view.empty .composer-wrap { position: static; padding-bottom: 0; }
.chat-view.empty .composer-wrap .fine { display: none; }
.chat-view.empty .chat-hero { margin: 0; padding: 0; }
.greet { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 0; font-family: Georgia, "Times New Roman", "Noto Serif", serif; font-weight: 400; font-size: clamp(1.9rem, 4.2vw, 2.6rem); letter-spacing: -.01em; color: var(--text); line-height: 1.2; text-wrap: balance; }
.greet-mark { display: grid; place-items: center; color: var(--accent); flex: none; }
.greet-mark svg.i { width: clamp(28px, 3.6vw, 38px); height: clamp(28px, 3.6vw, 38px); stroke-width: 2.2; animation: greetSpin 1.2s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes greetSpin { from { transform: rotate(-120deg) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.chat-hero .tutor-badge { margin-bottom: 12px; }
.chat-hero .hero-sub { max-width: 520px; margin: 10px auto 0; }
.chat-view.empty .composer { box-shadow: 0 2px 12px rgba(0, 0, 0, .06); }

.hero-below { margin-top: 14px; }
.hero-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.hero-chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: transparent; color: var(--text-2); font: inherit; font-size: .86rem; padding: 7px 14px; border-radius: 10px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.hero-chip svg.i { width: 16px; height: 16px; color: var(--muted); }
.hero-chip:hover { background: var(--hover); color: var(--text); }
.hero-chip.active { background: var(--surface-2); border-color: var(--line-2); color: var(--text); }
.hero-list { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; animation: stepIn .25s ease both; }
.hero-list-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 16px; font-size: .8rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.hero-list-head span { display: inline-flex; align-items: center; gap: 6px; }
.hero-list-head svg.i { width: 14px; height: 14px; }
.hero-list-head .icon-btn { width: 30px; height: 30px; }
.hero-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--text); font: inherit; font-size: .92rem; text-align: left; padding: 12px 16px; cursor: pointer; }
.hero-item:last-child { border-bottom: 0; }
.hero-item:hover { background: var(--hover); }
.hero-item svg.i { width: 16px; height: 16px; color: var(--muted); flex: none; }
.hero-item:not(:hover) svg.i[data-up] { opacity: 0; }
@media (max-width: 860px) {
  .chat-view.empty { padding-bottom: 6vh; }
  .hero-chips { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
  .hero-chip { white-space: nowrap; }
}

/* ---------- phone fix: keep the bottom of the sidebar (your name, Settings) on screen ---------- */
/* 100dvh = the real visible height on phones (100vh is taller because of the browser's address bar) */
.sidebar { height: 100vh; height: 100dvh; }
.side-section.grow { flex: 1; min-height: 0; overflow-y: auto; }
.chat-view.empty { min-height: calc(100dvh - 56px); }
@media (max-width: 860px) {
  .sidebar { height: auto; top: 0; bottom: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .side-bottom { flex: none; }
}

/* ---------- public landing page ---------- */
.landing { min-height: 100vh; background: var(--bg); }
.land-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px; max-width: 1120px; margin: 0 auto; padding: 14px 32px; background: var(--bg); }
.land-nav .brand { text-decoration: none; }
.land-links { display: flex; gap: 22px; margin-left: 12px; flex: 1; }
.land-links a { color: var(--text-2); text-decoration: none; font-size: .92rem; }
.land-links a:hover { color: var(--text); }
.land-cta { display: flex; gap: 8px; }
.land-cta .btn { padding: 8px 16px; }
.landing .auth { min-height: calc(100vh - 70px); padding-top: 24px; }
.land-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 500; color: var(--accent); background: var(--accent-soft); padding: 5px 12px; border-radius: 999px; }
.land-eyebrow svg.i { width: 15px; height: 15px; stroke-width: 2.4; }
.landing .hero-title { margin-top: 18px; }
.hero-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-btns .btn { text-decoration: none; }
.hero-fine { text-align: left; margin: 12px 0 22px; }
.g-wrap { margin: 16px 0 4px; }
#g-btn { display: flex; justify-content: center; min-height: 44px; }
.or-line { display: flex; align-items: center; gap: 12px; margin: 14px 0 2px; color: var(--muted); font-size: .78rem; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.forgot-row { display: flex; justify-content: flex-end; margin-top: 6px; }
.forgot-row .link { font-size: .82rem; color: var(--muted); }
#forgot-form h2, #reset-form h2 { margin-bottom: 6px; }
#forgot-form .btn.block, #reset-form .btn.block { margin-top: 12px; }
.auth-card > .fine { margin-top: 16px; }
.auth-card > .fine a { color: inherit; }

.land-sec { max-width: 1120px; margin: 0 auto; padding: 72px 32px 8px; }
.land-h { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; letter-spacing: -.02em; text-align: center; margin: 0 0 8px; }
.land-sub { text-align: center; color: var(--muted); max-width: 620px; margin: 0 auto 32px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feat { border: 1px solid var(--line); border-radius: 16px; padding: 22px; background: var(--surface); }
.feat-ic { font-size: 1.6rem; display: block; margin-bottom: 10px; }
.feat b { font-size: 1.02rem; font-weight: 600; }
.feat p { color: var(--muted); font-size: .9rem; margin: 6px 0 0; }
.model-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mcard { border: 1px solid var(--line); border-radius: 16px; padding: 22px; text-align: center; }
.mcard > span { font-size: 1.8rem; }
.mcard b { display: block; font-size: 1.1rem; margin-top: 8px; }
.mcard em { display: inline-block; font-style: normal; font-size: .72rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; margin: 6px 0; }
.mcard p { color: var(--muted); font-size: .9rem; margin: 4px 0 0; }
#land-plans .plan-card { background: var(--surface); }
.faq { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq details { border: 1px solid var(--line); border-radius: 14px; padding: 4px 18px; background: var(--surface); }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 500; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--muted); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq p { color: var(--text-2); margin: 0 0 14px; font-size: .93rem; }
.faq a { color: var(--accent); }
.land-final { text-align: center; padding: 80px 24px 60px; }
.land-final h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600; margin: 0 0 18px; }
.land-foot { max-width: 1120px; margin: 0 auto; padding: 22px 32px 34px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.land-foot a { color: inherit; }
@media (max-width: 960px) {
  .feat-grid { grid-template-columns: 1fr 1fr; }
  .land-links { display: none; }
}
@media (max-width: 640px) {
  .land-nav { padding: 12px 16px; gap: 10px; }
  .land-nav .brand { flex: 1; }
  .land-cta .btn.ghost { display: none; }
  .feat-grid, .model-cards { grid-template-columns: 1fr; }
  .land-sec { padding: 52px 16px 8px; }
  .landing .auth { min-height: 0; }
}

/* ---------- admin dashboard ---------- */
.admin { max-width: 1100px; margin: 0 auto; padding-top: 8px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.admin-head h2 { margin: 0; font-size: 1.5rem; }
.a-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.a-grid.three { grid-template-columns: repeat(3, 1fr); }
.a-grid.two { grid-template-columns: 1fr 1fr; }
.a-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; background: var(--surface); margin-bottom: 12px; min-width: 0; }
.a-grid .a-card { margin-bottom: 0; }
.a-card > span.muted { font-size: .8rem; }
.a-card > b { display: block; font-size: 1.7rem; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.02em; }
.a-card > small, .a-card small { display: block; color: var(--muted); font-size: .78rem; }
.a-ch-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.a-ch-head b { font-size: .95rem; }
.a-ch-head span { font-size: .78rem; }
.a-ch-head input { margin: 0; width: min(260px, 50%); padding: 7px 12px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bar-fill { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 0; transition: height .4s; }
.bar-col span { font-size: .62rem; color: var(--muted); }
.a-list { display: flex; flex-direction: column; margin-top: 8px; }
.a-list > div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.a-list > div:last-child { border-bottom: 0; }
.a-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: .88rem; }
.a-table td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.a-table tr:last-child td { border-bottom: 0; }
.a-table td b { font-weight: 500; }
.a-plan { display: inline-block; font-size: .72rem; font-weight: 600; text-transform: capitalize; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.a-plan.plus, .a-plan.pro, .a-plan.max { background: var(--accent-soft); color: var(--accent); }
.a-give { white-space: nowrap; text-align: right; }
.a-give select, .a-give input { width: auto; display: inline-block; margin: 0 4px 0 0; padding: 6px 8px; font-size: .82rem; }
.a-give input { width: 64px; }
.a-give .btn { padding: 6px 12px; font-size: .82rem; }
.a-hint { font-size: .8rem; margin: 0 0 4px; }
@media (max-width: 860px) {
  .a-grid, .a-grid.three, .a-grid.two { grid-template-columns: 1fr 1fr; }
  .a-table td { display: block; border: 0; padding: 4px 0; }
  .a-table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .a-give { text-align: left; }
}
@media (max-width: 520px) { .a-grid, .a-grid.three, .a-grid.two { grid-template-columns: 1fr; } }
.a-card > b.a-t { font-size: .95rem; font-weight: 600; margin: 0; letter-spacing: 0; }
.a-give select { padding-right: 28px; }

/* ---------- Android app (Play Store): no prices or upgrade buttons (Google Play billing rules) ---------- */
html.android-app .web-only,
html.android-app [data-upgrade],
html.android-app #up-chip,
html.android-app [data-stab="billing"],
html.android-app [data-buy],
html.android-app .lock { display: none !important; }
