:root {
  --bg-cream: #fffdf4;
  --ink: #141414;
  --yellow: #ffe600;
  --orange: #ff6b2b;
  --pink: #ff499e;
  --purple: #8b5cf6;
  --blue: #2563eb;
  --cyan: #00e5ff;
  --green: #22c55e;
  --red: #ff2e4c;
  --card-radius: 18px;
  --border-thick: 3px solid var(--ink);
  --shadow-md: 4px 4px 0px var(--ink);
  --shadow-lg: 6px 6px 0px var(--ink);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100dvh;
  font-family: "Noto Sans TC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background-color: var(--bg-cream);
  background-image: radial-gradient(#dcd6be 1.4px, transparent 1.4px);
  background-size: 20px 20px;
  overflow-x: hidden;
  touch-action: manipulation;
  user-select: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.hidden {
  display: none !important;
}

/* 頂部跑馬燈 */
.top-ticker-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  background: var(--ink);
  color: #fff;
  border-bottom: 3px solid var(--ink);
}

.ticker-badge {
  flex-shrink: 0;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.ticker-track-wrap {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
}

.ticker-track {
  display: inline-block;
  padding-left: 100%;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--yellow);
  animation: tickerMove 28s linear infinite;
}

@keyframes tickerMove {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

.sound-btn {
  flex-shrink: 0;
  background: #2c2c2c;
  border: 1.5px solid #555;
  color: #fff;
  border-radius: 8px;
  width: 30px;
  height: 26px;
  font-size: 14px;
  display: grid;
  place-items: center;
}

/* 主容器 */
.app-shell {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 12px 24px;
  position: relative;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 10px;
  animation: popIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.screen.active {
  display: flex;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Neo-Brutalism 通用卡片與按鈕 */
.neo-card {
  background: #fff;
  border: var(--border-thick);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
}

.neo-btn {
  border: var(--border-thick);
  border-radius: 14px;
  font-weight: 900;
  color: var(--ink);
  box-shadow: var(--shadow-md);
  transition: transform 0.06s ease, box-shadow 0.06s ease, filter 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
}

.neo-btn:active:not(:disabled) {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0px var(--ink);
}

.neo-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: #e5e5e5 !important;
  color: #666 !important;
}

.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 10px; box-shadow: 2px 2px 0 var(--ink); }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 11px; box-shadow: 3px 3px 0 var(--ink); }
.btn-md { padding: 10px 14px; font-size: 14.5px; }
.btn-lg { padding: 12px 16px; font-size: 16px; width: 100%; }
.btn-xl { padding: 15px 18px; font-size: 18px; width: 100%; letter-spacing: 0.5px; }

.btn-primary { background: var(--orange); color: #fff; text-shadow: 1px 1px 0 var(--ink); }
.btn-yellow { background: var(--yellow); }
.btn-green { background: #4ade80; }
.btn-purple { background: #c084fc; color: var(--ink); }
.btn-white { background: #fff; }
.btn-ready { background: var(--green); color: #fff; text-shadow: 1px 1px 0 var(--ink); }
.btn-ready.is-ready { background: var(--yellow); color: var(--ink); text-shadow: none; }

/* 首頁 Hero */
.hero-header {
  text-align: center;
  padding: 2px 4px 0;
}

.viral-pill {
  display: inline-block;
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  border-radius: 999px;
  padding: 2px 12px;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 5px;
}

.game-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.08;
}

.logo-top {
  font-size: 13px;
  font-weight: 900;
  color: #fff;
  background: var(--ink);
  padding: 2px 10px;
  border-radius: 6px;
  transform: rotate(-1.5deg);
  margin-bottom: 3px;
}

.logo-main {
  font-size: 34px;
  font-weight: 900;
  color: var(--orange);
  -webkit-text-stroke: 1.5px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
  letter-spacing: 1px;
}

.logo-emoji {
  display: inline-block;
  -webkit-text-stroke: 0;
  animation: brainBounce 1.6s infinite ease-in-out;
}

@keyframes brainBounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(8deg); }
}

.hero-sub {
  font-size: 12.5px;
  font-weight: 700;
  color: #444;
  margin-top: 4px;
}

/* 玩家身分列 */
.profile-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff9db;
}

.avatar-picker {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 2.5px solid var(--ink);
  background: #fff;
  box-shadow: 2px 2px 0 var(--ink);
  font-size: 25px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
  min-width: 0;
}

.profile-label {
  font-size: 11px;
  font-weight: 700;
  color: #666;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.profile-name {
  font-size: 16px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-icon-btn {
  border: none;
  background: transparent;
  font-size: 14px;
  padding: 2px 4px;
}

/* 五位數房號與遊戲內建鍵盤 */
.room-keypad-card {
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.keypad-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
}

.keypad-title {
  font-size: 15px;
  font-weight: 900;
}

.keypad-hint {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--blue);
}

.code-slots {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.code-digit {
  height: 54px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #f3f4f6;
  font-family: "Space Mono", "Fredoka", monospace;
  font-size: 28px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: inset 0 3px 0 rgba(0,0,0,0.08);
  transition: all 0.12s ease;
}

.code-digit.filled {
  background: var(--yellow);
  box-shadow: 3px 3px 0 var(--ink);
  transform: translateY(-2px);
}

.code-digit.active {
  border-color: var(--orange);
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(255, 107, 43, 0.28);
}

.ingame-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.key-btn {
  height: 50px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #ffffff;
  font-family: "Fredoka", "Noto Sans TC", sans-serif;
  font-size: 23px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 0.05s, box-shadow 0.05s, background 0.08s;
}

.key-btn:active,
.key-btn.pressed {
  transform: translateY(4px);
  box-shadow: 0 0px 0 var(--ink);
  background: var(--yellow);
}

.key-fn {
  font-size: 16px;
  font-weight: 900;
  background: #f1f5f9;
}

.key-clear {
  background: #ffe4e6;
  color: #be123c;
}

.key-back {
  background: #e0e7ff;
  color: #1d4ed8;
  font-size: 20px;
}

.home-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

/* 等候室 */
.lobby-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.room-badge-pill {
  background: var(--yellow);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 2px 2px 0 var(--ink);
}

.invite-banner {
  padding: 10px 12px;
  text-align: center;
  background: linear-gradient(135deg, #fffbeb, #fef08a);
}

.invite-banner > div:first-child {
  font-size: 12.5px;
  font-weight: 800;
  color: #444;
}

.lobby-big-code {
  font-family: "Space Mono", monospace;
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--ink);
  margin: 2px 0 8px;
  text-shadow: 2px 2px 0 #fff;
}

.invite-btn-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.versus-stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}

.player-pod {
  padding: 10px 8px;
  text-align: center;
  position: relative;
  background: #fff;
}

.player-pod.empty {
  background: #f8fafc;
  border-style: dashed;
}

.pod-tag {
  font-size: 11px;
  font-weight: 900;
  background: var(--ink);
  color: #fff;
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  margin-bottom: 4px;
}

.pod-avatar {
  font-size: 36px;
  line-height: 1.15;
}

.pod-name {
  font-size: 14px;
  font-weight: 900;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pod-status {
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 900;
  padding: 3px 6px;
  border-radius: 8px;
  border: 2px solid var(--ink);
}

.pod-status.waiting {
  background: #f1f5f9;
  color: #64748b;
}

.pod-status.ready {
  background: #4ade80;
  color: var(--ink);
}

.vs-emblem {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  border: 2.5px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  display: grid;
  place-items: center;
  transform: rotate(-8deg);
}

/* 生死狀賭注卡 */
.wager-card {
  padding: 10px 12px;
  background: #fff1f2;
}

.wager-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  font-weight: 900;
  color: #be123c;
  margin-bottom: 6px;
}

.wager-main {
  font-size: 15px;
  font-weight: 900;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 7px 10px;
}

/* 嘲諷貼圖列 */
.taunt-bar {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.taunt-label {
  font-size: 12px;
  font-weight: 800;
  color: #555;
}

.taunt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.taunt-chip {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 6px 4px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.taunt-chip:active {
  transform: translate(2px, 2px);
  box-shadow: none;
  background: var(--yellow);
}

/* ==================== 遊戲對戰畫面（一屏鎖定不捲動） ==================== */
#screenGame.active {
  height: calc(100dvh - 54px);
  min-height: 500px;
  max-height: 820px;
  justify-content: space-between;
  gap: 8px;
}

.hud-panel {
  padding: 8px 10px 14px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
  background: #fff;
}

.hud-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.hud-opp {
  justify-content: flex-end;
}

.align-right {
  text-align: right;
}

.hud-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.hud-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #fef9c3;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.combo-pill {
  position: absolute;
  bottom: -6px;
  left: -4px;
  background: var(--orange);
  color: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 900;
  padding: 0 5px;
  animation: pulsePop 0.3s ease;
}

.opp-bubble {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: var(--red);
  color: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 900;
  padding: 0 5px;
}

.hud-name {
  font-size: 11.5px;
  font-weight: 800;
  color: #555;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.hud-score {
  font-family: "Fredoka", sans-serif;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.hud-center {
  text-align: center;
  padding: 0 4px;
}

.round-pill {
  background: var(--ink);
  color: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 99px;
}

.timer-num {
  font-family: "Space Mono", monospace;
  font-size: 15px;
  font-weight: 700;
  margin-top: 2px;
}

.tug-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 7px;
  background: var(--pink);
  border-top: 2px solid var(--ink);
}

.tug-fill-me {
  height: 100%;
  background: var(--cyan);
  border-right: 2px solid var(--ink);
  transition: width 0.22s ease;
}

.time-bar-wrap {
  width: 100%;
  height: 10px;
  background: #e5e7eb;
  border: 2.5px solid var(--ink);
  border-radius: 99px;
  overflow: hidden;
}

.time-bar-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #eab308, #ef4444);
  transition: width 0.1s linear;
}

/* 舞台中央 */
.stage-card {
  flex: 1;
  min-height: 195px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: background-color 0.2s ease;
}

.stage-card.mode-rational {
  background: #dbeafe;
  border-color: #1d4ed8;
}

.stage-card.mode-lovebrain {
  background: #fce7f3;
  border-color: #db2777;
}

.stage-card.mode-danger {
  background: #fee2e2;
}

.rule-tag {
  font-size: 12px;
  font-weight: 900;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 99px;
  padding: 2px 12px;
  box-shadow: 2px 2px 0 var(--ink);
}

.prompt-instruction {
  font-size: 19px;
  font-weight: 900;
  line-height: 1.25;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.88);
  border: 2px solid var(--ink);
}

