/**
 * twft_duo — 「Creative Mode」新粗野主义海报风
 * 视觉 DNA（参考 style/app.wxss）：
 *  · 奶油纸底 #EFE9D9 + 卡片亮纸 #FBF6EA
 *  · 黑墨结构：粗黑边框 + 硬位移投影 (box-shadow: N N 0 黑，无模糊)
 *  · 自信多彩：森林绿 / 亮粉 / 橙 / 芥末黄，跨卡片轮换
 *  · 超重黑体标题 + 黑底奶油字 kicker 标签
 *  · 按钮按下「压进纸里」(translate + 收短硬阴影)
 */
:root {
  --cream: #efe9d9;
  --cream-2: #e4dcc4;
  --paper: #fbf6ea;
  --ink: #0f0f0f;
  --ink-soft: #4a4740;
  --ink-faint: #7c776c;

  --green: #1f8a4c;  --green-dark: #136636;
  --pink:  #f06ca8;  --pink-dark: #d14e8b;
  --orange:#e85a1f;  --orange-dark:#c0430f;
  --yellow:#f5c518;  --yellow-dark:#ce9f0c;

  --cjk: "Archivo Black", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --bd: 3px solid var(--ink);
  --bd-thin: 2px solid var(--ink);
  --sh: 4px 4px 0 var(--ink);
  --sh-lg: 6px 6px 0 var(--ink);
  --r: 12px;
  --r-lg: 18px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--cream); color: var(--ink);
  font-family: var(--cjk); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body { display: flex; flex-direction: column; align-items: center; }
#app { width: 100%; max-width: 640px; margin: 0 auto; padding: 1.2rem 1.1rem 2.6rem; }

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

/* ---------- type ---------- */
h1 { font-size: 1.7rem; line-height: 1.1; margin: 0 0 0.5rem; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); text-wrap: balance; }
h2 { font-size: 1.3rem; line-height: 1.15; margin: 0; font-weight: 800; color: var(--ink); }
p { margin: 0.4rem 0; }
.lead { color: var(--ink-soft); font-size: 1rem; font-weight: 600; margin: 0 0 1rem; }
.hint { color: var(--ink-faint); font-size: 0.84rem; font-weight: 600; margin: 0.25rem 0; }
strong, b { font-weight: 800; }

/* kicker：黑底奶油字海报标签 */
.kicker, .cues-label, .waiting-eyebrow, .decode-lead, .modal-eyebrow, .ib-sub, .ib-ex-label {
  display: inline-block; background: var(--ink); color: var(--cream);
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase;
  padding: 0.2rem 0.6rem; border-radius: 5px;
}

/* ---------- card / lobby ---------- */
.card {
  background: var(--paper); border: var(--bd); border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); padding: 1.5rem 1.5rem;
}
.field { display: grid; gap: 0.35rem; font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); margin: 0.7rem 0; }
.req { justify-self: start; background: var(--pink); color: var(--ink); border: var(--bd-thin); border-radius: 5px; padding: 0.02rem 0.4rem; font-size: 0.68rem; font-weight: 800; }
.field input, .field select {
  padding: 0.6rem 0.72rem; border: var(--bd-thin); border-radius: 10px;
  font-size: 1rem; font-family: inherit; font-weight: 700; background: #fff; color: var(--ink);
  transition: box-shadow 0.08s ease;
}
.field input:focus, .field select:focus { outline: none; box-shadow: var(--sh); }
.lobby-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 0.6rem; }
.lobby-box { border: var(--bd); border-radius: var(--r); padding: 1rem 1.05rem; background: var(--cream-2); box-shadow: var(--sh); border-top-width: 6px; }
.lobby-box:first-child { border-top-color: var(--green); }
.lobby-box:last-child { border-top-color: var(--orange); }
.lobby-box h2 { font-size: 1.05rem; margin-bottom: 0.15rem; }
@media (max-width: 560px) { .lobby-cols { grid-template-columns: 1fr; } }

