:root {
  --ink: #000100;
  --steel: #A1A6B4;
  --blue: #94C5CC;
  --sky: #B4D2E7;
  --snow: #F8F8F8;
  --fs-scale: 1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Helvetica Neue", sans-serif;
  background: var(--snow);
  color: var(--ink);
}

#app { min-height: 100vh; }

/* ---- login ---- */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
  text-align: center;
}
.login-card h1 { font-size: 20px; margin: 0 0 8px; }
.login-card p { color: #555; font-size: 14px; margin: 0 0 20px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--steel);
  font-size: 16px;
  margin-bottom: 12px;
}
.login-card button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
.login-card button:disabled { opacity: 0.5; cursor: default; }
.login-error { color: #c0392b; font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---- app shell ---- */
.topbar {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--steel);
  padding: 10px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  z-index: 10;
}
.topbar select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--steel);
  background: #fff;
  font-size: 14px;
}
.topbar .stats { margin-left: auto; font-size: 13px; color: #444; white-space: nowrap; }
.topbar .who { font-size: 12px; color: #777; }

.font-control { display: flex; align-items: center; gap: 6px; }
.font-control .font-icon { color: var(--steel); line-height: 1; user-select: none; }
.font-control .font-icon.small { font-size: 11px; }
.font-control .font-icon.large { font-size: 18px; }
.font-control input[type="range"] { width: 80px; accent-color: var(--ink); }

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px 100px;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.card-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.badge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--sky);
  color: var(--ink);
}
.badge.subtype { background: var(--blue); }
.badge.vote-yes { background: #cdeecb; color: #1f7a1f; }
.badge.vote-no { background: #f6cccc; color: #a33; }
.card-id { font-size: 11px; color: var(--steel); margin-left: auto; }

.stimulus { margin-bottom: 16px; }
.stimulus img { max-width: 100%; border-radius: 12px; display: block; }
.stimulus audio { width: 100%; }
.stimulus-text { white-space: pre-wrap; line-height: 1.7; font-size: calc(15px * var(--fs-scale)); }
.transcript-toggle {
  font-size: 13px;
  color: #4a7c8c;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: underline;
}
.transcript { margin-top: 8px; font-size: calc(14px * var(--fs-scale)); color: #333; }
.transcript div { margin-bottom: 6px; }
.transcript .role { color: var(--steel); font-size: calc(12px * var(--fs-scale)); margin-right: 6px; }
.pinyin { color: #888; font-size: calc(12px * var(--fs-scale)); margin-left: 4px; }

.question-block { border-top: 1px dashed var(--steel); padding-top: 14px; margin-top: 14px; }
.stem { font-size: calc(15px * var(--fs-scale)); font-weight: 600; margin-bottom: 10px; }
.blank { display: inline-block; min-width: 28px; border-bottom: 2px solid var(--ink); text-align: center; }

.option {
  border: 1px solid var(--steel);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.option.correct { border-color: #2f9e44; background: #f2fbf2; }
.option-head { display: flex; align-items: center; gap: 8px; font-size: calc(14px * var(--fs-scale)); }
.option-id {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--snow); border: 1px solid var(--steel);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; flex-shrink: 0;
}
.option.correct .option-id { background: #2f9e44; color: #fff; border-color: #2f9e44; }
.option img { max-width: 140px; border-radius: 8px; margin-top: 6px; }
.option .explanation { font-size: calc(12px * var(--fs-scale)); color: #666; margin-top: 6px; }

.votebar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  border-top: 1px solid var(--steel);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
}
.votebar button {
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 20px;
  cursor: pointer;
  background: var(--snow);
}
.votebar button.active.like { background: #cdeecb; }
.votebar button.active.unlike { background: #f6cccc; }
.votebar .nav {
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  padding: 12px 16px;
}
.votebar .nav:disabled { opacity: 0.3; }

.empty-state { text-align: center; padding: 60px 20px; color: #666; }