.stimulus-area {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 6px 0;
}

.stroop-word {
  font-size: 76px;
  font-weight: 900;
  line-height: 1;
  -webkit-text-stroke: 2.5px var(--ink);
  filter: drop-shadow(4px 4px 0 rgba(0,0,0,0.22));
  animation: pulsePop 0.18s ease-out;
}

.gonogo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.gonogo-emoji {
  font-size: 68px;
  line-height: 1.05;
  animation: pulsePop 0.18s ease-out;
}

.gonogo-sub {
  font-size: 16px;
  font-weight: 900;
  color: #333;
}

.nback-tray {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.nback-card {
  width: 112px;
  height: 112px;
  border: 3px solid var(--ink);
  border-radius: 20px;
  background: #fff;
  box-shadow: 4px 4px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: pulsePop 0.2s ease-out;
}

.nback-icon {
  font-size: 52px;
  line-height: 1;
}

.nback-name {
  font-size: 14px;
  font-weight: 900;
  margin-top: 4px;
}

.switch-vs-row {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  gap: 10px;
}

.switch-item {
  flex: 1;
  height: 116px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 16px;
  box-shadow: 3px 3px 0 var(--ink);
  display: grid;
  place-items: center;
  font-family: "Fredoka", sans-serif;
  font-weight: 900;
}

.feedback-banner {
  min-height: 24px;
  font-size: 14px;
  font-weight: 900;
}

/* 底部作答按鈕網格 */
.answer-grid {
  display: grid;
  gap: 9px;
}

.answer-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.ans-btn {
  min-height: 66px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 5px 0 var(--ink);
  font-size: 21px;
  font-weight: 900;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  transition: transform 0.05s, box-shadow 0.05s;
}

.ans-btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--ink);
}

