/* Sarcasm headline study — a calm reading surface, inherited from A1. */

:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --text: #1b1a18;
  --muted: #6b6862;
  --border: #e3ded6;
  --accent: #10695f;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1ee;
  --ok: #157347;
  --bad: #b4351f;
  --plain-ink: #1d4ed8;
  --plain-soft: #eff6ff;
  --sarcastic-ink: #9a3412;
  --sarcastic-soft: #fff7ed;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(24, 22, 18, .05), 0 8px 24px -12px rgba(24, 22, 18, .18);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181a;
    --surface: #1e2124;
    --surface-2: #24282c;
    --text: #e9e7e3;
    --muted: #9a968f;
    --border: #32373c;
    --accent: #4fb3a5;
    --accent-ink: #10201e;
    --accent-soft: #1d2f2c;
    --ok: #5cc48d;
    --bad: #f08573;
    --plain-ink: #93c5fd;
    --plain-soft: #172a46;
    --sarcastic-ink: #fdba74;
    --sarcastic-soft: #3a2418;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto,
        "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 46rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}

.page--wide { max-width: 72rem; margin: 0 auto; }

h1 { font-size: 1.65rem; line-height: 1.25; margin: 0 0 .35rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 2.25rem 0 .6rem; letter-spacing: -.005em; }
.page > h1:first-child { margin-bottom: 1rem; }

.lede { font-size: 1.05rem; color: var(--muted); margin: 0 0 1.5rem; }
.page__head { margin-bottom: 1.5rem; }
.page__head h1 { margin-bottom: .15rem; }
.page__actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.page__actions form { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82em; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.pending { color: var(--muted); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --- condition entries -------------------------------------------------- */

.entries {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .85rem;
  margin-top: 1.5rem;
}
.entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem 1.35rem;
}
.entry h2 { margin: 0; }
.entry p { margin: .2rem 0 .9rem; }

/* --- instructions ------------------------------------------------------- */

.instructions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem .5rem;
}
.instructions h2 { margin-top: 0; }
.instructions h2 + p { margin-top: 0; }
.instructions ol { padding-left: 1.25rem; margin: 0 0 1rem; }
.instructions ul { padding-left: 1.25rem; margin: 0 0 1rem; }
.instructions li { margin-bottom: .55rem; }

.guide__example { font-size: .92rem; color: var(--muted); }
.guide__label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .15rem;
}

/* --- start / survey forms ---------------------------------------------- */

.start {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-top: 1.5rem;
}
.start h2 { margin-top: 0; }
.start label { display: block; font-weight: 600; margin-bottom: .25rem; }
.start .muted { font-size: .9rem; margin: 0 0 .85rem; }
.start .btn--primary { margin-top: 1rem; }

input[type="text"], input[type="password"], textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .55rem .75rem;
  min-width: 0;
}
textarea { width: 100%; resize: vertical; }
input[type="text"]:focus-visible, input[type="password"]:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

/* Attention check: plain radios, keyboard focus stays visible. */
.check { border: 1px solid var(--border); border-radius: 10px; padding: .85rem 1rem 1rem; margin: 0 0 .5rem; }
.check legend { font-weight: 600; padding: 0 .3rem; }
.check label { display: flex; align-items: center; gap: .5rem; font-weight: 500; margin: .35rem 0; cursor: pointer; }
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.effort { border: 0; padding: 0; margin: 0 0 1.25rem; }
.effort legend { font-weight: 600; padding: 0; margin-bottom: .2rem; }
.effort__scale { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; margin-top: .5rem; }
.effort__scale label { margin: 0; }
.effort__scale input {
  position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0;
}
.effort__scale span {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); padding: .55rem 0; font-weight: 600; cursor: pointer;
}
.effort__scale label:hover span { border-color: var(--muted); }
.effort__scale input:checked + span {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.effort__scale input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- admin login -------------------------------------------------------- */

.login {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-top: 1.5rem;
  max-width: 26rem;
}
.login label { display: block; font-weight: 600; margin-bottom: .25rem; }
.login input { width: 100%; }
.login .btn--primary { margin-top: 1rem; }

/* --- buttons ------------------------------------------------------------ */

.btn {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: .55rem 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background-color .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn--primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  padding: .7rem 1.6rem;
}
.btn--primary:hover { background: var(--accent); border-color: var(--accent); filter: brightness(1.08); }

/* --- task card ---------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem 1.75rem;
}

.progress { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.progress__label { font-size: .85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.progress progress {
  flex: 1;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--border);
  appearance: none;
}
.progress progress::-webkit-progress-bar { background: var(--border); border-radius: 999px; }
.progress progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
.progress progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.prompt { font-size: .9rem; font-weight: 600; color: var(--muted); margin: 0 0 .5rem; }

.headline {
  margin: 0 0 1.5rem;
  padding: 1.15rem 1.35rem;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

/* Category colours identify a label; they never mean correct or incorrect. */
.label--plain { --label-ink: var(--plain-ink); --label-soft: var(--plain-soft); }
.label--sarcastic { --label-ink: var(--sarcastic-ink); --label-soft: var(--sarcastic-soft); }

/* --- AI suggestion panel ------------------------------------------------ */

.ai {
  margin: 0 0 1.5rem;
  padding: .9rem 1.1rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ai__head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; justify-content: space-between; }
.ai__head h2 { margin: 0; font-size: .95rem; }
.ai__label {
  background: var(--label-soft); color: var(--label-ink);
  border-radius: 999px; padding: .1rem .65rem;
  font-size: .85rem; font-weight: 600;
  white-space: nowrap;
}
.ai__score { margin: .35rem 0 .6rem; font-size: .92rem; }
.ai__cue-title { margin: 0 0 .3rem; font-size: .9rem; font-weight: 600; }
.ai__features { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .6rem; padding: 0; }
.ai__features li {
  display: inline-flex; align-items: baseline; gap: .3rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); padding: .12rem .6rem; font-size: .9rem;
}
.ai__features code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* --- answers ------------------------------------------------------------ */