/* ---------- buttons ---------- */
button { font-family: inherit; cursor: pointer; }
.primary, .ghost {
  appearance: none; border: var(--bd); border-radius: 999px;
  padding: 0.62rem 1.2rem; font-size: 1rem; font-weight: 800; letter-spacing: 0.02em;
  width: 100%; margin-top: 0.4rem; box-shadow: var(--sh);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.primary { background: var(--green); color: var(--cream); }
.primary:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.primary.big { padding: 0.85rem 1.2rem; font-size: 1.08rem; }
.ghost { background: var(--paper); color: var(--ink); }
.ghost:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.ghost:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-row { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; margin-top: 0.7rem; }
.btn-row button { width: auto; flex: 1 1 auto; min-width: 9rem; }
.ghost-btn { background: none; border: none; color: var(--ink); font-size: 0.85rem; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; margin-top: 0.9rem; }

.error-line { color: var(--pink-dark); font-size: 0.9rem; font-weight: 800; min-height: 1.2em; margin: 0.4rem 0; text-align: center; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  padding-bottom: 0.7rem; margin-bottom: 0.9rem; border-bottom: var(--bd);
}
.room-chip {
  background: var(--ink); color: var(--cream); border-radius: 999px;
  padding: 0.24rem 0.75rem; font-size: 0.78rem; letter-spacing: 0.14em; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.progress { color: var(--ink); font-size: 0.84rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.practice-pill { background: var(--yellow); color: var(--ink); border: var(--bd-thin); border-radius: 999px; padding: 0.12rem 0.6rem; }
.seats { margin-left: auto; display: flex; gap: 0.5rem; }
.seat { font-size: 0.75rem; color: var(--ink-faint); font-weight: 700; display: inline-flex; align-items: center; gap: 0.28rem; }
.seat.me { color: var(--ink); }
.seat-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--cream-2); border: 2px solid var(--ink); }
.seat.on .seat-dot { background: var(--green); }
.seat.away .seat-dot { background: var(--yellow); }
.help-btn {
  width: 1.7rem; height: 1.7rem; border-radius: 50%; border: var(--bd-thin);
  background: var(--paper); color: var(--ink); font-weight: 800; line-height: 1; padding: 0; box-shadow: 2px 2px 0 var(--ink);
}
.help-btn:active { transform: translate(2px, 2px); box-shadow: none; }

.game-body { display: flex; flex-direction: column; align-items: center; gap: 0.85rem; text-align: center; }
.game-body > * { width: 100%; }

/* ---------- waiting ---------- */
.waiting { text-align: center; padding: 0.5rem 0 1rem; }
.big-code {
  font-family: var(--mono); font-size: 3.4rem; font-weight: 800; letter-spacing: 0.2em;
  color: var(--ink); margin: 0.5rem 0; padding-left: 0.2em;
  -webkit-text-stroke: 0; text-shadow: 4px 4px 0 var(--yellow);
}
.waiting-lead { color: var(--ink-soft); font-weight: 600; }
.role-tag {
  display: inline-block; margin: 0.6rem 0; padding: 0.35rem 0.95rem; border-radius: 999px;
  font-size: 0.86rem; font-weight: 800; border: var(--bd-thin); box-shadow: var(--sh);
}
.role-tag.encoder { background: var(--green); color: var(--cream); }
.role-tag.decoder { background: var(--orange); color: var(--cream); }
.waiting-status { color: var(--orange-dark); font-weight: 800; margin-top: 0.6rem; }
.spinner {
  width: 1.6rem; height: 1.6rem; margin: 0.8rem auto 0;
  border: 3px solid var(--ink); border-top-color: var(--yellow);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- decoder waiting overlay ---------- */
.waiting-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem; background: rgba(15, 15, 15, 0.32);
  animation: fade 0.2s ease;
}
.waiting-card {
  background: var(--paper); border: var(--bd); box-shadow: var(--sh-lg);
  border-radius: var(--r); padding: 1.6rem 1.8rem; text-align: center;
  max-width: 22rem; width: 100%;
}
.waiting-card .spinner { width: 2.2rem; height: 2.2rem; }
.waiting-card .waiting-status { margin: 0.9rem 0 0.2rem; }

/* ---------- practice-only decoder reveal ---------- */
.decoder-reveal {
  background: var(--paper); border: var(--bd-thin); border-left: 6px solid var(--orange);
  box-shadow: var(--sh); border-radius: var(--r); padding: 0.7rem 0.95rem; margin: 0.6rem 0;
  animation: fade 0.25s ease;
}
.decoder-reveal .reveal-tag {
  display: inline-block; background: var(--orange); color: var(--cream);
  border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.74rem; font-weight: 800;
}
.decoder-reveal .reveal-words { margin: 0.5rem 0 0.2rem; font-size: 1.02rem; }
.decoder-reveal .reveal-words strong {
  display: inline-block; margin: 0 0.15rem; padding: 0.1rem 0.5rem;
  background: var(--cream-2); border: var(--bd-thin); border-radius: 8px;
}
.decoder-reveal .reveal-conf { margin: 0.2rem 0; font-weight: 700; color: var(--ink-soft); }
.decoder-reveal .reveal-reason { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- record sync progress bar (subtle, non-blocking) ---------- */
.sync-bar {
  height: 8px; margin: 0.1rem auto 0.6rem; max-width: 18rem;
  background: var(--cream-2); border: var(--bd-thin); border-radius: 999px; overflow: hidden;
}
.sync-fill {
  height: 100%; width: 0%; background: var(--green);
  border-radius: 999px; transition: width 0.3s ease;
}

/* ---------- practice strip ---------- */
.practice-strip {
  background: var(--yellow); color: var(--ink); border: var(--bd-thin); box-shadow: var(--sh);
  border-radius: var(--r); padding: 0.55rem 0.85rem; font-size: 0.86rem; font-weight: 800;
}

/* ---------- per-trial role banner (roles swap each trial) ---------- */
.role-banner {
  border: var(--bd); border-radius: var(--r); box-shadow: var(--sh);
  padding: 0.55rem 0.9rem; font-size: 1rem; font-weight: 700; letter-spacing: 0.02em;
}
.role-banner b { font-weight: 800; }
.role-banner.enc { background: var(--green); color: var(--cream); }
.role-banner.dec { background: var(--orange); color: var(--cream); }

/* ---------- condition tag: 3选2 / 4选2 ---------- */
.cond-tag { display: inline-block; border: var(--bd-thin); border-radius: 999px; padding: 0.3rem 0.95rem; font-size: 0.86rem; font-weight: 800; box-shadow: 2px 2px 0 var(--ink); }
.cond-tag b { font-weight: 800; }
.cond-tag.pick3 { background: var(--green); color: var(--cream); }
.cond-tag.pick4 { background: var(--orange); color: var(--cream); }

/* ---------- cues ---------- */
.cues { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin-top: 0.15rem; }
.cue-card {
  min-width: 8rem; padding: 0.7rem 1.1rem; border: var(--bd); border-radius: var(--r);
  background: var(--paper); box-shadow: var(--sh); border-top-width: 6px; border-top-color: var(--green);
}
.cue-tag { display: inline-block; font-family: var(--mono); font-size: 0.72rem; font-weight: 800; color: var(--cream); background: var(--ink); border-radius: 5px; padding: 0.05rem 0.4rem; margin-bottom: 0.25rem; }
.cue-zh { display: block; font-size: 1.55rem; font-weight: 800; color: var(--ink); letter-spacing: 0.04em; }
.seed-word sub { font-family: var(--mono); font-size: 0.6rem; color: var(--ink-faint); margin-right: 0.2rem; vertical-align: baseline; }
.cue-en { display: block; margin-top: 0.1rem; font-size: 0.8rem; font-weight: 700; color: var(--ink-faint); }
.cue-join { align-self: center; color: var(--ink); font-size: 1.4rem; font-weight: 800; }

/* ---------- step tracker ---------- */
.stepper { display: flex; align-items: stretch; justify-content: center; gap: 0.4rem; padding: 0.4rem 0.2rem; flex-wrap: wrap; }
.step-cell {
  display: flex; flex-direction: column; align-items: center; gap: 0.12rem;
  min-width: 4.4rem; padding: 0.45rem 0.55rem; border-radius: 10px;
  border: var(--bd-thin); background: var(--paper); box-shadow: 3px 3px 0 var(--ink);
}
.step-cell .step-tag { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-faint); font-weight: 800; }
.step-cell .step-val { font-size: 1.1rem; font-weight: 800; min-height: 1.3em; }
.step-cell.done { background: var(--green); }
.step-cell.done .step-tag, .step-cell.done .step-val { color: var(--cream); }
.step-cell.done .step-tag::after { content: " ✓"; }
.step-cell.current { background: var(--yellow); }
.step-cell.current .step-tag, .step-cell.current .step-val { color: var(--ink); }
.step-cell.todo { opacity: 0.55; box-shadow: none; border-style: dashed; }
.step-arrow { align-self: center; color: var(--ink); font-weight: 800; }

/* ---------- turn flag ---------- */
.turn-flag { font-size: 0.92rem; font-weight: 800; padding: 0.35rem 1rem; border-radius: 999px; border: var(--bd-thin); box-shadow: var(--sh); display: inline-block; margin: 0 auto; }
.turn-flag.you { background: var(--green); color: var(--cream); }
.turn-flag.wait { background: var(--paper); color: var(--ink-soft); }

.step-hint { font-size: 0.95rem; color: var(--ink-soft); font-weight: 700; }
.step-hint strong { color: var(--green-dark); font-family: var(--mono); }

/* ---------- word input ---------- */
.word-box { text-align: left; }
.word-box label { display: block; font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); margin-bottom: 0.3rem; }
.word-box input {
  width: 100%; padding: 0.65rem 0.75rem; border: var(--bd); border-radius: var(--r);
  font-size: 1.4rem; font-weight: 800; letter-spacing: 0.1em; text-align: center; font-family: inherit; background: #fff; color: var(--ink);
  transition: box-shadow 0.08s ease;
}
.word-box input:focus { outline: none; box-shadow: var(--sh); }