.ans-btn.tall {
  min-height: 108px;
  font-size: 24px;
}

.ans-btn.bomb-trap {
  background: #ff2e4c;
  color: #fff;
  animation: jitter 0.25s infinite;
}

@keyframes jitter {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-1.2deg); }
  75% { transform: rotate(1.2deg); }
}

@keyframes pulsePop {
  0% { transform: scale(0.75); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* 回合轉場遮罩 */
.round-splash {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(20, 20, 20, 0.78);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.splash-box {
  width: 100%;
  max-width: 360px;
  padding: 22px 18px;
  text-align: center;
  background: var(--yellow);
  animation: popIn 0.22s ease;
}

.splash-rnum {
  display: inline-block;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  padding: 3px 12px;
  border-radius: 99px;
  margin-bottom: 8px;
}

.splash-title {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 8px;
}

.splash-desc {
  font-size: 14.5px;
  font-weight: 800;
  line-height: 1.45;
  background: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 10px;
}

.splash-count {
  font-family: "Fredoka", sans-serif;
  font-size: 56px;
  font-weight: 900;
  color: var(--red);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 3px 3px 0 var(--ink);
  margin-top: 8px;
}

/* ==================== 結算處刑單畫面 ==================== */
.result-header {
  padding: 14px 12px;
  text-align: center;
  background: var(--yellow);
}

.result-header.is-lose {
  background: #fecdd3;
}

.result-stamp {
  display: inline-block;
  font-size: 22px;
  font-weight: 900;
  background: #fff;
  border: 3px solid var(--ink);
  padding: 4px 16px;
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-2deg);
  margin-bottom: 8px;
}

.result-headline {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 8px;
}

.result-wager-box {
  background: var(--ink);
  color: var(--yellow);
  font-size: 13.5px;
  font-weight: 900;
  padding: 7px 10px;
  border-radius: 10px;
}

.result-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.res-player-card {
  padding: 10px;
  text-align: center;
}

.res-player-card.winner {
  background: #dcfce7;
}

.res-player-card.loser {
  background: #ffe4e6;
}

.res-crown {
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}

.res-p-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 900;
  font-size: 14px;
}

.res-score {
  font-family: "Fredoka", sans-serif;
  font-size: 28px;
  font-weight: 900;
  margin: 2px 0;
}

.res-score small {
  font-size: 13px;
}

.res-species {
  font-size: 12.5px;
  font-weight: 900;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 3px 6px;
  margin: 4px 0;
}

.res-metrics {
  font-size: 11px;
  font-weight: 700;
  color: #444;
  line-height: 1.35;
}

.poster-wrap {
  padding: 10px;
  background: #fff;
  text-align: center;
}

.poster-title {
  font-size: 12.5px;
  font-weight: 900;
  margin-bottom: 8px;
}

.poster-canvas {
  width: 100%;
  max-width: 340px;
  height: auto;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--ink);
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result-sub-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* 彈幕與特效層 */
.fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  overflow: hidden;
}

