/* ==========================================================
   LearnWater — Adult Learning Center ("modern water brand")
   Layered on css/style.css. Used by adult-learning-center.html
   and (for the shared Greg chat + controls) the lesson pages.
   ========================================================== */

body.academy { background: var(--mist); }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field > label, .field > .label {
  font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.select, .input, .textarea {
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--white); border: 1.5px solid var(--line); border-radius: 12px;
  padding: .65rem .85rem; min-height: 44px; width: 100%;
  transition: border-color .2s, box-shadow .2s;
}
.select { appearance: none; -webkit-appearance: none; padding-right: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5l5 5 5-5' fill='none' stroke='%230a5a99' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .8rem center; background-size: 16px; }
.textarea { resize: vertical; min-height: 80px; }
.select:focus, .input:focus, .textarea:focus { outline: none; border-color: var(--tide); box-shadow: 0 0 0 4px rgba(14,127,192,.14); }

/* Segmented control */
.seg { display: inline-flex; background: var(--foam); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; cursor: pointer; border-radius: 999px;
  padding: .45rem .95rem; font-weight: 700; font-size: .88rem; color: var(--ink-2); min-height: 38px;
  transition: background .2s, color .2s, box-shadow .2s;
}
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--white); color: var(--ocean); box-shadow: var(--shadow-sm); }

