/* ==========================================================
   キミならこう言う v4 — リソ刷りZINE

   生成り色の紙に、青とピンクの2色刷り。版ズレの影と網点で
   手刷りのZINEらしさを出し、文字と操作は常にHTMLに置く。
   青=進む、ピンク=決める。待ち・選べないものは斜線の網かけ。
   ========================================================== */

:root {
  color-scheme: light;

  --paper: #F3EEE3;
  --paper-hi: #FFFDF7;
  --ink: #1E2A55;
  --ink-muted: #4F5A85;
  --blue: #2D50C8;
  --pink: #FF4FA3;
  --pink-tint: #FFE1EF;
  --rule: #9AA6D8;
  --off: #8E98C4;
  --off-text: #5E688F;
  --danger: #B0155F;

  --font-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", monospace;

  --halftone: radial-gradient(var(--pink) 2.4px, transparent 2.8px);
  --hatch: repeating-linear-gradient(-45deg, transparent 0 7px, rgba(45, 80, 200, 0.10) 7px 9px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --screen-max: 560px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--blue); }

:focus-visible {
  outline: 3px solid var(--pink);
  outline-offset: 2px;
}

.mono { font-family: var(--font-mono); font-weight: 500; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-150%);
}
.skip-link:focus-visible { transform: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- 画面の骨組み ---------- */

#app { outline: none; }

.screen {
  position: relative;
  width: 100%;
  max-width: var(--screen-max);
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--paper);
  border-bottom: 4px solid var(--blue);
}
.bar.is-parent { background: var(--pink-tint); }
.bar.plain { justify-content: flex-start; gap: 12px; }
.bar.titled { padding-left: 20px; }

.bar-title { margin: 0; font-size: 22px; font-weight: 900; line-height: 1.3; }

.bar-round { display: flex; align-items: baseline; gap: 6px; font-size: 13px; }
.bar-round b { font-family: var(--font-mono); font-weight: 500; font-size: 20px; color: var(--blue); }

.bar-lead { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; font-weight: 900; }
.bar-lead span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--blue);
  border-radius: 8px;
  background: var(--paper);
  color: var(--blue);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn .icon-off { display: none; }
.icon-btn.muted .icon-on { display: none; }
.icon-btn.muted .icon-off { display: block; }

.body {
  flex: 1;
  padding: 0 20px 28px;
  display: flex;
  flex-direction: column;
}

.dock {
  position: sticky;
  bottom: 0;
  z-index: 15;
  margin-top: auto;
  padding: 16px 20px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--paper);
  border-top: 2px dashed var(--blue);
}
.dock.bare { border-top: 0; align-items: center; background: transparent; }

/* ---------- ボタン ---------- */

.btn {
  width: 100%;
  min-height: 64px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 6px;
  font-size: 20px;
  font-weight: 900;
  text-decoration: none;
  transition: transform 90ms ease, box-shadow 90ms ease;
}
.btn svg { width: 22px; height: 22px; flex-shrink: 0; }
.btn:active:not(:disabled) { transform: translate(3px, 3px); }

.btn-go { background: var(--blue); color: var(--paper); box-shadow: 5px 5px 0 var(--pink); }
.btn-go:active:not(:disabled) { box-shadow: 2px 2px 0 var(--pink); }

.btn-decide { background: var(--pink); color: var(--ink); box-shadow: 5px 5px 0 var(--blue); }
.btn-decide:active:not(:disabled) { box-shadow: 2px 2px 0 var(--blue); }

.btn-line {
  min-height: 60px;
  border: 2.5px solid var(--blue);
  background: var(--paper);
  color: var(--blue);
  font-size: 18px;
}

.btn-small { width: auto; min-height: 48px; padding: 0 16px; font-size: 16px; }

.btn:disabled {
  border: 2.5px dashed var(--off);
  background-color: var(--paper);
  background-image: var(--hatch);
  color: var(--off-text);
  box-shadow: none;
  font-size: 18px;
}

.text-link {
  align-self: center;
  min-height: 48px;
  padding: 0 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}
.text-link.danger { color: var(--danger); font-weight: 900; text-decoration-color: currentColor; text-decoration-thickness: 2px; }

/* ---------- 文字の部品 ---------- */