/* ---------- decoder ---------- */
.decode-instr { color: var(--ink-soft); font-weight: 600; }
.pending-word { font-size: 1rem; color: var(--ink-soft); font-weight: 700; }
.pending-word.big {
  font-size: 2.5rem; font-weight: 800; color: var(--orange); letter-spacing: 0.06em;
  text-shadow: 3px 3px 0 var(--ink);
}
.pending-word strong { color: var(--ink); }
.pool { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin: 0.3rem 0; }
.pool-chip {
  appearance: none; padding: 0.6rem 1.1rem; border: var(--bd); border-radius: var(--r);
  background: var(--paper); font-size: 1.35rem; font-weight: 800; letter-spacing: 0.05em; color: var(--ink);
  box-shadow: var(--sh); transition: transform 0.08s, box-shadow 0.08s, background 0.08s;
}
.pool-chip:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.pool-chip.sel { background: var(--orange); color: var(--cream); }

/* ---------- reveal ---------- */
.reveal { border: var(--bd); border-radius: var(--r); padding: 0.85rem 1rem; background: var(--paper); box-shadow: var(--sh); border-top-width: 6px; }
.reveal.ok { border-top-color: var(--green); }
.reveal.bad { border-top-color: var(--pink); }
.reveal-word { font-size: 1.3rem; font-weight: 800; margin-bottom: 0.5rem; }
.reveal-badge { font-size: 0.82rem; margin-left: 0.35rem; font-weight: 800; }
.reveal.ok .reveal-badge { color: var(--green-dark); }
.reveal.bad .reveal-badge { color: var(--pink-dark); }
.reveal-row { display: flex; align-items: center; justify-content: center; gap: 0.4rem; flex-wrap: wrap; margin: 0.3rem 0; }
.reveal-k { font-size: 0.76rem; color: var(--ink-faint); font-weight: 700; }
.pick-word, .seed-word { font-size: 1.1rem; font-weight: 800; padding: 0.1rem 0.5rem; border-radius: 8px; border: var(--bd-thin); }
.pick-word.hit { color: var(--cream); background: var(--green); }
.pick-word.miss { color: var(--ink); background: var(--pink); }
.seed-word { color: var(--cream); background: var(--ink); border-color: var(--ink); }
.pick-plus { color: var(--ink); font-weight: 800; }