/* Meter */
.meter { position: relative; height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.meter > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--grad-bright); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.meter.thin { height: 5px; }
.meter.good > i { background: linear-gradient(90deg, #0f9a6c, #27c1d4); }
.meter.warn > i { background: linear-gradient(90deg, #d98a00, #f2b53c); }
.meter.low > i { background: linear-gradient(90deg, #c23a3a, #e8795a); }

/* ---------- Greg avatar ---------- */
.greg-avatar { display: inline-block; width: 56px; height: 56px; border-radius: 50%; flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(255,255,255,.55), 0 10px 22px -8px rgba(3,26,46,.55); }
.greg-avatar svg { display: block; width: 100%; height: 100%; }
.greg-avatar.lg { width: 72px; height: 72px; }
.greg-avatar.sm { width: 40px; height: 40px; box-shadow: 0 0 0 2px var(--white), var(--shadow-sm); }

/* ==========================================================
   HERO
   ========================================================== */
.hero-academy { text-align: left; padding: 4.25rem 0 7.25rem; }
.academy-hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 3rem; align-items: center; position: relative; z-index: 1; }
.hero-academy h1 { margin: .8rem 0 1rem; }
.hero-academy h1 .accent { background: linear-gradient(90deg, var(--spray), var(--aqua)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-academy .lead { color: rgba(232,246,250,.86); max-width: 560px; margin: 0 0 1.75rem; font-size: 1.1rem; }

.class-switch-label { display: block; font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--spray); margin-bottom: .6rem; }
.class-switch {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px;
  padding: 6px; border-radius: 20px; max-width: 560px;
  background: rgba(3,26,46,.35); border: 1px solid rgba(143,227,238,.22);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.class-switch button {
  display: flex; flex-direction: column; align-items: flex-start; gap: .1rem;
  border: 0; border-radius: 15px; cursor: pointer; text-align: left;
  padding: .7rem .8rem .75rem; background: transparent; color: rgba(232,246,250,.85);
  transition: background .2s, color .2s, transform .15s;
}
.class-switch button:hover { background: rgba(255,255,255,.08); }
.class-switch .cs-letter { font-family: var(--font-display); font-weight: 800; font-size: 1.55rem; line-height: 1; }
.class-switch .cs-name { font-size: .72rem; font-weight: 600; letter-spacing: .01em; opacity: .85; line-height: 1.25; }
.class-switch button[aria-checked="true"] { background: var(--white); color: var(--deep); box-shadow: 0 10px 26px -12px rgba(0,0,0,.6); }
.class-switch button[aria-checked="true"] .cs-letter { background: var(--grad-bright); -webkit-background-clip: text; background-clip: text; color: transparent; }
.class-tagline { margin: .9rem 0 0; color: rgba(232,246,250,.78); font-size: .95rem; max-width: 560px; min-height: 3em; }

.greg-hero { padding: 1.6rem; position: relative; }
.greg-hero-top { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.greg-hero-top strong { display: block; font-family: var(--font-display); font-size: 1.25rem; color: var(--white); line-height: 1.1; }
.greg-hero-top span.role { font-size: .84rem; color: var(--spray); }
.greg-hero .tip { font-size: .98rem; line-height: 1.55; color: rgba(255,255,255,.92); margin: 0 0 1.1rem; }
.greg-hero .tip b { color: var(--white); }
.hero-chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.2rem; }
.hero-chip {
  border: 1px solid rgba(143,227,238,.4); background: rgba(255,255,255,.07); color: var(--white);
  font-size: .82rem; font-weight: 600; padding: .4rem .75rem; border-radius: 999px; cursor: pointer; text-align: left;
  transition: background .2s, border-color .2s;
}
.hero-chip:hover { background: rgba(255,255,255,.16); border-color: var(--spray); }

/* ==========================================================
   PROGRESS RAIL — always visible
   ========================================================== */
.progress-rail {
  position: sticky; top: var(--nav-h); z-index: 150;
  background: rgba(255,255,255,.92); backdrop-filter: blur(12px) saturate(140%); -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 8px 24px -18px rgba(3,26,46,.35);
}
.rail-inner { display: flex; align-items: center; gap: 1.75rem; min-height: 60px; }
.rail-class {
  display: inline-flex; align-items: center; gap: .45rem; flex-shrink: 0;
  font-family: var(--font-display); font-weight: 800; color: var(--abyss); font-size: 1rem;
}
.rail-class .badge {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--grad-bright); color: var(--white); font-size: .95rem;
}
.rail-lessons { flex: 1; min-width: 150px; max-width: 360px; }
.rail-lessons .rail-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .3rem; }
.rail-label { font-family: var(--font-mono); font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.rail-val { font-family: var(--font-display); font-weight: 800; color: var(--abyss); font-size: 1.02rem; line-height: 1; }
.rail-stat { display: flex; flex-direction: column; gap: .25rem; flex-shrink: 0; }
.rail-link { margin-left: auto; font-weight: 700; font-size: .88rem; white-space: nowrap; flex-shrink: 0; }

/* ==========================================================
   TABS + PANELS
   ========================================================== */
.academy-main { padding: 2.25rem 0 4.5rem; }
.tool-tabs {
  display: flex; gap: .35rem; padding: .4rem; margin-bottom: 1.75rem;
  background: var(--white); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow-sm);
  overflow-x: auto; scrollbar-width: none;
}
.tool-tabs::-webkit-scrollbar { display: none; }
.tool-tabs [role="tab"] {
  flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border: 0; background: transparent; cursor: pointer; white-space: nowrap;
  padding: .75rem 1rem; border-radius: 13px; font-weight: 700; font-size: .92rem; color: var(--ink-2);
  transition: background .2s, color .2s;
}
.tool-tabs [role="tab"] svg { width: 19px; height: 19px; flex-shrink: 0; }
.tool-tabs [role="tab"]:hover { background: var(--foam); color: var(--ocean); }
.tool-tabs [role="tab"][aria-selected="true"] { background: var(--deep); color: var(--white); box-shadow: 0 10px 22px -12px rgba(6,47,82,.8); }
.tool-tabs [role="tab"][aria-selected="true"] svg { color: var(--aqua); }

.panel { display: none; padding: 0; animation: panelIn .35s ease; }
.panel.active { display: block; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem 2rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.panel-head h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); margin: .35rem 0 .3rem; }
.panel-head p { color: var(--muted); margin: 0; max-width: 640px; }

.sheet {
  background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 1.75rem;
}
.sheet + .sheet { margin-top: 1.25rem; }
.sheet h3 { margin-bottom: .6rem; }
.fine { font-size: .84rem; color: var(--muted); }

/* ---------- Lessons ---------- */
.next-up {
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  background: linear-gradient(120deg, var(--white) 55%, var(--foam));
  border: 1px solid var(--line-2); border-left: 5px solid var(--c, var(--tide));
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 1.15rem 1.35rem; margin-bottom: 1.5rem;
}
.next-up .nu-icon { font-size: 2rem; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: var(--t, var(--foam)); flex-shrink: 0; }
.next-up .nu-text { flex: 1; min-width: 200px; }
.next-up .nu-text strong { display: block; font-family: var(--font-display); font-size: 1.12rem; color: var(--abyss); }
.next-up .nu-text span { color: var(--muted); font-size: .92rem; }

.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.25rem; }

/* Deep dives: aquifers, modeling, regulations */
.deep-dives { margin-top: 2.25rem; }
.dd-head { margin-bottom: 1rem; }
.dd-head h3 { font-size: 1.35rem; margin: .15rem 0 .3rem; color: var(--abyss); }
.dd-head p { margin: 0; color: var(--muted); }
.dd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }
.dd-card {
  position: relative; display: flex; align-items: flex-start; gap: .9rem;
  background: var(--white); border: 1px solid var(--line-2); border-left: 5px solid var(--c, var(--tide));
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1.1rem 1.15rem;
  color: inherit; text-decoration: none; transition: transform .2s, box-shadow .2s;
}
.dd-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); text-decoration: none; }
.dd-card:focus-visible { outline: 3px solid var(--c, var(--tide)); outline-offset: 2px; }
.dd-icon { width: 46px; height: 46px; flex-shrink: 0; display: grid; place-items: center; font-size: 1.45rem; border-radius: 12px; background: var(--t, var(--foam)); }
.dd-text { flex: 1; display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.dd-text strong { font-family: var(--font-display); font-size: 1.08rem; color: var(--abyss); }
.dd-text span { color: var(--muted); font-size: .9rem; line-height: 1.5; }
.dd-arrow { font-weight: 700; color: var(--c, var(--tide)); align-self: center; transition: transform .2s; }
.dd-card:hover .dd-arrow { transform: translateX(4px); }
.ch-card {
  position: relative; display: flex; flex-direction: column; gap: .7rem;
  background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 1.35rem 1.35rem 1.15rem; overflow: hidden;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.ch-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c, var(--tide)); }
