/* Fonts are served from here, not Google, so no visitor's address goes to a font host.
   Both are SIL Open Font License; see static/fonts/*-OFL.txt. Other scripts fall back to system fonts. */
@font-face { font-family: "Literata"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url("../fonts/literata-latin-opsz-normal.c0473b84f21c.woff2") format("woff2-variations"), url("../fonts/literata-latin-opsz-normal.c0473b84f21c.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Literata"; font-style: normal; font-display: swap; font-weight: 200 900;
  src: url("../fonts/literata-latin-ext-opsz-normal.856a9f0a8e9f.woff2") format("woff2-variations"), url("../fonts/literata-latin-ext-opsz-normal.856a9f0a8e9f.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 400;
  src: url("../fonts/ibm-plex-sans-latin-400-normal.77bc02670657.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 400;
  src: url("../fonts/ibm-plex-sans-latin-ext-400-normal.1bc0d8e41d21.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 500;
  src: url("../fonts/ibm-plex-sans-latin-500-normal.f7016cd446d2.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 500;
  src: url("../fonts/ibm-plex-sans-latin-ext-500-normal.93a0df997e00.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 600;
  src: url("../fonts/ibm-plex-sans-latin-600-normal.196e3cbc5fee.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 600;
  src: url("../fonts/ibm-plex-sans-latin-ext-600-normal.8fccbdf5bf67.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* The base look: a notebook. Ink blue on graph paper, Literata for headings and
   IBM Plex Sans for text. Page pieces like the project page add their own
   decoration on top; the rest of the app keeps to these tokens. */
:root {
  --bg: #fafbf7;
  --surface: #ffffff;
  --text: #1f2a44;
  --muted: #586179;
  --border: #cfd8e8;
  --accent: #2b47b0;
  --accent-text: #ffffff;
  --ok: #2c7a4d;
  --wait: #a95a00;
  --stop: #b3261e;
  --hi: #fff27a; /* highlighter */
  --grid: #e3e9f4; /* the graph paper lines */
  --margin: #e7a1a1; /* a notebook's red margin line */
  --display: "Literata", Georgia, serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131a29;
    --surface: #1a2335;
    --text: #e7ebf5;
    --muted: #a2acc2;
    --border: #34405a;
    --accent: #93b0ff;
    --accent-text: #0f1626;
    --ok: #7fd3a0;
    --wait: #f0b25a;
    --stop: #ff8a80;
    --hi: #6b6320;
    --grid: #1b2438;
    --margin: #7a3d46;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; } /* so a styled button or panel still hides */

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text);
  font: 16px/1.5 var(--body);
}

h1, h2, h3 { font-family: var(--display); font-weight: 650; line-height: 1.2; }
h1 { letter-spacing: -0.01em; overflow-wrap: anywhere; }

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 3px double var(--border);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
}

.brand { font-family: var(--display); font-weight: 650; font-size: 1.15rem; text-decoration: none; color: var(--text); }

/* At phone width the bar wraps and a long email breaks, so the page never scrolls sideways. */
.topbar { flex-wrap: wrap; }
.account-menu { position: relative; min-width: 0; max-width: 100%; }
.account-menu summary { overflow-wrap: anywhere; }
.account-menu summary { cursor: pointer; list-style: none; color: var(--muted); }
.account-menu summary::-webkit-details-marker { display: none; }
.account-menu .balance { margin-left: 0.5rem; color: var(--text); font-weight: 600; }
.account-menu .menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  min-width: 14rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 10px 24px -14px rgb(31 42 68 / 0.45);
  z-index: 10;
}
.balance-line { margin: 0 0 0.5rem; }

main { max-width: 44rem; margin: 0 auto; padding: 1.5rem 1rem 3rem; }

.muted { color: var(--muted); }

.messages { list-style: none; max-width: 44rem; margin: 1rem auto 0; padding: 0 1rem; }

.stack { display: grid; gap: 0.5rem; }

textarea, input[type="text"], input[type="email"] {
  width: 100%;
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

button, .button {
  display: inline-block;
  padding: 0.5rem 1rem;
  font: inherit;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
}

button.link {
  padding: 0;
  color: var(--accent);
  background: none;
  text-decoration: underline;
}

/* Projects: new project flow and project page */
.small { font-size: 0.9rem; }
.card {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.card h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }
select, input[type="url"] {
  width: 100%;
  padding: 0.5rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
input[type="file"] { max-width: 100%; }
.error { color: var(--stop); }
.warning {
  padding: 0.5rem 0.75rem;
  border-left: 4px solid var(--wait);
  background: color-mix(in srgb, var(--wait) 12%, var(--surface));
}
fieldset { border: 1px solid var(--border); border-radius: 8px; }
.choice { display: block; margin: 0.25rem 0; }
.project-list { padding-left: 1.25rem; }
.project-list li { margin: 0.4rem 0; }
.chunk-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

/* Runs: progress and Start */
.run-progress progress { width: 100%; height: 0.75rem; accent-color: var(--accent); }
.run-progress ul { margin: 0; padding-left: 1.25rem; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* Glossaries */
.nav { margin-right: auto; margin-left: 1rem; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid th, table.grid td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.badge { display: inline-block; padding: 0 0.4rem; font-size: 0.85em; border: 1px solid var(--border); border-radius: 4px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 1rem 0; }
.errorlist { color: var(--stop); margin: 0.25rem 0; padding-left: 1rem; }
.helptext { color: var(--muted); font-size: 0.9em; }

/* Members */
form.inline { display: inline; }
#members input[readonly] { width: min(100%, 28rem); }

/* Term check (layout B): one card per term, side list of every term */
:root {
  --st-chosen: #2f7d4f;
  --st-kept: #8a5a00;
  --st-drop: #9a3b32;
  --tint: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
@media (prefers-color-scheme: dark) {
  :root { --st-chosen: #6fcf97; --st-kept: #e6b65c; --st-drop: #f08a7e; }
}
main:has(.tc) { max-width: 72rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 0.5rem 1.5rem; }
.tc-head h1 { margin: 0; }
.tc-head p { margin: 0.25rem 0 0; }
.tc-open { max-width: 26rem; }
.tc-grid { display: grid; grid-template-columns: minmax(0, 1fr) 17rem; gap: 1.25rem; align-items: start; margin-top: 1rem; }
.tc-card, .tc-rail, .tc-related, .tc-start {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.tc-card { padding: 1.25rem 1.5rem 1rem; display: grid; gap: 1rem; }
.tc-where { display: flex; justify-content: space-between; align-items: center; }
.tc-state { font-size: 0.85rem; padding: 0.1rem 0.55rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); }
.tc-state.st-accepted, .tc-state.st-other_option, .tc-state.st-own_wording { color: var(--st-chosen); border-color: currentColor; }
.tc-state.st-kept, .tc-state.st-kept_brackets { color: var(--st-kept); border-color: currentColor; }
.tc-state.st-dropped { color: var(--st-drop); border-color: currentColor; }
.tc-term { margin: 0; font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.15; font-weight: 650; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tc-sense { font-size: 1rem; font-weight: 400; color: var(--muted); }
.tc-meta { margin: -0.6rem 0 0; }
.tc-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: -0.25rem 0 0; padding: 0; list-style: none; }
.tc-tags li { font-size: 0.85rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--tint); }
.tc-block h3 { margin: 0 0 0.3rem; font-size: 0.95rem; font-weight: 600; color: var(--muted); }
.tc-block > p { margin: 0; }
.tc-note-edit summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; margin-top: 0.25rem; }
.tc-note-edit form { margin-top: 0.5rem; }
.tc-sents { margin: 0; padding-left: 1.1rem; }
.tc-sents li { margin: 0.2rem 0; }
.tc-opts { display: grid; gap: 0.5rem; margin: 0 0 0.5rem; padding: 0; list-style: none; }
.tc-opt {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.75rem; align-items: center;
  width: 100%; text-align: left; padding: 0.7rem 0.9rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
}
.tc-readonly .tc-opt { grid-template-columns: 1fr auto; }
button.tc-opt:hover:not(:disabled) { border-color: var(--accent); }
.tc-opt[aria-pressed="true"], .tc-opt[aria-current="true"] { border: 2px solid var(--accent); background: var(--tint); padding: calc(0.7rem - 1px) calc(0.9rem - 1px); }
.tc-opt-text { display: grid; gap: 0.1rem; font-size: 1.05rem; }
.tc-ai { font-size: 0.8rem; font-weight: 600; color: var(--accent); white-space: nowrap; }
kbd {
  display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 0.3rem;
  font: 600 0.85rem/1 system-ui, sans-serif; color: var(--muted);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--bg);
}
.tc-own { display: flex; gap: 0.5rem; }
.tc-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-top: 0.25rem; }
.tc-plain { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--text); background: transparent; border: 1px solid var(--border); padding: 0.4rem 0.75rem; }
.tc-plain[data-key="d"][aria-pressed="true"] { color: var(--st-drop); border-color: currentColor; }
.tc-box { width: 1rem; height: 1rem; border: 2px solid var(--muted); border-radius: 3px; }
.tc-tick[aria-pressed="true"] .tc-box { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--surface); }
.tc-offer { padding: 0.75rem 1rem; border-left: 4px solid var(--accent); background: var(--tint); border-radius: 0 8px 8px 0; }
.tc-offer p { margin: 0 0 0.5rem; }
.tc-answers ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; }
.tc-answers li { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.tc-nav { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.tc-nav a { display: inline-flex; gap: 0.4rem; align-items: center; text-decoration: none; }
.tc-rail { padding: 0.75rem; position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
.tc-rail h3, .tc-rail summary { margin: 0.75rem 0.25rem 0.35rem; font-size: 0.9rem; font-weight: 600; }
.tc-rail h3:first-child { margin-top: 0; }
.tc-rail summary { cursor: pointer; }
.tc-rail ul { margin: 0; padding: 0; list-style: none; }
.tc-rail a { display: flex; gap: 0.5rem; align-items: center; padding: 0.3rem 0.4rem; border-radius: 6px; color: var(--text); text-decoration: none; }
.tc-rail a > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-rail a:hover { background: var(--bg); }
.tc-rail a[aria-current="true"] { background: var(--tint); font-weight: 600; }
.tc-pick { font-size: 0.85rem; max-width: 6rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-accept { width: 100%; margin-bottom: 0.4rem; }
.dot { flex: none; width: 0.7rem; height: 0.7rem; border-radius: 50%; border: 2px solid var(--muted); }
.dot.st-accepted, .dot.st-other_option, .dot.st-own_wording { background: var(--st-chosen); border-color: var(--st-chosen); }
.dot.st-kept, .dot.st-kept_brackets { background: var(--st-kept); border-color: var(--st-kept); border-radius: 2px; }
.dot.st-dropped { border-color: var(--st-drop); background: linear-gradient(135deg, transparent 42%, var(--st-drop) 42% 58%, transparent 58%); }
.tc-dropped a > span:first-child { text-decoration: line-through; color: var(--muted); }
.tc-related { padding: 0.9rem 1.1rem; margin-top: 1rem; border-left: 4px solid var(--st-kept); }
.tc-related p { margin: 0 0 0.5rem; }
.tc-related form { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.tc-related-list { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.tc-start { padding: 0.75rem 1.1rem; margin-top: 1.25rem; }
.tc-start p { margin: 0; }
@media (max-width: 52rem) {
  .tc-grid { grid-template-columns: minmax(0, 1fr); }
  .tc-rail { position: static; max-height: none; }
  .tc-card { padding: 1rem; }
  .tc-keys { display: none; }
}
.footer { max-width: 44rem; margin: 0 auto; padding: 0 1rem 2rem; }