/* ---------- coach ---------- */
.coach { font-size: 1rem; font-weight: 800; padding: 0.6rem 0.85rem; border-radius: var(--r); border: var(--bd-thin); box-shadow: var(--sh); }
.coach.ok { background: var(--green); color: var(--cream); }
.coach.bad { background: var(--pink); color: var(--ink); }

/* ---------- think box ---------- */
.think-box { text-align: left; }
.think-label-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.3rem; }
.think-box label { font-size: 0.85rem; font-weight: 700; color: var(--ink-soft); }
.think-box textarea {
  width: 100%; min-height: 3rem; padding: 0.55rem 0.7rem; border: var(--bd-thin); border-radius: var(--r);
  font-size: 0.98rem; font-family: inherit; font-weight: 600; line-height: 1.5; resize: vertical; background: #fff; color: var(--ink);
}
.think-box textarea:focus { outline: none; box-shadow: var(--sh); }
.voice-btn {
  border: var(--bd-thin); background: var(--paper); color: var(--ink); border-radius: 999px;
  padding: 0.24rem 0.75rem; font-size: 0.78rem; font-weight: 800; flex-shrink: 0; box-shadow: 2px 2px 0 var(--ink);
}
.voice-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.voice-btn.recording { background: var(--pink); color: var(--ink); }
.voice-btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.mic-hint { font-size: 0.76rem; color: var(--ink-faint); font-weight: 600; margin: 0.25rem 0 0; }
.voice-status { font-size: 0.76rem; color: var(--ink-faint); font-weight: 600; margin: 0.2rem 0 0; min-height: 1em; }
.voice-status.warn { color: var(--pink-dark); }