.choices {
  border: 0;
  padding: 0;
  margin: 0 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
}

.choice { position: relative; }
.choice input[type="radio"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  margin: 0;
}
.choice label {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: .8rem .5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--label-soft);
  color: var(--label-ink);
  cursor: pointer;
  text-align: center;
  font-weight: 600;
  transition: border-color .12s ease, background-color .12s ease;
}
.choice label:hover { border-color: var(--label-ink); }
.choice input[type="radio"]:checked + label {
  background: var(--label-soft);
  border-color: var(--label-ink);
  box-shadow: inset 0 0 0 1px var(--label-ink);
  color: var(--label-ink);
}
.choice input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.reminder { margin-top: 1.25rem; font-size: .9rem; color: var(--muted); }
.reminder summary { cursor: pointer; font-weight: 600; }
.reminder p { margin: .5rem 0 0; }

/* --- done --------------------------------------------------------------- */

.card--done { text-align: center; padding: 2.5rem 1.75rem; }
.done__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem; height: 3rem;
  margin: 0 auto .75rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.5rem;
}
.card--done h2 { margin: 0 0 .5rem; }
.card--done p { margin: 0 0 .35rem; }
.done__next { margin-top: 1.5rem; }

/* --- alert -------------------------------------------------------------- */

.alert {
  background: color-mix(in srgb, var(--bad) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--border));
  color: var(--bad);
  border-radius: 10px;
  padding: .7rem 1rem;
  margin: 1rem 0;
  font-size: .93rem;
}

/* --- tables (admin) ----------------------------------------------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: .55rem .75rem; text-align: left; vertical-align: top; }
thead th {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  white-space: normal;
}
tbody tr + tr td { border-top: 1px solid var(--border); }
.comment-cell { max-width: 24rem; overflow-wrap: anywhere; }
.headline-cell { min-width: 18rem; max-width: 26rem; overflow-wrap: anywhere; }
.num, .nowrap { font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-row td { background: var(--surface-2); }
.detail-row details { margin: .1rem 0; }
.detail-row summary, .admin-meta summary, .raw-json summary { cursor: pointer; font-weight: 600; }
.detail-row details details { margin-top: .5rem; }
.comment-full { white-space: pre-wrap; overflow-wrap: anywhere; margin: .25rem 0 0; }
.json-block {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: .35rem 0 0;
  font-size: .8rem;
}
.meta-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: .3rem .9rem;
  margin: .4rem 0 0;
}
.meta-grid dt { font-weight: 600; color: var(--muted); }
.meta-grid dd { margin: 0; overflow-wrap: anywhere; }
.admin-meta { margin-top: 2rem; }
.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: end;
  margin: 1rem 0 .35rem;
}
.admin-filters label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
}
.admin-filters input, .admin-filters select {
  font: inherit;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
.admin-filters input:focus-visible, .admin-filters select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

@media (max-width: 34rem) {
  .shell { padding: 1.75rem 1rem 3rem; }
  .entries { grid-template-columns: 1fr; }
  .card { padding: 1.25rem; }
  .headline { font-size: 1.08rem; }
  .effort__scale { grid-template-columns: repeat(4, 1fr); }
  .meta-grid { grid-template-columns: 1fr; }
  .meta-grid dt { margin-top: .45rem; }
  .admin-filters label { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
