/* 自前配信のサブセットフォント(tools/build-fonts.py で生成)。800 指定は 900 で描かれる */
@font-face { font-family: "AM Rounded"; font-weight: 700; font-display: swap; src: url("/fonts/am-rounded-700.woff2") format("woff2"); }
@font-face { font-family: "AM Rounded"; font-weight: 900; font-display: swap; src: url("/fonts/am-rounded-900.woff2") format("woff2"); }

:root {
  --bg: #ffffff;
  --surface: #f7f7f7;
  --line: #e5e5e5;
  --line-dark: #cfcfcf;
  --text: #3c3c3c;
  --muted: #8a8a8a;

  --green: #58cc02;
  --green-dark: #58a700;
  --green-soft: #d7ffb8;
  --blue: #1cb0f6;
  --blue-dark: #1899d6;
  --blue-soft: #ddf4ff;
  --red: #ff4b4b;
  --red-dark: #ea2b2b;
  --yellow: #ffc800;
  --yellow-dark: #e5a400;
  --orange: #ff9600;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "AM Rounded", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-weight: 700;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
}

main {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

[hidden] { display: none !important; }

#conn-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--red); color: #fff; text-align: center;
  padding: 8px; font-size: 14px; font-weight: 800;
}

/* ---------- home ---------- */
.logo-tiles { display: flex; justify-content: center; gap: 8px; margin-top: 36px; }
.logo-tiles span {
  width: 56px; height: 56px; display: grid; place-items: center;
  border-radius: 14px; color: #fff; font-size: 32px; font-weight: 900;
  background: var(--green); box-shadow: 0 5px 0 var(--green-dark);
}
.logo-tiles span:nth-child(2) { background: var(--blue); box-shadow: 0 5px 0 var(--blue-dark); transform: translateY(-8px) rotate(4deg); }
.logo-tiles span:nth-child(3) { background: var(--yellow); box-shadow: 0 5px 0 var(--yellow-dark); transform: rotate(-5deg); }
.logo-tiles span:nth-child(4) { background: var(--red); box-shadow: 0 5px 0 var(--red-dark); transform: translateY(-6px) rotate(3deg); }

.logo {
  margin: 14px 0 0; text-align: center; line-height: 1.15;
  font-size: 34px; font-weight: 900; color: var(--green); letter-spacing: .02em;
}
.logo span { display: inline; }
.logo-sub { color: var(--green); }
.lead { text-align: center; color: var(--muted); font-size: 15px; line-height: 1.7; margin: 4px 0 10px; }

.home-step { display: flex; flex-direction: column; gap: 14px; }
.step2-title { margin: 0; text-align: center; font-size: 20px; font-weight: 900; color: var(--text); }

.field { display: flex; flex-direction: column; gap: 8px; font-size: 14px; font-weight: 800; color: var(--muted); }