/* your own submitted reasoning while you wait (private until reveal) */
.own-think {
  text-align: left; background: var(--cream-2); border: var(--bd-thin); border-radius: var(--r);
  box-shadow: 3px 3px 0 var(--ink); padding: 0.6rem 0.8rem; font-size: 0.9rem; font-weight: 600; color: var(--ink);
}
.own-think .ot-tag { display: inline-block; background: var(--ink); color: var(--cream); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; padding: 0.12rem 0.5rem; border-radius: 5px; margin-right: 0.5rem; }
.own-think .ot-step { margin-top: 0.4rem; font-weight: 600; }
.own-think .ot-step b { color: var(--green-dark); }
.own-think .ot-note { font-size: 0.74rem; font-weight: 700; color: var(--ink-faint); margin-top: 0.4rem; }

/* generated (distractor) words shown at reveal */
.reveal .gen-word { font-weight: 700; color: var(--ink-soft); }

/* both sides' reasoning, revealed together after the guess */
.think-reveal { text-align: left; margin-top: 0.6rem; display: grid; gap: 0.5rem; }
.tr-row {
  display: grid; grid-template-columns: auto 1fr; gap: 0.55rem; align-items: start;
  border: var(--bd-thin); border-radius: var(--r); padding: 0.55rem 0.7rem; background: var(--paper); box-shadow: 3px 3px 0 var(--ink);
}
.tr-tag { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; padding: 0.2rem 0.5rem; border-radius: 6px; color: var(--cream); white-space: nowrap; align-self: center; }
.tr-tag.enc { background: var(--green); }
.tr-tag.dec { background: var(--orange); }
.tr-txt { font-size: 0.92rem; font-weight: 600; color: var(--ink); line-height: 1.5; }

/* ---------- finished ---------- */
.finished { text-align: center; }
.fin-check {
  width: 3.2rem; height: 3.2rem; margin: 0.3rem auto 0.7rem; border-radius: 50%;
  background: var(--green); color: var(--cream); font-size: 1.7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; border: var(--bd); box-shadow: var(--sh);
}
.fin-list { margin: 1rem 0; display: grid; gap: 0.5rem; }
.fin-row {
  display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem;
  border: var(--bd-thin); border-radius: var(--r); background: var(--paper); box-shadow: 3px 3px 0 var(--ink); text-align: left;
}
.fin-cues { color: var(--green-dark); font-weight: 800; white-space: nowrap; }
.fin-arrow { color: var(--ink); font-weight: 800; }
.fin-chain { color: var(--ink); font-weight: 700; }

