/* Ballot Box: 集まりの投票箱。木の箱、紙の票、鉛筆。色は暗い机に明るい紙（暗いモード専用は作らない）。
   インラインの style 属性と <style> は使わない（CSP）。動きは transform と opacity だけ。 */
:root {
  --desk: #3b281a; --desk-2: #5a3d28;
  --oak: #b98a56; --oak-shadow: #7a5230; --oak-hi: #d9b37e;
  --paper: #f3ebd8; --rule: #c9bfa5; --print: #2a2a2a;
  --graphite: #4a4a50; --seal: #a3322a; --red-pencil: #c9584d; --brass: #b08a3c;
  --on-desk: #f3ebd8; --on-desk-soft: rgba(243, 235, 216, .82);
  --serif: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  --sans: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  --dock-h: 120px;
}
html[lang="en"] { --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--desk); color: var(--on-desk); font: 16px/1.55 var(--serif); }
/* 文書そのものが指で送れる。紙や箱の上から引いても字が選ばれない（入力欄と URL の札だけ選べる） */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overflow-x: hidden; }
textarea, input, .url-plate, .sendline { -webkit-user-select: text; user-select: text; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse 90% 60% at 50% 12%, rgba(255, 226, 170, .26), rgba(0, 0, 0, 0) 70%), radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .55) 100%), url(/assets/desk-backdrop.jpg) center / cover no-repeat, linear-gradient(var(--desk-2), var(--desk)); }
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.offscreen { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }

#app, .shell { min-height: 100vh; min-height: 100dvh; }
/* 上の帯: 左に言語と音。右の 64px は「作った話と感想」のために空ける */
.bar { position: fixed; top: 0; left: 0; right: 0; height: 48px; display: flex; align-items: center; gap: 8px; padding: 2px 68px 2px 10px; z-index: 20; }
.lang { display: flex; gap: 6px; }
.tab { min-height: 44px; min-width: 44px; padding: 0 10px; border: 2px solid rgba(243, 235, 216, .45); border-radius: 4px; background: rgba(0, 0, 0, .25); color: var(--on-desk); font: 600 14px var(--sans); display: inline-flex; align-items: center; justify-content: center; }
.lang .tab[aria-pressed="true"] { background: var(--paper); color: #3b281a; border-color: var(--paper); }
.tab.sound[aria-pressed="false"] { opacity: .75; }

/* 中身は文書の流れに置く（指で送れる）。下端の帯の高さぶんの余白を、全部の画面の一番下に取る */
.stage { position: relative; padding: 48px 0 calc(var(--dock-h) + 16px); min-height: 100dvh; }
.stage > div { max-width: 480px; margin: 0 auto; padding: 4px 16px 20px; animation: screenIn .3s ease-out; }
@keyframes screenIn { from { opacity: 0; } to { opacity: 1; } }

/* 下端の固定のボタン。主ボタンは常に一番下 */
.dock { position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; z-index: 15; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(40, 26, 16, .97) 80%, rgba(40, 26, 16, 0)); }
.dock.empty { padding-top: 0; padding-bottom: 12px; min-height: 8px; background: none; }
.dock-msg { margin: 0; color: #ffd3c9; font: 600 14px/1.4 var(--sans); text-align: center; }
.btn { min-height: 44px; width: 100%; border-radius: 6px; border: 2px solid var(--on-desk); background: transparent; color: var(--on-desk); font: 700 16px var(--sans); padding: 0 16px; }
.btn.primary { min-height: 56px; background: var(--paper); color: #2b1c10; border-color: var(--oak-hi); box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3px rgba(60, 40, 20, .35), 0 2px 8px rgba(0, 0, 0, .35); font-size: 18px; }
.btn.primary.seal, .btn.danger { background: var(--seal); color: #fff6ea; border-color: #d27a6f; box-shadow: inset 0 0 0 2px var(--seal), inset 0 0 0 3px rgba(255, 220, 200, .35), 0 2px 8px rgba(0, 0, 0, .4); }
.btn:active { transform: translateY(1px); }
.btn.arming { pointer-events: none; opacity: .35; }
.dock-create .btn.secondary { border-color: transparent; text-decoration: underline; text-underline-offset: 4px; }

.stamp { min-height: 44px; padding: 0 14px; border: 2px solid currentColor; border-radius: 4px; background: transparent; color: var(--on-desk); font: 600 15px var(--sans); display: inline-flex; align-items: center; gap: 8px; }
.stamp.strong { background: rgba(243, 235, 216, .14); }
.stamp.done { background: var(--paper); color: #2b1c10; }
.paper .stamp { color: #3b281a; }
.stamp-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* 紙 */
.paper { position: relative; background: url(/assets/paper-grain.jpg) center / 256px, var(--paper); background-blend-mode: multiply; color: var(--print); border-radius: 3px; padding: 18px 16px; box-shadow: 0 1px 0 #fff8 inset, 0 8px 22px rgba(0, 0, 0, .45); overflow-wrap: anywhere; }
.paper::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 3px; background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 60%, rgba(150, 110, 40, .18) 100%); }
.paper > * { position: relative; z-index: 1; }
.ballot { transform: rotate(-.5deg); transition: transform .4s ease, opacity .5s ease; transform-origin: 50% 50%; }
.ballot.folding { transform: rotate(-.5deg) scale(.4, .3); }
.ballot.dropping { transform: translateY(var(--drop-y, 200px)) scale(.14, .08); opacity: 0; transition: transform .5s ease-in, opacity .5s ease-in; }
.question { margin: 0 0 12px; font: 700 26px/1.4 var(--serif); }
.question.small { font-size: 20px; color: var(--on-desk); text-align: center; margin: 4px 0 12px; }
.paper .question { color: var(--print); }
.rule-label { font: 600 12px var(--sans); letter-spacing: .06em; color: #6e6450; margin-bottom: 2px; }
.note { margin: 10px 0 0; font-size: 14px; color: var(--on-desk-soft); }
.paper .note { color: #4a4438; }
.note.strong { color: inherit; font-weight: 700; }
.ballot .note.strong { color: #2a2a2a; }
.choices { list-style: none; margin: 0; padding: 0; }
.choice { position: relative; display: flex; gap: 12px; align-items: flex-start; width: 100%; min-height: 56px; padding: 15px 10px; background: none; border: 0; border-bottom: 1px solid var(--rule); text-align: left; font-size: 19px; line-height: 1.4; color: var(--print); }
.choice .bullet { flex: none; margin-top: 3px; }
.ctext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.choice:focus-visible { outline: 2px solid var(--seal); outline-offset: -2px; }
.pencil-oval { position: absolute; left: -2px; top: 4px; width: calc(100% + 4px); height: calc(100% - 8px); pointer-events: none; opacity: 0; overflow: visible; transition: opacity .2s ease; }
.pencil-path { stroke-dasharray: 2600; stroke-dashoffset: 2600; transition: stroke-dashoffset 0s .2s; }
.inked > .choice .pencil-oval, .pencil-oval.inked { opacity: 1; }
.inked > .choice .pencil-path, .pencil-oval.inked .pencil-path { stroke-dashoffset: 0; transition: stroke-dashoffset .3s ease-out; }
.pencil-art { position: absolute; right: -6px; top: var(--py, 0); opacity: 0; pointer-events: none; z-index: 3; transform: rotate(-35deg); }
.pencil-art.go { animation: pencilMove .7s ease-out; }
.sending { text-align: center; color: var(--on-desk); margin: 8px 0 0; font: 600 14px var(--sans); }
.vote-wrap { padding-bottom: 30px; }
.box-slot-area { margin-top: 14px; display: flex; justify-content: center; }

/* 木の箱 */
.box { position: relative; margin: 0 auto; width: var(--bw, 220px); }
.box-s { --bw: 190px; } .box-m { --bw: 210px; } .box-l { --bw: 250px; }
.box-svg { display: block; width: 100%; height: auto; overflow: visible; }
.box-seal, .box-inside { opacity: 0; transition: opacity .5s; }
.box[data-sealed="1"] .box-seal { opacity: 1; }
.box[data-open="1"] .box-inside { opacity: 1; }
.box-lid { transform-box: fill-box; transform-origin: 50% 0; transition: transform .6s ease-out; }
.box[data-open="1"] .box-lid { transform: translateY(-30px) scaleY(.4); }
.box.tearing .box-seal { animation: sealTear .8s ease-in forwards; }
.box-layer { position: absolute; inset: 0; pointer-events: none; }
.drop-paper { position: absolute; left: 50%; top: 22%; width: 34px; height: 44px; margin-left: -17px; background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); animation: dropPaper .5s ease-in forwards; }
.drop-paper.own { animation-duration: .6s; }
.box.bump .box-svg { animation: bump .32s ease-out; }
.breathe .box-svg { animation: breathe 12s ease-in-out infinite; }

.create-wrap { padding-top: 0; }
.tagline { margin: 4px 0 12px; font-size: 14.5px; line-height: 1.55; color: var(--on-desk-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.paper.draft { transform: rotate(-.3deg); }
.field { display: block; width: 100%; min-height: 44px; margin: 0; padding: 9px 4px; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: transparent; color: #1c1c1c; font: 18px/1.5 var(--serif); resize: none; overflow: hidden; }
.field.q { font-size: 21px; font-weight: 700; }
.field:focus { outline: none; border-bottom: 2px solid var(--seal); padding-bottom: 8px; }
.field::placeholder { color: #9b917a; font-weight: 400; }
.field.penned { color: var(--graphite); }
.field.shake, .shake { animation: shake .4s; }
.line { position: relative; display: flex; gap: 10px; align-items: flex-start; }
.line .bullet { flex: none; margin-top: 12px; }
.line .field { flex: 1; min-width: 0; }
.need-oval { position: absolute; left: -4px; top: 0; width: calc(100% + 8px); height: 100%; opacity: 0; }
.remain { display: block; min-height: 0; font: 12px var(--sans); color: #8a3a30; text-align: right; }
.paper .stamp { margin-top: 12px; }
.need { min-height: 1.6em; margin: 10px 2px 0; color: #ffc9be; font: 600 14px/1.4 var(--sans); }

.heading { margin: 4px 0 14px; font: 700 22px/1.4 var(--serif); color: var(--on-desk); }
.url-plate { padding: 14px; background: var(--paper); color: var(--print); border-radius: 4px; border: 1px dashed #8c7a52; box-shadow: 0 4px 12px rgba(0, 0, 0, .4); font: 17px/1.5 var(--serif); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.url-plate.small { font-size: 13px; margin-top: 8px; }
.sendcard { margin-top: 12px; }
.sendline { margin: 6px 0 0; font-size: 16px; overflow-wrap: anywhere; user-select: all; }
.count { text-align: center; margin: 10px 0 0; font: 700 22px var(--serif); color: var(--on-desk); }
.count.big { font-size: 30px; margin-top: 14px; }
.created-wrap .box { margin-top: 18px; }
.admin-keep { margin-top: 16px; color: var(--on-desk-soft); font-size: 14px; }
.admin-keep summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }

.wait-wrap, .closed-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; }
.voted-line { margin: 6px 0 4px; font: 700 17px var(--serif); color: var(--oak-hi); }
.conn { min-height: 1.2em; margin: 0; font: 13px var(--sans); color: #ffd9a0; }
.closed-text { margin: 16px 0 0; font: 700 20px/1.5 var(--serif); }

.reveal-wrap { display: flex; flex-direction: column; }
.reveal-status { min-height: 1.5em; margin: 8px 0 0; text-align: center; font: 600 14px var(--sans); color: var(--oak-hi); }
.reveal-box { position: relative; min-height: 190px; padding-top: 70px; }
.ballot-card { position: absolute; left: 50%; top: 0; width: 230px; margin-left: -115px; z-index: 4; padding: 10px 12px; background: var(--paper); color: var(--print); border-radius: 3px; text-align: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .5); transform-origin: 50% 100%; will-change: transform, opacity; }
.card-q { font-size: 12px; color: #6e6450; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.card-choice { position: relative; margin-top: 6px; padding: 8px 10px; font: 700 18px/1.3 var(--serif); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-choice .pencil-oval { opacity: 1; }
.card-choice .pencil-path { stroke-dashoffset: 0; }

.tallysheet { padding: 8px 14px; }
.trow { position: relative; padding: 8px 2px 6px; border-bottom: 1px solid var(--rule); }
.trow:last-child { border-bottom: 0; }
.rhead { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rname { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; background: none; text-align: left; font: 600 17px/1.4 var(--serif); color: var(--print); overflow-wrap: anywhere; }
button.rname { min-height: 44px; display: -webkit-box; align-items: center; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.clamp.open { -webkit-line-clamp: unset; }
.rcount { flex: none; font: 700 15px var(--serif); color: #5a5040; }
.tally-wrap { display: flex; flex-wrap: wrap; gap: 6px; min-height: 30px; margin-top: 2px; }
.tally-group { display: block; width: 26px; height: 30px; overflow: visible; }
.tally-stroke.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: strokeIn .18s ease-out forwards; }
.win-oval { position: absolute; left: -6px; top: 2px; width: calc(100% + 12px); height: calc(100% - 4px); opacity: 0; pointer-events: none; }
.trow.winner .win-oval { opacity: 1; }
.trow.winner .win-oval .pencil-path { stroke-dashoffset: 0; transition: stroke-dashoffset .5s ease-out; }
.trow.winner .rname { font-weight: 800; }

.result-wrap .headline { margin: 4px 0 6px; font: 800 25px/1.35 var(--serif); text-align: center; color: var(--on-desk); overflow-wrap: anywhere; }
.result-wrap .sub { margin: 0 0 10px; text-align: center; color: var(--on-desk-soft); }
.totals { display: flex; justify-content: space-between; gap: 12px; margin: 12px 4px 0; font: 17px var(--serif); }
.anon { margin: 10px 4px 0; font: 600 14px var(--serif); color: var(--oak-hi); text-align: center; }
.result-wrap .stamp-row { justify-content: center; }

.status-wrap { padding-top: 24px; text-align: center; }
.status-text { font: 600 18px/1.6 var(--serif); margin: 18px 0; }
.paper .status-text { color: var(--print); margin: 6px 0; }
.desk-empty { height: 120px; border-radius: 6px; background: rgba(0, 0, 0, .15); }
.skeleton .ghost { height: 150px; opacity: .22; animation: pulse 3s ease-in-out infinite; }
.skeleton .box { margin-top: 16px; opacity: .3; animation: pulse 3s ease-in-out infinite; }
.loading-text { text-align: center; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 480px; margin: 0 auto; z-index: 40; padding: 20px 16px calc(16px + env(safe-area-inset-bottom)); background: var(--paper); color: var(--print); border-radius: 14px 14px 0 0; box-shadow: 0 -12px 34px rgba(0, 0, 0, .55); animation: sheetIn .35s ease-out; }
.sheet-text { margin: 0 0 18px; font: 700 18px/1.5 var(--serif); }
.sheet-actions { display: flex; gap: 24px; }
.sheet .btn { flex: 1; min-height: 56px; }
.sheet .btn.secondary { color: #3b281a; border-color: #3b281a; }

@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes pencilMove { 0% { opacity: 1; transform: translate(-30px, 8px) rotate(-35deg); } 80% { opacity: 1; transform: translate(0, 0) rotate(-35deg); } 100% { opacity: 0; transform: translate(14px, -6px) rotate(-35deg); } }
@keyframes dropPaper { 0% { opacity: 0; transform: translateY(-120px) rotate(-10deg) scale(1.2); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px) rotate(4deg) scale(.5, .15); } }
@keyframes bump { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(3px) scaleY(.985); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.012); } }
@keyframes sealTear { 0% { opacity: 1; transform: translateY(0) rotate(0); } 60% { opacity: 1; transform: translateY(-4px) rotate(-3deg); } 100% { opacity: 0; transform: translateY(-30px) rotate(-12deg); } }
@keyframes strokeIn { to { stroke-dashoffset: 0; } }
@keyframes sheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: .15; } 50% { opacity: .32; } }

@media (prefers-reduced-motion: reduce) {
  .breathe .box-svg { animation: none; }
  .ballot, .box-lid, .pencil-path { transition-duration: .01ms !important; }
  .pencil-art.go { animation: none; }
  .tally-stroke.draw { animation: none; stroke-dasharray: none; }
}
@media (min-width: 600px) { .stage > div { padding-left: 24px; padding-right: 24px; } .box-l { --bw: 280px; } }
@media (max-height: 700px) { .box-l { --bw: 190px; } .count.big { font-size: 26px; } .question { font-size: 23px; } }

/* 仕上げ: 鉛筆の丸は選択肢の頭の丸に濃く、選んだ行は太字と淡い色の帯でも分かる */
.bwrap { position: relative; flex: none; width: 20px; height: 20px; margin-top: 3px; }
.choice .pencil-oval.bullet-oval { left: -6px; top: -6px; width: 32px; height: 32px; }
.inked > .choice { background: rgba(163, 50, 42, .07); }
.inked > .choice .ctext { font-weight: 800; }
.ballot.folding { transition: transform .28s ease; }
.ballot.dropping { transition: transform .33s ease-in, opacity .33s ease-in; }
.grip { touch-action: none; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 44px; margin-top: 8px; padding-top: 6px; cursor: grab; user-select: none; -webkit-user-select: none; }
.grip-bar { width: 56px; height: 5px; border-radius: 3px; background: #8c7a52; }
.grip-label { font: 12px var(--sans); color: #6e6450; text-align: center; }
.hero { display: flex; align-items: center; gap: 14px; margin: 2px 0 14px; }
.hero .box { --bw: 124px; flex: none; margin: 0; }
.hero .paper.mini { flex: 1; min-width: 0; padding: 6px 12px; transform: rotate(.6deg); }
.mrow { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.mname { flex: none; width: 5.5em; font: 600 14px var(--serif); color: var(--print); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow .tally-wrap { min-height: 30px; margin: 0; gap: 2px; flex-wrap: nowrap; overflow: hidden; }
.mrow .tally-group { width: 24px; height: 28px; flex: none; }
.dock-create .btn.secondary { border: 2px solid rgba(243, 235, 216, .7); text-decoration: none; background: rgba(243, 235, 216, .1); font-size: 15px; min-height: 48px; }
@media (max-height: 700px) { .hero .box { --bw: 96px; } .hero .paper.mini { padding: 2px 10px; } .mrow { min-height: 34px; } }
.hero .drop-paper { animation-name: heroDrop; }
@keyframes heroDrop { 0% { opacity: 0; transform: translateY(-46px) rotate(-10deg) scale(1); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px) rotate(4deg) scale(.5, .15); } }
/* PC: 開票は左に箱と開かれる票、右に正の字の紙 */
@media (min-width: 900px) {
  .stage > div.reveal-wrap { max-width: 1000px; display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "q q" "box sheet"; column-gap: 40px; align-items: start; }
  .reveal-wrap .question { grid-area: q; }
  .reveal-wrap .tallysheet { grid-area: sheet; }
  .reveal-wrap .reveal-status { display: none; }
  .reveal-wrap .reveal-box { grid-area: box; padding-top: 90px; }
  .reveal-wrap .box-m { --bw: 300px; }
}
.share .bar, .share .dock, .share [class*="dafb"], .share .reveal-status { display: none !important; }

/* ---- 工程7: 票をつかんで箱の口へ運ぶ。折られて運ばれ、口に吸い込まれる ---- */
.ballot { transform: none; rotate: -.5deg; scale: 1; translate: 0 0; transform-origin: var(--ox, 50%) var(--oy, 50%); transition: scale .28s ease, translate .3s ease, opacity .3s ease; }
.ballot.folding, .ballot.carrying { transform: none; scale: .4 .3; }
.ballot.carrying { transition: scale .2s ease; box-shadow: 0 14px 28px rgba(0, 0, 0, .55); z-index: 14; }
.ballot.returning { transition: scale .3s ease, translate .3s ease; }
.ballot.dropping { transform: none; opacity: 0; transition: opacity .05s; }
.ballot.gone { visibility: hidden; }
.grip { touch-action: none; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px; min-height: 56px; margin: 12px -6px -6px; padding: 8px 12px; border-top: 2px dashed #8c7a52; border-radius: 0 0 3px 3px; background: rgba(90, 60, 30, .1); cursor: grab; }
.grip:active { cursor: grabbing; }
.grip-ridges { flex: none; display: flex; flex-direction: column; gap: 4px; }
.grip-ridges i { display: block; width: 28px; height: 3px; border-radius: 2px; background: #6b5a38; }
.grip-label { font: 700 13px/1.3 var(--sans); color: #4a3d24; text-align: left; }
.grip-bar { display: none; }
.sending { position: absolute; left: 0; right: 0; top: -22px; margin: 0; text-align: center; color: var(--on-desk); font: 600 14px var(--sans); pointer-events: none; }
.box-slot-area { position: sticky; bottom: calc(var(--dock-h) + 2px); z-index: 12; margin: 10px -16px 0; padding: 22px 0 6px; justify-content: center; background: linear-gradient(to top, rgba(59, 40, 26, .92) 62%, rgba(59, 40, 26, 0)); }
.box-slot-area .box-s { --bw: 128px; }
.vote-wrap { padding-bottom: 6px; }
.fly-layer { position: fixed; left: 0; right: 0; top: 0; overflow: hidden; z-index: 13; pointer-events: none; }
.fly-paper { position: absolute; background: var(--paper); border: 1px solid var(--rule); border-radius: 2px; box-shadow: 0 2px 5px rgba(0, 0, 0, .35); will-change: transform; }
.fly-paper::after { content: ""; position: absolute; left: 18%; right: 18%; top: 38%; height: 2px; background: #1d1d22; opacity: .7; box-shadow: 0 6px 0 #1d1d22; }
.box.bump .box-svg { animation: bump .26s ease-out; }
@keyframes bump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(2px); } 70% { transform: translateY(-1px); } }
/* 開いたふたは箱の後ろに立てかける */
.box[data-open="1"] .box-lid { transform: scaleY(-.55); }
.box[data-open="1"] .box-lid .slot { opacity: 0; }
/* 選んだ印は太く濃く */
.inked > .choice { background: rgba(163, 50, 42, .13); }
.inked > .choice .ctext { font-weight: 800; color: #000; }
/* 数字の書体をそろえる */
.count, .rcount, .totals, .mname { font-family: var(--sans); font-variant-numeric: lining-nums tabular-nums; }
.count { font-weight: 700; }
.demo-tag { margin: 8px 0 0; padding: 6px 10px; border: 1.5px dashed var(--oak-hi); border-radius: 4px; color: var(--oak-hi); font: 600 13px/1.4 var(--sans); text-align: center; }
.next-step { margin: 10px 4px 0; padding: 10px 12px; border-radius: 4px; background: rgba(243, 235, 216, .12); color: var(--on-desk); font: 600 15px/1.5 var(--serif); text-align: center; }
.dock-note { margin: 0; color: var(--on-desk-soft); font: 600 13px/1.4 var(--sans); text-align: center; }
.sheet-note { margin: -10px 0 14px; font: 600 14px/1.5 var(--sans); color: #6e2b24; }
@media (prefers-reduced-motion: reduce) { .ballot { transition-duration: .01ms !important; } }
.win-oval { left: -6px; right: auto; width: calc(100% - 58px); }
.box.near .box-svg { filter: drop-shadow(0 0 8px rgba(255, 226, 170, .8)); }

/* ---- 周回1 A: 下端の帯は透けない地。上の縁に短いぼかし（字1行ぶんより短い）だけ ---- */
.dock { background: #281a10; box-shadow: 0 -1px 0 rgba(243, 235, 216, .12); }
.dock::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 12px; pointer-events: none; background: linear-gradient(to top, #281a10, rgba(40, 26, 16, 0)); }
.dock.empty { background: none; box-shadow: none; }
.dock.empty::before { display: none; }
.dock-msg, .dock-note { min-height: 0; }
/* 長い切れ目のない字は折る（質問、選択肢、見出し） */
.question, .headline, .rname, .ctext, .closed-text, .voted-line, .card-choice, .card-q, .mname, .sendline, .heading, .status-text { overflow-wrap: anywhere; word-break: normal; }
.wait-wrap > *, .closed-wrap > * { max-width: 100%; min-width: 0; }
.mname { overflow-wrap: normal; }
/* 低い画面では見本の絵を畳む（最初の位置で「選択肢を足す」が帯の後ろに入らない） */
@media (max-height: 700px) { .hero { display: none; } }
/* 開票の間は下端に主ボタンを置かない。結果へ飛ばすは小さな字のリンク */
.skip-row { display: flex; justify-content: flex-end; margin: 0; }
.skip-link { min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--on-desk-soft); font: 500 13px var(--sans); text-decoration: underline; text-underline-offset: 3px; }
.dock.reveal-dock { display: none; }

/* ---- 周回1 B: 二つ折りの票。上の半分が下の半分に折り重なって箱から出て、上の辺が持ち上がって開く ---- */
.ballot-card { padding: 0; background: none; box-shadow: none; display: flex; flex-direction: column; width: 230px; margin-left: -115px; }
.bc-top { position: relative; z-index: 2; transform-origin: 50% 100%; transform-style: preserve-3d; will-change: transform; }
.bc-face { background: var(--paper); border-radius: 3px 3px 0 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 -4px 14px rgba(0, 0, 0, .35); }
.bc-face.front { padding: 10px 12px 6px; text-align: center; }
.bc-face.back { position: absolute; inset: 0; transform: rotateX(180deg); background: linear-gradient(to top, #d9cdb0, var(--paper) 55%); box-shadow: 0 -2px 8px rgba(0, 0, 0, .3); }
.bc-low { position: relative; z-index: 1; padding: 4px 12px 10px; background: var(--paper); border-radius: 0 0 3px 3px; text-align: center; box-shadow: 0 8px 20px rgba(0, 0, 0, .5); }
.bc-low::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: rgba(110, 100, 80, .35); }
.card-choice { min-height: 2.4em; }
.card-choice .pencil-oval { opacity: 0; }
.card-choice .pencil-path { stroke-dashoffset: 2600; }
.card-choice .pencil-oval.inked { opacity: 1; }
.card-choice .pencil-oval.inked .pencil-path { stroke-dashoffset: 0; }
.bc-blank { margin-top: 2px; font: 600 11px var(--sans); color: #8a7f68; letter-spacing: .08em; }
.ballot-card[data-blank="1"] .card-choice { min-height: 2.4em; }
@media (min-width: 900px) { .reveal-wrap .skip-row { grid-column: 1 / -1; } }

/* ---- 周回1 C: QR と結果の画像 ---- */
.qr-panel { margin: 4px 0 12px; padding: 16px 12px 12px; background: var(--paper); color: var(--print); border-radius: 6px; text-align: center; box-shadow: 0 6px 18px rgba(0, 0, 0, .45); }
.qr-svg { display: block; width: 240px; height: 240px; max-width: 100%; margin: 0 auto; background: #fff; }
.qr-hint { margin: 10px 0 0; font: 600 14px/1.4 var(--sans); color: #4a4438; }
.image-error { margin: 0 0 8px; text-align: center; color: #ffd3c9; font: 600 14px/1.4 var(--sans); }
.stamp:disabled { opacity: .6; }

/* ===== 周回2: 机の上に、箱と紙が置いてある ===== */
/* 机の絵が見えなかった原因: body 自身の背景が、z-index:-1 の絵の前面に塗られていた。body は透明にし、机は固定の層に置く */
html { background: #4a3322; }
body { background: transparent; }
body::before { z-index: -2; background: url(/assets/desk-backdrop.jpg) center / cover no-repeat, #5a3d28; filter: brightness(1.5) contrast(1.08) saturate(1.12); }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 90% 55% at 50% 22%, rgba(255, 226, 170, .2), rgba(0, 0, 0, 0) 70%), radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, .45) 100%); }
/* 机の上の字は、濃い木の札の上に置く（机の絵の上に細い字を直接置かない） */
.tagline, .note, .count, .voted-line, .conn, .heading, .question.small, .headline, .result-wrap .sub, .anon, .totals, .sending, .need, .closed-text, .image-error, .reveal-status, .status-text, .loading-text { background: rgba(28, 18, 10, .74); border-radius: 6px; padding: 6px 12px; max-width: 100%; }
.conn:empty, .need:empty, .reveal-status:empty, .sending[hidden] { background: none; padding: 0; }
.demo-tag, .next-step { background: rgba(28, 18, 10, .78); }
.paper .note, .paper .status-text, .sheet .note { background: none; padding: 0; border-radius: 0; }
.stamp:not(.done) { background-color: rgba(28, 18, 10, .62); }
.paper .stamp { background-color: transparent; }
.tab { background: rgba(28, 18, 10, .7); }
.lang .tab[aria-pressed="true"] { background: var(--paper); }
.question.small, .headline { display: block; }
.url-plate, .qr-panel { box-shadow: 0 2px 3px rgba(0, 0, 0, .4), 0 14px 26px rgba(0, 0, 0, .45); }
/* 紙は机に落ちる影を二重にして、厚みを出す */
.paper { box-shadow: 0 1px 0 #fff8 inset, 0 1px 1px rgba(0, 0, 0, .5), 0 10px 16px -4px rgba(0, 0, 0, .55), 0 26px 40px rgba(0, 0, 0, .35); }
.box-svg { filter: drop-shadow(0 8px 8px rgba(0, 0, 0, .4)); }
.box .box-body { }
/* 下端の帯は、同じ調子の濃い木。後ろの字は透けない */
.dock { background: linear-gradient(rgba(28, 17, 9, .86), rgba(28, 17, 9, .86)), url(/assets/wood-grain.jpg) 0 0 / 220px, #281a10; background-color: #281a10; }
.dock::before { background: linear-gradient(to top, rgba(28, 17, 9, .9), rgba(28, 17, 9, 0)); }
.box-slot-area { background: none; padding-top: 22px; }

/* 開いた箱: ふたは後ろの蝶番で立てかかる。箱の口の縁に板の厚み */
.box[data-open="1"] .box-lid .slot, .box[data-open="1"] .box-lid .slot-rim { opacity: 0; }
.box[data-open="1"] .box-lid { transform: scaleY(-.62); }
.box-inside { transition: opacity .5s; }
.box-lid .lid-edge { }
/* 投票の後に箱が動く間は、画面のふわっと出る動きを付けない */
.stage > div.from-box { animation: none; }

/* 紙: 開く途中の票は紙の色のまま（灰色に沈めない）。二つ折りの票の裏は折り目つきの紙 */
.bc-face.back { background: url(/assets/paper-folded.webp) center / 100% 100%, var(--paper); box-shadow: 0 -2px 6px rgba(0, 0, 0, .22); }
.bc-face { background: url(/assets/paper-grain.jpg) center / 256px, var(--paper); background-blend-mode: multiply; }
.bc-face.back { background-blend-mode: normal; }
.bc-low { background: url(/assets/paper-grain.jpg) center / 256px, var(--paper); background-blend-mode: multiply; }

/* 結果の鉛筆の丸: 選択肢の名前を囲む大きさ（字の幅 + 余白）。正の字と隣の行にかぶらない */
.trow { padding: 16px 2px 8px; }
.rhead { gap: 26px; }
.namebox { position: relative; flex: 0 1 auto; min-width: 0; max-width: calc(100% - 78px); margin-left: 8px; }
.namebox .rname { flex: none; display: block; width: auto; max-width: 100%; }
button.namebox .rname { min-height: 0; }
.namebox .rname.clamp { display: -webkit-box; min-height: 28px; padding: 3px 0; }
.trow .win-oval, .namebox .win-oval { left: -18px; right: auto; top: -8px; width: calc(100% + 36px); height: calc(100% + 16px); opacity: 0; }
.trow.winner .win-oval { opacity: 1; }
.tally-wrap { margin-top: 12px; }
/* 投票中の鉛筆の丸は、細い手書きの線。印刷の丸 ○ の上に二重にせず、選んだ丸は鉛筆で塗り替わる */
.choice .pencil-oval.bullet-oval { left: -4px; top: -4px; width: 28px; height: 28px; }
.inked > .choice .bullet circle { opacity: .15; }

/* 利用者の文（質問、選択肢、見出し、札、帯の中）は、切れ目のない長い英字でも折り返す */
.question, .headline, .sub, .next-step, .anon, .totals, .totals > *, .note, .tagline, .demo-tag, .sheet-text, .sheet-note, .dock-msg, .dock-note, .qr-hint, .conn, .need, .image-error, .url-plate, .rcount, .rname, .closed-text, .voted-line, .count, .reveal-status, .heading, .status-text, .stamp, .sendline, .rule-label { overflow-wrap: anywhere; min-width: 0; }
.result-wrap, .wait-wrap, .closed-wrap, .created-wrap, .create-wrap, .status-wrap, .vote-wrap, .reveal-wrap { min-width: 0; max-width: 100%; }
.stamp { max-width: 100%; }
.totals { justify-content: center; }

/* 画面の高さに合わせて、箱と余白を詰める。大事な行（票の数、待っている文、URL とコピーと QR の入口）が帯の上に全部収まる */
.box-l { --bw: clamp(112px, 24dvh, 250px); }
.box-m { --bw: clamp(120px, 26dvh, 210px); }
.count.big { font-size: clamp(22px, 4.2dvh, 30px); margin-top: clamp(4px, 1.6dvh, 14px); }
.wait-wrap .note, .closed-wrap .note { margin-top: clamp(4px, 1dvh, 10px); }
.created-wrap .heading { margin-bottom: clamp(6px, 1.6dvh, 14px); }
@media (max-height: 700px) {
  .stage > div { padding-top: 0; }
  .question.small { margin: 0 0 6px; font-size: 18px; padding: 3px 10px; }
  .demo-tag { margin-top: 4px; padding: 3px 8px; }
  .wait-wrap .box, .closed-wrap .box { margin-top: 4px; }
  .voted-line { margin: 2px 0; font-size: 15px; padding: 2px 10px; }
  .closed-text { margin-top: 8px; font-size: 18px; }
  .note { font-size: 13px; padding: 4px 10px; line-height: 1.45; }
  .heading { font-size: 19px; margin: 0 0 8px; padding: 3px 10px; }
  .url-plate { padding: 10px; font-size: 15px; }
  .stamp-row { margin: 8px 0; }
  .dock { gap: 8px; padding-top: 10px; }
}

/* PC: 箱と紙を机の中央に大きく置く */
@media (min-width: 900px) {
  body::before { background-image: url(/assets/desk-props.jpg); background-size: 150% auto; background-position: right bottom; } /* 小物（鉛筆、封蝋、消しゴム）が帯や字の後ろに半分隠れないよう、机の中央の空いた所だけを見せる */
  .stage { display: flex; flex-direction: column; justify-content: center; padding-top: 72px; }
  .stage > div { width: 100%; max-width: 680px; }
  .stage > div.reveal-wrap { max-width: 1120px; }
  .dock { max-width: 680px; }
  .box-s { --bw: 240px; } .box-m { --bw: 340px; } .box-l { --bw: 420px; }
  .paper { padding: 28px 32px; }
  .question { font-size: 32px; }
  .question.small { font-size: 26px; }
  .choice { font-size: 22px; min-height: 64px; }
  .count.big { font-size: 38px; }
  .heading { font-size: 28px; }
  .reveal-wrap .box-m { --bw: 440px; }
  .reveal-box { min-height: 360px; padding-top: 170px; }
  .ballot-card { width: 300px; margin-left: -150px; }
  .tallysheet { padding: 14px 22px; }
  .rname { font-size: 22px; }
  .hero { margin-bottom: 22px; }
}
.created-wrap .box { --bw: clamp(104px, 19dvh, 210px); margin-top: clamp(6px, 1.6dvh, 18px); }
@media (min-width: 900px) { .created-wrap .box { --bw: 260px; } }

/* ---- 周回2 QA: N8 箱が着いてから票の数の札を出す。N9 PC の投票は紙と箱を横に並べる ---- */
.stage > div.from-box .count, .stage > div.from-box .voted-line { animation: lateIn .2s ease-out .4s backwards; }
@keyframes lateIn { from { opacity: 0; } to { opacity: 1; } }
@media (min-width: 900px) {
  .stage > div.vote-wrap { max-width: 1040px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; column-gap: 48px; align-items: center; padding-bottom: 20px; }
  .vote-wrap .demo-tag { grid-column: 1 / -1; }
  .vote-wrap .box-slot-area { position: relative; bottom: auto; margin: 0; padding: 0; background: none; }
  .vote-wrap .box-slot-area .box-s { --bw: 340px; }
}

/* 周回3: 続きの部屋の札、前に作った部屋の一覧、最初の画面への入口 */
.next-note { margin: 0 0 10px; padding: 10px 12px; border: 2px solid var(--brass); border-radius: 4px; background: rgba(28, 18, 10, .86); color: var(--oak-hi); font: 700 15px/1.4 var(--sans); text-align: center; overflow-wrap: anywhere; }
.home-link { display: block; margin: 8px auto 0; }
.next-mode .heading { margin-top: 4px; }
/* 周回3: 線を引いている間、その行を少し強める */
.trow { transition: background-color .15s ease-out, box-shadow .15s ease-out; }
.trow.drawing { background: rgba(176, 138, 60, .22); box-shadow: inset 4px 0 0 var(--brass); }
.trow.drawing .rname { font-weight: 800; }

/* 周回3（初見の確認4人目）: 空の札は出さない（j07）、見本の紙は箱の周りだけ（j01）、選んだ丸を塗る（j05）、質問の上限（j24） */
.note:empty, .sub:empty, .conn:empty, .count:empty, .closed-text:empty, .reveal-status:empty, .voted-line:empty, .headline:empty, .dock-msg:empty { display: none; }
@keyframes heroDrop { 0% { opacity: 0; transform: translateY(-20px) rotate(-10deg) scale(1); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px) rotate(4deg) scale(.5, .15); } }
.hero .box { clip-path: inset(0 -10px -24px -10px); }
.inked > .choice .bullet circle { opacity: 1; fill: #2c2c34; fill-opacity: .88; }
.field.q.at-limit { box-shadow: 0 0 0 2px var(--seal); border-radius: 3px; }
.remain.zero { font: 700 14px var(--sans); color: var(--seal); }

/* 周回4: 結果は紙1枚を主役に。上の札は1枚の見出しにまとめ、保存・コピー・合計は紙の下。帯は主ボタン1つ、副は小さく */
.result-head { margin: 0 0 8px; padding: 6px 12px 8px; border-radius: 6px; background: rgba(28, 18, 10, .8); text-align: center; }
.result-head .question.small, .result-head .headline, .result-head .sub, .result-head .next-step { background: none; padding: 0; border-radius: 0; margin: 0; }
.result-head .question.small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; font-weight: 600; line-height: 1.35; color: var(--on-desk-soft); }
.result-head .headline { font-size: 22px; line-height: 1.3; margin-top: 2px; }
.result-head .sub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 1.35; }
.result-head .next-step { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(243, 235, 216, .22); font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--on-desk); }
.result-wrap .tallysheet { margin-top: 0; }
.result-wrap .totals { margin-top: 12px; }
.btn.secondary.small { min-height: 38px; font-size: 14px; font-weight: 600; border-width: 1.5px; }
.dock-note.next-note { margin: 0; padding: 4px 10px; font-size: 14px; border-width: 1.5px; }
.bar { background: linear-gradient(rgba(28, 18, 10, .94) 72%, rgba(28, 18, 10, 0)); pointer-events: none; }
.bar > * { pointer-events: auto; }
@media (max-height: 700px) { .result-head .headline { font-size: 20px; } .result-head { padding: 4px 10px 6px; margin-bottom: 6px; } }
/* 周回4: 前に作った部屋。1行を「…」に省く、一覧から外す入口 */
/* 周回4: 部屋ができた画面の控え、最初の画面への入口は上、例の札は「例を入れる」ボタン */
.home-row { display: flex; justify-content: flex-end; margin: -2px 0 -4px; }
.home-row .home-link { margin: 0; min-height: 36px; padding: 0 8px; border-radius: 4px; background: rgba(28, 18, 10, .7); }
.stub { margin-top: 12px; padding: 10px 14px 12px; }
.stub-q { margin: 2px 0 6px; font: 700 17px/1.4 var(--serif); color: var(--print); overflow-wrap: anywhere; }
.stub-list { margin: 0; padding: 0 0 0 20px; font: 15px/1.5 var(--serif); color: #3b3025; }
.stub-list li { overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chips-label { flex: 0 0 100%; margin: 0; font: 600 13px var(--sans); color: var(--on-desk-soft); }
.chip { border-style: dashed; border-width: 1.5px; background-color: rgba(28, 18, 10, .62); box-shadow: none; outline: none; }
.chip::before { content: "+ "; opacity: .8; }
.chip:focus, .chip:active, .chip:hover { background-color: rgba(28, 18, 10, .62); outline: none; }
.create-wrap .field, .create-wrap .stamp { scroll-margin-bottom: calc(var(--dock-h, 120px) + 24px); scroll-margin-top: 64px; }
/* 周回4: 開票の溜め（並んでいる行を強め、ほかを薄くして「あと N 枚」）。出る票の字は長くても紙の中で折り返す・縮める */
.tallysheet.holding .trow { transition: opacity .2s ease-out, background-color .2s ease-out; }
.trow.hold-on { background: rgba(176, 138, 60, .26); box-shadow: inset 4px 0 0 var(--brass); }
.trow.hold-dim { opacity: .45; }
.rleft { flex: none; margin-right: 8px; padding: 0 6px; border-radius: 3px; background: var(--brass); color: #fff8e8; font: 700 12px/1.6 var(--sans); white-space: nowrap; }
.rhead .rleft { align-self: center; }
.card-choice[data-fit="m"] { font-size: 15px; -webkit-line-clamp: 3; }
.card-choice[data-fit="l"] { font-size: 13px; line-height: 1.25; -webkit-line-clamp: 4; }
.card-choice[data-fit="xl"] { font-size: 12px; line-height: 1.2; -webkit-line-clamp: 5; }
.card-choice[data-fit="m"], .card-choice[data-fit="l"], .card-choice[data-fit="xl"] { padding: 6px 8px; }
.ballot-card, .bc-top, .bc-face, .bc-low { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .tallysheet.holding .trow { transition: none; } }

/* ---- 周回5: 投票用の URL の1行、作った人の印、合言葉 ---- */
.voteurl-note, .host-mark, .pass-note, .gate-note-desk { margin: 8px 0 0; padding: 6px 12px; border-radius: 6px; background: rgba(28, 18, 10, .78); color: var(--on-desk); font: 600 13.5px/1.5 var(--sans); overflow-wrap: anywhere; min-width: 0; max-width: 100%; }
.host-mark { font-weight: 500; font-size: 12.5px; color: var(--on-desk-soft); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.lock-badge { display: inline-block; padding: 1px 8px; border: 1.5px solid var(--on-desk-soft); border-radius: 999px; font-weight: 700; white-space: nowrap; }
.lock-badge::before { content: "🔒 "; }
.pass-block { margin-top: 8px; display: grid; gap: 8px; justify-items: start; }
.pass-block .pass-note { margin: 0; }
.pass-block .note { margin: 0; }
.pass-plate { padding: 10px 14px; background: var(--paper); color: var(--print); border-radius: 4px; border: 1px dashed #8c7a52; font: 700 20px/1.4 var(--serif); overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; max-width: 100%; }
.pass-wrap { margin-top: 12px; }
.pass-toggle { display: flex; gap: 8px; align-items: center; min-height: 44px; max-width: 100%; padding: 6px 12px; border: 1.5px dashed rgba(243, 235, 216, .5); border-radius: 6px; background: rgba(28, 18, 10, .78); color: var(--on-desk); font: 600 14px/1.4 var(--sans); text-align: left; overflow-wrap: anywhere; }
.pass-toggle[aria-expanded="true"] .pt-mark { display: inline-block; transform: rotate(90deg); }
.pass-body { margin-top: 8px; padding: 10px 12px; border-radius: 4px; background: var(--paper); color: var(--print); box-shadow: 0 6px 16px rgba(0, 0, 0, .4); }
.pass-body[hidden] { display: none; }
.pass-body .note { margin: 6px 0 0; padding: 0; background: none; color: #4a4438; font-size: 13px; }
.gate-wrap { display: grid; justify-items: center; gap: 14px; padding-top: 8px; min-width: 0; max-width: 100%; }
.gate-wrap .box { margin: 0; }
.gate-paper { width: 100%; max-width: 420px; transform: rotate(-.4deg); }
.gate-title { margin: 0 0 6px; font: 700 20px/1.4 var(--serif); color: var(--print); overflow-wrap: anywhere; }
.gate-paper .note { margin: 0 0 8px; }
.gate-error { margin: 8px 0 0; font: 700 14px/1.45 var(--sans); color: #8a1f12; overflow-wrap: anywhere; }
.gate-error[hidden] { display: none; }
.next-mode .note[data-testid="next-pass-inherit"] { margin-top: 10px; }

/* 周回5 R4-3: 選択肢が多く長くても、開票の間は箱と開く紙が画面の中（スマホは箱を画面の下端に貼る。名前は1行に省く。タップで全文） */
.reveal-wrap .rname.clamp:not(.open) { -webkit-line-clamp: 1; }
@media (max-width: 899px) {
  .reveal-wrap .reveal-box { position: sticky; bottom: 6px; z-index: 12; margin: 0 -16px; padding-bottom: 6px; background: linear-gradient(to top, rgba(59, 40, 26, .94) 72%, rgba(59, 40, 26, 0)); }
}
.pass-field { scroll-margin-bottom: calc(var(--dock-h, 120px) + 24px); }
.pass-body { scroll-margin-bottom: calc(var(--dock-h, 120px) + 24px); }
.ballot-card .card-choice { max-height: calc(2.6em + 16px); }
@media (max-width: 899px) { .reveal-wrap .reveal-box { bottom: 14px; } }

/* 周回6: 部屋ができた画面の整理（暗い板をやめ、URL の紙と合言葉の紙の中の小さな1行にする） */
.url-card, .pass-card { padding: 10px 14px; background: url(/assets/paper-grain.jpg) center / 256px, var(--paper); background-blend-mode: multiply; color: var(--print); border-radius: 4px; border: 1px dashed #8c7a52; box-shadow: 0 2px 3px rgba(0, 0, 0, .4), 0 12px 22px rgba(0, 0, 0, .4); min-width: 0; max-width: 100%; }
.url-card .url-plate, .pass-card .pass-plate { padding: 0; background: none; border: 0; box-shadow: none; border-radius: 0; }
.url-card .url-plate { font-size: 17px; }
.pass-card .pass-plate { font-size: 20px; }
.card-note, .created-wrap .card-note { margin: 6px 0 0; padding: 0; border-radius: 0; background: none; color: #4a4438; font: 600 13px/1.45 var(--sans); }
.pass-card .pass-later { margin: 0; color: var(--print); font: 600 14px/1.5 var(--sans); }
.created-wrap .pass-block { margin-top: 10px; display: grid; gap: 8px; justify-items: stretch; }
.created-wrap .pass-block .stamp { justify-self: start; }
.created-wrap .buttons, .created-wrap .stamp-row { margin-top: 8px; }
@media (max-height: 700px) { .created-wrap .url-card, .created-wrap .pass-card { padding: 8px 12px; } .created-wrap .heading { font-size: 20px; } }
/* 合言葉の欄の下の字 */
.pass-hint { margin: 0 0 2px; color: #4a4438; font: 600 13px/1.4 var(--sans); }
.pass-msg { margin: 4px 0 0; color: #4a4438; font: 600 13px/1.4 var(--sans); }
.pass-msg.bad { color: #8a1f12; font-weight: 700; }
.pass-msg[hidden] { display: none; }
/* 入口の画面: 待つ間は「入る」を押せない。紙の上に理由 */
.btn.primary:disabled, .btn.primary.is-waiting { opacity: .45; cursor: not-allowed; }
.gate-error.waiting { color: #6b3a10; }

/* 周回6: 開票の溜めの札は箱の上に1つ。決まった枚の印 */
.reveal-box { position: relative; }
@media (max-width: 899px) { .reveal-wrap .reveal-box { position: sticky; } }
.hold-tag { position: absolute; z-index: 13; top: -2px; right: 14px; padding: 2px 10px; border-radius: 3px; background: var(--brass); color: #fff8e8; font: 700 14px/1.6 var(--sans); white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.hold-tag[hidden] { display: none; }
.trow.hold-dim { opacity: .5; }
.decided-mark { position: absolute; right: 8px; top: -13px; z-index: 3; display: flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 3px; background: #f4ecd4; color: #5a3f1c; border: 1px dashed #8c7a52; font: 700 12px/1.5 var(--sans); transform: rotate(-2deg); box-shadow: 0 2px 4px rgba(0, 0, 0, .3); white-space: nowrap; }
.decided-mark[hidden] { display: none; }
.decided-mark .pencil-art { width: 28px; height: 7px; }
.tallysheet { margin-top: 14px; }
.pass-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; justify-content: space-between; }
.pass-row .pass-plate { flex: 1 1 100px; min-width: 0; }
.pass-row .stamp { flex: none; margin: 0; min-height: 44px; padding: 6px 12px; }
.created-wrap .pass-block { gap: 0; }
@media (max-height: 700px) {
  .created-wrap .heading { font-size: 18px; line-height: 1.3; margin: 2px 0 6px; padding: 4px 10px; }
  .created-wrap .stamp-row { margin: 6px 0; }
  .created-wrap .url-card, .created-wrap .pass-card { padding: 6px 12px; }
  .created-wrap .count { margin-top: 6px; padding: 2px 10px; font-size: 18px; }
  .created-wrap .pass-block { margin-top: 6px; }
  .created-wrap .stub { margin-top: 8px; padding: 6px 12px 8px; }
  .home-row .home-link { min-height: 32px; }
}

/* 周回7 A: 投票の帯。選ぶ前は押せない案内、白票は小さな文字のリンク */
.btn.primary.is-hint { background: rgba(243, 235, 216, .14); color: var(--on-desk-soft); border-color: rgba(243, 235, 216, .35); box-shadow: none; font-weight: 600; font-size: 16px; opacity: 1; cursor: default; }
.dock-link { align-self: center; width: auto; min-height: 36px; margin: 0; padding: 0 10px; font-size: 14px; }

/* 周回7 B/D: 決まった瞬間。1位の正の字を囲む鉛筆の線、決まった1画の横の矢印、「N枚目で決まり」の紙片 */
.trow.decided-row .tally-wrap { position: relative; }
.decided-mark.drop { animation: tagDrop .2s ease-out; }
@keyframes tagDrop { from { opacity: 0; transform: translateY(-14px) rotate(-6deg); } to { opacity: 1; transform: translateY(0) rotate(-2deg); } }
.box.hop { animation: boxHop .26s ease-out; }
@keyframes boxHop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-7px); } 70% { transform: translateY(1px); } }
@media (prefers-reduced-motion: reduce) { .decided-mark.drop, .box.hop { animation: none; } .decided-ring.draw .pencil-path { transition: none; } }
.closed-count { margin: 14px 0 0; padding: 0 12px; font: 700 17px var(--serif); color: var(--on-desk); }
.closed-count:empty { display: none; }
.closed-count + .closed-text { margin-top: 10px; }
@media (max-height: 700px) { .created-wrap .pass-card .pass-later { font-size: 13px; line-height: 1.4; } .created-wrap .count { margin-top: 4px; } }
.round-note { margin: 2px 0 6px; text-align: center; font: 600 13px/1.4 var(--sans); color: var(--on-desk-soft); }
.next-step.is-gone { visibility: hidden; } /* R4-2: 続きの札が届いても、場所は空けたまま（紙が上がらない） */
@media (max-height: 700px) { .created-wrap .stub .rule-label { display: none; } .created-wrap .stub-q { margin-top: 0; } } /* N6-1: 低い画面では控えの「質問」の札を省いて、質問を帯の上に収める */

/* 周回8 0: 選択肢の欄の右に鉛筆の×（消す）。紙の下に「空の欄は使いません」 */
.line-del { flex: none; width: 44px; min-height: 44px; margin: 0; padding: 0; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; opacity: .7; }
.line-del[hidden] { display: none; }
.line-del:hover, .line-del:focus-visible { opacity: 1; outline: none; }
.line-del:focus-visible .pencil-cross { outline: 2px solid var(--seal); outline-offset: 2px; }
.empty-note { margin: 6px 0 0; font: 12px/1.4 var(--sans); color: #6e6450; text-align: right; }

/* 周回8 L7: 溜めの札は箱の口に差した小さな紙の札（紙の色、鉛筆の字、細い影）。「N枚目で決まり」は破線をやめ、紙の縁と細い影だけの付箋 */
.hold-tag { top: -4px; padding: 3px 12px 4px; border-radius: 2px; background: var(--paper); color: var(--graphite); font: 700 15px/1.5 var(--serif); letter-spacing: .02em; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); transform: rotate(-1.5deg); }
.hold-tag::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: -3px; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(rgba(0, 0, 0, .38), rgba(0, 0, 0, 0)); }
.decided-mark { border: 0; border-radius: 2px; background: var(--paper); color: var(--graphite); font: 700 13px/1.5 var(--serif); padding: 2px 8px 2px 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.decided-mark .shaving { display: block; width: 36px; height: 18px; flex: none; }
.tally-redo.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: strokeIn .22s ease-out forwards; }
@media (prefers-reduced-motion: reduce) { .tally-redo.draw { animation: none; stroke-dasharray: none; } }

/* 周回8 N7-2: 長い選択肢は2行で省く。丸（card-choice の枠）の中に収める */
.ballot-card .card-choice[data-fit="m"], .ballot-card .card-choice[data-fit="l"], .ballot-card .card-choice[data-fit="xl"] { -webkit-line-clamp: 2; max-height: none; min-height: 2.4em; }
.ballot-card .card-choice[data-fit="xl"] { font-size: 12.5px; }

/* 周回8 A: 届いた絵。開いた箱は、奥に倒れた樫のふたの写真。票の縁。スマホの机の小物 */
.lid-open { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(.5); transition: opacity .5s, transform .6s ease-out; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .45)); }
.box[data-open="1"] .lid-open { opacity: 1; transform: none; }
.box[data-open="1"] .box-lid { transform: none; }
.box[data-open="1"] .box-lid .lid-top { opacity: 0; transition: opacity .3s; }
.bc-low::after, .paper.ballot::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -6px; height: 8px; background: url(/assets/ballot-edge.webp) center / 100% 100% no-repeat; pointer-events: none; }
.paper.ballot { position: relative; }
/* 周回9（L9）: 小物の絵は html::before の別の層に置き、上下を羽根でぼかす。絵の中の木目の継ぎ目（上の帯と中ほど、中ほどと下の帯の境の水平線）を、机の絵（body::before）に溶かして見えなくする。小物は上端と下端の帯だけ見える */
@media (max-width: 640px) {
  html::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: url(/assets/desk-props-mobile.webp) center / cover no-repeat; filter: brightness(1.5) contrast(1.08) saturate(1.12);
    /* 周回10（L12）: 下端の封蝋と消しゴムは帯で切れて見えるので出さない（上端の帯だけ） */
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 12%, rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 100%); mask-image: linear-gradient(to bottom, #000 0, #000 12%, rgba(0, 0, 0, 0) 22%, rgba(0, 0, 0, 0) 100%); }
}

/* 周回8 C: 結果の画面は1枚の紙（暗い角丸の板をやめた）。見出しは上端に鉛筆の字、合計と説明は下の余白 */
.paper.result-paper { padding: 0; }
.result-paper .result-head { margin: 0; padding: 10px 16px 6px; border-radius: 0; background: none; color: var(--graphite); }
.result-paper .result-head .question.small { color: #6e6450; font-family: var(--serif); }
.result-paper .result-head .headline { color: var(--print); }
.result-paper .result-head .sub { color: #4a4438; }
.result-paper .result-head .next-step { background: rgba(110, 100, 80, .1); color: #3b281a; border-top: 0; border-radius: 3px; padding: 6px 8px; margin-top: 6px; }
.result-paper .tallysheet { margin: 0; background: none; box-shadow: none; border-radius: 0; border-top: 1px solid var(--rule); }
.result-paper .tallysheet::after { display: none; }
.result-paper .totals, .result-paper .anon, .result-paper .round-note { background: none; border-radius: 0; margin: 0; padding: 6px 16px; max-width: none; color: #4a4438; }
.result-paper .totals { padding-top: 10px; border-top: 1px solid var(--rule); }
.result-paper .totals b { font-weight: 700; color: var(--print); }
.result-paper .anon { padding-bottom: 12px; font-size: 13px; color: #5e5440; }
.result-paper .round-note { color: #5e5440; }
.paper.ballot::after { top: auto; border-radius: 0; }

/* 周回8: 「N枚目で決まり」の付箋は、決まった行（赤い1画のある行）の右の余白に置く（見出しと重ならない） */
.trow .decided-mark { top: auto; bottom: 10px; right: 4px; }
.ballot-card .card-choice > span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.ballot-card .card-choice { display: block; overflow: visible; }

/* 周回8 D: 合言葉の札は、質問の紙の下の端に付けた付箋（紙の色、細い影）。欄は紙の上の線 */
.pass-wrap { margin-top: -1px; }
.pass-toggle { margin-left: 16px; border: 0; border-radius: 0 0 4px 4px; background: url(/assets/paper-grain.jpg) center / 256px, var(--paper); background-blend-mode: multiply; color: var(--graphite); box-shadow: 0 2px 3px rgba(0, 0, 0, .4); font-family: var(--serif); font-weight: 700; }
.pass-body { margin-top: 10px; background: url(/assets/paper-grain.jpg) center / 256px, var(--paper); background-blend-mode: multiply; }
.pass-body .pass-field { border-bottom: 1px solid var(--rule); }

/* ===== 周回9 B: 暗い板を全画面で紙に（磨く案が6回効かなかったので作り方を替える: 板をやめ、1枚の紙の上の字か、紙の付箋にする）===== */
:root { --paper-bg: url(/assets/paper-grain.jpg) center / 256px, var(--paper); --ink: #2a2a2a; --ink-soft: #4a4438; }
/* 紙の上端の鉛筆の字（見出し） */
.paper-title { margin: 0 0 8px; padding: 0 0 6px; border-bottom: 1px solid var(--rule); background: none; border-radius: 0; text-align: left; font: 700 19px/1.4 var(--serif); color: var(--graphite); letter-spacing: .01em; }
/* 紙の付箋（1枚の小さな紙） */
.tagline, .demo-tag, .host-mark, .foot-note, .create-wrap > .note, .result-wrap > .note { background: var(--paper-bg); background-blend-mode: multiply; color: var(--ink-soft); border: 0; border-radius: 3px; padding: 7px 12px; box-shadow: 0 1px 0 #fff8 inset, 0 1px 1px rgba(0, 0, 0, .5), 0 6px 10px -2px rgba(0, 0, 0, .45); }
.demo-tag { border: 1.5px dashed #8c7a52; color: #5a4220; font-weight: 700; }
.tagline { color: #3b3025; }
.host-mark, .foot-note { font: 500 12.5px/1.5 var(--sans); margin: 8px 0 0; }
.foot-note { text-align: center; }
.created-wrap .host-mark, .result-wrap .host-mark, .wait-wrap .host-mark, .closed-wrap .host-mark { color: var(--ink-soft); }
/* 合言葉の朱肉の判（絵文字をやめる）。赤い丸に白抜きの輪 */
.lock-badge { color: var(--seal); border: 0; padding: 0; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.lock-badge::before { content: ""; flex: none; width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, #b8443a 0 46%, rgba(255, 224, 210, .75) 47% 54%, #b8443a 55% 100%); box-shadow: 0 1px 1px rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(90, 20, 15, .35); transform: rotate(-8deg); }
.host-mark .hm-text { flex: 1 1 14em; }

/* 部屋ができた: 見出し・URL・合言葉・票の数・質問の控えを1枚の紙に */
.room-paper { padding: 12px 14px 12px; margin-top: 6px; }
.room-paper > .paper-title { font-size: 18px; }
.room-paper .url-card, .room-paper .pass-card { padding: 0; background: none; border: 0; box-shadow: none; border-radius: 0; }
.room-paper .url-card .url-plate { font-size: 17px; }
.room-paper .url-card .card-note { margin-top: 4px; }
.room-paper .stamp-row { margin: 8px 0; }
.room-paper .stamp.strong { background: rgba(59, 40, 26, .07); }
.room-paper .qr-panel { box-shadow: none; border: 1px solid var(--rule); margin: 6px 0 8px; }
.room-paper .pass-block { margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--rule); }
.room-paper .count { background: none; color: var(--print); padding: 8px 0 0; margin: 8px 0 0; border-top: 1px solid var(--rule); border-radius: 0; font: 700 17px/1.4 var(--serif); }
.room-paper .stub { margin: 8px 0 0; padding: 8px 0 0; border-top: 1px solid var(--rule); }
.room-paper .host-mark { box-shadow: none; }

/* 締め切り・待つ: 上の紙（質問は上端の鉛筆の字）、箱、箱の前に置いた紙の札 */
.plate { width: 100%; text-align: center; }
.plate-top { padding: 8px 14px 9px; margin: 2px 0 0; }
.plate .question.small { margin: 0; padding: 0; background: none; border-radius: 0; text-align: center; color: var(--graphite); font: 700 17px/1.4 var(--serif); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.plate-top .demo-tag { margin-top: 6px; box-shadow: none; background: none; }
.plate-front { position: relative; z-index: 3; margin-top: -18px; padding: 16px 14px 10px; transform: rotate(-.25deg); }
.plate-front > * { background: none; box-shadow: none; border-radius: 0; margin: 4px 0 0; padding: 0; max-width: 100%; color: var(--ink); }
.plate-front > :first-child { margin-top: 0; }
.plate-front .count, .plate-front .closed-count { font: 700 19px/1.35 var(--serif); color: var(--print); }
.plate-front .closed-text { font: 700 17px/1.45 var(--serif); color: var(--print); }
.plate-front .voted-line { font: 600 15px/1.4 var(--sans); color: var(--ink-soft); }
.plate-front .note { font: 500 13px/1.5 var(--sans); color: var(--ink-soft); border-top: 1px solid var(--rule); padding-top: 5px; }
.plate-front .note.strong { font-weight: 700; color: var(--print); border-top: 0; font-size: 14px; }
.plate-front .conn { color: var(--seal); font-weight: 700; }
.wait-wrap .box, .closed-wrap .box { margin-top: 6px; position: relative; z-index: 1; }

/* 開票: 質問は正の字の紙の上端の鉛筆の字 */
.tallysheet > .question.small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 6px; padding: 0 0 5px; background: none; border-radius: 0; border-bottom: 1px solid var(--rule); text-align: left; font: 700 16px/1.4 var(--serif); color: var(--graphite); }

/* 作る画面: 説明は紙の付箋、例は紙の小さな付箋 */
.create-wrap > .tagline { margin: 2px 0 10px; font-size: 14px; }
.chips { gap: 8px 10px; align-items: center; }
.chips-label { flex: 0 0 auto; padding: 2px 8px; border-radius: 3px; background: var(--paper-bg); background-blend-mode: multiply; color: var(--ink-soft); box-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.chip, .chip:focus, .chip:active, .chip:hover { border: 0; border-radius: 2px; background: var(--paper-bg); background-blend-mode: multiply; color: #3b281a; box-shadow: 0 1px 0 #fff8 inset, 0 1px 1px rgba(0, 0, 0, .5), 0 4px 8px -1px rgba(0, 0, 0, .45); }
.chip:nth-child(2) { transform: rotate(-1deg); } .chip:nth-child(3) { transform: rotate(.8deg); } .chip:nth-child(4) { transform: rotate(-.5deg); }
.chip::before { opacity: .65; }
.next-head { padding: 10px 14px 10px; margin-bottom: 10px; }
.next-head .tagline { background: none; box-shadow: none; padding: 0; margin: 0; font-size: 13.5px; color: var(--ink-soft); }
.next-mode .next-head .heading { margin-top: 0; }
@media (max-height: 700px) { .plate-top { padding: 5px 12px 6px; } .plate .question.small { font-size: 15px; -webkit-line-clamp: 2; } .plate-front { padding: 12px 12px 6px; margin-top: -14px; } .plate-front .count, .plate-front .closed-count { font-size: 17px; } .plate-front .note { font-size: 12px; line-height: 1.4; } .room-paper { padding: 8px 12px; } .room-paper > .paper-title { font-size: 16px; margin-bottom: 4px; padding-bottom: 3px; } .tagline { padding: 5px 10px; } }
@media (min-width: 900px) { .plate-top, .plate-front { max-width: 520px; } .paper-title { font-size: 22px; } .room-paper { padding: 18px 24px; } }
.stamp.chip:not(.done), .stamp.chip:not(.done):focus, .stamp.chip:not(.done):active, .stamp.chip:not(.done):hover { background-color: transparent; background: var(--paper-bg); background-blend-mode: multiply; color: #3b281a; }
.host-mark, .foot-note { position: relative; z-index: 4; }
.plate-front + .host-mark, .plate-front + .stamp-row { margin-top: 16px; }
.admin-keep { margin-top: 14px; padding: 0 12px 2px; background: var(--paper-bg); background-blend-mode: multiply; color: var(--ink-soft); border-radius: 3px; box-shadow: 0 1px 1px rgba(0, 0, 0, .5), 0 6px 10px -2px rgba(0, 0, 0, .45); }
.admin-keep .note { background: none; color: var(--ink-soft); padding: 0; }
.admin-keep .stamp { color: #3b281a; }

/* ===== 周回9 C: 机の下半分と PC の机。投票の紙と結果の画面で、帯の上に見える位置に紙の束と鉛筆（スマホ）、紙の束と封蝋（PC）を置く。操作の邪魔をしない（pointer-events: none、紙と箱の後ろ）===== */
#shell[data-screen="vote"]::before, #shell[data-screen="vote"]::after, #shell[data-screen="result"]::before, #shell[data-screen="result"]::after { content: ""; position: fixed; z-index: -1; pointer-events: none; }
#shell[data-screen="vote"]::before, #shell[data-screen="result"]::before { background: url(/assets/paper-stack.webp) center / contain no-repeat; filter: drop-shadow(0 6px 5px rgba(0, 0, 0, .5)); }
/* スマホ: 左に紙の束、右に鉛筆（帯の上、箱の左右）。結果は紙が画面いっぱいなので出さない */
#shell[data-screen="vote"]::before { left: -10px; bottom: calc(var(--dock-h) + 48px); width: 112px; height: 56px; transform: rotate(-9deg); }
#shell[data-screen="vote"]::after { right: 14px; bottom: calc(var(--dock-h) + 52px); width: 118px; height: 10px; transform: rotate(-14deg); border-radius: 1px 3px 3px 1px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, .38), rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, .32)), linear-gradient(to right, #2f2f33 0 4px, #e2bf8c 4px 15px, #e9b755 15px calc(100% - 13px), #b4443f calc(100% - 13px));
  clip-path: polygon(0 50%, 15px 0, 100% 0, 100% 100%, 15px 100%); filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .5)); }
#shell[data-screen="result"]::before, #shell[data-screen="result"]::after { display: none; }
@media (max-height: 700px) { #shell[data-screen="vote"]::before, #shell[data-screen="vote"]::after { display: none; } }
@media (min-width: 900px) {
  #shell[data-screen="vote"]::before, #shell[data-screen="result"]::before { display: block; left: 3vw; bottom: 24vh; width: 220px; height: 110px; transform: rotate(-7deg); }
  #shell[data-screen="vote"]::after, #shell[data-screen="result"]::after { display: block; right: 6vw; bottom: 26vh; width: 84px; height: 84px; border-radius: 52% 44% 56% 41% / 46% 55% 42% 53%; transform: rotate(-8deg); clip-path: none; filter: drop-shadow(0 5px 4px rgba(0, 0, 0, .5));
    /* 周回10（L12）: 縁の不揃いな蝋だまり。かすれ（まだらの濃淡）と、左上の照り */
    background: radial-gradient(ellipse 22% 16% at 30% 24%, rgba(255, 214, 196, .55), rgba(255, 214, 196, 0)), radial-gradient(circle at 68% 72%, rgba(70, 12, 10, .38) 0 14%, rgba(70, 12, 10, 0) 30%), radial-gradient(circle at 20% 70%, rgba(150, 40, 32, .0) 0 10%, rgba(90, 18, 14, .22) 18%, rgba(90, 18, 14, 0) 30%), radial-gradient(ellipse at 46% 48%, #b8443a 0 38%, rgba(214, 120, 104, .35) 42% 46%, #ad362e 52% 78%, #8f2a23 100%); box-shadow: inset 2px 3px 4px rgba(255, 190, 170, .35), inset -3px -4px 5px rgba(80, 14, 10, .5); }
}
@media (min-width: 900px) { #shell[data-screen="vote"]::after, #shell[data-screen="result"]::after { width: 66px; height: 66px; right: 7vw; } }

/* ===== 周回10 0: N9-3 結果の「この部屋は N 日後に消えます」の札は帯の上に出す（下の余白を増やす） ===== */
.result-wrap .foot-note { margin-bottom: 28px; }
.stage:has(.result-wrap) { padding-bottom: calc(var(--dock-h) + 36px); }

/* ===== 周回10 A: 合言葉の入口の返り。間違い・待ちは紙が左右に揺れる（0.35秒、7px）。通った時は鍵穴が回って錠が開く（0.5秒） ===== */
@keyframes gateShake { 0%, 100% { transform: rotate(-.4deg) translateX(0); } 15% { transform: rotate(-.4deg) translateX(-7px); } 38% { transform: rotate(-.4deg) translateX(7px); } 60% { transform: rotate(-.4deg) translateX(-6px); } 82% { transform: rotate(-.4deg) translateX(5px); } }
.gate-paper.shake { animation: gateShake .35s ease-in-out; }
.keyhole { transform-box: fill-box; transform-origin: 50% 25%; }
.box.unlocking .keyhole { transform: rotate(90deg); transition: transform .45s cubic-bezier(.4, 0, .2, 1); }
.box.unlocking .lock-plate { filter: brightness(1.25); transition: filter .45s; }
.box.unlocking .box-lid { transform: translateY(-4px); transition: transform .3s .25s ease-out; }
@media (prefers-reduced-motion: reduce) { .gate-paper.shake { animation: none; } .box.unlocking .keyhole { transition: none; } }

/* ===== 周回10 B: 決まった瞬間の箱のはね（8px。開いたふたが揺れる）。決まった枚で1回だけ ===== */
.box.hop { animation: boxHop .3s ease-out; }
@keyframes boxHop { 0%, 100% { transform: translateY(0); } 38% { transform: translateY(-8px); } 68% { transform: translateY(1.5px); } 85% { transform: translateY(-1px); } }
.box.hop .lid-open { animation: lidWiggle .5s ease-out; }
@keyframes lidWiggle { 0% { transform: rotate(0); } 25% { transform: rotate(-3.5deg); } 55% { transform: rotate(2.5deg); } 80% { transform: rotate(-1deg); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .box.hop, .box.hop .lid-open { animation: none; } }

/* ===== 周回10 C R4: 続きの部屋の「2問目」。紙の見出しの上端、質問の上の鉛筆の字（1問目には出さない） ===== */
.round-kicker { margin: 0 0 2px; font: 700 15px/1.2 var(--serif); font-style: italic; letter-spacing: .06em; color: var(--graphite); text-align: left; transform: rotate(-1.5deg); transform-origin: 0 100%; opacity: .9; pointer-events: none; }
.result-paper .round-kicker { margin: 0 0 3px; }
.tallysheet > .round-kicker { margin: 2px 4px 0; }
.ballot > .round-kicker { margin: 0 0 4px; }

/* ===== 周回10 L1'': (d) 部屋ができた右上の「最初の画面へ」は暗い板をやめて下線の字。(c) 白票などの確かめは白い板をやめ、票の紙の質感の付箋（紙の粒、ずれた縁、細い影）に ===== */
.home-row .home-link { background: none; text-decoration: underline; text-underline-offset: 3px; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.sheet { background: var(--paper-bg); background-blend-mode: multiply; border-radius: 3px 5px 0 0; border-top: 1px solid rgba(255, 250, 235, .7); box-shadow: 0 -2px 3px rgba(0, 0, 0, .3), 0 -14px 30px rgba(0, 0, 0, .5); }
.sheet::before { content: ""; position: absolute; left: 14px; right: 18px; top: -7px; height: 8px; background: var(--paper-bg); background-blend-mode: multiply; border-radius: 3px 3px 0 0; transform: rotate(-.35deg); box-shadow: 0 -1px 2px rgba(0, 0, 0, .25); }
.sheet .btn { padding: 0 8px; } /* 周回10: 英語 390px で「Put in a blank vote」が2行に折れないように */

/* 周回10（C12）: 付箋の中の1位の名前は長ければ省く */
.decided-mark { max-width: calc(100% - 12px); }
.decided-mark > span { white-space: nowrap; min-width: 0; }
.decided-name { display: inline-block; max-width: 9em; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; margin: 0 .25em; }

/* ===== 周回11 0: F5 開票の紙から結果の紙へは透明から出さない（机だけの1コマを作らない） ===== */
.stage > div.no-fade { animation: none; }

/* ===== 周回11 0: N10-3/L12' PC の封蝋。縁を大きく不揃いに、かすれと照りは端に寄せ、傾けて、影を机の右下へ長く落とす。丸い押しボタンに見えないよう中央の照りと内側の輪をやめる ===== */
@media (min-width: 900px) {
  #shell[data-screen="vote"]::after, #shell[data-screen="result"]::after { width: 70px; height: 62px; border-radius: 41% 59% 47% 53% / 57% 38% 62% 43%; transform: rotate(-23deg) skewX(-4deg);
    background: radial-gradient(ellipse 30% 14% at 24% 18%, rgba(255, 206, 186, .42), rgba(255, 206, 186, 0)), radial-gradient(ellipse 18% 26% at 82% 66%, rgba(60, 10, 8, .45), rgba(60, 10, 8, 0)), radial-gradient(circle at 12% 78%, rgba(60, 10, 8, .3) 0 9%, rgba(60, 10, 8, 0) 22%), radial-gradient(circle at 62% 40%, rgba(176, 62, 50, .5) 0 18%, rgba(176, 62, 50, 0) 40%), linear-gradient(155deg, #b5443a, #962c25 60%, #7d2620);
    box-shadow: inset 1px 2px 3px rgba(255, 190, 170, .25), inset -2px -3px 4px rgba(70, 12, 8, .5), 5px 7px 6px -1px rgba(0, 0, 0, .0);
    filter: drop-shadow(7px 9px 5px rgba(0, 0, 0, .5)) drop-shadow(2px 2px 1px rgba(0, 0, 0, .45)); }
}

/* ===== 周回11 A(a): 結果の札3つ。暗い板をやめ、紙の札（明るい紙、鉛筆の字、少し傾け、細い影）。44px 以上 ===== */
.result-tags { gap: 10px 12px; }
.result-tags .stamp, .result-tags .stamp:not(.done), .result-tags .stamp.strong { background: var(--paper-bg); background-blend-mode: multiply; color: #2f2a22; border: 0; border-radius: 3px 5px 4px 3px; min-height: 44px; padding: 0 16px; font: 700 15px var(--sans); box-shadow: 0 1px 0 #fff8 inset, 0 1px 1px rgba(0, 0, 0, .5), 0 5px 9px -2px rgba(0, 0, 0, .5); transform: rotate(-.7deg); }
.result-tags .stamp:nth-child(2) { transform: rotate(.6deg); }
.result-tags .stamp:nth-child(3) { transform: rotate(-.3deg); }
.result-tags .stamp:disabled { opacity: .7; }
.result-tags .stamp:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }

/* ===== 周回11 A(b): 「合言葉あり」の判。朱肉の輪の判のかすれ（不揃いな輪、欠け、濃淡、少し傾ける） ===== */
.lock-badge::before { width: 26px; height: 25px; border-radius: 47% 53% 50% 50% / 52% 47% 53% 48%; transform: rotate(-11deg); box-shadow: none; mix-blend-mode: multiply; opacity: .92;
  background: radial-gradient(ellipse 14% 14% at 50% 50%, #a8342b 0 100%, rgba(168, 52, 43, 0) 101%), radial-gradient(ellipse at 52% 49%, rgba(0, 0, 0, 0) 0 31%, #b23a30 34% 40%, #9b2e27 46% 56%, rgba(178, 58, 48, .55) 60%, rgba(0, 0, 0, 0) 66%);
  -webkit-mask-image: conic-gradient(from 18deg, #000 0 16%, rgba(0, 0, 0, .35) 17% 20%, #000 21% 46%, rgba(0, 0, 0, .2) 47% 50%, #000 51% 73%, rgba(0, 0, 0, .55) 74% 80%, #000 81%);
  mask-image: conic-gradient(from 18deg, #000 0 16%, rgba(0, 0, 0, .35) 17% 20%, #000 21% 46%, rgba(0, 0, 0, .2) 47% 50%, #000 51% 73%, rgba(0, 0, 0, .55) 74% 80%, #000 81%); }

/* ===== 周回11 A(c): 白票の確かめ。白い下からの板をやめ、票の紙の下に差し込んだ付箋（黄みの紙、傾き、貼り目の影）。全幅にしない ===== */
.sheet.in-paper { left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); max-width: 456px; padding: 16px 14px 14px; border: 0; border-radius: 2px 4px 3px 5px; background: linear-gradient(rgba(246, 226, 150, .55), rgba(246, 226, 150, .55)), var(--paper-bg); background-blend-mode: normal, multiply; transform: rotate(-.8deg); box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 2px 3px rgba(0, 0, 0, .45), 0 14px 26px rgba(0, 0, 0, .5); animation: noteIn .3s ease-out; }
.sheet.in-paper::before { left: 22px; right: auto; width: 46%; top: -6px; height: 14px; border-radius: 1px; background: rgba(236, 226, 196, .72); transform: rotate(-1.6deg); box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.sheet.in-paper .sheet-text { font: 700 17px/1.5 var(--serif); margin-bottom: 14px; color: #2f2a22; }
@keyframes noteIn { from { transform: translateY(40px) rotate(-.8deg); opacity: 0; } to { transform: rotate(-.8deg); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sheet.in-paper { animation: none; } }