.q-head { margin: 18px 0 0; display: flex; gap: 10px; }
.q-head .q-mark { font-family: var(--font-mono); font-size: 26px; line-height: 1.3; color: var(--pink); }
.q-head p {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.32;
  color: var(--blue);
  text-shadow: 2px 2px 0 rgba(255, 79, 163, 0.75);
  overflow-wrap: anywhere;
}

.q-mini { margin: 14px 0 0; display: flex; gap: 8px; font-size: 15px; overflow-wrap: anywhere; }
.q-mini .q-mark { font-family: var(--font-mono); color: var(--pink); }

.big-title {
  margin: 14px 0 16px;
  font-size: clamp(32px, 10vw, 40px);
  font-weight: 900;
  line-height: 1.15;
  color: var(--blue);
  text-shadow: 4px 3px 0 var(--pink);
}

.hl {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  background-image: linear-gradient(transparent 58%, rgba(255, 79, 163, 0.45) 58%);
}

.row-head { margin: 24px 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-head h2 { margin: 0; font-size: 15px; font-weight: 900; }

.muted { color: var(--ink-muted); }

.progress { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 15px; color: var(--blue); white-space: nowrap; }
.progress i { width: 10px; height: 10px; border: 2px solid var(--blue); }
.progress i.done { background: var(--blue); }
.progress span { margin-left: 4px; }
.progress.large i { width: 14px; height: 14px; border-width: 2.5px; }
.progress.large { font-size: 18px; gap: 6px; }

.stamp {
  display: inline-block;
  padding: 4px 12px;
  border: 2.5px solid var(--ink);
  background: var(--paper);
  font-size: 14px;
  font-weight: 900;
  transform: rotate(-4deg);
}
.stamp.loud { padding: 8px 16px; border-width: 3px; background: var(--pink); font-size: 22px; box-shadow: 4px 4px 0 var(--blue); }
.stamp.soft { background: var(--pink-tint); font-size: 13px; }

.tag { padding: 2px 8px; border: 1.5px solid var(--blue); color: var(--blue); font-size: 12px; font-weight: 900; white-space: nowrap; }
.tag.me { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.tag.off { border-color: var(--off-text); color: var(--off-text); }

.chip { padding: 6px 12px; border: 2px solid var(--blue); color: var(--blue); font-size: 14px; font-weight: 900; }

.dots { display: inline-flex; gap: 5px; flex-shrink: 0; }
.dots i { width: 10px; height: 10px; background: var(--blue); animation: dot-blink 1.2s infinite steps(1); }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dot-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.wait-box {
  margin-top: 24px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 2px dashed var(--blue);
  border-radius: 6px;
  background-image: var(--hatch);
  font-size: 15px;
  font-weight: 900;
}

.error-text { min-height: 0; margin: 0; color: var(--danger); font-size: 14px; font-weight: 900; }
.error-text:empty { display: none; }

/* ---------- アバター ---------- */

.avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--av-bg, var(--blue));
  color: var(--av-fg, var(--paper));
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}
.avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.avatar.xs { width: 28px; height: 28px; font-size: 12px; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.avatar.offline {
  border: 2px dashed var(--ink-muted);
  background: var(--paper);
  background-image: repeating-linear-gradient(-45deg, transparent 0 4px, rgba(30, 42, 85, 0.18) 4px 6px);
  color: var(--ink-muted);
}

/* ---------- 入力 ---------- */

.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field-label label, .field-label .label { font-size: 15px; font-weight: 900; }
.counter { font-family: var(--font-mono); font-weight: 500; font-size: 13px; color: var(--ink-muted); }
.counter.end { align-self: flex-end; }

.field {
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  border: 2.5px solid var(--blue);
  border-radius: 6px;
  background: var(--paper-hi);
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  outline: none;
  transition: box-shadow 120ms ease, border-color 120ms ease;
}
textarea.field { padding: 14px 16px; line-height: 1.5; resize: none; }
.field::placeholder { color: var(--off); font-weight: 700; }
.field:focus, .field:focus-visible { border-color: var(--pink); box-shadow: 4px 4px 0 var(--blue); outline: none; }
.field[aria-invalid="true"] { border-color: var(--danger); }

.code-boxes { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.code-boxes span {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--blue);
  border-radius: 6px;
  background: var(--paper-hi);
  font-family: var(--font-mono);
  font-size: 30px;
  color: var(--blue);
}
.code-boxes input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  font-size: 16px;
  border: 0;
  cursor: text;
}
.code-boxes:focus-within span.active { border-color: var(--pink); box-shadow: 4px 4px 0 var(--blue); }
.code-boxes.invalid span { border-color: var(--danger); }

