/* Study app. Everything is scoped to .lz-study so a host site's CSS (e.g. Bulma) and this file don't collide.
   Host pages restyle it by overriding the tokens on .lz-study; .light-only opts out of dark mode. */
.lz-study {
  --bg: #f3f4f1; --paper: #ffffff; --ink: #1d2320; --muted: #5d6762; --line: #d5d9d4;
  --accent: #1f6f5c; --accent-ink: #ffffff; --flag: #b4690e; --flag-bg: #fff3e0; --focus: #2b7fd8;
  --radius: 6px; --task-offset: 0px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lz-study:not(.light-only) {
  --bg: #161a18; --paper: #1f2421; --ink: #e6ebe7; --muted: #9aa59f; --line: #353d38;
  --accent: #4fb495; --accent-ink: #0f1a16; --flag: #f0a54a; --flag-bg: #3a2a14; --focus: #6aa8ef; color-scheme: dark } }
:root[data-theme="dark"] .lz-study:not(.light-only) {
  --bg: #161a18; --paper: #1f2421; --ink: #e6ebe7; --muted: #9aa59f; --line: #353d38;
  --accent: #4fb495; --accent-ink: #0f1a16; --flag: #f0a54a; --flag-bg: #3a2a14; --focus: #6aa8ef; color-scheme: dark }

.lz-study *, .lz-study *::before, .lz-study *::after { box-sizing: border-box; }
.lz-study .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 16px; }
.lz-study h1, .lz-study h2 { text-wrap: balance; line-height: 1.2; margin: 0; color: var(--ink); font-family: var(--display); }
.lz-study h1 { font-size: 1.7rem; font-weight: 800; }
.lz-study h2 { font-size: 1.15rem; font-weight: 700; }
.lz-study p { margin: 0; max-width: 65ch; }
.lz-study .stack { display: flex; flex-direction: column; gap: 14px; }
.lz-study .panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 760px; margin: 24px auto; }
.lz-study .eyebrow { font: 600 0.75rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lz-study button { font: 600 0.95rem var(--sans); border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 9px 18px; cursor: pointer; line-height: 1.4; height: auto; }
.lz-study button:hover { filter: brightness(1.12); }
.lz-study button.ghost { background: transparent; color: var(--accent); }
.lz-study button.small { padding: 3px 9px; font-size: 0.85rem; }
.lz-study button:disabled { opacity: 0.5; cursor: default; }
.lz-study :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lz-study input, .lz-study select, .lz-study textarea { font: 0.95rem var(--mono); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; width: 100%; min-width: 0; height: auto; box-shadow: none; }
.lz-study label { font-weight: 400; }
.lz-study ul.rules { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; max-width: 65ch; list-style: disc; }
.lz-study .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.lz-study [hidden] { display: none !important; }

/* task screen */
.lz-study .task { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: calc(100dvh - var(--task-offset)); }
.lz-study .bar { grid-column: 1 / -1; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: var(--paper); }
.lz-study .bar .spacer { flex: 1; }
.lz-study .cond { font: 600 0.8rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 3px; border: 1px solid var(--accent); color: var(--accent); }
.lz-study .viewer { overflow: auto; background: var(--bg); border-right: 1px solid var(--line); min-height: 0; }
.lz-study .viewer img { display: block; max-width: none; margin: 12px auto; box-shadow: 0 1px 4px rgb(0 0 0 / 0.18); }
.lz-study .form { overflow: auto; min-height: 0; background: var(--paper); }
.lz-study .fields { display: grid; grid-template-columns: minmax(9em, 0.8fr) minmax(0, 1.6fr); gap: 8px 12px; align-items: center; }
.lz-study .fields label { font-size: 0.88rem; color: var(--muted); }
.lz-study .flagged input, .lz-study .flagged select, .lz-study tr.flagged input { border-color: var(--flag); background: var(--flag-bg); }
.lz-study .flagnote { color: var(--flag); font: 600 0.75rem var(--mono); }
.lz-study .rows { grid-column: 1 / -1; overflow-x: auto; }
.lz-study .rows table { border-collapse: collapse; width: 100%; min-width: 520px; background: transparent; }
.lz-study .rows th { font: 600 0.75rem var(--mono); text-align: left; color: var(--muted); padding: 2px 4px; border: 0; }
.lz-study .rows td { padding: 2px 4px; border: 0; }
.lz-study .rows td.del { width: 1%; }
.lz-study .foot { margin-top: 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.lz-study .status { font: 0.85rem var(--mono); color: var(--muted); }
.lz-study textarea.code { height: 9em; font-size: 0.75rem; }
@media (max-width: 860px) {
  .lz-study .task { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto; height: auto; }
  .lz-study .viewer { border-right: 0; border-bottom: 1px solid var(--line); max-height: 70vh; }
  .lz-study .fields { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .lz-study * { transition: none !important; } }
