/* style.css：クイズ番組のステージ × らくがき帳。太いふち、ずらした影、はっきりした色。 */
:root {
  --ink: #0a0f2e;
  --navy: #101a4d;
  --panel: #1c2b6e;
  --line: #34449a;
  --gold: #ffc928;
  --pink: #ff5d8f;
  --sky: #3ec5ff;
  --green: #3ddc84;
  --orange: #ff9a3c;
  --red: #ff5252;
  --paper: #fffdf5;
  --text: #ffffff;
  --sub: #c3cbef;
  --display: "Mochiy Pop One", "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
  --body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  /* 文字のふちどり（8方向）＋下の影 */
  --outline: 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink),
    2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  color: var(--text);
  font-family: var(--body);
  font-weight: 500;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% -10%, rgba(255, 201, 40, .28) 0, transparent 38%),
    radial-gradient(circle at 88% -10%, rgba(62, 197, 255, .28) 0, transparent 38%),
    radial-gradient(rgba(255, 255, 255, .07) 2px, transparent 2.5px) 0 0 / 26px 26px,
    linear-gradient(#1a2a7a, var(--navy) 55%, #0a1038) fixed;
  overflow-x: hidden;
  display: flex; flex-direction: column; /* 著作権表示をいちばん下に置く */
}
.backdrop { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; }

#app {
  position: relative; z-index: 1; flex: 1 0 auto; width: 100%;
  max-width: 600px; margin: 0 auto; padding: 66px 16px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
}
h1, h2, p, ul { margin: 0; padding: 0; }

/* 画面が変わったとき、上から順にぽんと出る */
#app.enter > * { animation: pop .42s cubic-bezier(.2, 1.4, .4, 1) backwards; }
#app.enter > :nth-child(2) { animation-delay: .05s; }
#app.enter > :nth-child(3) { animation-delay: .1s; }
#app.enter > :nth-child(4) { animation-delay: .15s; }
#app.enter > :nth-child(5) { animation-delay: .2s; }
#app.enter > :nth-child(6) { animation-delay: .25s; }
#app.enter > :nth-child(n+7) { animation-delay: .3s; }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.94); } }

/* ---------- 文字 ---------- */
.logo {
  font-family: var(--display); font-weight: 400; font-size: clamp(44px, 13vw, 78px); line-height: 1.1;
  margin-top: 0; display: flex; flex-wrap: wrap; justify-content: center; letter-spacing: .02em;
}
.logo span {
  display: inline-block; color: var(--gold);
  text-shadow: var(--outline), 0 9px 0 var(--ink), 0 14px 18px rgba(0, 0, 0, .35);
  animation: hop 2.6s ease-in-out infinite; animation-delay: calc(var(--i) * .12s);
  transform: rotate(calc((var(--i) - 2.5) * 2deg));
}
.logo span:nth-child(2) { color: var(--pink); }
.logo span:nth-child(3) { color: var(--sky); }
.logo span:nth-child(4) { color: var(--green); }
.logo span:nth-child(5) { color: var(--orange); }
@keyframes hop {
  0%, 60%, 100% { translate: 0 0; }
  30% { translate: 0 -12px; }
}
.mascot { width: min(260px, 70%); margin-top: -6px; }
.mascot svg { display: block; width: 100%; overflow: visible; }
/* 線とえんぴつの動きは app.js の animateMascot が毎フレーム動かす（えんぴつの先が線の先頭にくる） */
.squiggle { fill: none; stroke: var(--gold); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }

.tagline {
  font-family: var(--display); font-size: 16px; color: var(--ink); background: var(--paper);
  border: 3px solid var(--ink); border-radius: 999px; padding: 6px 18px; box-shadow: 0 4px 0 var(--ink); rotate: -1.5deg;
}
.head { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ribbon {
  font-family: var(--display); font-weight: 400; font-size: clamp(26px, 7vw, 36px); color: var(--ink);
  background: var(--gold); border: 4px solid var(--ink); border-radius: 14px; padding: 6px 30px;
  box-shadow: 0 6px 0 var(--ink); rotate: -2deg;
}
.lead { font-size: 19px; font-weight: 700; }
.note { font-size: 15px; color: var(--sub); line-height: 1.6; }
.status { font-size: 13px; color: var(--sub); display: flex; align-items: center; gap: 8px; justify-content: center; }
.status i { width: 10px; height: 10px; border-radius: 50%; background: var(--orange); flex: none; }
.status.on i { background: var(--green); box-shadow: 0 0 0 4px rgba(61, 220, 132, .25); }

/* ---------- 入力 ---------- */
.nametag {
  display: flex; align-items: stretch; width: 100%; max-width: 360px; border: 4px solid var(--ink); border-radius: 16px;
  background: var(--paper); box-shadow: 0 5px 0 var(--ink); overflow: hidden;
}
.nametag span { white-space: nowrap; font-family: var(--display); font-size: 15px; color: var(--paper); background: var(--pink); padding: 0 14px; display: grid; place-items: center; border-right: 4px solid var(--ink); }
.input { font: inherit; font-weight: 700; font-size: 20px; text-align: center; color: var(--ink); background: transparent; border: 0; padding: 10px 12px; width: 100%; min-width: 0; }
.input:focus { outline: none; background: #fff3c4; }
.input.key { font-family: var(--display); font-size: clamp(22px, 7vw, 32px); letter-spacing: .06em; padding: 8px 0; color: var(--ink); }
.input.key::placeholder { color: #cfd3e6; }
.input::placeholder { color: #b3b8cf; font-weight: 500; font-size: 16px; }

/* ---------- ボタン ---------- */
button { font-family: var(--body); cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 4px solid #fff; outline-offset: 3px; }
.ico { display: inline-grid; place-items: center; flex: none; }
.ico svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.menu { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 460px; }
.card {
  position: relative; display: flex; align-items: center; gap: 16px; text-align: left; color: var(--ink);
  background: var(--c); border: 4px solid var(--ink); border-radius: 22px; padding: 14px 18px;
  box-shadow: 0 8px 0 var(--ink); transition: translate .08s, box-shadow .08s, rotate .15s;
}
.card:hover { rotate: -1deg; translate: 0 -2px; box-shadow: 0 10px 0 var(--ink); }
.card:active { translate: 0 6px; box-shadow: 0 2px 0 var(--ink); }
.card-art { width: 64px; height: 64px; flex: none; border-radius: 18px; background: var(--paper); border: 4px solid var(--ink); display: grid; place-items: center; font-size: 30px; rotate: -4deg; overflow: hidden; }
.card-art .mini { width: 100%; height: 100%; display: block; }
.card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-text b { font-family: var(--display); font-weight: 400; font-size: clamp(22px, 6.5vw, 28px); line-height: 1.25; }
.card-text small { font-size: 14px; font-weight: 700; opacity: .85; }
.stars { margin-left: auto; font-size: 20px; color: var(--paper); text-shadow: var(--outline); white-space: nowrap; letter-spacing: 2px; }
.stars i { font-style: normal; opacity: .28; }

.btn {
  font-family: var(--display); font-size: 17px; color: var(--ink); background: var(--paper);
  border: 4px solid var(--ink); border-radius: 18px; padding: 11px 22px; box-shadow: 0 6px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: translate .08s, box-shadow .08s;
}
.btn:hover { translate: 0 -2px; box-shadow: 0 8px 0 var(--ink); }
.btn:active { translate: 0 5px; box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--gold); font-size: 22px; padding: 14px 40px; }
.btn.primary.on, .btn.go { background: var(--green); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--sub); font-family: var(--body); font-weight: 700; font-size: 16px; }
.btn.ghost:hover { color: #fff; translate: 0 0; box-shadow: none; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; }

.mute {
  position: fixed; top: 12px; right: 12px; z-index: 20; width: 46px; height: 46px; border-radius: 50%;
  background: var(--paper); color: var(--ink); border: 4px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  display: grid; place-items: center; font-size: 18px; padding: 0;
}
.mute:active { translate: 0 3px; box-shadow: 0 1px 0 var(--ink); }

/* ---------- チップ・カギ ---------- */
.chips, .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; width: 100%; }
.chip { background: var(--panel); border: 3px solid var(--ink); border-radius: 999px; padding: 5px 14px; font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.chip.gold { background: var(--gold); color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 17px; box-shadow: 0 4px 0 var(--ink); }
.chip .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--seat); border: 3px solid var(--ink); flex: none; }

.ticket {
  position: relative; background: var(--paper); color: var(--ink); border: 4px dashed var(--ink); border-radius: 18px;
  padding: 10px 26px 12px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 6px 0 var(--ink); width: 100%; max-width: 380px; rotate: 1deg;
}
.ticket small { font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; }
.ticket b { font-family: var(--display); font-weight: 400; font-size: clamp(26px, 8.2vw, 40px); letter-spacing: .04em; line-height: 1.3; white-space: nowrap; color: var(--pink); text-shadow: 0 3px 0 var(--ink); }
.ticket .tool { margin-top: 4px; }

/* ---------- ロビー：回答席 ---------- */
.podiums { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; align-items: end; }
.podium {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  background: var(--seat); color: var(--ink); border: 4px solid var(--ink); border-radius: 18px 18px 10px 10px;
  padding: 34px 6px 8px; margin-top: 30px; box-shadow: 0 6px 0 var(--ink);
}
.podium.empty { background: var(--panel); color: var(--sub); border-style: dashed; box-shadow: none; }
.avatar { position: absolute; top: -32px; width: 60px; height: 60px; }
.face svg { width: 60px; height: 60px; display: block; }
.podium:not(.empty) .avatar { animation: bob 2.2s ease-in-out infinite; }
.podium.ready .avatar { animation: cheer .5s ease-in-out infinite alternate; }
.q { display: grid; place-items: center; width: 54px; height: 54px; margin: 3px; border-radius: 50%; border: 4px dashed var(--line); font-family: var(--display); font-size: 26px; color: var(--line); background: var(--navy); }
@keyframes bob { 50% { translate: 0 -5px; } }
@keyframes cheer { to { translate: 0 -10px; rotate: 6deg; } }
.pname { font-weight: 700; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you { font-size: 11px; font-weight: 700; background: var(--ink); color: #fff; border-radius: 999px; padding: 1px 8px; }
.lamp { margin-top: 2px; width: 100%; font-size: 12px; font-weight: 700; border-radius: 8px; padding: 4px 2px; background: rgba(10, 15, 46, .18); display: flex; justify-content: center; align-items: center; gap: 3px; }
.podium.ready .lamp { background: var(--ink); color: var(--green); box-shadow: 0 0 14px rgba(61, 220, 132, .8); }
.podium.empty .lamp { background: transparent; }

/* ---------- お題の巨大パネル ---------- */
.board {
  position: relative; width: 100%; background: linear-gradient(#1746d6, #0d2a8a); border: 6px solid var(--gold); border-radius: 22px;
  padding: 22px 12px 26px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 0 0 4px var(--ink), 0 12px 0 var(--ink), 0 0 60px rgba(255, 201, 40, .35);
}
.board::before, .board::after { content: ""; position: absolute; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: blink 1s steps(2) infinite; }
.board::before { left: 12px; }
.board::after { right: 12px; animation-delay: .5s; }
@keyframes blink { 50% { opacity: .25; } }
.board small { font-family: var(--display); font-size: 20px; color: var(--gold); letter-spacing: .3em; padding-left: .3em; }
.board b { font-family: var(--display); font-weight: 400; font-size: clamp(54px, 17vw, 108px); line-height: 1.15; color: #fff; text-shadow: var(--outline), 0 8px 0 var(--ink); overflow-wrap: anywhere; }
.board.small { padding: 8px 12px 10px; border-width: 5px; box-shadow: 0 0 0 4px var(--ink), 0 7px 0 var(--ink); flex-direction: row; justify-content: center; align-items: baseline; gap: 14px; }
.board.small small { font-size: 14px; letter-spacing: .1em; }
.board.small b { font-size: clamp(30px, 8.5vw, 46px); text-shadow: var(--outline), 0 4px 0 var(--ink); }
.board.small::before, .board.small::after { display: none; }

/* お題の発表 */
#app[data-screen="intro"] .board { animation: flip .7s cubic-bezier(.2, 1.3, .4, 1) backwards; }
#app[data-screen="intro"] .board b { animation: slam .5s .45s cubic-bezier(.2, 1.6, .4, 1) backwards; }
@keyframes flip { from { transform: perspective(700px) rotateX(-88deg); opacity: 0; } }
@keyframes slam { from { scale: 2.4; opacity: 0; } }
.spots { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.spots i { position: absolute; top: -10vh; width: 40vw; height: 130vh; background: linear-gradient(rgba(255, 255, 255, .16), transparent 80%); transform-origin: top center; filter: blur(6px); clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%); }
.spots i:first-child { left: 0; animation: sweep 2.4s ease-in-out infinite alternate; }
.spots i:last-child { right: 0; animation: sweep 2.4s ease-in-out infinite alternate-reverse; }
@keyframes sweep { from { rotate: -22deg; } to { rotate: 22deg; } }
.brief { display: flex; align-items: center; gap: 18px; text-align: left; background: var(--panel); border: 4px solid var(--ink); border-radius: 20px; padding: 14px 18px; box-shadow: 0 6px 0 var(--ink); }
.preview { width: 104px; flex: none; aspect-ratio: 1; border-radius: 12px; border: 4px solid var(--ink); display: block; }
.part-name { font-family: var(--display); font-size: clamp(26px, 8vw, 36px); color: var(--gold); text-shadow: var(--outline); line-height: 1.3; }
.fuse { width: 100%; max-width: 420px; height: 14px; background: var(--ink); border-radius: 999px; padding: 3px; }
.fuse i { display: block; height: 100%; border-radius: 999px; background: var(--gold); animation: burn linear forwards; transform-origin: left; }
@keyframes burn { to { transform: scaleX(0); } }

/* ---------- 描く画面 ---------- */
.clock { display: inline-flex; align-items: center; gap: 8px; background: var(--ink); border-radius: 999px; padding: 6px 14px 6px 10px; font-size: 17px; position: relative; overflow: hidden; }
.clock b { font-family: var(--display); font-weight: 400; font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.clock .ico { position: relative; z-index: 1; color: var(--gold); }
.timebar { position: absolute; inset: 0; opacity: .5; }
.timebar i { display: block; height: 100%; background: var(--green); transition: width .25s linear; }
.clock.hurry { animation: shake .4s infinite; }
.clock.hurry .timebar i { background: var(--red); }
@keyframes shake { 25% { translate: -2px 0; } 75% { translate: 2px 0; } }

.easel { width: min(100%, 60vh); background: var(--paper); border: 5px solid var(--ink); border-radius: 18px; padding: 8px; box-shadow: 0 10px 0 var(--ink), 0 22px 30px rgba(0, 0, 0, .35); position: relative; }
.easel::before { content: ""; position: absolute; top: -16px; left: 50%; translate: -50% 0; width: 86px; height: 22px; border-radius: 8px; background: var(--pink); border: 4px solid var(--ink); }
.pad { width: 100%; aspect-ratio: 1; background: #fff; border-radius: 10px; touch-action: none; cursor: crosshair; display: block; }
#app .easel.flash { animation: flash .6s ease-out; }
@keyframes flash { 0% { scale: .9; box-shadow: 0 0 0 0 #fff, 0 10px 0 var(--ink); } 40% { scale: 1.04; box-shadow: 0 0 0 26px rgba(255, 255, 255, 0), 0 10px 0 var(--ink); } }

.tools { display: flex; flex-direction: column; gap: 10px; width: 100%; background: var(--panel); border: 4px solid var(--ink); border-radius: 20px; padding: 12px 10px; box-shadow: 0 6px 0 var(--ink); }
.toolrow { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--ink); background: var(--sw); padding: 0; box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .2), inset 0 4px 0 rgba(255, 255, 255, .35); transition: scale .12s; }
.swatch.on { scale: 1.22; box-shadow: 0 0 0 4px #fff, inset 0 -5px 0 rgba(0, 0, 0, .2); }
.tool { font-size: 14px; font-weight: 700; color: var(--ink); background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; padding: 6px 10px; box-shadow: 0 4px 0 var(--ink); display: inline-flex; align-items: center; gap: 5px; min-height: 40px; }
.tool:active { translate: 0 3px; box-shadow: 0 1px 0 var(--ink); }
.tool.on { background: var(--gold); }
.tool .dot { width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); display: inline-block; }
.waiting .tools, .waiting .easel { opacity: .6; pointer-events: none; }
.waiting #wait-text { font-family: var(--display); font-size: 17px; color: var(--gold); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ---------- 合体 ---------- */
#app .merging { font-family: var(--display); font-size: 26px; color: var(--sky); text-shadow: var(--outline); animation: shake .25s infinite; }
#app .stamp {
  font-family: var(--display); font-size: clamp(44px, 14vw, 72px); line-height: 1.1; color: var(--red);
  text-shadow: var(--outline), 0 7px 0 var(--ink); rotate: -6deg; margin-bottom: 14px; animation: stamp .55s cubic-bezier(.2, 1.7, .4, 1) backwards;
}
@keyframes stamp { from { scale: 3.6; opacity: 0; rotate: 12deg; } }

.loading { display: flex; gap: 12px; margin-top: 60px; }
.loading i { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); border: 4px solid var(--ink); animation: hop .9s ease-in-out infinite; }
.loading i:nth-child(2) { background: var(--pink); animation-delay: .15s; }
.loading i:nth-child(3) { background: var(--sky); animation-delay: .3s; }

.toast {
  position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: 40; max-width: 90vw;
  font-weight: 700; font-size: 16px; color: var(--ink); background: var(--paper);
  border: 4px solid var(--ink); border-radius: 14px; padding: 10px 18px; box-shadow: 0 5px 0 var(--ink); animation: pop .3s backwards; text-align: center;
}

/* せまい画面：回答席を2列に */
@media (max-width: 430px) {
  .podiums { grid-template-columns: repeat(2, 1fr); row-gap: 4px; }
  .card { padding: 12px 14px; gap: 12px; }
  .card-art { width: 54px; height: 54px; font-size: 26px; }
  .stars { font-size: 16px; }
  .brief { flex-direction: column; text-align: center; }
}

/* 「動きを減らす」設定の人には、動きを止める */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 著作権表示（どの画面でもいちばん下） */
.copyright { position: relative; z-index: 1; text-align: center; padding: 14px 16px 18px; color: var(--sub); font-size: 13px; letter-spacing: .04em; }
.copyright a { color: var(--gold); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; padding: 6px 2px; }
.copyright a:hover { color: #fff; }

/* Xでシェア */
.btn.share { background: #000; color: #fff; text-decoration: none; }

/* パソコンの「Xでシェア」の手順の窓 */
.share-dialog {
  width: min(92vw, 460px); max-height: 92vh; overflow: auto; color: var(--ink); background: var(--paper);
  border: 5px solid var(--ink); border-radius: 22px; padding: 18px 20px; box-shadow: 0 10px 0 var(--ink); text-align: center;
  font-family: var(--body); font-weight: 500;
}
.share-dialog::backdrop { background: rgba(5, 8, 30, .78); }
.share-dialog h3 { margin: 0 0 10px; font-family: var(--display); font-weight: 400; font-size: 24px; }
.share-preview { width: min(100%, 210px); aspect-ratio: 4 / 5; border-radius: 12px; border: 4px solid var(--ink); background: var(--navy); display: block; margin: 0 auto 12px; }
.steps { list-style: none; counter-reset: step; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 10px; text-align: left; }
.steps li { counter-increment: step; position: relative; padding: 10px 12px 10px 54px; background: #fff; border: 3px solid var(--ink); border-radius: 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.steps li::before { content: counter(step); position: absolute; left: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%; background: var(--gold); border: 3px solid var(--ink); display: grid; place-items: center; font-family: var(--display); font-size: 16px; }
.steps b { font-size: 17px; }
.steps .note { color: #4a5176; font-size: 14px; }
.steps .toolrow { justify-content: flex-start; }
.step-state { font-size: 14px; font-weight: 700; color: #4a5176; }
.step-state.ok { color: #12813f; }
.step-state.ng { color: #c22a2a; }
.share-dialog .btn.ghost { color: #4a5176; }
.share-dialog .btn.ghost:hover { color: var(--ink); }