/* ================= instructions / modal ================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 15, 15, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 1.2rem 1rem; overflow-y: auto; z-index: 100; animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  background: var(--paper); border: var(--bd); border-radius: var(--r-lg); box-shadow: 8px 8px 0 var(--ink);
  max-width: 560px; width: 100%; padding: 1.5rem 1.6rem 1.4rem; margin: auto; text-align: left;
}
.modal-head { margin-bottom: 0.5rem; }
.modal-head h2 { margin-top: 0.5rem; }
.modal-lead { color: var(--ink-soft); font-weight: 600; margin: 0.4rem 0 0.9rem; }
.modal-actions { margin-top: 1.1rem; }
.modal-actions .primary { width: 100%; }

.ib-role { border: var(--bd-thin); border-radius: var(--r); padding: 0.9rem 1rem; margin: 0.5rem 0 0.9rem; box-shadow: var(--sh); border-left-width: 8px; }
.ib-role.enc { background: var(--paper); border-left-color: var(--green); }
.ib-role.dec { background: var(--paper); border-left-color: var(--orange); }
.ib-role-tag { display: inline-block; font-weight: 800; font-size: 0.82rem; padding: 0.2rem 0.6rem; border-radius: 6px; margin-bottom: 0.4rem; color: var(--cream); }
.ib-role.enc .ib-role-tag { background: var(--green); }
.ib-role.dec .ib-role-tag { background: var(--orange); }
.ib-role p { margin: 0 0 0.4rem; color: var(--ink); font-weight: 600; }
.ib-role ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.ib-role li { margin: 0.3rem 0; font-weight: 600; }

.ib-sub { margin: 1rem 0 0.5rem; }
.loop { display: flex; align-items: center; justify-content: center; gap: 0.35rem; flex-wrap: wrap; margin: 0.3rem 0 0.7rem; }
.loop-step { padding: 0.4rem 0.8rem; border-radius: 999px; font-size: 0.85rem; font-weight: 800; border: var(--bd-thin); box-shadow: 2px 2px 0 var(--ink); }
.loop-step.enc { background: var(--green); color: var(--cream); }
.loop-step.dec { background: var(--orange); color: var(--cream); }
.loop-step.rev { background: var(--yellow); color: var(--ink); }
.loop-step.nxt { background: var(--paper); color: var(--ink); }
.loop-arrow { color: var(--ink); font-weight: 800; }

.ladder { display: flex; align-items: stretch; justify-content: center; gap: 0.45rem; margin: 0.3rem 0 0.5rem; flex-wrap: wrap; }
.ladder-cell {
  display: flex; flex-direction: column; align-items: center; gap: 0.1rem; min-width: 5.2rem;
  padding: 0.55rem 0.6rem; border-radius: 10px; border: var(--bd-thin); box-shadow: var(--sh);
  font-family: var(--mono); font-weight: 800; font-size: 1.05rem;
}
.ladder-cell small { font-family: var(--cjk); font-weight: 700; font-size: 0.72rem; }
.ladder-cell.c0 { background: var(--green); color: var(--cream); }
.ladder-cell.c1 { background: var(--yellow); color: var(--ink); }
.ladder-cell.c2 { background: var(--orange); color: var(--cream); }

.ib-example, .ib-rules { border: var(--bd-thin); border-radius: var(--r); padding: 0.85rem 0.95rem; margin-top: 0.8rem; background: var(--cream-2); box-shadow: var(--sh); }
.ib-ex-cues { color: var(--green-dark); font-weight: 800; margin-top: 0.4rem; }
.ib-ex-chain { font-size: 1.08rem; font-weight: 700; margin: 0.4rem 0; }
.ib-ex-chain b { color: var(--orange-dark); }
.ib-ex-note { font-size: 0.85rem; color: var(--ink-soft); font-weight: 600; margin: 0.2rem 0 0; }
.ib-rules ul { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.ib-rules li { margin: 0.28rem 0; font-size: 0.92rem; font-weight: 600; }

/* interactive demo inside instructions */
.demo { border: var(--bd); border-radius: var(--r); background: var(--cream-2); box-shadow: var(--sh); padding: 0.9rem 1rem; margin: 0.6rem 0 0.9rem; }
.demo-step { font-size: 0.92rem; font-weight: 600; color: var(--ink); margin: 0.35rem 0; line-height: 1.5; }
.demo-tag { display: inline-block; color: var(--cream); font-size: 0.72rem; font-weight: 800; padding: 0.1rem 0.45rem; border-radius: 5px; margin-right: 0.4rem; }
.demo-tag.enc { background: var(--green); } .demo-tag.dec { background: var(--orange); }
.demo-clue { color: var(--orange-dark); }
.demo-pool { margin: 0.55rem 0; }
.demo-pool .demo-chip { font-size: 1.15rem; padding: 0.45rem 0.85rem; }
.demo-feedback { font-size: 0.9rem; font-weight: 700; color: var(--ink-soft); min-height: 1.3em; padding: 0.35rem 0; }
.demo-feedback.ok { color: var(--green-dark); }
.demo-feedback.bad { color: var(--pink-dark); }
