/* ===== 动漫猜猜看 · 界面美化 ===== */
:root {
  --bg-1: #0f0c1d;
  --bg-2: #1a1333;
  --card: rgba(24, 20, 46, 0.72);
  --card-border: rgba(167, 139, 250, 0.16);
  --card-hover: rgba(167, 139, 250, 0.28);
  --accent: #a78bfa;
  --accent-2: #f472b6;
  --accent-glow: rgba(167, 139, 250, 0.35);
  --text: #eae7f5;
  --text-dim: #9d96b8;
  --text-faint: #6b6485;
  --good: #34d399;
  --bad: #f87171;
  --radius: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 800px at 85% -10%, rgba(167,139,250,.14), transparent 60%),
    radial-gradient(1000px 700px at -10% 110%, rgba(244,114,182,.10), transparent 55%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2) 60%, #141026);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.container { max-width: 1160px; margin: 0 auto; padding: 32px 24px 64px; }

/* 顶部品牌 */
.brand { display:flex; align-items:baseline; gap:14px; margin-bottom: 6px; }
h1 { font-size: 34px; font-weight: 800; letter-spacing: .5px;
  background: linear-gradient(92deg, #c4b5fd 0%, #f472b6 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { color: var(--text-dim); font-size: 15px; margin-bottom: 36px; }
.subtitle b { color: var(--accent); font-weight: 600; }

/* 卡片 */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 30px;
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.04);
}
h3 { font-weight: 700; letter-spacing: .3px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 13px 26px;
  font-size: 15px; font-weight: 700; cursor: pointer; color: #fff;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
  letter-spacing: .3px;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary { background: linear-gradient(93deg, #8b5cf6, #ec4899); box-shadow: 0 8px 24px var(--accent-glow); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 32px rgba(236,72,153,.4); }
.btn-ghost {
  background: rgba(167,139,250,.08); color: var(--accent);
  border: 1px solid rgba(167,139,250,.25); box-shadow: none;
}
.btn-ghost:hover:not(:disabled) { background: rgba(167,139,250,.15); }

/* 输入 */
label { display: block; margin: 18px 0 8px; color: var(--text-dim); font-size: 13px; font-weight: 600; letter-spacing: .4px; }
input, textarea {
  width: 100%; background: rgba(10, 8, 24, .6);
  border: 1px solid rgba(167,139,250,.18); border-radius: 12px;
  padding: 13px 16px; color: var(--text); font-size: 15px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(167,139,250,.15); }
input::placeholder { color: var(--text-faint); }
.row { display: flex; gap: 12px; align-items: center; }
.mt { margin-top: 22px; }
.error { color: var(--bad); margin-top: 10px; font-size: 14px; min-height: 20px; }

/* ===== 大厅 ===== */
.room-code-box {
  display: flex; align-items: center; gap: 16px; padding: 18px 22px; margin: 20px 0 8px;
  background: rgba(167,139,250,.07); border: 1px dashed rgba(167,139,250,.3); border-radius: 14px;
}
.room-code-display {
  font-size: 44px; font-weight: 800; letter-spacing: 10px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  background: linear-gradient(92deg,#f472b6,#c4b5fd);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.copy-hint { color: var(--text-faint); font-size: 13px; margin-bottom: 24px; }
.players-list { display: flex; flex-wrap: wrap; gap: 12px; }
.player-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(167,139,250,.10); border: 1px solid rgba(167,139,250,.25);
  border-radius: 999px; padding: 9px 20px; font-weight: 600; font-size: 14px;
}
.player-chip.ready {
  background: rgba(52,211,153,.10);
  border-color: rgba(52,211,153,.35);
}
.player-chip.unready { opacity: .82; }
.player-chip.disconnected { opacity: .48; }
.player-chip .ready-state { font-size: 12px; color: var(--text-faint); }
.player-chip.ready .ready-state { color: var(--good); font-weight: 700; }
.player-chip .score { color: var(--accent-2); font-weight: 800; }
.share-box {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 18px; padding: 14px 16px; border-radius: 14px;
  background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.25);
}
.share-label { display: block; font-size: 12px; color: var(--text-faint); letter-spacing: 1px; }
.share-url {
  color: var(--good); font-weight: 800; text-decoration: none;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  word-break: break-all;
}
.share-url:hover { text-decoration: underline; }
.ready-status {
  margin: 18px 0 0; padding: 12px 16px; border-radius: 12px;
  background: rgba(167,139,250,.08); border: 1px solid rgba(167,139,250,.2);
  color: var(--text-dim); font-size: 14px; text-align: center;
}

/* ===== 游戏布局 ===== */
/* 桌面端：左侧玩家列表，右侧上方题目、下方答题记录 */
.game-layout {
  display: grid; grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px; align-items: start;
}
.game-main {
  min-width: 0; display: flex; flex-direction: column; gap: 16px;
}
.game-sidebar { position: sticky; top: 24px; min-width: 0; }
.question-stage { padding: 16px; }

/* 答题记录 + 提交框 */
.answer-panel {
  margin-top: 0; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 260px;
}
.answer-log {
  flex: 1; min-height: 150px; overflow-y: auto; padding-right: 6px;
  display: flex; flex-direction: column; gap: 8px;
}
.answer-item {
  display: flex; align-items: baseline; gap: 7px;
  padding: 9px 11px; border-radius: 10px; line-height: 1.35;
  background: rgba(167,139,250,.07); border: 1px solid rgba(167,139,250,.12);
}
.answer-item .answer-name {
  flex: 0 0 auto; max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--accent); font-weight: 700; font-size: 13px;
}
.answer-item .answer-text { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); font-size: 13px; }
.answer-item.correct {
  background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.24);
}
.answer-item.correct .answer-text,
.answer-item.correct .answer-name {
  color: var(--good); font-weight: 800;
}
.answer-item.wrong {
  background: #fdf4f4;
  border-color: #f0caca;
}
.answer-item.wrong .answer-name,
.answer-item.wrong .answer-text {
  color: var(--bad);
  font-weight: 800;
}
.answer-item.wrong.mine {
  background: #fdf1f1;
  border-color: #e9b7b7;
}