.ch-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line); }
.ch-top { display: flex; align-items: center; gap: .7rem; }
.ch-num { font-family: var(--font-mono); font-weight: 700; font-size: .78rem; letter-spacing: .08em; color: var(--c, var(--tide)); }
.ch-icon { width: 42px; height: 42px; display: grid; place-items: center; font-size: 1.35rem; border-radius: 12px; background: var(--t, var(--foam)); }
.ch-status { margin-left: auto; font-size: .72rem; font-weight: 700; letter-spacing: .03em; padding: .22rem .6rem; border-radius: 999px; background: var(--mist); color: var(--muted); border: 1px solid var(--line-2); }
.ch-status.done { background: var(--success-bg); color: var(--success); border-color: rgba(17,133,95,.25); }
.ch-card h3 { font-size: 1.14rem; margin: 0; }
.ch-card h3 a { color: var(--abyss); }
.ch-card h3 a::after { content: ''; position: absolute; inset: 0; z-index: 0; }
.ch-card p { color: var(--muted); font-size: .9rem; line-height: 1.5; margin: 0; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ch-stat { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .6rem; font-size: .8rem; color: var(--muted); }
.ch-stat b { font-family: var(--font-display); color: var(--abyss); font-size: .9rem; }
.ch-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; position: relative; z-index: 1; padding-top: .35rem; border-top: 1px solid var(--line-2); }
.ch-actions .btn { padding: .5rem .9rem; font-size: .84rem; }
.ch-done-toggle {
  margin-left: auto; display: inline-flex; align-items: center; gap: .4rem; cursor: pointer;
  background: none; border: 1.5px solid var(--line); border-radius: 999px; padding: .4rem .75rem;
  font-size: .8rem; font-weight: 700; color: var(--ink-2); min-height: 36px;
}
.ch-done-toggle .box { width: 16px; height: 16px; border-radius: 5px; border: 2px solid var(--muted); display: grid; place-items: center; }
.ch-done-toggle[aria-pressed="true"] { border-color: rgba(17,133,95,.4); color: var(--success); background: var(--success-bg); }
.ch-done-toggle[aria-pressed="true"] .box { background: var(--success); border-color: var(--success); }
.ch-done-toggle[aria-pressed="true"] .box::after { content: ''; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

/* ---------- Setup bars (quiz, math) ---------- */
.setup-bar { display: grid; grid-template-columns: minmax(0, 1.6fr) auto auto; gap: 1rem 1.25rem; align-items: end; }
.setup-bar .btn { min-height: 46px; }

/* ---------- Question cards ---------- */
.q-card { max-width: 860px; margin: 0 auto; }
.q-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .8rem; }
.q-tag {
  font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--c, var(--ocean)); background: var(--t, var(--foam)); border-radius: 999px; padding: .28rem .7rem;
}
.q-count { font-size: .88rem; color: var(--muted); font-weight: 600; }
.q-score { margin-left: auto; font-family: var(--font-display); font-weight: 800; color: var(--abyss); }
.q-text { font-family: var(--font-display); font-size: clamp(1.15rem, 2.4vw, 1.4rem); font-weight: 700; line-height: 1.35; margin: 1.3rem 0 1.2rem; color: var(--abyss); outline: none; }
.q-choices { display: grid; gap: .65rem; }
.choice {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; cursor: pointer;
  background: var(--white); border: 1.5px solid var(--line); border-radius: 14px;
  padding: .85rem 1rem; font-size: 1rem; line-height: 1.4; color: var(--ink);
  transition: border-color .15s, background .15s, transform .1s;
}
.choice:hover:not(:disabled) { border-color: var(--tide); background: var(--foam); }
.choice:active:not(:disabled) { transform: scale(.995); }
.choice .key {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: .85rem; background: var(--mist); color: var(--ocean); border: 1px solid var(--line);
}
.choice:disabled { cursor: default; }
.choice.correct { border-color: var(--success); background: var(--success-bg); }
.choice.correct .key { background: var(--success); color: #fff; border-color: var(--success); }
.choice.wrong { border-color: var(--danger); background: var(--danger-bg); }
.choice.wrong .key { background: var(--danger); color: #fff; border-color: var(--danger); }
.choice.dim { opacity: .55; }

.feedback { display: none; margin-top: 1.1rem; border-radius: 14px; padding: 1rem 1.15rem; font-size: .96rem; line-height: 1.55; border: 1px solid; }
.feedback.show { display: block; animation: panelIn .25s ease; }
.feedback.good { background: var(--success-bg); border-color: rgba(17,133,95,.25); }
.feedback.bad  { background: var(--warn-bg); border-color: rgba(168,98,0,.25); }
.feedback strong { display: block; margin-bottom: .2rem; }
.feedback.good strong { color: var(--success); }
.feedback.bad strong { color: var(--warn); }
.feedback ol { margin: .5rem 0 0 1.2rem; }
.feedback li { margin-bottom: .25rem; font-family: var(--font-mono); font-size: .88rem; }
.q-actions { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.q-hint { margin-right: auto; font-size: .8rem; color: var(--muted); }
.q-hint kbd { font-family: var(--font-mono); font-size: .75rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 .3rem; background: var(--mist); }

/* Math answer row */
.math-answer { display: flex; gap: .6rem; flex-wrap: wrap; align-items: stretch; }
.math-answer .input-wrap { position: relative; flex: 1 1 220px; max-width: 340px; }
.math-answer .input { padding-right: 5.5rem; font-family: var(--font-mono); font-size: 1.05rem; }
.math-answer .unit { position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: .82rem; color: var(--muted); pointer-events: none; }
.formula-sheet { margin-top: 1.25rem; }
.formula-sheet summary { cursor: pointer; font-weight: 700; color: var(--ocean); padding: .4rem 0; }
.formula-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .6rem; margin-top: .75rem; }
.formula-grid div { background: var(--mist); border: 1px solid var(--line-2); border-radius: 12px; padding: .65rem .8rem; }
.formula-grid b { display: block; font-size: .78rem; color: var(--muted); font-weight: 700; margin-bottom: .15rem; }
.formula-grid code { font-family: var(--font-mono); font-size: .84rem; color: var(--abyss); }

/* ---------- Results ---------- */
.result-top { display: flex; align-items: center; gap: 1.75rem; flex-wrap: wrap; }
.ring { position: relative; width: 132px; height: 132px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 11; }
.ring .track { stroke: var(--line-2); }
.ring .val { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.ring .ring-num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .ring-num b { font-family: var(--font-display); font-size: 1.9rem; color: var(--abyss); line-height: 1; }
.ring .ring-num small { display: block; font-size: .72rem; color: var(--muted); margin-top: .2rem; }
.result-text h3 { font-size: 1.45rem; margin-bottom: .3rem; }
.result-text p { color: var(--muted); margin: 0 0 .9rem; }
.result-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.breakdown { margin-top: 1.5rem; display: grid; gap: .55rem; }
.breakdown-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(80px, 1fr) 70px; gap: .9rem; align-items: center; font-size: .9rem; }
.breakdown-row .name { font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breakdown-row .num { text-align: right; font-family: var(--font-mono); font-size: .82rem; color: var(--muted); }
.missed { margin-top: 1.5rem; }
.missed h4 { margin-bottom: .6rem; }
.missed-item { border: 1px solid var(--line-2); border-left: 4px solid var(--warn); border-radius: 12px; padding: .85rem 1rem; margin-bottom: .6rem; background: var(--white); }
.missed-item .mq { font-weight: 700; color: var(--abyss); margin-bottom: .35rem; }
.missed-item .ma { font-size: .9rem; color: var(--ink-2); }
.missed-item .ma span { display: block; }
.missed-item .ma .yours { color: var(--danger); }
.missed-item .ma .right { color: var(--success); font-weight: 600; }
.missed-item .mx { font-size: .86rem; color: var(--muted); margin-top: .35rem; }

/* ---------- Flash cards ---------- */
.fc-toolbar { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: end; margin-bottom: 1.25rem; }
.fc-toolbar .field { min-width: 220px; }
.fc-toolbar .spacer { flex: 1; }
.fc-study { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.fc-meta { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; font-size: .88rem; color: var(--muted); font-weight: 600; }
.fc-meta b { color: var(--abyss); }
.fc-card {
  position: relative; width: min(640px, 100%); aspect-ratio: 16 / 9; border: 0; padding: 0; cursor: pointer;
  perspective: 1400px; background: none; border-radius: var(--radius-lg);
}
.fc-inner { position: absolute; inset: 0; transition: transform .6s cubic-bezier(.3,.7,.2,1); transform-style: preserve-3d; }
.fc-card.flipped .fc-inner { transform: rotateY(180deg); }
.fc-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg); display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 1.75rem 2rem; text-align: center; gap: .6rem;
}
.fc-front { background: var(--grad-deep); color: var(--white); box-shadow: var(--shadow-lg); overflow: hidden; }
.fc-front::before { content: ''; position: absolute; inset: auto -20% -60% -20%; height: 90%; background: radial-gradient(closest-side, rgba(39,193,212,.35), transparent); }
.fc-front .fc-term { position: relative; font-family: var(--font-display); font-size: clamp(1.25rem, 3.2vw, 1.8rem); font-weight: 800; line-height: 1.2; }
.fc-back { background: var(--white); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-lg); transform: rotateY(180deg); }
.fc-back .fc-def { font-size: clamp(1rem, 2.2vw, 1.18rem); line-height: 1.5; }
.fc-src { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; opacity: .7; position: relative; }
.fc-hint { font-size: .78rem; opacity: .7; position: relative; }
.fc-controls { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }
.fc-controls .icon-btn { width: 46px; height: 46px; padding: 0; border-radius: 50%; }
.btn-soft { background: var(--foam); color: var(--ocean); border-color: var(--line); }
.btn-soft:hover { background: var(--white); border-color: var(--tide); }
.btn-good { background: var(--success); color: var(--white); }
.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.fc-tile { background: var(--white); border: 1px solid var(--line-2); border-radius: 14px; padding: 1rem 1.05rem; box-shadow: var(--shadow-sm); break-inside: avoid; }
.fc-tile .t { font-family: var(--font-display); font-weight: 800; color: var(--abyss); margin-bottom: .35rem; font-size: 1rem; line-height: 1.3; }
.fc-tile .d { font-size: .88rem; color: var(--ink-2); line-height: 1.45; }
.fc-tile .s { font-family: var(--font-mono); font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--tide); margin-top: .5rem; }
.fc-tile.known { border-color: rgba(17,133,95,.35); }
.fc-tile.known .s::after { content: ' · known ✓'; color: var(--success); }
.fc-add { margin-top: 1.5rem; }
.fc-add summary { cursor: pointer; font-weight: 700; color: var(--ocean); }
.fc-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: .75rem; align-items: end; margin-top: .9rem; }
.mine-list { list-style: none; margin-top: 1rem; display: grid; gap: .5rem; }
.mine-list li { display: flex; gap: .75rem; align-items: flex-start; background: var(--mist); border: 1px solid var(--line-2); border-radius: 12px; padding: .65rem .8rem; }
.mine-list li div { flex: 1; min-width: 0; font-size: .9rem; overflow-wrap: anywhere; }
.mine-list li b { display: block; color: var(--abyss); }
.mine-list button { border: 0; background: none; color: var(--danger); font-weight: 700; cursor: pointer; font-size: .82rem; padding: .3rem .4rem; }