.stepper { display: flex; align-items: center; justify-content: space-between; padding: 8px; border: 2px dashed var(--blue); border-radius: 6px; }
.stepper output { font-family: var(--font-mono); font-weight: 500; font-size: 44px; line-height: 1; color: var(--blue); text-shadow: 3px 2px 0 var(--pink); }
.stepper button {
  width: 56px;
  height: 56px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--blue);
  border-radius: 6px;
  background: var(--paper);
  color: var(--blue);
}
.stepper button svg { width: 22px; height: 22px; }
.stepper button:disabled { border-style: dashed; border-color: var(--off); color: var(--off); }
.stepper.compact { padding: 0; border: 0; flex: 1; }
.stepper.compact output { font-size: 28px; text-shadow: none; }
.stepper.compact button { width: 48px; height: 44px; }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice {
  position: relative;
  min-height: 112px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 2.5px solid var(--blue);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
}
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice b { display: flex; justify-content: space-between; align-items: center; font-size: 17px; font-weight: 900; }
.choice b svg { width: 20px; height: 20px; visibility: hidden; }
.choice small { font-size: 13px; line-height: 1.5; color: var(--ink-muted); }
.choice:has(input:checked) { background: var(--blue); color: var(--paper); box-shadow: 5px 5px 0 var(--pink); }
.choice:has(input:checked) small { color: var(--paper); }
.choice:has(input:checked) b svg { visibility: visible; }
.choice:has(input:focus-visible) { outline: 3px solid var(--pink); outline-offset: 2px; }

.segmented { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 2.5px solid var(--blue); border-radius: 6px; overflow: hidden; }
.segmented button { min-height: 44px; border: 0; background: var(--paper); color: var(--blue); font-size: 15px; font-weight: 900; }
.segmented button[aria-pressed="true"] { background: var(--blue); color: var(--paper); }

/* ---------- ホーム ---------- */