/* 手机端：上方题目舞台，下方左侧玩家、右侧答题记录 */
@media (max-width: 900px) {
  .container { padding: 14px 10px 32px; }
  .game-layout {
    grid-template-columns: minmax(92px, 112px) minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) minmax(0, auto);
    grid-template-areas:
      "stage stage"
      "players answers";
    gap: 10px; align-items: stretch;
  }
  .game-main { display: contents; }
  .question-stage {
    grid-area: stage; padding: 12px;
    max-height: 54svh; overflow: hidden;
  }
  .game-sidebar {
    grid-area: players; position: static;
    display: flex; flex-direction: column; min-height: 0;
  }
  .answer-panel {
    grid-area: answers; display: flex; flex-direction: column;
    padding: 12px; min-height: 0; overflow: hidden; gap: 8px;
  }
  .answer-log { flex: 1; min-height: 0; }
  .answer-input-row { margin-top: auto; }
  /* 手机端隐藏侧栏离开按钮，保持紧凑玩家栏 */

  .game-sidebar .btn { display: none; }
  .hint-line { padding: 9px 10px; gap: 8px; }
  .hint-masks { min-width: 0; font-size: clamp(18px, 5.4vw, 26px); letter-spacing: 2px; }
  .round-bar { font-size: 12px; gap: 6px; }
  .round-pill, .score-pill { padding: 4px 8px; font-size: 11px; }
}

@media (max-width: 520px) {
  .game-layout { grid-template-columns: minmax(84px, 96px) minmax(0, 1fr); gap: 8px; }
  .score-board { height: 100%; min-height: 0; overflow-y: auto; padding: 7px; border-radius: 14px; }
  .score-row { gap: 6px; padding: 7px 5px; }
  .player-avatar {
    width: 24px; height: 24px; flex: 0 0 auto;
    font-size: 11px; border-radius: 50%;
  }
  .player-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
  .player-name {
    font-size: 11px; line-height: 1.15;
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
.score-row .pts { font-size: 10px; line-height: 1.15; font-weight: 800; color: var(--text-dim); }
.score-row.disconnected { opacity: .48; }
  .answer-panel { padding: 10px; }
  .answer-input-row { gap: 6px; }
  .answer-input-row input { padding: 9px 10px; font-size: 13px; }
  .answer-input-row .btn { padding: 9px 10px; font-size: 12px; }
  .answer-item { padding: 7px 8px; gap: 5px; }
  .answer-item .answer-name { max-width: 32%; font-size: 11px; }
  .answer-item .answer-text { font-size: 12px; }
}

.round-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
  color: var(--text-dim); font-size: 14px;
}
.round-bar b { color: var(--text); font-weight: 700; }
.round-pill {
  padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(167,139,250,.12); border: 1px solid rgba(167,139,250,.28); color: var(--accent);
}
.score-pill {
  padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(244,114,182,.12); border: 1px solid rgba(244,114,182,.3); color: var(--accent-2);
}