/* ---------- Videos ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip {
  border: 1.5px solid var(--line); background: var(--white); color: var(--ink-2); cursor: pointer;
  border-radius: 999px; padding: .42rem .9rem; font-weight: 700; font-size: .84rem; min-height: 36px;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--tide); color: var(--ocean); }
.chip[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: var(--white); }
.vid-toolbar { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.4rem; }
.vid-search { display: flex; gap: .6rem; flex-wrap: wrap; }
.vid-search .input { flex: 1 1 260px; }
.video-links .lesson-link { color: var(--muted); }

/* ---------- Glossary ---------- */
.gl-tools { padding: 1.35rem 1.5rem 1.2rem; }
.gl-bar { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 1rem 1.25rem; align-items: end; }
.gl-search-wrap { position: relative; }
.gl-search-wrap svg { position: absolute; left: .95rem; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--tide); pointer-events: none; }
.gl-search-wrap .input { padding-left: 2.7rem; font-size: 1rem; min-height: 48px; }
.gl-az { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--line-2); }
.gl-az[hidden] { display: none; }
.gl-az button {
  min-width: 34px; height: 34px; padding: 0 .35rem; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--white); color: var(--ocean);
  font-family: var(--font-display); font-weight: 800; font-size: .9rem;
  transition: background .15s, color .15s, border-color .15s;
}
.gl-az button:hover:not(:disabled) { background: var(--deep); border-color: var(--deep); color: var(--white); }
.gl-az button:disabled { color: var(--line); border-color: var(--line-2); background: transparent; cursor: default; }
.gl-count { margin: 1.3rem 0 0; font-size: .9rem; font-weight: 600; color: var(--muted); }
.gl-group { margin-top: 1.4rem; padding: 0; scroll-margin-top: calc(var(--nav-h) + 76px); }
.gl-letter, .gl-sub { display: flex; align-items: baseline; gap: .75rem; margin: 0 0 .65rem; outline: none; }
.gl-letter span {
  font-family: var(--font-display); font-weight: 800; font-size: 2.3rem; line-height: 1;
  background: var(--grad-bright); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gl-letter small, .gl-sub { font-family: var(--font-mono); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gl-letter:focus-visible { box-shadow: 0 2px 0 var(--tide); }
.gl-list {
  --glpad: 1.5rem; margin: 0; padding: 0 var(--glpad);
  background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.gl-item {
  display: grid; grid-template-columns: minmax(170px, 300px) minmax(0, 1fr); gap: .45rem 2rem;
  padding: .95rem 0; border-bottom: 1px solid var(--line-2); outline: none;
  scroll-margin-top: calc(var(--nav-h) + 90px);
}
.gl-item:last-child { border-bottom: 0; }
.gl-item dt { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; min-width: 0; }
.gl-term { font-family: var(--font-display); font-weight: 800; font-size: 1.04rem; line-height: 1.3; color: var(--abyss); overflow-wrap: anywhere; }
.gl-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.gl-item dd { margin: 0; min-width: 0; display: flex; align-items: flex-start; gap: 1rem; }
.gl-item dd p { flex: 1; margin: 0; font-size: .94rem; line-height: 1.6; color: var(--ink-2); }
.gl-item mark { background: rgba(39,193,212,.3); color: inherit; border-radius: 3px; padding: 0 1px; }
.gl-ch {
  font-family: var(--font-mono); font-size: .64rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--c, var(--ocean)); background: var(--t, var(--foam)); border-radius: 999px; padding: .16rem .55rem;
}
.gl-ch:hover { text-decoration: none; box-shadow: inset 0 0 0 1px var(--c, var(--ocean)); }
.gl-acts { display: inline-flex; gap: .3rem; flex-shrink: 0; }
.gl-act {
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 11px; background: var(--white); color: var(--ocean);
  transition: background .15s, border-color .15s, color .15s;
}
.gl-act svg { width: 19px; height: 19px; }
.gl-act:hover { border-color: var(--tide); background: var(--foam); }
.gl-card .gl-tick { display: none; }
.gl-card[aria-pressed="true"] { color: var(--success); background: var(--success-bg); border-color: rgba(17,133,95,.35); }
.gl-card[aria-pressed="true"] .gl-plus { display: none; }
.gl-card[aria-pressed="true"] .gl-tick { display: inline; }
.gl-item.flash { animation: glFlash 2.6s ease; }
@keyframes glFlash {
  0%, 35% { background: rgba(39,193,212,.16); box-shadow: calc(var(--glpad) * -1) 0 0 rgba(39,193,212,.16), var(--glpad) 0 0 rgba(39,193,212,.16); }
  100% { background: transparent; box-shadow: calc(var(--glpad) * -1) 0 0 transparent, var(--glpad) 0 0 transparent; }
}
.gl-results .empty-note { margin-top: 1.25rem; }
.gl-results .empty-note .btn { margin-left: .5rem; }

/* ---------- Progress ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-tile { background: var(--white); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.stat-tile::after { content: ''; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--foam); }
.stat-tile .v { position: relative; z-index: 1; font-family: var(--font-display); font-size: 2rem; font-weight: 800; color: var(--abyss); line-height: 1.05; }
.stat-tile .l { position: relative; z-index: 1; font-size: .84rem; color: var(--muted); margin-top: .25rem; }
.review-list { display: grid; gap: .6rem; }
.review-item { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; background: var(--warn-bg); border: 1px solid rgba(168,98,0,.2); border-radius: 12px; padding: .7rem .9rem; }
.review-item .ri-name { flex: 1; min-width: 180px; font-weight: 700; color: var(--abyss); }
.review-item .ri-acc { font-family: var(--font-mono); font-size: .85rem; color: var(--warn); font-weight: 700; }
.ch-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ch-table th { text-align: left; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.ch-table td { padding: .7rem .6rem; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.ch-table td.name { font-weight: 600; color: var(--abyss); }
.ch-table td.name small { display: block; color: var(--muted); font-weight: 500; font-family: var(--font-mono); font-size: .7rem; }
.ch-table .acc-cell { display: grid; grid-template-columns: minmax(70px, 1fr) 58px; gap: .6rem; align-items: center; min-width: 150px; }
.ch-table .acc-cell span { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); text-align: right; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; background: var(--mist); color: var(--muted); border: 1px solid var(--line-2); white-space: nowrap; }
.pill.done { background: var(--success-bg); color: var(--success); border-color: rgba(17,133,95,.25); }
.danger-link { background: none; border: 0; color: var(--danger); font-weight: 700; cursor: pointer; padding: .4rem 0; font-size: .9rem; }
.empty-note { text-align: center; color: var(--muted); padding: 1.25rem; border: 1.5px dashed var(--line); border-radius: var(--radius); }

/* ==========================================================
   GREG CHAT (shared)
   ========================================================== */
.gchat { display: flex; flex-direction: column; gap: .75rem; min-height: 0; }
.gchat-log { display: flex; flex-direction: column; gap: .8rem; overflow-y: auto; padding: .25rem .1rem; scroll-behavior: smooth; }
.gchat-msg { display: flex; gap: .6rem; align-items: flex-end; max-width: 100%; }
.gchat-msg.you { justify-content: flex-end; }
.gchat-face { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; overflow: hidden; }
.gchat-face svg { width: 100%; height: 100%; display: block; }
.gchat-bubble { max-width: 85%; padding: .7rem .95rem; border-radius: 16px; font-size: .94rem; line-height: 1.55; overflow-wrap: anywhere; }
.gchat-msg.greg .gchat-bubble { background: var(--white); border: 1px solid var(--line-2); border-bottom-left-radius: 5px; box-shadow: var(--shadow-sm); color: var(--ink); }
.gchat-msg.you .gchat-bubble { background: var(--grad-bright); color: var(--white); border-bottom-right-radius: 5px; }
.gchat-bubble p { margin: 0 0 .5rem; }
.gchat-bubble p:last-child { margin: 0; }
.gchat-bubble ul, .gchat-bubble ol { margin: .3rem 0 .3rem 1.15rem; }
.gchat-bubble strong { color: var(--abyss); }
.gchat-msg.you .gchat-bubble strong { color: #fff; }
.gchat-typing { display: inline-flex; gap: 4px; padding: .65rem .9rem; margin-left: 42px; background: var(--white); border: 1px solid var(--line-2); border-radius: 14px; width: max-content; }
.gchat-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--tide); animation: gtype 1s infinite ease-in-out; }
.gchat-typing i:nth-child(2) { animation-delay: .15s; }
.gchat-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes gtype { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.gchat-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.gchat-chips:empty { display: none; }
.gchat-chip { border: 1px solid var(--line); background: var(--foam); color: var(--ocean); border-radius: 999px; padding: .4rem .8rem; font-size: .82rem; font-weight: 700; cursor: pointer; text-align: left; }
.gchat-chip:hover { background: var(--white); border-color: var(--tide); }
.gchat-form { display: flex; gap: .5rem; }
.gchat-input { flex: 1; min-width: 0; font: inherit; font-size: .95rem; border: 1.5px solid var(--line); border-radius: 999px; padding: .7rem 1.05rem; min-height: 46px; background: var(--white); color: var(--ink); }
.gchat-input:focus { outline: none; border-color: var(--tide); box-shadow: 0 0 0 4px rgba(14,127,192,.14); }
.gchat-send { width: 46px; height: 46px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--grad-bright); color: #fff; cursor: pointer; display: grid; place-items: center; }
.gchat-send svg { width: 20px; height: 20px; }

/* Official sources + site search inside Greg's answers */
.gchat-sources { margin-top: .8rem; padding-top: .65rem; border-top: 1px dashed var(--line); }
.gs-label { display: block; font-family: var(--font-mono); font-size: .64rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
.gchat-bubble .gchat-sources ul, .gchat-bubble .gs-results { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.gchat-sources a { font-size: .86rem; font-weight: 600; line-height: 1.35; }
.gchat-sources a b { font-family: var(--font-mono); font-size: .64rem; font-weight: 700; letter-spacing: .06em; color: var(--white); background: var(--ocean); border-radius: 5px; padding: .08rem .38rem; margin-right: .45rem; vertical-align: 1px; }
.gsearch { margin-top: .8rem; display: grid; gap: .55rem; }
.gs-site { border: 1px solid var(--line); border-radius: 12px; padding: .65rem .8rem; background: var(--mist); }
.gs-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem .75rem; flex-wrap: wrap; }
.gs-name b { display: block; font-family: var(--font-display); font-size: .95rem; color: var(--abyss); line-height: 1.2; }
.gs-name span { font-size: .74rem; color: var(--muted); }
.gs-open { flex-shrink: 0; font-size: .78rem; font-weight: 700; white-space: nowrap; background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: .32rem .75rem; }
.gs-open:hover { border-color: var(--tide); text-decoration: none; }
.gchat-bubble .gs-results { margin-top: .55rem; }
.gs-results a { font-size: .86rem; line-height: 1.35; }
.gs-note { font-size: .8rem; color: var(--muted); }

/* Drawer (Adult Learning Center) */
.greg-drawer { position: fixed; inset: 0; z-index: 500; }
.greg-drawer[hidden] { display: none; }
.gd-backdrop { position: absolute; inset: 0; background: rgba(3,26,46,.45); backdrop-filter: blur(2px); animation: fadeIn .25s ease; }
.gd-panel {
  padding: 0; position: absolute; top: 0; right: 0; bottom: 0; width: min(460px, 100%);
  background: var(--mist); display: flex; flex-direction: column; box-shadow: -30px 0 60px -20px rgba(3,26,46,.5);
  animation: slideIn .32s cubic-bezier(.2,.8,.2,1);
}
.gd-head { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.1rem; background: var(--grad-deep); color: var(--white); }
.gd-head h2 { font-size: 1.15rem; color: var(--white); margin: 0; }
.gd-head p { margin: 0; font-size: .8rem; color: var(--spray); }
.gd-close { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(143,227,238,.35); background: transparent; color: var(--white); font-size: 1.4rem; cursor: pointer; line-height: 1; }
.gd-close:hover { background: rgba(255,255,255,.1); }
.gd-body { flex: 1; min-height: 0; padding: 1rem 1.1rem 1.1rem; display: flex; }
.gd-body .gchat { flex: 1; }
.gd-body .gchat-log { flex: 1; }
.gd-note { font-size: .74rem; color: var(--muted); padding: 0 1.1rem .9rem; margin: 0; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.greg-fab-a {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 400;
  display: inline-flex; align-items: center; gap: .55rem;
  background: var(--abyss); color: var(--white); border: 1px solid rgba(143,227,238,.3);
  border-radius: 999px; padding: .4rem 1.05rem .4rem .4rem; cursor: pointer; font-weight: 700; font-size: .92rem;
  box-shadow: 0 16px 34px -12px rgba(3,26,46,.65); transition: transform .2s, box-shadow .2s;
}
.greg-fab-a:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -12px rgba(3,26,46,.75); }
.greg-fab-a .greg-avatar { width: 40px; height: 40px; box-shadow: none; }
body.drawer-open { overflow: hidden; }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-width: 960px) {
  .academy-hero { grid-template-columns: 1fr; gap: 2rem; }
  .rail-stat.hide-md { display: none; }
}
@media (max-width: 720px) {
  .hero-academy { padding: 3rem 0 6rem; }
  .class-switch { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .class-switch button { align-items: center; text-align: center; padding: .6rem .3rem; }
  .class-switch .cs-name { display: none; }
  .rail-inner { gap: 1rem; min-height: 54px; }
  .rail-class .label-long, .rail-link { display: none; }
  .rail-stat.hide-sm { display: none; }
  .setup-bar { grid-template-columns: 1fr; }
  .setup-bar .seg { justify-self: start; }
  .sheet { padding: 1.25rem; }
  .tool-tabs [role="tab"] { padding: .7rem .8rem; font-size: .86rem; }
  .fc-form { grid-template-columns: 1fr; }
  .fc-card { aspect-ratio: 4 / 3; }
  .breakdown-row { grid-template-columns: minmax(0, 1fr) 70px; }
  .breakdown-row .meter { display: none; }
  .ch-table .hide-sm { display: none; }
  .greg-fab-a .fab-label { display: none; }
  .greg-fab-a { padding: .4rem; }
  .gl-tools { padding: 1.1rem; }
  .gl-bar { grid-template-columns: 1fr; }
  .gl-az { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .gl-az::-webkit-scrollbar { display: none; }
  .gl-az button { flex-shrink: 0; }
  .gl-list { --glpad: 1.05rem; }
  .gl-item { grid-template-columns: 1fr; position: relative; }
  .gl-item dt { padding-right: 84px; min-height: 36px; }
  .gl-acts { position: absolute; top: .95rem; right: 0; }
}

/* ==========================================================
   PRINT — flash cards print as a clean sheet
   ========================================================== */
@media print {
  body.academy { background: #fff; }
  .site-nav, .hero, .progress-rail, .tool-tabs, .greg-fab-a, .greg-drawer, .site-footer, .no-print, .skip-link { display: none !important; }
  .panel { display: none !important; }
  body.print-cards #panel-cards { display: block !important; animation: none; }
  body.print-cards .fc-study, body.print-cards .fc-toolbar, body.print-cards .fc-add, body.print-cards .panel-head p { display: none !important; }
  body.print-cards .fc-grid { display: grid !important; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .fc-tile { box-shadow: none; border: 1px solid #999; }
  .academy-main { padding: 0; }
  body.print-glossary #panel-glossary { display: block !important; animation: none; }
  body.print-glossary .gl-tools, body.print-glossary .gl-count, body.print-glossary .gl-acts, body.print-glossary .panel-head p { display: none !important; }
  body.print-glossary .gl-list { box-shadow: none; border: 0; padding: 0; }
  body.print-glossary .gl-item { grid-template-columns: 190px 1fr; padding: .45rem 0; break-inside: avoid; border-color: #ccc; }
  body.print-glossary .gl-item dt { font-size: .92rem; }
  body.print-glossary .gl-item dd p { font-size: .82rem; line-height: 1.4; color: #000; }
  body.print-glossary .gl-letter { break-after: avoid; margin-bottom: .2rem; }
  body.print-glossary .gl-letter span { background: none; color: #000; -webkit-text-fill-color: #000; font-size: 1.5rem; }
}