.home {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 0 22px calc(30px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.home-art { position: absolute; inset: 0; pointer-events: none; }
.home-art i { position: absolute; display: block; }
.home-art .rule { left: 0; right: 0; top: 74px; height: 4px; background: var(--blue); }
.home-art .disc { left: -96px; top: 150px; width: min(270px, 64vw); height: min(270px, 64vw); border-radius: 50%; background: var(--blue); mix-blend-mode: multiply; }
.home-art .dots-disc { left: -44px; top: 205px; width: min(270px, 62vw); height: min(270px, 62vw); border-radius: 50%; background-image: var(--halftone); background-size: 8px 8px; mix-blend-mode: multiply; }
.home-art .bubble { left: 40px; top: 470px; width: 120px; height: 84px; border-radius: 42px; background: var(--pink); mix-blend-mode: multiply; }
.home-art .bubble-tail { left: 118px; top: 540px; width: 24px; height: 24px; background: var(--pink); transform: rotate(35deg); mix-blend-mode: multiply; }
.home-art .bubble-line { left: 46px; top: 476px; width: 120px; height: 84px; border-radius: 42px; border: 2.5px solid var(--blue); }

.home-top { position: relative; height: 78px; display: flex; align-items: center; justify-content: flex-end; }

.home-logo-wrap { position: relative; flex: 1; min-height: 0; display: flex; justify-content: flex-end; padding-top: 26px; }
.home-logo {
  margin: 0;
  writing-mode: vertical-rl;
  font-weight: 900;
  line-height: 1;
  --logo: clamp(58px, 11.5dvh, 96px);
}
.home-logo span { display: block; }
.home-logo .logo-small { margin-left: 8px; font-size: calc(var(--logo) * 0.48); color: var(--ink); text-shadow: 3px 3px 0 var(--pink); }
.home-logo .logo-big { font-size: var(--logo); letter-spacing: -0.04em; color: var(--blue); text-shadow: 5px 4px 0 var(--pink); }

.home-actions { position: relative; margin-top: 28px; background: var(--paper); box-shadow: 0 -12px 0 var(--paper); display: flex; flex-direction: column; gap: 14px; }

.resume {
  margin-bottom: 6px;
  padding: 14px 8px 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2.5px solid var(--blue);
  border-radius: 6px;
  background: var(--pink-tint);
}
.resume > div { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.resume b { font-family: var(--font-mono); font-weight: 500; font-size: 22px; letter-spacing: 2px; color: var(--blue); }
.resume .btn { box-shadow: 3px 3px 0 var(--blue); }
.resume .icon-btn { border: 0; background: transparent; color: var(--ink); }

/* ---------- 設定・参加フォーム ---------- */

.setup-form { padding-top: 24px; display: flex; flex-direction: column; gap: 26px; }
.setup-form fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; }
.setup-form legend { padding: 0; margin-bottom: 8px; font-size: 15px; font-weight: 900; }
.range-note { align-self: center; font-family: var(--font-mono); font-weight: 500; font-size: 13px; color: var(--ink-muted); }

/* ---------- 接続 ---------- */

.center-stage { flex: 1; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.center-stage h1 { margin: 36px 0 0; font-size: 26px; font-weight: 900; line-height: 1.35; }
.center-stage p { margin: 10px 0 0; font-size: 15px; line-height: 1.7; color: var(--ink-muted); }
.center-stage .code { font-family: var(--font-mono); font-weight: 500; font-size: 22px; letter-spacing: 3px; color: var(--blue); }

.orb { position: relative; width: 200px; height: 200px; }
.orb .disc { position: absolute; left: 0; top: 0; width: 170px; height: 170px; border-radius: 50%; background: var(--blue); mix-blend-mode: multiply; }
.orb .dots-disc { position: absolute; left: 30px; top: 30px; width: 170px; height: 170px; border-radius: 50%; background-image: var(--halftone); background-size: 8px 8px; mix-blend-mode: multiply; }
.orb .dots { position: absolute; left: 50px; top: 76px; gap: 10px; }
.orb .dots i { width: 14px; height: 14px; background: var(--paper); }

.retry-mark { position: relative; width: 150px; height: 150px; }
.retry-mark::before { content: ""; position: absolute; left: 14px; top: 14px; width: 136px; height: 136px; background-image: var(--halftone); background-size: 8px 8px; }
.retry-mark span { position: absolute; inset: 0 14px 14px 0; display: flex; align-items: center; justify-content: center; border: 3px solid var(--blue); background: var(--paper); color: var(--blue); }
.retry-mark svg { width: 64px; height: 64px; }

.notice {
  position: sticky;
  top: 72px;
  z-index: 18;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--ink);
  color: var(--paper);
}
.notice .dots i { width: 9px; height: 9px; background: var(--pink); }
.notice > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.notice b { font-size: 15px; font-weight: 900; }
.notice small { font-size: 12px; font-weight: 700; }
.notice .btn { min-height: 44px; width: auto; padding: 0 12px; font-size: 14px; box-shadow: none; background: var(--pink); color: var(--ink); }

.host-recovery {
  margin: 16px 18px 0;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 2.5px solid var(--ink);
  background: var(--pink-tint);
  box-shadow: 4px 4px 0 var(--pink);
}
.host-recovery > div { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 900; }
.host-recovery .btn { min-height: 50px; font-size: 16px; box-shadow: 3px 3px 0 var(--ink); }

/* ---------- 待合室 ---------- */

.ticket {
  margin-top: 18px;
  padding: 14px 14px 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 2.5px solid var(--blue);
  border-radius: 6px;
  background: var(--pink-tint);
  box-shadow: 5px 5px 0 var(--blue);
}
.ticket > div { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 12px; }
.ticket strong { font-family: var(--font-mono); font-weight: 500; font-size: clamp(30px, 9vw, 38px); letter-spacing: 4px; color: var(--blue); text-shadow: 2px 2px 0 var(--pink); }
.ticket-cut { align-self: stretch; border-left: 2px dashed var(--blue); }
.ticket button {
  width: 76px;
  min-height: 60px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  border-radius: 6px;
  background: var(--blue);
  color: var(--paper);
  font-size: 12px;
  font-weight: 900;
}
.ticket button svg { width: 22px; height: 22px; }

.member-list { display: flex; flex-direction: column; }
.member-row { min-height: 56px; display: flex; align-items: center; gap: 12px; border-bottom: 2px dashed var(--rule); }
.member-row .name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.member-row .name b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-row .name small { font-size: 12px; color: var(--ink-muted); }
.member-row.offline .name b { color: var(--ink-muted); }
.kick-button { width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--ink-muted); display: inline-flex; align-items: center; justify-content: center; }
.kick-button svg { width: 16px; height: 16px; }

.settings-box { margin-top: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px; border: 2px dashed var(--blue); border-radius: 6px; }
.settings-row { display: flex; align-items: center; gap: 12px; }
.settings-row > span { width: 64px; font-size: 14px; font-weight: 900; }
.settings-chips { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; }

.test-tools { margin-top: 28px; padding: 16px; border: 2px dashed var(--ink-muted); display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.test-tools p { margin: 0; color: var(--ink-muted); }
.test-tools .btn { min-height: 48px; font-size: 15px; }

/* ---------- お題・回答 ---------- */

.title-row { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.title-row h1 { margin: 0; font-size: 24px; font-weight: 900; }

.suggestions { display: flex; flex-direction: column; gap: 10px; }
.suggestions button {
  min-height: 54px;
  padding: 12px 16px;
  border: 2px dashed var(--blue);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}
.suggestions button:hover { background: var(--pink-tint); }
.reroll { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--blue); font-size: 15px; font-weight: 900; display: inline-flex; align-items: center; gap: 6px; }
.reroll svg { width: 18px; height: 18px; }

.thinker { margin-top: 110px; align-self: center; position: relative; width: 200px; height: 180px; }
.thinker .shade { position: absolute; left: 6px; top: 20px; width: 150px; height: 150px; border-radius: 50%; background-image: var(--halftone); background-size: 8px 8px; }
.thinker .avatar { position: absolute; left: 34px; top: 0; width: 130px; height: 130px; font-size: 56px; }
.thinker .bubble { position: absolute; right: -8px; top: 96px; padding: 8px 12px; border: 2.5px solid var(--blue); border-radius: 22px; background: var(--paper); }
.thinker .dots i { width: 9px; height: 9px; }
.thinker-title { margin: 34px 0 0; font-size: 24px; font-weight: 900; text-align: center; line-height: 1.4; }

.random-q { position: relative; margin-top: 90px; display: flex; flex-direction: column; gap: 14px; }
.random-q .q-mark { font-family: var(--font-mono); font-size: 40px; line-height: 1; color: var(--pink); }
.random-q h1 { margin: 0; font-size: clamp(28px, 8.6vw, 36px); font-weight: 900; line-height: 1.3; color: var(--blue); text-shadow: 3px 3px 0 var(--pink); overflow-wrap: anywhere; }
.random-q .meta { display: flex; align-items: center; gap: 12px; }
.random-art { position: relative; height: 230px; margin-top: 36px; pointer-events: none; }
.random-art i { position: absolute; display: block; border-radius: 50%; }
.random-art .dots-disc { right: -90px; top: 20px; width: 260px; height: 260px; background-image: var(--halftone); background-size: 8px 8px; }
.random-art .disc { right: 40px; top: 0; width: 170px; height: 170px; background: var(--blue); mix-blend-mode: multiply; }

.answer-form { display: flex; flex-direction: column; gap: 6px; }
.parent-stamp { position: relative; margin-top: 26px; }
.parent-stamp .stamp { position: relative; }
.parent-art { position: absolute; left: 150px; top: -14px; width: 78px; height: 78px; border-radius: 50%; background-image: var(--halftone); background-size: 8px 8px; pointer-events: none; }

.envelope { position: relative; margin: 80px auto 0; width: 236px; height: 170px; }
.envelope::before { content: ""; position: absolute; left: 18px; top: 18px; width: 218px; height: 150px; background-image: var(--halftone); background-size: 8px 8px; }
.envelope svg.env { position: absolute; left: 0; top: 0; width: 218px; height: 150px; }
.envelope .seal { position: absolute; left: 86px; top: 60px; width: 46px; height: 46px; border-radius: 50%; background: var(--pink); border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.envelope .seal svg { width: 20px; height: 20px; }
.done-stage { display: flex; flex-direction: column; align-items: center; text-align: center; }
.done-stage h1 { margin: 40px 0 0; font-size: 28px; font-weight: 900; color: var(--blue); text-shadow: 3px 2px 0 var(--pink); }
.done-stage .progress { margin-top: 22px; }
.done-stage p { margin: 14px 0 0; font-size: 14px; color: var(--ink-muted); }

/* ---------- 投票 ---------- */

.answer-grid { display: flex; flex-direction: column; gap: 10px; }
.vote-card {
  min-height: 60px;
  padding: 0;
  display: flex;
  align-items: stretch;
  border: 2px solid var(--blue);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  overflow: hidden;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.vote-letter {
  flex-shrink: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 2px dashed var(--blue);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 20px;
  color: var(--blue);
}
.vote-text { flex: 1; align-self: center; padding: 12px 14px; overflow-wrap: anywhere; }
.vote-check { align-self: center; margin-right: 14px; width: 22px; height: 22px; flex-shrink: 0; visibility: hidden; }
.vote-card.selected { background: var(--blue); color: var(--paper); font-weight: 900; transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--pink); }
.vote-card.selected .vote-letter { color: var(--paper); border-right-color: var(--paper); }
.vote-card.selected .vote-check { visibility: visible; }
.vote-card.mine {
  border-style: dashed;
  border-color: var(--off);
  background-image: var(--hatch);
  color: var(--off-text);
  cursor: default;
}
.vote-card.mine .vote-letter { color: var(--off-text); border-right-color: var(--off); }
.vote-card.mine .tag { align-self: center; margin-right: 12px; }

.wait-head { margin: 22px 0 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.wait-head h1 { margin: 0; font-size: 28px; font-weight: 900; line-height: 1.3; color: var(--blue); text-shadow: 3px 2px 0 var(--pink); }
.wait-head .mono { font-size: 30px; color: var(--blue); }

.own-answer { margin-top: 24px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; border: 2.5px solid var(--ink); background: var(--pink-tint); }
.own-answer span { font-size: 12px; font-weight: 900; }
.own-answer b { font-size: 18px; font-weight: 900; overflow-wrap: anywhere; }

/* ---------- 答えあわせ ---------- */

.reveal-hero {
  position: relative;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 3px solid var(--blue);
  border-radius: 6px;
  background: var(--pink-tint);
  box-shadow: 6px 6px 0 var(--blue);
  overflow: hidden;
}
.reveal-hero::before { content: ""; position: absolute; right: -46px; bottom: -46px; width: 112px; height: 112px; border-radius: 50%; background-image: var(--halftone); background-size: 8px 8px; }
.reveal-hero > * { position: relative; }
.reveal-hero .stamp { align-self: flex-start; }
.reveal-hero p { margin: 0; font-size: 26px; font-weight: 900; line-height: 1.32; overflow-wrap: anywhere; }
.voters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.voters .names { font-size: 14px; }
.points-big { margin-left: auto; padding: 2px 12px; background: var(--blue); color: var(--paper); font-family: var(--font-mono); font-weight: 500; font-size: 20px; }

.reveal-list { margin-top: 22px; display: flex; flex-direction: column; }
.reveal-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 2px dashed var(--rule); }
.reveal-row:last-child { border-bottom: 0; }
.reveal-row .letter { font-family: var(--font-mono); font-weight: 500; font-size: 17px; color: var(--blue); }
.reveal-row .what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.reveal-row .what b { font-size: 15px; overflow-wrap: anywhere; }
.reveal-row .what small { font-size: 12px; color: var(--ink-muted); }
.reveal-row .avatars { display: flex; gap: 4px; }
.reveal-row .pts { font-family: var(--font-mono); font-weight: 500; font-size: 16px; color: var(--blue); }
.reveal-row .zero { font-family: var(--font-mono); font-weight: 500; font-size: 14px; color: var(--ink-muted); }

/* ---------- スコア・結果 ---------- */

.scoreboard { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.score-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--blue); border-radius: 6px; }
.score-row.top { border-width: 3px; background: var(--pink-tint); box-shadow: 5px 5px 0 var(--blue); }
.score-row .rank { width: 30px; font-family: var(--font-mono); font-weight: 500; font-size: 22px; color: var(--blue); }
.score-row.top .rank { font-size: 26px; }
.score-row .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.score-row .who b { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score-row .delta { padding: 1px 8px; background: var(--pink); font-family: var(--font-mono); font-weight: 500; font-size: 14px; }
.score-row .total { min-width: 56px; text-align: right; font-family: var(--font-mono); font-weight: 500; font-size: 20px; color: var(--blue); }
.next-parent { margin: 22px 0 0; font-size: 14px; color: var(--ink-muted); }
.next-parent b { color: var(--ink); font-weight: 900; }

.winner { position: relative; height: 270px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; }
.winner .disc { position: absolute; left: 50%; top: 14px; width: 220px; height: 220px; margin-left: -130px; border-radius: 50%; background: var(--blue); mix-blend-mode: multiply; }
.winner .dots-disc { position: absolute; left: 50%; top: 40px; width: 220px; height: 220px; margin-left: -80px; border-radius: 50%; background-image: var(--halftone); background-size: 8px 8px; mix-blend-mode: multiply; }
.winner .crown { position: absolute; left: 50%; top: 34px; width: 84px; height: 64px; margin-left: -40px; }
.winner-avatars { position: relative; margin-bottom: 18px; display: flex; gap: 10px; }
.winner-avatars .avatar { width: 104px; height: 104px; font-size: 46px; border: 4px solid var(--ink); background: var(--paper); color: var(--blue); }
.winner-avatars.many .avatar { width: 76px; height: 76px; font-size: 32px; }
.winner-title { margin: 0; text-align: center; font-size: clamp(30px, 9.6vw, 38px); font-weight: 900; line-height: 1.2; color: var(--blue); text-shadow: 4px 3px 0 var(--pink); overflow-wrap: anywhere; }
.winner-pts { margin: 6px 0 0; text-align: center; font-family: var(--font-mono); font-weight: 500; font-size: 22px; }
.final-list { margin: 20px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.final-list li { display: flex; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 2px dashed var(--rule); }
.final-list li:last-child { border-bottom: 0; }
.final-list .rank { width: 24px; font-family: var(--font-mono); font-weight: 500; font-size: 17px; color: var(--blue); }
.final-list b { flex: 1; font-size: 15px; }
.final-list .total { font-family: var(--font-mono); font-weight: 500; font-size: 16px; color: var(--blue); }

/* ---------- メニュー・遊び方 ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(30, 42, 85, 0.62);
}
.sheet {
  width: 100%;
  max-width: var(--screen-max);
  max-height: 92dvh;
  overflow-y: auto;
  padding: 20px 20px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--paper);
  border-top: 4px solid var(--blue);
  border-radius: 14px 14px 0 0;
  outline: none;
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sheet-head > div { display: flex; flex-direction: column; gap: 2px; }
.sheet-head .mono { font-size: 13px; color: var(--blue); }
.sheet-head h2 { margin: 0; font-size: 26px; font-weight: 900; }
.icon-btn.close svg { width: 18px; height: 18px; }

.menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  min-height: 58px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 2.5px solid var(--blue);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
}
.menu-item svg { width: 20px; height: 20px; color: var(--blue); }
.switch { position: relative; width: 52px; height: 30px; border-radius: 4px; background: var(--paper); border: 2.5px solid var(--off); }
.switch i { position: absolute; left: 3px; top: 3px; width: 19px; height: 19px; border-radius: 2px; background: var(--off); transition: left 120ms ease; }
.menu-item[aria-pressed="true"] .switch { background: var(--blue); border-color: var(--blue); box-shadow: 3px 3px 0 var(--pink); }
.menu-item[aria-pressed="true"] .switch i { left: 25px; background: var(--paper); }
.menu-section { padding-top: 14px; border-top: 2px dashed var(--rule); display: flex; flex-direction: column; gap: 10px; }
.menu-section h3 { margin: 0; font-size: 14px; font-weight: 900; }
.menu-section p { margin: 0; font-size: 14px; color: var(--ink-muted); }
.transfer-list { display: flex; flex-wrap: wrap; gap: 8px; }
.transfer-list button { min-height: 44px; padding: 0 14px; border: 2px solid var(--blue); border-radius: 6px; background: var(--paper); color: var(--blue); font-size: 15px; font-weight: 900; }

.sheet.rules { min-height: 70dvh; }
.rule-steps { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 18px; }
.rule-steps li { display: flex; align-items: center; gap: 16px; font-size: 17px; font-weight: 900; line-height: 1.5; }
.rule-steps .num { flex-shrink: 0; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: var(--blue); color: var(--paper); box-shadow: 3px 3px 0 var(--pink); font-family: var(--font-mono); font-weight: 500; font-size: 22px; }
.rule-steps .num.line { background: transparent; border: 2.5px solid var(--blue); color: var(--blue); box-shadow: none; }
.rule-steps .num svg { width: 22px; height: 22px; }
.score-card { position: relative; padding: 18px; display: flex; flex-direction: column; gap: 12px; border: 2.5px solid var(--blue); border-radius: 6px; background: var(--pink-tint); box-shadow: 5px 5px 0 var(--blue); overflow: hidden; }
.score-card::after { content: ""; position: absolute; right: -36px; top: -44px; width: 104px; height: 104px; border-radius: 50%; background-image: var(--halftone); background-size: 8px 8px; }
.score-card > * { position: relative; z-index: 1; }
.score-card h3 { margin: 0; font-size: 17px; font-weight: 900; }
.score-card div { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; }
.score-card div + div { padding-top: 12px; border-top: 2px dashed var(--blue); }
.score-card div b { font-family: var(--font-mono); font-weight: 500; font-size: 26px; color: var(--blue); }

/* ---------- 演出 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(128px + var(--safe-bottom));
  z-index: 80;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 4px 4px 0 var(--pink);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-kind="error"] { box-shadow: 4px 4px 0 var(--danger); }

.screen-transition-wipe { position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden; }
.screen-transition-wipe > i { position: absolute; left: 0; width: 100%; height: 34%; transform: translateX(-130%); }
.screen-transition-wipe > i:nth-child(1) { top: 0; background: var(--blue); }
.screen-transition-wipe > i:nth-child(2) { top: 33%; background-color: var(--paper); background-image: var(--halftone); background-size: 8px 8px; }
.screen-transition-wipe > i:nth-child(3) { top: 66%; background: var(--pink); }

.confetti-layer { position: fixed; inset: 0; z-index: 75; pointer-events: none; overflow: hidden; }
.confetti { position: absolute; top: -20px; width: 10px; height: 14px; animation: confetti-fall 2.4s ease-in forwards; }
@keyframes confetti-fall {
  to { transform: translate(var(--drift, 0), 110vh) rotate(540deg); }
}

/* ---------- サイト情報 ---------- */

.site-footer { padding: 24px 20px calc(28px + var(--safe-bottom)); border-top: 2px dashed var(--blue); font-size: 13px; text-align: center; }
.site-footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
.site-footer a { display: inline-flex; min-height: 44px; align-items: center; color: var(--ink); text-decoration-color: var(--pink); }
.site-credit { margin: 6px 0 0; color: var(--ink-muted); }
body:not(.is-home) .site-footer-links { display: none; }

/* ---------- PC：同じ紙面を中央に置き、余白に版の飾りを刷る ---------- */

@media (min-width: 900px) {
  body::before, body::after {
    content: "";
    position: fixed;
    z-index: -1;
    border-radius: 50%;
    pointer-events: none;
  }
  body::before { left: -140px; bottom: -160px; width: 520px; height: 520px; background: var(--blue); opacity: 0.9; }
  body::after { right: -120px; top: 80px; width: 460px; height: 460px; background-image: var(--halftone); background-size: 9px 9px; }
  .screen, .home { border-left: 2.5px solid var(--blue); border-right: 2.5px solid var(--blue); box-shadow: 10px 0 0 var(--pink); }
  .home { max-width: 520px; }
  .sheet { border-left: 2.5px solid var(--blue); border-right: 2.5px solid var(--blue); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .screen-transition-wipe, .confetti-layer { display: none; }
}

/* ---------- 補助 ---------- */

.body { position: relative; }
.screen-fill { flex: 1; display: flex; flex-direction: column; }
.dock .wait-box { margin-top: 0; }
.code-boxes:has(input[aria-invalid="true"]) span { border-color: var(--danger); }
.btn-line[href] { display: inline-flex; }

/* 背の低い画面では吹き出しの飾りが操作に重なるので刷らない */
@media (max-height: 760px) {
  .home-art .bubble, .home-art .bubble-tail, .home-art .bubble-line { display: none; }
  .home-art .disc { top: 120px; }
  .home-art .dots-disc { top: 160px; }
}