input[type="text"] {
  width: 100%; font-size: 18px; padding: 14px 16px;
  border-radius: 14px; border: 2px solid var(--line);
  background: var(--surface); color: var(--text);
  font-family: inherit; font-weight: 700;
}
input[type="text"]::placeholder { color: #b8b8b8; }
input[type="text"]:focus { outline: none; border-color: var(--blue); background: #fff; }
#code-input { letter-spacing: .4em; text-align: center; font-size: 28px; font-weight: 900; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 800; }
.divider::before, .divider::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.error {
  color: var(--red-dark); background: #ffdfe0; border-radius: 12px;
  text-align: center; font-size: 14px; font-weight: 800; margin: 0; padding: 10px;
}

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 0; border-radius: 16px;
  font: inherit; font-weight: 900; font-size: 16px; letter-spacing: .04em;
  padding: 14px 14px; min-height: 52px; width: 100%;
  cursor: pointer; touch-action: manipulation;
  transition: transform .06s, box-shadow .06s, filter .1s;
  margin-bottom: 4px;
}
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: none !important; }
.btn:disabled { background: var(--line) !important; color: #afafaf !important; box-shadow: none !important; cursor: default; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-secondary {
  background: #fff; color: var(--blue);
  border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line);
}
.btn-ghost {
  background: transparent; color: var(--muted);
  min-height: 44px; padding: 10px; margin-bottom: 0;
}
.btn-ghost:active:not(:disabled) { transform: none; background: var(--surface); }
.btn-red { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-dark); }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- game header ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chip {
  appearance: none; border: 2px solid var(--line); border-radius: 14px;
  font: inherit; font-size: 13px; font-weight: 800;
  background: #fff; color: var(--muted); padding: 8px 12px; cursor: pointer;
  box-shadow: 0 2px 0 var(--line);
}
.chip:active { transform: translateY(2px); box-shadow: none; }
.chip b { font-size: 17px; letter-spacing: .1em; color: var(--blue); font-weight: 900; }
.chip { display: inline-flex; align-items: center; gap: 6px; line-height: 1; }
.chip-icon { font-size: 11px; color: var(--blue-dark); background: var(--blue-soft); border-radius: 999px; padding: 4px 8px; }
.badge { font-size: 13px; font-weight: 900; color: var(--orange); text-align: center; }

/* ---------- topic ---------- */
.topic-card {
  background: #fff; border-radius: 20px; padding: 16px 16px 12px;
  text-align: center; position: relative;
  border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line);
}
.topic-round {
  display: inline-block; font-size: 12px; font-weight: 900; color: var(--blue);
  background: var(--blue-soft); border-radius: 999px; padding: 3px 12px; min-height: 0;
}
.topic-round:empty { display: none; }
.topic-letter {
  display: grid; place-items: center;
  width: 88px; height: 88px; margin: 12px auto 12px;
  background: var(--green); color: #fff;
  font-size: 54px; font-weight: 900; border-radius: 22px;
  box-shadow: 0 6px 0 var(--green-dark);
  animation: pop .45s cubic-bezier(.2, 1.6, .4, 1);
}
.topic-line { font-size: 14px; color: var(--muted); font-weight: 800; }
.topic-text { font-size: 24px; font-weight: 900; line-height: 1.35; margin: 4px 0; color: var(--text); }
.topic-wait { font-size: 16px; color: var(--muted); padding: 22px 0; line-height: 1.8; }
.speak-btn {
  appearance: none; border: 0; background: transparent; color: var(--blue);
  font: inherit; font-size: 13px; font-weight: 900; padding: 8px 12px; cursor: pointer; margin-top: 4px;
  border-radius: 10px;
}
.speak-btn:active { background: var(--blue-soft); }

@keyframes pop { from { transform: scale(.2) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }

.status { margin: 0; text-align: center; font-size: 14px; font-weight: 800; color: var(--muted); min-height: 20px; }

/* ---------- flips ---------- */
.flips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 12px; }

.flip-wrap { display: flex; flex-direction: column; gap: 8px; animation: drop .3s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes drop { from { transform: translateY(-14px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }

.flip { perspective: 900px; aspect-ratio: 4 / 3; cursor: default; -webkit-tap-highlight-color: transparent; }
.flip.tappable { cursor: pointer; }
.flip.tappable .flip-back { animation: wiggle 1.6s ease-in-out infinite; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-2deg) scale(1.03); } }

.flip-inner {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.3, 1.4, .5, 1);
}
.flip.open .flip-inner { transform: rotateX(180deg); }

.flip-face {
  position: absolute; inset: 0; border-radius: 16px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: grid; place-items: center; padding: 10px; overflow: hidden;
}
.flip-back {
  background: var(--blue); color: #fff;
  border-bottom: 5px solid var(--blue-dark);
  font-size: 48px; font-weight: 900;
}

