html, body { height: 100%; margin: 0; }
#card {
  box-sizing: border-box; height: 100%; display: flex; flex-direction: column;
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #1d2530; background: #fbfdfb; border: 1px solid #ccd2da; border-radius: 8px;
  overflow: hidden;
}
#card * { box-sizing: border-box; }
#card header {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: #1c5e34; color: #fff;
}
#card header .title { font-weight: 700; letter-spacing: .02em; }
#card header .sub { font-size: 11.5px; color: #cfe6d8; }

/* progress strip: question counter, score, clock */
.strip { flex: 0 0 auto; display: flex; align-items: center; gap: 14px; padding: 5px 10px;
  background: #eef3ee; border-bottom: 1px solid #dde4dd; font-size: 12px; color: #33433a; min-height: 28px; }
.strip b { color: #15110c; }
.strip .clock { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; color: #1c7d3a; }
.strip .clock.low { color: #b00020; }
.bar { flex: 0 0 auto; height: 4px; background: #dde4dd; }
.bar > span { display: block; height: 100%; background: #1c7d3a; transition: width 1s linear; }
.bar > span.low { background: #b00020; }

.body { flex: 1 1 auto; overflow: auto; padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
.note { margin: 0; color: #6b7770; font-size: 12.5px; }
.meta { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7a8a80; }
.question { font-size: 15px; font-weight: 600; line-height: 1.35; margin: 0 0 4px; }
.choices { display: flex; flex-direction: column; gap: 5px; }
.choice { text-align: left; padding: 6px 9px; border: 1px solid #c7cfd6; border-radius: 6px;
  background: #fff; cursor: pointer; font: inherit; color: inherit; }
.choice:hover:not(:disabled) { border-color: #6f8db5; background: #f3f7fb; }
.choice.correct { background: #e3f5e6; border-color: #1c7d3a; font-weight: 700; }
.choice.wrong { background: #fde7e7; border-color: #b00020; }
.choice:disabled { cursor: default; }
.result { font-size: 13px; font-weight: 700; }
.result.ok { color: #1c7d3a; }
.result.bad { color: #b00020; }
.result .expl { display: block; color: #55615a; font-weight: 400; font-size: 12px; margin-top: 2px; }
.result .qlink { display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 600; color: #1c7d3a; text-decoration: none; }
.result .qlink:hover { text-decoration: underline; }
.action { margin-top: auto; padding: 8px; border: 0; border-radius: 6px; background: #1c7d3a; color: #fff;
  font-weight: 700; font-size: 15px; cursor: pointer; }
.action:disabled { background: #a9c7b4; cursor: default; }
.action.secondary { background: transparent; color: #1c7d3a; border: 1px solid #1c7d3a; font-size: 13px; padding: 6px; }

/* intro + summary */
.big { font-size: 30px; font-weight: 800; color: #1c5e34; line-height: 1.1; margin: 4px 0 0; }
.big small { font-size: 14px; font-weight: 600; color: #6b7770; margin-left: 6px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: #33433a; }
.facts b { color: #15110c; }
.streak { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #fff7e6; color: #7a5b1e; font-weight: 700; font-size: 12px; }
h4 { margin: 8px 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #7a8a80; }
table.board { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.board td { padding: 3px 4px; border-bottom: 1px solid #e6ece8; white-space: nowrap; }
table.board td.n { text-align: right; font-variant-numeric: tabular-nums; }
table.board td.name { width: 100%; white-space: normal; overflow: hidden; text-overflow: ellipsis; }
table.board tr.you td { font-weight: 700; background: #fff7e6; }
ul.review { list-style: none; margin: 0; padding: 0; font-size: 12px; }
ul.review li { padding: 3px 0; border-bottom: 1px solid #e6ece8; display: flex; gap: 6px; align-items: baseline; }
ul.review .q { flex: 1; color: #55615a; }
ul.review .ok { color: #1c7d3a; font-weight: 700; }
ul.review .bad { color: #b00020; font-weight: 700; }
ul.review a { color: #1c7d3a; text-decoration: none; font-weight: 600; }
.row { display: flex; gap: 6px; }
.row .action { flex: 1; margin-top: 0; }
.copied { color: #1c7d3a; font-size: 12px; font-weight: 600; }

/* ---- dark theme (host page's toggle or system preference) ---- */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="dark"] #card,
:root[data-theme="dark"] .choice { background: #14191d; color: #e4e7ea; border-color: #333b44; }
:root[data-theme="dark"] .choice { background: #1c2329; }
:root[data-theme="dark"] .choice:hover:not(:disabled) { background: #243040; }
:root[data-theme="dark"] .strip { background: #1a2430; border-color: #2a3a4c; color: #b6c0c9; }
:root[data-theme="dark"] .strip b, :root[data-theme="dark"] .facts b { color: #e4e7ea; }
:root[data-theme="dark"] .bar { background: #2a3a4c; }
:root[data-theme="dark"] .result .expl, :root[data-theme="dark"] ul.review .q, :root[data-theme="dark"] .facts, :root[data-theme="dark"] .note { color: #b6c0c9; }
:root[data-theme="dark"] .big { color: #7fd0a0; }
:root[data-theme="dark"] table.board td, :root[data-theme="dark"] ul.review li { border-color: #2a3a4c; }
:root[data-theme="dark"] table.board tr.you td, :root[data-theme="dark"] .streak { background: #3a2f12; color: #f2d48a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) #card { background: #14191d; color: #e4e7ea; border-color: #333b44; }
  :root:not([data-theme="light"]) .choice { background: #1c2329; color: #e4e7ea; border-color: #333b44; }
  :root:not([data-theme="light"]) .choice:hover:not(:disabled) { background: #243040; }
  :root:not([data-theme="light"]) .strip { background: #1a2430; border-color: #2a3a4c; color: #b6c0c9; }
  :root:not([data-theme="light"]) .strip b, :root:not([data-theme="light"]) .facts b { color: #e4e7ea; }
  :root:not([data-theme="light"]) .bar { background: #2a3a4c; }
  :root:not([data-theme="light"]) .result .expl, :root:not([data-theme="light"]) ul.review .q, :root:not([data-theme="light"]) .facts, :root:not([data-theme="light"]) .note { color: #b6c0c9; }
  :root:not([data-theme="light"]) .big { color: #7fd0a0; }
  :root:not([data-theme="light"]) table.board td, :root:not([data-theme="light"]) ul.review li { border-color: #2a3a4c; }
  :root:not([data-theme="light"]) table.board tr.you td, :root:not([data-theme="light"]) .streak { background: #3a2f12; color: #f2d48a; }
}

/* past-days archive */
select#pastday { flex: 1; font: inherit; font-size: 12.5px; padding: 5px 6px; border: 1px solid #c7cfd6; border-radius: 6px; background: #fff; color: inherit; }
ol.archive { margin: 4px 0 0; padding-left: 20px; font-size: 12.5px; }
ol.archive li { padding: 5px 0; border-bottom: 1px solid #e6ece8; }
ol.archive .aq { font-weight: 600; }
ol.archive .aa { color: #1c7d3a; font-weight: 700; }
ol.archive .ax { color: #55615a; font-size: 12px; }
ol.archive .ay { font-size: 11.5px; margin-top: 2px; }
ol.archive .ay a { color: #1c7d3a; font-weight: 600; text-decoration: none; }
ol.archive .ok { color: #1c7d3a; font-weight: 700; }
ol.archive .bad { color: #b00020; font-weight: 700; }
ul.review .n { color: #7a8a80; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] select#pastday { background: #1c2329; border-color: #333b44; }
:root[data-theme="dark"] ol.archive li { border-color: #2a3a4c; }
:root[data-theme="dark"] ol.archive .ax { color: #b6c0c9; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) select#pastday { background: #1c2329; border-color: #333b44; }
  :root:not([data-theme="light"]) ol.archive li { border-color: #2a3a4c; }
  :root:not([data-theme="light"]) ol.archive .ax { color: #b6c0c9; }
}

/* Arcade host: the frame follows the content (index.html reports the card's height) */
html.autosize, html.autosize body { height: auto; background: transparent !important; }
html.autosize #card { height: auto; max-height: 1100px; }

/* Past days: "✕ Close" beside the day picker (shown once a day is open) */
.closeday { font: inherit; font-size: 12.5px; padding: 5px 10px; border: 1px solid rgba(128,128,128,.45); border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.closeday[hidden] { display: none; }