.img-wrapper {
  position: relative; display: grid; place-items: center;
  aspect-ratio: var(--image-aspect, 16 / 9);
  width: 100%;
  min-height: 0; max-height: 70vh; border-radius: var(--radius); overflow: hidden;
  background: #08060f;
  border: 1px solid rgba(167,139,250,.18);
  box-shadow: 0 24px 70px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.02) inset;
}
.image-canvas { position: relative; line-height: 0; }
.img-wrapper img { width: 100%; height: 100%; object-fit: contain; display: block; }
.grid-overlay { position: absolute; inset: 0; display: grid; pointer-events: none; }
.cell { border: .5px solid rgba(8,6,15,.9); background: #08060f; transition: background .35s ease; }
.cell.revealed { background: transparent; border-color: transparent; }

.timer-bar { height: 10px; background: rgba(167,139,250,.12); border-radius: 999px; margin-top: 18px; overflow: hidden; }
.timer-fill { height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #ec4899);
  box-shadow: 0 0 12px var(--accent-glow); transition: width .5s linear; }

/* 答题卡 */
.answer-panel label { margin-top: 0; }
.answer-input-row { gap: 10px; }
.hint-line {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: 14px;
  background: rgba(167,139,250,.09); border: 1px solid rgba(167,139,250,.2);
}
.question-hint { margin-bottom: 16px; }
.question-stage.result .img-wrapper img {
  object-fit: contain;
}
.hint-label { font-size: 13px; font-weight: 800; color: var(--text-dim); letter-spacing: 1px; }
.hint-masks {
  flex: 1; min-width: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(24px, 4vw, 36px); font-weight: 900; letter-spacing: 4px; color: var(--accent);
  white-space: pre-wrap; word-break: break-word; line-height: 1.3;
  text-shadow: 0 0 18px rgba(167,139,250,.25);
}
.hint-wrong { color: var(--bad); }
.hint-right { color: var(--good); }

/* 结果 */
.result-banner {
  margin-top: 0; padding: 20px 22px; border-radius: 14px;
  background: linear-gradient(160deg, rgba(52,211,153,.14), rgba(52,211,153,.05));
  border: 1px solid rgba(52,211,153,.35);
  animation: pop .4s cubic-bezier(.2,1.4,.4,1);
}
.result-banner.wrong {
  background: linear-gradient(160deg, rgba(248,113,113,.12), rgba(248,113,113,.04));
  border-color: rgba(248,113,113,.3);
}
.result-banner .big-line { font-size: 17px; font-weight: 700; }
.result-banner .flow { margin-top: 4px; font-size: 12px; color: var(--text-faint); letter-spacing: .5px; }
.result-banner .ans-line { margin-top: 12px; font-size: 14px; color: var(--text-dim); }
.result-banner .ans-word { font-size: 20px; font-weight: 800; color: var(--accent); margin-left: 8px; }
.result-banner .who { margin-top: 8px; font-size: 13px; color: var(--text-dim); }
@keyframes pop { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* 玩家列表：头像在左，名称/分数在右 */
.score-board {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 16px; backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.score-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 12px; margin-bottom: 4px;
}
.player-avatar {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg,#8b5cf6,#ec4899); color:#fff; font-size:13px; font-weight:800;
}
.player-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.player-name {
  font-size: 14px; line-height: 1.2;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.score-row .pts { font-size: 12px; line-height: 1.2; color: var(--text-dim); font-weight: 800; }
.score-row.me { background: rgba(244,114,182,.1); border: 1px solid rgba(244,114,182,.22); }
.score-row.me .player-name, .score-row.me .pts { color: var(--accent-2); }

/* ===== 结算 ===== */
.final-wrap { max-width: 620px; margin: 40px auto 0; text-align: center; }
.final-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-radius: 12px; margin-bottom: 10px; font-size: 17px;
  background: rgba(167,139,250,.06); border: 1px solid rgba(167,139,250,.12);
}
.final-row.champ { background: linear-gradient(93deg, rgba(244,114,182,.16), rgba(167,139,250,.14)); border-color: rgba(244,114,182,.35); }
.final-row .pts { font-weight: 800; font-size: 22px; color: var(--accent-2); }

/* ===== 题库管理 ===== */
.divider { border: none; border-top: 1px solid rgba(167,139,250,.12); margin: 24px 0; }
.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; margin-top: 18px; }
.q-item {
  background: rgba(10,8,24,.5); border: 1px solid rgba(167,139,250,.14);
  border-radius: 12px; overflow: hidden; transition: transform .15s, border-color .15s;
}
.q-item:hover { transform: translateY(-3px); border-color: var(--card-hover); }
.q-item img { width: 100%; aspect-ratio: 16/10; object-fit: cover; display: block; }
.q-item .answer { padding: 9px 12px 4px; font-size: 12.5px; color: var(--accent); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-item button {
  width: 100%; border: none; background: transparent; color: var(--text-faint);
  padding: 7px; cursor: pointer; font-size: 12px;
}
.q-item button:hover { color: var(--bad); }

/* 顶部导航条（游戏中） */
.topnav { display:flex; justify-content: space-between; align-items:center; margin-bottom: 18px; }
.topnav .room-tag { color: var(--text-faint); font-size: 13px; letter-spacing: 1px; }
.topnav .room-tag b { color: var(--accent); font-family: "SF Mono", monospace; letter-spacing: 3px; }

/* 手机端最终布局：强制上下分区在一屏内显示，并修复后置基础样式造成的排版覆盖 */
@media (max-width: 900px) {
  .container { padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  #view-game {
    display: flex; flex-direction: column;
    min-height: calc(100svh - 20px - env(safe-area-inset-bottom));
    overflow: visible;
  }
  .topnav { flex: 0 0 auto; margin-bottom: 7px; }
  .topnav .room-tag { font-size: 11px; }
  .topnav .room-tag b { letter-spacing: 2px; }

  .game-layout {
    flex: 1; min-height: 0;
    grid-template-columns: minmax(96px, 112px) minmax(0, 1fr);
    grid-template-rows: minmax(0, auto) minmax(0, 1fr);
    grid-template-areas:
      "stage stage"
      "players answers";
    gap: 7px; align-items: stretch;
  }
  .question-stage {
    grid-area: stage;
    display: flex; flex-direction: column;
    min-height: 0; max-height: 100%;
    padding: 9px; overflow: hidden;
  }
  .question-hint { margin-bottom: 7px; }
  .hint-line {
    align-items: center; gap: 6px;
    padding: 5px 7px; border-radius: 10px;
  }
  .hint-label { flex: 0 0 auto; font-size: 10px; letter-spacing: 1px; }
  .hint-masks {
    min-width: 0; flex: 1;
    font-size: clamp(14px, 3.8vw, 19px);
    letter-spacing: 3px; line-height: 1.1;
    max-height: calc(1.1em * 3); overflow: hidden;
    text-shadow: none;
  }
  .hint-line {
    flex: 0 0 auto;
  }
  .img-wrapper {
    flex: 0 0 auto;
    aspect-ratio: var(--image-aspect, 16 / 9);
    width: 100%;
    min-height: 0;
    max-height: 60vh;
    margin: 0 auto;
  }
  .timer-bar { height: 4px; margin-top: 7px; }

  .game-sidebar {
    grid-area: players; position: static;
    min-width: 0; min-height: 0; display: flex;
  }
  .game-sidebar .btn { display: none; }
  .score-board {
    width: 100%; height: 100%; min-height: 0;
    padding: 5px; border-radius: 14px; overflow-y: auto;
  }
  .score-row {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: 6px; row-gap: 1px;
    align-items: center; padding: 6px 4px; margin-bottom: 3px;
  }
  .player-avatar {
    grid-column: 1; grid-row: 1 / span 2;
    width: 22px; height: 22px; font-size: 10px;
  }
  .player-meta { display: contents; }
  .player-name {
    grid-column: 2; grid-row: 1;
    min-width: 0; max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 11px; line-height: 1.1;
  }
  .score-row .pts {
    grid-column: 2; grid-row: 2;
    font-size: 10px; line-height: 1.1; color: var(--text-dim);
  }

  .answer-panel {
    grid-area: answers;
    height: 100%; min-height: 0;
    padding: 8px; gap: 6px; overflow: hidden;
  }
  .answer-log { flex: 1 1 auto; min-height: 0; gap: 5px; padding-right: 3px; }
  #answer-area { flex: 0 0 auto; }
  .answer-input-row { gap: 6px; align-items: stretch; margin-top: 0; }
  .answer-input-row input { min-width: 0; padding: 9px 10px; font-size: 13px; height: auto; }
  .answer-input-row .btn { padding: 9px 12px; font-size: 12px; border-radius: 10px; }
  .answer-item { padding: 6px 7px; gap: 5px; }
  .answer-item .answer-name { max-width: 31%; font-size: 11px; }
  .answer-item .answer-text { font-size: 12px; }
}

@media (max-width: 520px) {
  .game-layout { grid-template-columns: minmax(92px, 102px) minmax(0, 1fr); gap: 6px; }
}


/* 候选截图审核 */
.candidate-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px; margin-top: 16px;
}
.candidate-item { padding: 0; overflow: hidden; }
.candidate-form { display: flex; flex-direction: column; gap: 7px; padding: 9px; }
.candidate-form input { padding: 8px 10px; font-size: 12px; }
.candidate-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.candidate-actions button {
  border: none; border-radius: 9px; padding: 8px; cursor: pointer;
  color: #fff; font-size: 12px; font-weight: 700;
}
.candidate-actions .approve { background: linear-gradient(93deg,#10b981,#34d399); }
.candidate-actions .reject { background: rgba(248,113,113,.16); color: var(--bad); border: 1px solid rgba(248,113,113,.28); }

/* ===== 简约清新大气 · 浅色主题覆盖 ===== */
:root {
  --bg-1: #f5f8fb;
  --bg-2: #eef3f8;
  --card: #ffffff;
  --card-border: #e4eaf2;
  --card-hover: #cfd9e7;
  --accent: #2563eb;
  --accent-2: #0f9d8f;
  --accent-glow: rgba(37, 99, 235, .12);
  --text: #17233a;
  --text-dim: #637084;
  --text-faint: #8c99aa;
  --good: #129d6e;
  --bad: #d94f4f;
  --radius: 6px;
}

html { color-scheme: light; }
body {
  background:
    radial-gradient(720px 460px at 82% 0%, rgba(59,130,246,.10), transparent 62%),
    radial-gradient(620px 430px at 0% 100%, rgba(15,157,143,.09), transparent 60%),
    linear-gradient(180deg, #f7fafc, #eef3f8);
  color: var(--text);
}

h1 {
  background: linear-gradient(92deg, #2563eb, #0f9d8f);
  -webkit-background-clip: text; background-clip: text;
}
.subtitle, .copy-hint, label, .ready-status { color: var(--text-dim); }
.subtitle b { color: var(--accent); }

.card, .score-board {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--card-border);
  box-shadow: 0 12px 34px rgba(23, 55, 94, .06);
}

.btn { color: white; }
.btn-primary {
  background: linear-gradient(93deg, #2563eb, #0ea5a4);
  box-shadow: 0 8px 20px rgba(37,99,235,.14);
}
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 24px rgba(37,99,235,.2); }
.btn-ghost {
  background: #fff; color: #2c4a6b;
  border: 1px solid #d8e0ea;
  box-shadow: 0 2px 8px rgba(23,55,94,.04);
}
.btn-ghost:hover:not(:disabled) { background: #f5f8fb; }

input, textarea {
  background: #f8fafc;
  border: 1px solid #dbe3ec;
  color: var(--text);
}
input:focus { border-color: #93b4fb; box-shadow: 0 0 0 4px rgba(37,99,235,.08); }
input::placeholder { color: #a4b0c0; }

.room-code-box {
  background: #f3f7fd;
  border: 1px dashed #bfd0e6;
}
.room-code-display {
  background: linear-gradient(92deg, #2563eb, #0f9d8f);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.players-list .player-chip {
  background: #fff; border: 1px solid #dbe3ec; color: var(--text);
  box-shadow: 0 2px 8px rgba(23,55,94,.04);
}
.player-chip.ready {
  background: #f0fbf6;
  border-color: #a7e5c8;
  color: var(--good);
}
.player-chip .ready-state { color: var(--text-faint); }
.player-chip.ready .ready-state { color: var(--good); }
.player-chip .score { color: var(--accent-2); }

.share-box {
  background: #f0fbf6;
  border: 1px solid #bfe7d2;
}
.share-label { color: var(--text-faint); }
.share-url { color: #0d8a61; }
.ready-status {
  background: #f4f7fd;
  border: 1px solid #dce5f0;
}

.answer-item {
  background: #f7f9fc;
  border: 1px solid #e3e9f1;
}
.answer-item .answer-name { color: var(--accent); }
.answer-item .answer-text { color: #28364c; }
.answer-item.correct { background: #eefaf4; border-color: #bfe8d3; }
.answer-item.correct .answer-text,
.answer-item.correct .answer-name { color: var(--good); }
.answer-item.wrong.mine { background: #fdf4f4; border-color: #f0caca; }

.round-pill {
  background: #eef4ff;
  border: 1px solid #cfdefb;
  color: #2557b8;
}
.score-pill {
  background: #edf9f7;
  border: 1px solid #bfe7e2;
  color: #0c7f74;
}

.hint-line {
  background: #f4f7fd;
  border: 1px solid #dbe5f1;
}
.hint-label { color: #637084; }
.hint-masks {
  color: #1f4f8f;
  text-shadow: none;
}

.img-wrapper {
  background: #f2f5f8;
  border: 1px solid #e0e6ee;
  box-shadow: 0 8px 22px rgba(23,55,94,.06);
}
.grid-overlay .cell {
  background: #e7ecf3;
  border-color: rgba(255,255,255,.72);
}
.grid-overlay .cell.revealed { background: transparent; border-color: transparent; }
.timer-bar { background: #e6ecf4; }
.timer-fill {
  background: linear-gradient(90deg, #2563eb, #0ea5a4);
  box-shadow: none;
}

.score-board { box-shadow: 0 8px 24px rgba(23,55,94,.05); }
.score-row.me {
  background: #f1f7ff;
  border: 1px solid #cddff9;
}
.score-row.me .player-name,
.score-row.me .pts { color: #22518f; }
.player-avatar {
  background: linear-gradient(135deg, #2563eb, #0ea5a4);
  color: #fff;
}

.result-banner {
  background: linear-gradient(160deg, #eefaf4, #fff);
  border: 1px solid #bfe8d3;
}
.result-banner.wrong {
  background: linear-gradient(160deg, #fff6f5, #fff);
  border-color: #f2c7c5;
}
.result-banner .ans-word { color: var(--accent); }

.final-row {
  background: #f7f9fc;
  border: 1px solid #e3e9f1;
}
.final-row.champ {
  background: linear-gradient(93deg, #f0fbf6, #eef4ff);
  border-color: #bfe0f5;
}
.final-row .pts { color: var(--accent-2); }

.divider { border-top: 1px solid #e6ebf2; }
.q-item {
  background: #fff;
  border: 1px solid #e4eaf2;
  box-shadow: 0 6px 16px rgba(23,55,94,.04);
}
.q-item:hover { border-color: #bfd0e6; }
.q-item .answer { color: var(--accent); }
.q-item button { color: var(--text-faint); }
.topnav .room-tag { color: var(--text-faint); }
.topnav .room-tag b { color: var(--accent); }

/* ===== 创建房间弹窗 ===== */
.modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(23,35,58,.28);
  backdrop-filter: blur(8px);
}
.modal-card {
  width: min(430px, 100%); background: rgba(255,255,255,.97);
  border: 1px solid var(--card-border); border-radius: 22px;
  padding: 24px; box-shadow: 0 24px 70px rgba(23,55,94,.18);
  animation: modal-pop .22s ease;
}
.modal-title { font-size: 20px; color: var(--text); }
.modal-desc { margin: 7px 0 16px; color: var(--text-dim); font-size: 13px; }
.room-size-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.room-size-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 15px 16px; cursor: pointer; text-align: left;
  background: #f8fafc; border: 1px solid #dbe3ec; border-radius: 15px;
  transition: .16s ease;
}
.room-size-option:hover { border-color: #93b4fb; background: #f2f7ff; transform: translateY(-2px); }
.room-size-option b { font-size: 16px; color: var(--text); }
.room-size-option span { font-size: 12px; color: var(--text-faint); }
.room-size-option.selected {
  background: #eef5ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,.10);
}
.room-size-option.selected b { color: #2358b7; }
.modal-actions {
  display: grid; grid-template-columns: 94px minmax(0, 1fr); gap: 10px;
  margin-top: 2px;
}
.modal-actions .modal-cancel { width: 100%; margin-top: 0; }
@keyframes modal-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }


/* 创建房间弹窗：2-8人布局 */
.room-size-grid { grid-template-columns: repeat(4, 1fr); }
.room-size-option { align-items: center; text-align: center; }
@media (max-width: 520px) {
  .room-size-option { padding: 8px 4px; border-radius: 11px; gap: 1px; }
  .room-size-option b { font-size: 12px; }
  .room-size-option span { font-size: 9px; }
  .modal-card { padding: 16px 14px; }
}


/* 单人模式入口 */
.solo-option {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 16px; margin-bottom: 18px; cursor: pointer; text-align: left;
  background: linear-gradient(93deg, #eef6ff, #effaf7);
  border: 1px solid #c8e2f7; border-radius: 16px;
  transition: .16s ease;
}
.solo-option:hover { transform: translateY(-2px); border-color: #93b4fb; box-shadow: 0 10px 22px rgba(37,99,235,.08); }
.solo-option b { font-size: 16px; color: var(--text); }
.solo-option span { font-size: 12px; color: var(--text-faint); }
.modal-subtitle {
  margin: 0 0 10px; color: var(--text-faint); font-size: 12px; font-weight: 700; letter-spacing: 1px;
}

.mode-selector {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-bottom: 14px;
}
.mode-option {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 11px 9px; cursor: pointer; text-align: center;
  background: #f8fafc; border: 1px solid #dbe3ec; border-radius: 15px;
  transition: .16s ease;
}
.mode-option:hover { border-color: #93b4fb; background: #f2f7ff; }
.mode-option b { font-size: 14px; color: var(--text); }
.mode-option span { font-size: 11px; color: var(--text-faint); }
.mode-option.selected {
  background: #eef5ff; border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37,99,235,.10);
}
.mode-option.selected b { color: #2358b7; }
#multi-room-settings { margin-bottom: 12px; }

.question-count-setting {
  margin-bottom: 16px; padding: 12px 14px;
  background: #f7fafd; border: 1px solid #dfe8f2; border-radius: 16px;
}
.question-count-setting .setting-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 9px; color: var(--text-dim); font-size: 13px; font-weight: 700;
}
.question-count-setting b { color: var(--accent); font-size: 15px; }
.question-count-setting input[type="range"] {
  width: 100%; height: 22px; padding: 0; margin: 0;
  border: none; background: transparent; accent-color: #2563eb; box-shadow: none;
}
.question-count-setting .range-scale {
  display: flex; justify-content: space-between; margin-top: 3px;
  color: var(--text-faint); font-size: 11px;
}


/* 当前答题阶段提示：放在图片外侧，不遮挡画面 */
.stage-timer-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; min-width: 0;
}
.stage-timer-row .timer-bar { flex: 1; margin-top: 0; min-width: 0; }
.stage-badge {
  flex: 0 0 auto; padding: 7px 12px; border-radius: 999px;
  background: #f4f7fd; border: 1px solid rgba(37,99,235,.18);
  color: #2358b7; font-size: 12px; font-weight: 800; letter-spacing: .5px;
  white-space: nowrap; pointer-events: none;
}
@media (max-width: 900px) {
  .stage-timer-row { gap: 6px; margin-top: 7px; }
  .stage-badge { padding: 4px 8px; font-size: 10px; }
}


/* 答题记录状态颜色 */
.answer-item.correct .answer-name,
.answer-item.correct .answer-text {
  color: var(--good);
  font-weight: 800;
}
.answer-item.wrong .answer-name,
.answer-item.wrong .answer-text {
  color: var(--bad);
  font-weight: 800;
}


/* 倒计时图标与剩余时间 */
.timer-meta {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 6px;
  color: #2358b7; font-size: 12px; font-weight: 800;
  white-space: nowrap; min-width: 68px;
}
.timer-clock {
  width: 16px; height: 16px; flex: 0 0 auto;
  fill: none; stroke: #2563eb; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
@media (max-width: 900px) {
  .timer-meta { gap: 4px; min-width: 56px; font-size: 10px; }
  .timer-clock { width: 13px; height: 13px; }
}


/* 键盘弹出时锁定游戏区高度，避免视觉视口变化带动图片区域抖动 */
#view-game.keyboard-locked {
  height: var(--locked-game-height, calc(100svh - 20px - env(safe-area-inset-bottom)));
}


/* 阶段切换倒计时 Toast */
.stage-toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(320px, calc(100vw - 48px));
  padding: 14px 22px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(15, 23, 42, .08);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .18);
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  animation: stage-toast-in .24s ease;
}
.stage-toast.hidden { display: none; }

@keyframes stage-toast-in {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.94); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 房间号复制与题目进度 */
.room-code-box { gap: 10px; }
.copy-room-btn {
  width: 34px; height: 34px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 10px; background: #fff; color: var(--text-dim);
  cursor: pointer; transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.copy-room-btn:hover { color: var(--accent-2); border-color: rgba(37,99,235,.3); background: #f4f8ff; transform: translateY(-1px); }
.copy-room-btn:active { transform: translateY(0); }
.copy-room-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.copy-room-btn .icon-check { display: none; }
.copy-room-btn.copied { color: var(--good); border-color: rgba(16, 185, 129, .38); background: #f0fbf6; }
.copy-room-btn.copied .icon-copy { display: none; }
.copy-room-btn.copied .icon-check { display: block; }
.lobby .room-code-box .copy-room-btn,
#view-lobby .room-code-box .copy-room-btn { margin-left: auto; }

.room-code-tag {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 0; white-space: nowrap;
}
.room-code-tag > span:first-child { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.room-code-tag .copy-room-btn { width: 24px; height: 24px; border-radius: 8px; }
.room-code-tag .copy-room-btn svg { width: 14px; height: 14px; }
.progress-tag { flex: 0 0 auto; font-weight: 750; letter-spacing: .6px; }
.topnav { gap: 8px; }

@media (max-width: 900px) {
  .room-code-box { padding: 13px 16px; }
  .room-code-display { font-size: clamp(30px, 9vw, 38px); letter-spacing: 7px; }
  .copy-room-btn { width: 30px; height: 30px; }
  .topnav { margin-bottom: 6px; }
  .room-code-tag { gap: 4px; }
  .room-code-tag .copy-room-btn { width: 22px; height: 22px; border-radius: 7px; }
  .room-code-tag .copy-room-btn svg { width: 13px; height: 13px; }
  .progress-tag { min-width: 30px; text-align: right; }
}

@media (max-width: 520px) {
  .topnav { align-items: center; }
  .topnav .room-tag { font-size: 11px; }
  .room-code-display { font-size: clamp(27px, 8vw, 32px); letter-spacing: 5px; }
  .progress-tag { font-size: 12px; }
}


/* 答案提示内容默认居中 */
.question-hint .hint-masks {
  text-align: center;
}


/* 「答案：__」整体居中 */
.question-hint {
  justify-content: center;
}
.question-hint .hint-label {
  flex: 0 0 auto;
}
.question-hint .hint-masks {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  text-align: center;
}


/* 缩小答案下划线之间的间距 */
.question-hint .hint-masks {
  letter-spacing: 2px;
  word-spacing: normal;
}


/* 手机版玩家名称空间优化 */
@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: minmax(118px, 136px) minmax(0, 1fr);
    column-gap: 6px;
  }
  .score-board { padding: 4px; }
  .score-row {
    grid-template-columns: 26px minmax(0, 1fr);
    column-gap: 8px;
    row-gap: 1px;
    padding: 5px 4px;
    margin-bottom: 2px;
  }
  .player-avatar {
    width: 26px; height: 26px; font-size: 11px;
  }
  .player-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    white-space: normal;
    text-overflow: clip;
    font-size: 10px;
    line-height: 1.15;
  }
  .score-row.me .player-avatar {
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .28);
  }
}

@media (max-width: 520px) {
  .game-layout {
    grid-template-columns: minmax(122px, 140px) minmax(0, 1fr);
    column-gap: 5px;
  }
  .score-board { padding: 3px; }
  .score-row {
    grid-template-columns: 28px minmax(0, 1fr);
    column-gap: 8px;
    padding: 4px;
  }
  .player-avatar {
    width: 28px; height: 28px; font-size: 12px;
  }
  .player-name { font-size: 10px; }
}

/* 用户头像 */
.avatar-setup {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}
.home-avatar,
.player-avatar {
  overflow: hidden;
}
.home-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, #2563eb, #0ea5a4);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
}
.home-avatar img,
.player-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}
.avatar-upload-btn {
  padding: 10px 16px;
  font-size: 13px;
  cursor: pointer;
}
.player-chip .player-avatar {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

@media (max-width: 520px) {
  .avatar-setup { gap: 10px; margin-top: 12px; }
  .home-avatar { width: 48px; height: 48px; font-size: 19px; }
  .avatar-upload-btn { padding: 9px 13px; font-size: 12px; }
  .player-chip .player-avatar { width: 22px; height: 22px; font-size: 10px; }
}


/* 答题记录里的头像 */
.answer-item {
  align-items: center;
}
.answer-avatar {
  width: 22px !important;
  height: 22px !important;
  flex: 0 0 auto;
  font-size: 10px !important;
}

@media (max-width: 900px) {
  .answer-avatar {
    width: 17px !important;
    height: 17px !important;
    font-size: 8px !important;
  }
  .answer-item { gap: 4px; }
  .answer-item .answer-name { flex: 0 1 auto; max-width: 38%; }
}


/* 新揭开的方格缓慢渐入 */
.grid-overlay .cell {
  transition: background-color 1.6s cubic-bezier(.22,.61,.36,1), border-color 1.6s cubic-bezier(.22,.61,.36,1);
}
.grid-overlay .cell.slow-reveal {
  animation: cellSlowReveal 1.8s cubic-bezier(.22,.61,.36,1) forwards;
}
@keyframes cellSlowReveal {
  0% {
    background-color: #e7ecf3;
    border-color: rgba(255, 255, 255, .72);
  }
  100% {
    background-color: transparent;
    border-color: transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grid-overlay .cell,
  .grid-overlay .cell.slow-reveal {
    transition: none;
    animation: none;
  }
}

/* 昵称为空时的行内校验提示 */
#nickname.invalid {
  border-color: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, .10);
}
.field-error {
  display: none;
  margin-top: 6px;
  color: #dc2626;
  font-size: 12px;
  line-height: 1.3;
}
.field-error.visible {
  display: block;
}

/* 首页标题与表单整体垂直水平居中 */
#view-home {
  min-height: calc(100svh - 96px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#view-home .brand {
  justify-content: center;
  text-align: center;
  margin: 0 0 26px;
}

#view-home .card {
  width: min(480px, 100%);
}

@media (max-width: 900px) {
  #view-home {
    min-height: calc(100svh - 20px - env(safe-area-inset-bottom));
  }

  #view-home .brand {
    margin-bottom: 20px;
  }
}

/* 答题页房间号左侧的回首页按钮 */
.home-room-btn {
  width: 24px; height: 24px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(37, 99, 235, .18); border-radius: 8px;
  background: #fff; color: var(--text-dim); cursor: pointer;
  transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.home-room-btn:hover { color: #2563eb; border-color: rgba(37,99,235,.3); background: #f4f8ff; transform: translateY(-1px); }
.home-room-btn:active { transform: translateY(0); }
.home-room-btn svg {
  width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

@media (max-width: 900px) {
  .home-room-btn { width: 22px; height: 22px; border-radius: 7px; }
  .home-room-btn svg { width: 13px; height: 13px; }
}

/* 回首页确认弹窗 */
.confirm-card {
  width: min(360px, 100%);
  text-align: center;
}
.confirm-card h3 { font-size: 20px; }
.confirm-card .modal-desc { margin-bottom: 22px; font-size: 14px; line-height: 1.5; }
.leave-actions { grid-template-columns: 1fr 1fr; }
.leave-actions .modal-cancel,
.leave-actions .leave-confirm { width: 100%; margin-top: 0; }
.leave-confirm {
  background: #2563eb;
  color: #fff;
  box-shadow: none;
}
.leave-confirm:hover:not(:disabled) {
  background: #1d4ed8;
  box-shadow: none;
}

/* 答题页房间号右侧：只保留复制图标，不要底色和边框 */
.room-code-tag .copy-room-btn,
.room-code-tag .copy-room-btn.copied {
  width: 24px;
  height: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--text-dim);
}
.room-code-tag .copy-room-btn:hover {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: #2563eb;
  transform: none;
}
.room-code-tag .copy-room-btn.copied {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--good);
}

@media (max-width: 900px) {
  .room-code-tag .copy-room-btn,
  .room-code-tag .copy-room-btn.copied {
    width: 22px;
    height: 22px;
  }
}

/* 倒计时未作答记录 */
.answer-item.timeout {
  background: #f7f9fc;
  border-color: #dbe4ef;
}
.answer-item.timeout .answer-name,
.answer-item.timeout .answer-text {
  color: #64748b;
  font-weight: 700;
}

/* 桌面端强制答题页在一屏内显示，聊天/答题区保持可见 */
@media (min-width: 901px) {
  body.viewing-game .container {
    padding: 16px 24px;
  }

  #view-game {
    display: flex;
    flex-direction: column;
    height: calc(100svh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    min-height: 0;
    overflow: hidden;
  }

  .topnav {
    flex: 0 0 auto;
    margin-bottom: 12px;
  }

  .game-layout {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
  }

  .game-sidebar {
    position: static;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .game-sidebar .score-board {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }

  .game-sidebar .btn.mt {
    flex: 0 0 auto;
    margin-top: 10px;
  }

  .game-main {
    height: 100%;
    min-height: 0;
    gap: 14px;
  }

  .question-stage {
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 14px;
  }

  .question-hint {
    flex: 0 0 auto;
  }

  .img-wrapper {
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    max-height: 60vh;
    aspect-ratio: var(--image-aspect, 16 / 9);
  }

  .stage-timer-row {
    flex: 0 0 auto;
    margin-top: 10px;
  }
  .answer-panel {
    flex: 0 0 auto;
    height: clamp(180px, 28vh, 300px);
    min-height: 0;
    padding: 14px;
    gap: 10px;
    overflow: hidden;
  }

  .answer-log {
    flex: 1 1 auto;
    min-height: 0;
  }
}


/* 猜人物模式 */
.question-type-selector {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  margin-bottom: 18px;
}
.question-type-option {
  border: 1px solid #dbe5f1; background: #f7fafc; color: var(--text);
  border-radius: 14px; padding: 13px 14px; text-align: left; cursor: pointer;
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
}
.question-type-option b { display: block; font-size: 15px; }
.question-type-option span { display: block; margin-top: 3px; color: #68788f; font-size: 12px; }
.question-type-option.selected {
  background: #edf5ff; border-color: #9dc1f5; color: #17458f;
  box-shadow: 0 0 0 2px rgba(37,99,235,.08);
}
.question-type-option:active { transform: scale(.99); }

.character-import .character-fields {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px;
}
.character-import #character-image-input { grid-column: 1 / -1; }
.character-import .character-fields,
.character-import input[type="file"] { color: var(--text-dim); }
.character-preview {
  margin-top: 12px; padding: 10px; border-radius: 12px;
  background: #f7fafc; border: 1px solid #dbe5f1;
}
.character-preview img {
  max-width: 180px; max-height: 220px; object-fit: contain; display: block;
  background: #fff; border-radius: 8px;
}
.character-preview div { margin-top: 8px; color: #68788f; font-size: 12px; }
.character-import .error { min-height: 18px; margin-top: 8px; }
#image-canvas.character-canvas {
  background: #fff;
  box-shadow: 0 0 0 1px #e5ebf3;
}
.result-work {
  margin: -6px 0 14px; color: #68788f; font-size: 13px; text-align: center;
}
@media (max-width: 640px) {
  .character-import .character-fields { grid-template-columns: 1fr; }
  .question-type-option b { font-size: 14px; }
  .question-type-option span { font-size: 11px; }
}


/* PC 答题稳定性：题图区和答题区共享固定可视高度，输入框始终留在底部。 */
@media (min-width: 901px) {
  .game-layout {
    height: 100%;
    min-height: 0;
    align-items: stretch;
  }
  .game-main {
    display: grid;
    grid-template-rows: minmax(0, 1fr) clamp(180px, 28vh, 300px);
    height: 100%;
    min-height: 0;
    gap: 14px;
  }
  .question-stage {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .img-wrapper {
    flex: 1 1 auto;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    aspect-ratio: auto;
  }
  .answer-panel {
    height: auto;
    min-height: 0;
    margin: 0;
  }
}

/* 新题图片加载前覆盖旧图，避免上一题在下一题出现前闪过一帧。
   加载期间保持正常的浅色背景与遮挡方格，不额外显示黑屏或 Loading 文案。 */
.image-canvas #q-img {
  opacity: 1;
  transition: opacity .24s ease;
}
.image-canvas.image-loading #q-img {
  visibility: hidden;
  opacity: 0;
}