.flip-front {
  background: #fff; color: var(--text);
  border: 2px solid var(--line); border-bottom-width: 5px;
  transform: rotateX(180deg);
  font-weight: 900; line-height: 1.3; text-align: center; word-break: break-all;
  font-size: 26px;
}
.flip-front.len-m { font-size: 20px; }
.flip-front.len-l { font-size: 15px; }
.flip-front.is-verbal { color: var(--blue-dark); font-size: 19px; background: var(--blue-soft); border-color: #84d8ff; }

.flip.correct .flip-front { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.flip.correct .flip-front::after {
  content: "✓"; position: absolute; right: 6px; top: 6px;
  color: #fff; background: var(--green); border-radius: 50%;
  width: 30px; height: 30px; display: grid; place-items: center;
  font-size: 18px; font-weight: 900;
  animation: stamp .35s cubic-bezier(.2, 1.8, .4, 1);
}
@keyframes stamp { from { transform: scale(3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.flip-name { text-align: center; font-size: 14px; font-weight: 900; color: var(--text); }
.flip-name small { color: var(--muted); font-weight: 700; }

.flip-actions { display: flex; gap: 6px; }
.flip-actions button {
  flex: 1; appearance: none; border: 0; border-radius: 12px; font: inherit;
  font-size: 13px; font-weight: 900; padding: 8px 4px; cursor: pointer; min-height: 40px;
  margin-bottom: 3px; transition: transform .06s, box-shadow .06s;
}
.flip-actions button:active { transform: translateY(3px); box-shadow: none; }
.act-correct { background: var(--green); color: #fff; box-shadow: 0 3px 0 var(--green-dark); }
.act-correct.on { background: #fff; color: var(--muted); border: 2px solid var(--line) !important; box-shadow: 0 3px 0 var(--line); }
.act-scribe {
  background: #fff; color: var(--text); border: 2px solid var(--line) !important; box-shadow: 0 3px 0 var(--line);
  flex: 0 0 auto !important; padding: 8px 12px !important;
}

/* ---------- answer ---------- */
.answer-form, .answer-done {
  background: #fff; border: 2px solid var(--line); border-radius: 20px; padding: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.answer-done { text-align: center; font-size: 15px; color: var(--muted); gap: 4px; }
.answer-done b { color: var(--text); font-size: 20px; font-weight: 900; display: block; margin-top: 2px; }

/* ---------- host bar ---------- */
.host-bar {
  position: sticky; bottom: 0; margin: 4px -16px 0;
  padding: 14px 16px calc(10px + env(safe-area-inset-bottom));
  background: #fff; border-top: 2px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}

/* ---------- seikai overlay ---------- */
.seikai {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  display: grid; place-content: center; justify-items: center; text-align: center; gap: 14px;
  background: rgba(88, 204, 2, .94);
  animation: fade 2s forwards;
}
.seikai-text {
  font-size: min(17vw, 96px); font-weight: 900; color: #fff;
  text-shadow: 0 6px 0 var(--green-dark);
  animation: slam .5s cubic-bezier(.2, 1.8, .4, 1);
}
.seikai-name {
  padding: 10px 20px; margin: 0 20px; word-break: break-all;
  font-size: 22px; font-weight: 900; color: var(--green-dark);
  background: #fff; border-radius: 16px; box-shadow: 0 4px 0 var(--green-dark);
  animation: slam .5s .1s cubic-bezier(.2, 1.8, .4, 1) backwards;
}
@keyframes slam { from { transform: scale(3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade { 0%, 78% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- dialogs ---------- */
dialog {
  border: 0; border-radius: 22px; background: #fff; color: var(--text);
  width: min(92vw, 460px); max-height: 86dvh; padding: 20px;
  font-family: inherit;
}
dialog[open] { display: flex; flex-direction: column; gap: 14px; animation: dialog-in .2s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes dialog-in { from { transform: scale(.92); opacity: 0; } to { transform: none; opacity: 1; } }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin: 0; font-size: 20px; font-weight: 900; text-align: center; }

.player-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.player-list li {
  display: flex; align-items: center; gap: 8px;
  border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; font-size: 15px;
}
.player-list .pname { flex: 1; font-weight: 900; }
.player-list .pname small { color: var(--muted); font-weight: 700; margin-left: 6px; font-size: 12px; }
.player-list .pscore { color: var(--orange); font-weight: 900; min-width: 44px; text-align: right; }
.player-list .off { opacity: .5; }
.mini {
  appearance: none; border: 2px solid var(--line); background: #fff; color: var(--blue);
  border-radius: 10px; font: inherit; font-size: 12px; font-weight: 900; padding: 6px 8px; cursor: pointer;
}
.hint { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.6; text-align: center; }
.add-virtual { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border-radius: 16px; padding: 12px; }
.add-virtual input[type="text"] { background: #fff; }
.add-virtual .row > button { flex: 0 0 84px; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; }
.toggle input { width: 22px; height: 22px; accent-color: var(--green); }

.history-list { overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.history-item { border: 2px solid var(--line); border-radius: 14px; padding: 12px; font-size: 14px; }
.history-item .q { color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 6px; }
.history-item .a { display: flex; gap: 6px; padding: 2px 0; }
.history-item .a.win { color: var(--green-dark); font-weight: 900; }
.history-empty { color: var(--muted); text-align: center; padding: 20px 0; }

.custom-row { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 900; }
#custom-letter { width: 70px; text-align: center; font-size: 24px; font-weight: 900; }

/* ---------- お題えらび ---------- */
.pick-list { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 120px; padding-bottom: 4px; }
.pick-item {
  appearance: none; font: inherit; cursor: pointer;
  background: #fff; color: var(--text); padding: 10px 12px;
  border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 4px 0 var(--line);
  display: flex; align-items: center; gap: 12px; text-align: left;
  transition: transform .06s, box-shadow .06s;
}
.pick-item:hover { background: var(--blue-soft); border-color: #84d8ff; box-shadow: 0 4px 0 #84d8ff; }
.pick-item:active { transform: translateY(4px); box-shadow: none; }
.pick-letter {
  flex: 0 0 48px; height: 48px; display: grid; place-items: center;
  background: var(--green); color: #fff; border-radius: 12px;
  font-size: 28px; font-weight: 900; box-shadow: 0 3px 0 var(--green-dark);
}
.pick-text { font-size: 16px; font-weight: 900; line-height: 1.35; }
.pick-text small { display: block; color: var(--muted); font-weight: 700; font-size: 11px; }

select {
  width: 100%; font: inherit; font-size: 16px; font-weight: 800; color: var(--text);
  padding: 12px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface);
}
select:focus { outline: none; border-color: var(--blue); }

/* ---------- キャラクター ---------- */
.avatar {
  --size: 56px;
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: var(--size); height: var(--size); border-radius: 50%;
  box-shadow: 0 0 0 2px var(--line), 0 3px 0 2px var(--line);
  overflow: hidden; vertical-align: middle;
}
.avatar svg { width: 88%; height: 88%; display: block; }
.avatar.xs { --size: 26px; box-shadow: 0 0 0 1.5px var(--line); }
.avatar.sm { --size: 36px; box-shadow: 0 0 0 2px var(--line); }
.avatar.xl { --size: 120px; box-shadow: 0 6px 0 var(--green-dark); border: 5px solid #fff; }

.char-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 8px; }
.char-btn {
  appearance: none; background: #fff; font: inherit; cursor: pointer; padding: 8px 2px 6px;
  border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 3px 0 var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 900; color: var(--muted);
  transition: transform .06s, box-shadow .06s;
}
.char-btn .avatar { --size: 52px; box-shadow: none; }
.char-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.char-btn.selected { border-color: var(--green); box-shadow: 0 3px 0 var(--green-dark); background: var(--green-soft); color: var(--green-dark); }
.char-btn.selected .avatar { animation: wobble .5s cubic-bezier(.2, 1.6, .4, 1); }
.char-btn:disabled { cursor: default; background: var(--surface); box-shadow: none; color: #b8b8b8; }
.char-btn:disabled .avatar { filter: grayscale(1); opacity: .35; }
@keyframes wobble { 0% { transform: scale(.6) rotate(-20deg); } 60% { transform: scale(1.15) rotate(8deg); } 100% { transform: none; } }

/* ---------- メンバー一覧 ---------- */
.roster { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 4px; min-height: 84px; overflow: hidden; padding-top: 14px; }
.roster-item {
  appearance: none; border: 0; background: transparent; font: inherit; padding: 0;
  width: 72px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 900; color: var(--text); position: relative;
}
.roster-item.clickable { cursor: pointer; }
.roster-item .rname { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-item.me .rname { color: var(--blue-dark); }
.roster-item.off .avatar { filter: grayscale(1); opacity: .45; }
.roster-item .avatar-wrap { position: relative; display: block; }
.roster-item .crown { position: absolute; top: -15px; left: 50%; transform: translateX(-50%) rotate(-8deg); font-size: 18px; line-height: 1; z-index: 1; }
.roster-item .mark {
  position: absolute; right: -4px; bottom: -2px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; color: #fff; border: 2px solid #fff;
}
.roster-item .mark.done { background: var(--green); animation: stamp .3s cubic-bezier(.2, 1.8, .4, 1); }
.roster-item .mark.mic { background: var(--blue); font-size: 11px; }
.roster-item.thinking .avatar { animation: bob 1.1s ease-in-out infinite; }
.roster-item.enter { animation: hop-in .9s cubic-bezier(.3, .7, .4, 1) backwards; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes hop-in {
  0% { transform: translate(260px, 0) scale(.9); opacity: 0; }
  15% { opacity: 1; }
  30% { transform: translate(170px, -34px); }
  48% { transform: translate(100px, 0) scale(1.08, .9); }
  64% { transform: translate(50px, -22px); }
  80% { transform: translate(12px, 0) scale(1.1, .86); }
  90% { transform: translate(0, -8px); }
  100% { transform: none; }
}

.toast {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 45;
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
  background: #fff; color: var(--text); font-size: 15px; font-weight: 900;
  border: 2px solid var(--line); border-radius: 999px; padding: 6px 18px 6px 6px;
  box-shadow: 0 4px 0 var(--line);
  animation: toast-in 2.6s cubic-bezier(.2, 1.4, .4, 1) forwards;
}
@keyframes toast-in {
  0% { transform: translate(-50%, -80px); } 12%, 85% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, -80px); opacity: 0; }
}

.flip-name { display: flex; align-items: center; justify-content: center; gap: 6px; }
.seikai .avatar { animation: slam .5s cubic-bezier(.2, 1.8, .4, 1); }

.roster-item .mark.edit { left: -4px; right: auto; background: #fff; color: var(--blue); border-color: var(--line); font-size: 12px; }
.char-hint { margin: -8px 0 0; text-align: center; font-size: 12px; font-weight: 800; color: var(--blue); }

/* ---------- 吹き出し ---------- */
.bubble {
  position: relative; align-self: center; margin-bottom: 6px;
  background: var(--yellow); color: #5a4300; font-size: 15px; font-weight: 900;
  padding: 10px 18px; border-radius: 16px; box-shadow: 0 4px 0 var(--yellow-dark);
  animation: bubble-bounce 1.2s ease-in-out infinite;
}
.bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%);
  border: 8px solid transparent; border-top: 10px solid var(--yellow);
  filter: drop-shadow(0 4px 0 var(--yellow-dark));
}
@keyframes bubble-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- 制限時間 ---------- */
.timer { display: flex; align-items: center; gap: 10px; margin-top: -4px; }
.timer-bar { flex: 1; height: 16px; border-radius: 999px; background: var(--line); overflow: hidden; }
.timer-bar i { display: block; height: 100%; width: 100%; border-radius: 999px; background: var(--green); transition: width .25s linear, background .3s; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12); }
.timer-text { min-width: 52px; text-align: right; font-size: 18px; font-weight: 900; color: var(--green-dark); font-variant-numeric: tabular-nums; }
.timer.warn .timer-bar i { background: var(--yellow); }
.timer.warn .timer-text { color: var(--orange); }
.timer.danger .timer-bar i { background: var(--red); }
.timer.danger .timer-text { color: var(--red-dark); animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.25); } }

.limit-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.limit-chip {
  appearance: none; font: inherit; font-size: 14px; font-weight: 900; cursor: pointer;
  background: #fff; color: var(--muted); padding: 8px 12px; border-radius: 12px;
  border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line);
}
.limit-chip:active { transform: translateY(3px); box-shadow: none; }
.limit-chip.selected { background: var(--blue-soft); color: var(--blue-dark); border-color: var(--blue); box-shadow: 0 3px 0 var(--blue-dark); }

.flip-front.is-timeout { color: var(--muted); font-size: 18px; background: var(--surface); }

/* ---------- プレイ中のコンパクト表示(フリップを広く見せる) ---------- */
.playing:not(.topic-intro) { gap: 12px; }
.playing:not(.topic-intro) .topic-card { display: flex; align-items: center; gap: 8px; padding: 12px 8px 10px 12px; margin-top: 6px; }
.playing:not(.topic-intro) .topic-round { position: absolute; top: -11px; left: 14px; font-size: 11px; padding: 2px 10px; border: 2px solid #fff; }
.playing:not(.topic-intro) #topic-body { flex: 1; display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; }
.playing:not(.topic-intro) .topic-letter { flex: 0 0 auto; width: 54px; height: 54px; margin: 0; font-size: 34px; border-radius: 14px; box-shadow: 0 4px 0 var(--green-dark); animation: none; }
.playing:not(.topic-intro) .topic-line { font-size: 11px; line-height: 1.3; }
.playing:not(.topic-intro) .topic-text { font-size: 18px; line-height: 1.25; margin: 0; }
.playing:not(.topic-intro) .speak-btn { flex: 0 0 auto; margin: 0; padding: 8px 6px; font-size: 0; }
.playing:not(.topic-intro) .speak-btn::before { content: "🔊"; font-size: 20px; }

.playing .timer { margin-top: -2px; }
.playing .timer-bar { height: 12px; }
.playing .timer-text { font-size: 16px; min-width: 46px; }

.playing .roster { gap: 8px 0; min-height: 0; padding-top: 10px; }
.playing .roster-item { width: 50px; gap: 3px; font-size: 10px; }
.playing .roster-item .rname { max-width: 50px; }
.playing .roster-item .avatar { --size: 36px; box-shadow: 0 0 0 2px var(--line); }
.playing .roster-item .crown { font-size: 13px; top: -10px; }
.playing .roster-item .mark { width: 16px; height: 16px; font-size: 9px; right: -4px; bottom: -3px; border-width: 1.5px; }
.playing .roster-item .mark.edit { display: none; }
.playing .status { font-size: 13px; margin-top: -4px; }

.playing .host-bar { padding-top: 10px; gap: 6px; }
.playing .host-bar .btn { min-height: 46px; padding: 10px; font-size: 15px; }
.playing .host-bar .row .btn { min-height: 40px; padding: 8px; font-size: 13px; }

.decide-hint { margin: 0; text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.decide-hint b { color: var(--red-dark); font-size: 14px; }

#conn-banner::before { content: "再接続中…"; }

/* ---------- かぶり ---------- */
.seikai.kaburi { background: rgba(28, 176, 246, .94); }
.seikai.kaburi .seikai-text { text-shadow: 0 6px 0 var(--blue-dark); }
.seikai.kaburi .seikai-name { color: var(--blue-dark); box-shadow: 0 4px 0 var(--blue-dark); }
.flip.dup .flip-front::before {
  content: "かぶり"; position: absolute; left: 6px; top: 6px;
  background: var(--blue); color: #fff; font-size: 11px; font-weight: 900;
  border-radius: 999px; padding: 3px 8px;
  animation: stamp .35s cubic-bezier(.2, 1.8, .4, 1);
}

/* ---------- リアクション ---------- */
.react-bar { display: flex; justify-content: center; gap: 8px; margin-top: -4px; }
.react-btn {
  appearance: none; border: 2px solid var(--line); background: #fff; border-radius: 14px;
  box-shadow: 0 3px 0 var(--line); font-size: 22px; line-height: 1; padding: 8px 10px; cursor: pointer;
  touch-action: manipulation; transition: transform .06s, box-shadow .06s;
}
.react-btn:active { transform: translateY(3px) scale(.95); box-shadow: none; }
.float-layer { position: fixed; inset: 0; pointer-events: none; z-index: 35; overflow: hidden; }
.float-emoji {
  position: absolute; bottom: 90px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 44px; line-height: 1; animation: float-up 2.2s ease-out forwards;
}
.float-emoji .avatar { --size: 26px; box-shadow: 0 0 0 2px #fff; }
@keyframes float-up {
  0% { transform: translateY(40px) scale(.4); opacity: 0; }
  15% { transform: translateY(0) scale(1.2); opacity: 1; }
  30% { transform: translateY(-40px) scale(1) rotate(-6deg); }
  100% { transform: translateY(-62vh) scale(1) rotate(8deg); opacity: 0; }
}

/* ---------- 結果発表 ---------- */
.result-mode #topic-card, .result-mode #timer, .result-mode #roster, .result-mode #status,
.result-mode #flips, .result-mode #answer-form, .result-mode #answer-done, .result-mode #char-hint { display: none !important; }
.result { display: flex; flex-direction: column; gap: 14px; }
.result-title { margin: 6px 0 0; text-align: center; font-size: 30px; font-weight: 900; color: var(--green); }
.result-sub { margin: -8px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 4px 0 var(--line); background: #fff;
  animation: rank-in .6s cubic-bezier(.2, 1.4, .4, 1) backwards;
}
.rank-row.first { border-color: var(--yellow); box-shadow: 0 4px 0 var(--yellow-dark); background: #fff8d6; }
.rank-row.first .avatar { --size: 72px; }
.rank-no { flex: 0 0 38px; text-align: center; font-size: 26px; font-weight: 900; color: var(--muted); }
.rank-name { flex: 1; font-size: 18px; font-weight: 900; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { font-size: 22px; font-weight: 900; color: var(--orange); }
.rank-score small { font-size: 13px; }
@keyframes rank-in { from { transform: translateX(-60px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.result h3 { margin: 10px 0 0; font-size: 18px; font-weight: 900; text-align: center; }
.hl-list { display: flex; flex-direction: column; gap: 8px; }
.hl-item { border: 2px solid var(--line); border-radius: 16px; padding: 10px 12px; }
.hl-q { font-size: 12px; color: var(--muted); font-weight: 800; margin-bottom: 4px; }
.hl-a { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 900; padding: 2px 0; }
.hl-a small { color: var(--muted); font-weight: 700; font-size: 12px; white-space: nowrap; }
.hl-a > span:not(.avatar) { flex: 1; min-width: 0; word-break: break-all; }
.hl-empty { text-align: center; color: var(--muted); font-size: 14px; padding: 8px 0; }
.toast.notice { border-color: var(--red); box-shadow: 0 4px 0 var(--red-dark); padding-left: 18px; white-space: normal; text-align: center; max-width: 92vw; font-size: 13px; }
#seikai-avatar { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 0 16px; }
.seikai.kaburi .avatar.xl { --size: 92px; }

/* ---------- 指名 → 自分でめくる ---------- */
.flip.nominated .flip-back { animation: nominate-glow .8s ease-in-out infinite alternate; }
.flip.nominated { z-index: 1; }
@keyframes nominate-glow {
  from { box-shadow: 0 0 0 4px var(--yellow), 0 0 0 rgba(255, 200, 0, 0); transform: scale(1); }
  to { box-shadow: 0 0 0 4px var(--yellow), 0 0 26px rgba(255, 200, 0, .95); transform: scale(1.04); }
}
.flip-wrap.nominated .flip-name { color: var(--orange); }
.selfflip {
  position: sticky; bottom: 0; z-index: 5; margin: 4px -16px 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: #fff; border-top: 2px solid var(--line); text-align: center;
}
.selfflip p { margin: 0 0 8px; font-size: 14px; font-weight: 900; color: var(--orange); }
.selfflip .btn { min-height: 72px; font-size: 26px; animation: bubble-bounce 1s ease-in-out infinite; }

/* ---------- あそびかた(トップ画面) ---------- */
.how { margin-top: 18px; display: flex; flex-direction: column; gap: 12px; }
.how-title { margin: 0 0 2px; text-align: center; font-size: 18px; font-weight: 900; color: var(--text); display: flex; align-items: center; gap: 12px; }
.how-title::before, .how-title::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
.how-step { display: flex; gap: 12px; border: 2px solid var(--line); border-radius: 18px; padding: 12px; box-shadow: 0 3px 0 var(--line); }
.how-no {
  flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--green); color: #fff; font-size: 16px; font-weight: 900; box-shadow: 0 3px 0 var(--green-dark);
}
.how-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.how-head { margin: 4px 0 0; font-size: 15px; font-weight: 900; }
.how-note { margin: 0; font-size: 12px; color: var(--muted); font-weight: 800; }
.how-art { background: var(--surface); border-radius: 14px; padding: 12px; }
.how-row { display: flex; align-items: flex-end; justify-content: center; gap: 12px; }

.how-topic { display: flex; align-items: center; gap: 12px; }
.how-tile {
  flex: 0 0 52px; height: 52px; display: grid; place-items: center; border-radius: 14px;
  background: var(--green); color: #fff; font-size: 32px; font-weight: 900; box-shadow: 0 4px 0 var(--green-dark);
  animation: how-pop 2.4s ease-in-out infinite;
}
.how-topic-text { font-size: 17px; font-weight: 900; line-height: 1.3; }
.how-topic-text small { display: block; font-size: 11px; color: var(--muted); font-weight: 800; }
@keyframes how-pop { 0%, 80%, 100% { transform: none; } 88% { transform: scale(1.12) rotate(-5deg); } }

.how-person { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; width: 76px; }
.how-person .avatar { --size: 34px; box-shadow: 0 0 0 2px var(--line); }
.how-flip {
  width: 76px; height: 54px; border-radius: 10px; display: grid; place-items: center;
  font-size: 15px; font-weight: 900; line-height: 1.1; text-align: center;
}
.how-flip.back { background: var(--blue); color: #fff; font-size: 26px; border-bottom: 4px solid var(--blue-dark); }
.how-flip.voice { background: var(--blue-soft); border: 2px solid #84d8ff; border-bottom-width: 4px; font-size: 24px; }
.how-flip.front { background: #fff; color: var(--text); border: 2px solid var(--line); border-bottom-width: 4px; }
.how-flip.correct { background: var(--green-soft); border-color: var(--green); color: var(--green-dark); }
.how-flip.glow { animation: nominate-glow .8s ease-in-out infinite alternate; }
.how-point {
  position: absolute; top: 22px; right: -10px; background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 900; border-radius: 999px; padding: 2px 7px; transform: rotate(8deg);
}
.how-seikai {
  align-self: center; background: var(--green); color: #fff; font-size: 15px; font-weight: 900; line-height: 1.15;
  text-align: center; padding: 10px 12px; border-radius: 14px; box-shadow: 0 4px 0 var(--green-dark);
  transform: rotate(-6deg); animation: how-pop 2.4s ease-in-out infinite;
}
