/* The lesson screen. Night theme, matching thoughtfeel.net. */
:root {
  color-scheme: dark;
  --bg: #0c0a1d; --surface: #16122e; --surface-2: #1e193c; --rule: #2c2752; --rule-2: #3d3670;
  --ink: #f4f1ea; --ink-2: #bcb6d2; --ink-3: #918baf;
  --gold: #f3cb76; --gold-2: #e2a84a; --blue: #a9b9ff; --blue-soft: #232652;
  --ok: #7fd1a3; --miss: #f09a86;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --col: 680px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: radial-gradient(1200px 600px at 50% -200px, #1b1442 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
kbd { font: 600 11px/1 var(--sans); color: var(--ink-3); border: 1px solid var(--rule-2); border-radius: 5px; padding: 3px 5px; margin-left: 8px; text-transform: uppercase; letter-spacing: .04em; }
@media (hover: none) { kbd { display: none; } }

/* ---------- top bar */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 12px max(16px, env(safe-area-inset-left)) 12px max(16px, env(safe-area-inset-right));
  background: rgba(12, 10, 29, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule);
}
.brand { font: 600 19px/1 var(--display); letter-spacing: -.01em; white-space: nowrap; }
.brand span { color: var(--gold); font-style: italic; font-weight: 500; }
.progress { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.bar { flex: 1; max-width: 220px; height: 4px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-2), var(--gold)); border-radius: 4px; transition: width .5s ease; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill { font-size: 12px; font-weight: 700; color: var(--bg); background: var(--gold); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.tool { background: none; border: 1px solid var(--rule-2); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.tool:hover { border-color: var(--blue); color: var(--ink); }
.tool[aria-pressed="false"] { color: var(--ink-3); }

/* ---------- the feed */
#feed { flex: 1; width: 100%; max-width: var(--col); margin: 0 auto; padding: 28px 16px 40px; }
#feed > * { scroll-margin-top: 76px; }
/* Room below the newest step, so it can always be brought to the top of the screen. */
#feed::after { content: ""; display: block; height: 45vh; }
.tutor { margin: 30px 0 14px; transition: opacity .4s ease; }
.tutor p { margin: 0 0 12px; font: 400 21px/1.5 var(--display); letter-spacing: -.005em; }
.tutor p:last-child { margin-bottom: 0; }
.you { margin: 14px 0 14px auto; width: fit-content; max-width: 88%; background: var(--blue-soft); border: 1px solid #343a78; color: #dfe4ff; border-radius: 16px 16px 4px 16px; padding: 8px 14px; font-size: 15.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.you.did { background: none; border: 0; color: var(--ink-3); font-size: 13.5px; padding: 0; }
.past { opacity: .5; }
.past .tutor p, .tutor.past p { font-size: 18px; }
.m-new { color: var(--gold); font-weight: 600; }
.m-known { color: var(--blue); font-weight: 600; }
.m-change { font-style: italic; }
.waiting { display: flex; gap: 6px; margin: 26px 0; height: 20px; align-items: center; }
.waiting i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: breathe 1.2s ease-in-out infinite; }
.waiting i:nth-child(2) { animation-delay: .18s; } .waiting i:nth-child(3) { animation-delay: .36s; }
@keyframes breathe { 0%, 100% { opacity: .25; transform: scale(.85); } 50% { opacity: 1; transform: scale(1); } }
.trouble { margin: 20px 0; padding: 14px 16px; border: 1px solid #5a2d27; background: #2a1613; border-radius: 12px; color: #ffd2c8; font-size: 15px; display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

/* ---------- cards and buttons */
.card { background: var(--surface); border: 1px solid var(--rule); border-radius: 18px; padding: 22px; margin: 16px 0 8px; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.card h2 { margin: 0 0 10px; font: 600 13px/1.2 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.card .body p { margin: 0 0 12px; color: var(--ink-2); }
.card .body p:last-child { margin-bottom: 0; }
.card.passage .body p { font-size: 17.5px; color: var(--ink); }
.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; align-items: center; }
.row.end { justify-content: flex-end; }
.btn { border: 1px solid var(--rule-2); background: var(--surface-2); border-radius: 12px; padding: 11px 18px; font-weight: 700; font-size: 16px; min-height: 46px; display: inline-flex; align-items: center; transition: transform .08s ease, background .15s ease, border-color .15s ease; }
.btn:hover:not(:disabled) { border-color: var(--blue); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1b1436; }
.btn.primary:hover:not(:disabled) { background: #f7d78f; border-color: #f7d78f; }
.btn.primary kbd { color: #5a4a22; border-color: #b9953f; }
.btn.quiet { background: none; color: var(--ink-2); }
.choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; animation: rise .35s ease both; }
.hint { font-size: 13.5px; color: var(--ink-3); margin: 10px 0 0; }

/* ---------- start */
.start { text-align: center; padding: 8vh 0 0; }
.start h1 { font: 500 clamp(34px, 7vw, 52px)/1.08 var(--display); letter-spacing: -.02em; margin: 0 0 16px; }
.start h1 em { color: var(--gold); font-weight: 400; }
.start p { color: var(--ink-2); max-width: 30em; margin: 0 auto 12px; }
.start .btn { margin-top: 18px; padding: 14px 30px; font-size: 18px; }

/* ---------- four ways */
.ways { display: grid; gap: 12px; margin: 16px 0 8px; animation: rise .35s ease both; }
.way { background: var(--surface); border: 1px solid var(--rule); border-radius: 16px; padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.way .num { grid-row: span 2; font: 500 28px/1 var(--display); color: var(--gold); padding-top: 2px; }
.way h3 { margin: 0; font: 600 17px/1.35 var(--sans); }
.way p { margin: 0; color: var(--ink-2); font-size: 15px; }
.way .seg { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 10px; }
.seg button { flex: 1; border: 1px solid var(--rule-2); background: none; border-radius: 10px; padding: 9px 6px; font-weight: 700; font-size: 15px; color: var(--ink-2); min-height: 42px; }
.seg button:hover { border-color: var(--blue); }
.seg button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #141233; }

/* ---------- a line, or a piece of one */
.line { padding: 24px 22px 20px; }
.line-top { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.line-text { margin: 18px 0 6px; font: 400 clamp(25px, 5.2vw, 33px)/1.32 var(--display); letter-spacing: -.012em; min-height: 2.6em; }
.line-text .w { transition: color .3s ease, text-shadow .3s ease, opacity .3s ease; }
.line-text .m-new, .line-text .m-known { opacity: .62; }
.line-text .m-new.lit { opacity: 1; text-shadow: 0 0 22px rgba(243, 203, 118, .5); }
.line-text .m-known.lit { opacity: 1; text-shadow: 0 0 22px rgba(169, 185, 255, .5); }
.orbs { display: flex; align-items: flex-start; justify-content: center; gap: 0; margin: 22px 0 8px; min-height: 92px; flex-wrap: wrap; row-gap: 14px; }
.orb { position: relative; flex: 0 1 112px; min-width: 76px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; font-size: 12.5px; line-height: 1.25; color: var(--ink-3); padding: 0 4px; transition: color .4s ease; }
.orb::before { content: ""; width: 44px; height: 44px; border-radius: 50%; opacity: .22; transform: scale(.8); transition: opacity .5s ease, transform .5s cubic-bezier(.2, 1.4, .4, 1), box-shadow .5s ease; }
.orb.new::before { background: radial-gradient(circle at 50% 45%, #fff3d2 0%, var(--gold) 38%, rgba(226, 168, 74, .25) 70%, transparent 74%); }
.orb.known::before { background: radial-gradient(circle at 50% 45%, #eef1ff 0%, var(--blue) 38%, rgba(120, 140, 255, .25) 70%, transparent 74%); }
.orb.lit { color: var(--ink-2); }
.orb.lit::before { opacity: 1; transform: scale(1); }
.orb.new.lit::before { box-shadow: 0 0 34px 6px rgba(243, 203, 118, .35); }
.orb.known.lit::before { box-shadow: 0 0 34px 6px rgba(169, 185, 255, .32); }
.orb + .orb::after { content: ""; position: absolute; top: 21px; right: calc(50% + 30px); width: calc(100% - 60px); height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--rule-2) 20%, var(--rule-2) 80%, transparent); opacity: .5; transition: opacity .5s ease, background .5s ease; }
.orb.lit + .orb.lit::after, .orb + .orb.lit::after { opacity: 1; background: linear-gradient(90deg, transparent, #7d76b8 20%, #7d76b8 80%, transparent); }
.orb.changed::before { animation: change 1.1s ease 1; }
@keyframes change { 0% { transform: scale(1); } 35% { transform: scale(1.28); filter: brightness(1.35); } 100% { transform: scale(1); } }
.line .row { margin-top: 14px; }
.line .row .btn.primary { margin-left: auto; padding-left: 26px; padding-right: 22px; }
.play { margin-top: 6px; }
@media (prefers-reduced-motion: reduce) {
  .card, .choices, .ways { animation: none; }
  .orb::before { transition: opacity .2s linear; transform: none !important; }
  .orb.changed::before { animation: none; }
  .waiting i { animation: none; opacity: .6; }
}

/* ---------- talking to the tutor */
#talk {
  position: sticky; bottom: 0; z-index: 4; width: 100%; display: flex; gap: 8px; align-items: flex-end; justify-content: center;
  padding: 10px max(16px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-right));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
#talk textarea { flex: 1; max-width: calc(var(--col) - 180px); resize: none; background: var(--surface); border: 1px solid var(--rule-2); border-radius: 14px; padding: 12px 14px; line-height: 1.4; max-height: 40vh; min-height: 48px; }
#talk textarea::placeholder { color: var(--ink-3); }
#talk textarea:focus { outline: none; border-color: var(--blue); }
#talk.asked textarea { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(243, 203, 118, .14); }
#talk button { border: 1px solid var(--rule-2); background: var(--surface-2); border-radius: 12px; padding: 0 16px; height: 48px; font-weight: 700; font-size: 15px; }
#talk #send { background: var(--blue); border-color: var(--blue); color: #141233; }
#talk #mic[aria-pressed="true"] { background: var(--miss); border-color: var(--miss); color: #2a1613; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .top { gap: 10px; }
  /* On a phone the count is on the line card; the top bar keeps only a thin line along its lower edge. */
  .progress span { display: none; }
  .progress .bar { position: absolute; left: 0; right: 0; bottom: -1px; max-width: none; height: 2px; border-radius: 0; background: none; }
  .tutor p { font-size: 19.5px; }
  .card { padding: 18px 16px; border-radius: 16px; }
  .line .row .btn { flex: 1; justify-content: center; padding-left: 10px; padding-right: 10px; }
  .line .row .btn.primary { flex: 1 1 100%; order: -1; margin-left: 0; min-height: 54px; font-size: 17px; }
  .orb { flex-basis: 84px; min-width: 64px; font-size: 11.5px; }
  .orb::before { width: 36px; height: 36px; }
  .orb + .orb::after { top: 17px; right: calc(50% + 24px); width: calc(100% - 48px); }
  #restart { display: none; }
}