.flying-taunt {
  position: absolute;
  right: -320px;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
  animation: flyAcross 3.4s linear forwards;
}

@keyframes flyAcross {
  0% { transform: translateX(0) scale(0.9); }
  10% { transform: translateX(-15vw) scale(1.04); }
  100% { transform: translateX(calc(-100vw - 420px)) scale(1); }
}

.hazard-floater {
  position: absolute;
  font-size: 44px;
  font-weight: 900;
  text-shadow: 2px 2px 0 #000;
  animation: hazardDrop 2.2s ease-in forwards;
}

@keyframes hazardDrop {
  0% { transform: translateY(-60px) rotate(0deg) scale(0.8); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(85vh) rotate(25deg) scale(1.2); opacity: 0; }
}

/* 震動與閃光回饋 */
.shake-hard {
  animation: shakeScreen 0.32s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeScreen {
  10%, 90% { transform: translate3d(-4px, 1px, 0); }
  20%, 80% { transform: translate3d(5px, -2px, 0); }
  30%, 50%, 70% { transform: translate3d(-7px, 2px, 0); }
  40%, 60% { transform: translate3d(7px, -1px, 0); }
}

.flash-ok {
  box-shadow: 0 0 0 4px #22c55e, var(--shadow-md) !important;
}

.flash-bad {
  box-shadow: 0 0 0 5px #ff2e4c, var(--shadow-md) !important;
  background: #ffe4e6 !important;
}

/* Toast 通知 */
.toast-box {
  position: fixed;
  top: 46px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 92%;
  max-width: 420px;
  pointer-events: none;
}

.toast-msg {
  background: var(--ink);
  color: #fff;
  border: 2.5px solid var(--yellow);
  border-radius: 12px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  text-align: center;
  animation: popIn 0.2s ease;
}

/* 自訂名字彈窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(0,0,0,0.6);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 340px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-card p {
  font-size: 13px;
  color: #555;
  font-weight: 700;
}

.neo-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 900;
  border: 3px solid var(--ink);
  border-radius: 12px;
  font-family: inherit;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-height: 700px) {
  .logo-main { font-size: 28px; }
  .code-digit { height: 46px; font-size: 24px; }
  .key-btn { height: 43px; font-size: 20px; }
  .stroop-word { font-size: 60px; }
  .ans-btn { min-height: 56px; font-size: 18px; }
}
