/* 环一把 · 异环风格样式
 * 配色取自《异环 Neverness to Everness》官方视觉:超自然都市夜景 ——
 * 沥青黑底 + 高饱和霓虹橙主视觉,辅以青 / 紫异能辉光与街头元素
 * (斜切警示条纹、城市街区网格、半调网点、故障 glitch 标题)。
 * 反馈色语义对齐 Wordle 玩法:命中 = 霓虹绿,接近 = 琥珀橙,不匹配 = 近底色空洞。
 */
:root {
  color-scheme: dark;

  --bg: #0b0b12;
  --card: #14141f;
  --card-soft: #101019;
  --border: rgba(255, 122, 38, 0.16);
  --border-strong: rgba(255, 122, 38, 0.45);

  --text: #f2ede4;
  --text-sec: #bab7c7;
  --text-light: #7d7b8e;

  --input-bg: #07070d;

  --primary: #ff7a26;
  --primary-hover: #ff9552;
  --primary-soft: rgba(255, 122, 38, 0.12);
  --primary-dim: rgba(255, 122, 38, 0.45);

  --cyan: #35d6ff;
  --cyan-soft: rgba(53, 214, 255, 0.14);
  --violet: #a06bff;
  --violet-soft: rgba(160, 107, 255, 0.12);

  --correct: #2be3a4;
  --close: #ffb020;
  --danger: #ff4d6d;
  --wrong: #171722;

  --radius: 4px;
  --radius-sm: 3px;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.6);
  --glow: 0 0 18px rgba(255, 122, 38, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { width: 100%; max-width: 100%; overflow-x: hidden; }

body {
  min-width: 320px;
  min-height: 100dvh;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  background-image:
    /* 都市霓虹辉光:橙主视觉 + 青 / 紫异能点缀 */
    radial-gradient(ellipse 60% 46% at 84% -10%, rgba(255, 122, 38, 0.18), transparent 62%),
    radial-gradient(ellipse 52% 42% at 2% 96%, rgba(160, 107, 255, 0.16), transparent 66%),
    radial-gradient(ellipse 64% 46% at 14% 4%, rgba(53, 214, 255, 0.1), transparent 64%),
    /* 城市街区网格:细密路网 */
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    /* 斜向拉丝:霓虹灯箱的动态感 */
    repeating-linear-gradient(118deg, transparent 0 96px, rgba(255, 122, 38, 0.02) 96px 97px);
  background-size: auto, auto, auto, 56px 56px, 56px 56px, auto;
  background-attachment: fixed;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat, repeat;
}

/* 叠加一层扫描线 + 暗角 + 半调网点,让整体更像游戏内的都市 HUD */
body::before {
  position: fixed;
  inset: 0;
  z-index: 0;
  content: '';
  pointer-events: none;
  background:
    radial-gradient(circle at 92% 12%, rgba(255, 255, 255, 0.05) 1px, transparent 1.6px),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 4px),
    radial-gradient(ellipse 88% 78% at 50% 42%, transparent 38%, rgba(0, 0, 0, 0.58) 100%);
  background-size: 9px 9px, auto, auto;
}

button, input { font: inherit; }
button, a { touch-action: manipulation; }
::selection { background: rgba(255, 122, 38, 0.45); }

* { scrollbar-color: rgba(255, 122, 38, 0.42) rgba(255, 255, 255, 0.04); scrollbar-width: thin; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.04); }
*::-webkit-scrollbar-thumb { background: rgba(255, 122, 38, 0.38); }

.screen { position: relative; z-index: 1; min-height: 100dvh; display: flex; flex-direction: column; }
.screen.hidden { display: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(1rem, 4vw, 3.25rem);
  background: rgba(11, 11, 18, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3);
}
.topbar::after {
  position: absolute;
  right: clamp(1rem, 4vw, 3.25rem);
  bottom: -1px;
  width: clamp(48px, 9vw, 120px);
  height: 3px;
  content: '';
  /* 斜切警示条纹:异环街头元素 */
  background: repeating-linear-gradient(-45deg, var(--primary) 0 8px, #0b0b12 8px 16px);
  box-shadow: 0 0 20px rgba(255, 122, 38, 0.5);
}
.brand {
  color: #fff7ee;
  font-family: Bahnschrift, 'Arial Narrow', 'Microsoft YaHei', sans-serif;
  font-style: italic;
  font-weight: 800;
  letter-spacing: 0.045em;
  font-size: 1.15rem;
}
.brand::before { content: "//"; color: var(--primary); margin-right: 8px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  min-height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(0, 0, 0, 0.28); }
.btn:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: 0.52; cursor: not-allowed; box-shadow: none; }
.btn-sm { padding: 7px 12px; font-size: 0.85rem; min-height: 34px; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }
.btn-primary {
  background: linear-gradient(135deg, #ff8a3d, var(--primary));
  border-color: transparent;
  color: #1a0d02;
  box-shadow: 0 0 22px rgba(255, 122, 38, 0.35);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #ffa05e, var(--primary-hover)); }
.btn-warning { background: transparent; border-color: var(--close); color: var(--close); }
.btn-warning:hover:not(:disabled) { background: rgba(255, 176, 32, 0.14); border-color: var(--close); color: var(--close); box-shadow: none; }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 77, 109, 0.14); border-color: var(--danger); color: var(--danger); box-shadow: none; }
.link-btn { background: none; border: none; color: var(--text-light); text-decoration: underline; font-size: 0.9rem; margin-top: 6px; cursor: pointer; }

/* ---------- 开始页 ---------- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px clamp(1rem, 4vw, 3.25rem);
  gap: 18px;
  animation: surface-enter 0.52s cubic-bezier(0.2, 0.72, 0.25, 1) both;
}
@keyframes surface-enter {
  from { opacity: 0; transform: translate3d(0, 16px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
.kicker {
  letter-spacing: 0.35em;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}
.hero h1 {
  font-size: 3rem;
  letter-spacing: 0.14em;
  font-family: Bahnschrift, 'Arial Narrow', 'Microsoft YaHei', sans-serif;
  font-style: italic;
  font-weight: 800;
  color: #fff7ee;
  position: relative;
}
/* 故障(glitch)标题:青 / 紫错位残影,呼应「异象」的不稳定感 */
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
}
.glitch::before { color: var(--cyan); z-index: -1; animation: glitch-a 3.4s infinite steps(1); }
.glitch::after { color: var(--violet); z-index: -2; animation: glitch-b 2.9s infinite steps(1); }
@keyframes glitch-a {
  0%, 88%, 100% { transform: none; }
  90% { transform: translate(3px, -2px); }
  94% { transform: translate(-2px, 1px); }
}
@keyframes glitch-b {
  0%, 90%, 100% { transform: none; }
  92% { transform: translate(-3px, 2px); }
  96% { transform: translate(2px, -1px); }
}
@media (prefers-reduced-motion: reduce) {
  .glitch::before, .glitch::after { animation: none; transform: none; }
}
.subtitle { color: var(--text-light); max-width: 34rem; }
.hero .btn-primary { margin-top: 12px; }
.footer { text-align: center; color: var(--text-light); font-size: 0.78rem; padding: 16px; }
.footer-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer-link:hover { color: var(--primary); }

/* ---------- 游戏页 ---------- */
.game-wrap {
  flex: 1;
  width: 100%;
  max-width: 73.75rem;
  margin: 0 auto;
  padding: 16px clamp(1rem, 4vw, 3.25rem) 24px;
  animation: surface-enter 0.52s cubic-bezier(0.2, 0.72, 0.25, 1) both;
}
.status-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  color: var(--text-sec);
  font-size: 0.85rem;
}
.progress-dots { display: inline-flex; align-items: center; gap: 4px; }
.progress-dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  background: transparent;
}
.progress-dots i.used { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 8px rgba(255, 122, 38, 0.5); }

/* 棋盘(圆角色块 + 间距) */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-soft);
  padding: 10px;
}
table.board { width: 100%; border-collapse: separate; border-spacing: 6px 5px; font-size: 0.9rem; }
.board th {
  color: var(--text-sec);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 6px 8px;
  text-align: center;
  white-space: nowrap;
}
.board td {
  padding: 9px 10px;
  text-align: center;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid transparent;
  white-space: nowrap;
}
.board td.name { font-weight: 700; text-align: left; }
/* 6 列:角色名/属性/所属/弧盘适配/性别/生日
 * 百分比总和 = 100%,配合 table-layout:fixed 保证移动端不横向溢出 */
.board th:nth-child(1), .board td:nth-child(1) { width: 21%; }
.board th:nth-child(2), .board td:nth-child(2) { width: 12%; }
.board th:nth-child(3), .board td:nth-child(3) { width: 24%; }
.board th:nth-child(4), .board td:nth-child(4) { width: 17%; }
.board th:nth-child(5), .board td:nth-child(5) { width: 10%; }
.board th:nth-child(6), .board td:nth-child(6) { width: 16%; }
/* 命中/接近用深色字压在高饱和底色上,保证可读性;不匹配是近底色的“空洞” */
.board td.correct { background: var(--correct); border-color: var(--correct); color: #07271b; font-weight: 700; }
.board td.close { background: var(--close); border-color: var(--close); color: #2b1c00; font-weight: 700; }
.board td.wrong { background: var(--wrong); border-color: rgba(255, 255, 255, 0.05); color: var(--text-light); }
.board td .dir { display: inline-flex; vertical-align: -2px; margin-left: 3px; }
.board tr.row-latest td { border-color: var(--primary); box-shadow: 0 0 0 1px rgba(255, 122, 38, 0.25); }
.board tr.row-correct td { background: var(--primary-soft); }
.board tr.row-correct td.correct { background: var(--correct); }

/* 属性色圆点:属性列的彩色小标识 */
.attr-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: 0;
  box-shadow: 0 0 6px currentColor;
}

/* 图例 */
.legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 14px;
  color: var(--text-light);
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.legend .legend-correct { background: var(--correct); }
.legend .legend-close { background: var(--close); }
.legend .legend-wrong { background: var(--wrong); }

/* 输入栏 */
.input-bar {
  display: flex;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 56.25rem;
  margin: 14px auto 0;
}
.input-bar input {
  flex: 1;
  min-width: 0;
  font-size: 1.05rem;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--input-bg);
  color: var(--text);
  outline: none;
}
.input-bar input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 122, 38, 0.14); }
.input-bar .btn { flex-shrink: 0; white-space: nowrap; }

.autocomplete { position: relative; max-width: 56.25rem; margin: 0 auto; }
.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  z-index: 10;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow-y: auto;
  display: none;
  list-style: none;
  padding: 6px;
}
.suggestions.open { display: block; }
.suggestions li {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}
.suggestions li.active, .suggestions li:hover { background: var(--primary-soft); color: var(--primary-hover); }

.empty-hint { color: var(--text-light); text-align: center; padding: 60px 16px; }

/* ---------- 弹窗 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 4, 9, 0.82);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.overlay.show { display: flex; }
.overlay-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 26px;
  max-width: 440px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: surface-enter 0.32s cubic-bezier(0.2, 0.72, 0.25, 1) both;
}
.overlay-card h2 { margin-bottom: 10px; font-size: 1.25rem; }
.overlay-card.win { border-color: var(--correct); box-shadow: 0 0 40px rgba(43, 227, 164, 0.18), var(--shadow-lg); }
.overlay-card.lose { border-color: var(--danger); }
.answer-name {
  font-size: 1.9rem;
  font-weight: 800;
  font-family: Bahnschrift, 'Arial Narrow', 'Microsoft YaHei', sans-serif;
  font-style: italic;
  margin: 6px 0 14px;
  color: #fff7ee;
}
.info-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.info-table td { padding: 8px 6px; border-bottom: 1px solid var(--border); }
.info-table td.label { color: var(--text-light); width: 40%; }
.muted { color: var(--text-light); font-size: 0.85rem; margin: 8px 0; }
.overlay-actions { display: flex; gap: 8px; margin-top: 18px; }
.overlay-actions .btn { flex: 1; }

/* 规则 */
.rules-body { font-size: 0.9rem; line-height: 1.75; color: var(--text-sec); }
.rules-body h3 { color: var(--text); margin: 14px 0 6px; font-size: 0.95rem; }
.rules-body ul { padding-left: 18px; }
.rules-body li { margin: 3px 0; }
.rules-body code {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
}
.rule-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.rule-close:hover { color: var(--text); }

/* ---------- 输入坞(底部固定,手机端粘底) ---------- */
.input-dock {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  padding: 12px 0 14px;
  background: linear-gradient(180deg, transparent, var(--bg) 22%);
  z-index: 5;
}
.input-dock .autocomplete { position: relative; max-width: 56.25rem; margin: 0 auto; }
.input-dock .input-bar { margin-top: 0; }

/* 提示 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--close);
  color: var(--close);
  padding: 10px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  z-index: 100;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 头像:有图用图,无图用属性色首字徽章 ----------
 * 徽章颜色由 app.js 按角色属性注入 --chip 变量(光金/灵青/咒紫/暗绯/魂翠/相橙),
 * 发光用 color-mix 叠加,旧浏览器只是没光晕,不影响显示。 */
.row-avatar {
  width: 26px;
  height: 26px;
  margin-right: 7px;
  border-radius: 22%;
  object-fit: cover;
  vertical-align: -8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}
span.row-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #0d0d14;
  background: var(--chip, #9a97ad);
  box-shadow: 0 0 9px color-mix(in srgb, var(--chip, #9a97ad) 55%, transparent);
}

.suggestions li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sug-avatar {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 22%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}
span.sug-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: #0d0d14;
  background: var(--chip, #9a97ad);
  border: none;
  box-shadow: 0 0 9px color-mix(in srgb, var(--chip, #9a97ad) 55%, transparent);
}

/* ---------- 结算卡 ---------- */
.result-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 2px 0 14px;
}
.result-portrait.hidden { display: none; }
.portrait-img {
  /* 立绘多为竖版(600~1200px 高),结算卡内限宽限高完整展示 */
  max-width: min(100%, 280px);
  max-height: 340px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01));
}
.portrait-chip {
  width: 112px;
  height: 112px;
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: Bahnschrift, 'Arial Narrow', 'Microsoft YaHei', sans-serif;
  font-style: italic;
  font-size: 62px;
  font-weight: 800;
  color: #0d0d14;
  background: var(--chip, #9a97ad);
  box-shadow:
    0 0 36px color-mix(in srgb, var(--chip, #9a97ad) 55%, transparent),
    inset 0 -10px 24px rgba(0, 0, 0, 0.16);
}
.portrait-tags { display: flex; gap: 8px; }
.ptag {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #0d0d14;
  background: var(--chip, #9a97ad);
}
.ptag-rare { background: var(--primary); }

/* ---------- 手机端 ---------- */
@media (max-width: 640px) {
  body { padding-bottom: env(safe-area-inset-bottom); }

  .topbar {
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 0.875rem 10px;
  }
  .topbar::after { right: 0.875rem; }
  .topbar .actions { gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topbar .actions .btn { padding: 7px 10px; font-size: 0.82rem; min-height: 36px; }

  .hero { padding: 28px 1rem; gap: 14px; }
  .hero h1 { font-size: 2rem; letter-spacing: 0.1em; }
  .kicker { font-size: 0.7rem; }
  .hero .btn-lg { min-height: 46px; padding: 12px 26px; }

  .game-wrap { padding: 10px 0.875rem 0; }

  .btn { min-height: 40px; padding: 9px 14px; }
  .btn-lg { min-height: 44px; padding: 11px 19px; }
  .input-bar .input { min-height: 46px; font-size: 1rem; padding: 10px 12px; }
  .input-bar .btn { min-height: 46px; padding-inline: 14px; }

  .status-line { padding: 8px 4px; font-size: 0.8rem; }

  /* 棋盘:固定布局 + 紧凑单元格 */
  .table-wrap { overflow-x: hidden; border-radius: 10px; padding: 6px; }
  table.board {
    min-width: 0;
    table-layout: fixed;
    border-spacing: 2px;
    font-size: 0.72rem;
  }
  .board th {
    padding: 5px 1px;
    font-size: 0.68rem;
    line-height: 1.12;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .board td {
    padding: 6px 2px;
    border-radius: 4px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.15;
  }
  .board td .dir { margin-left: 1px; font-size: 8px; }

  /* 6 列在窄屏下的分配:所属与生日信息量大,占大头 */
  .board th:nth-child(1), .board td:nth-child(1) { width: 19%; }
  .board th:nth-child(2), .board td:nth-child(2) { width: 13%; }
  .board th:nth-child(3), .board td:nth-child(3) { width: 24%; }
  .board th:nth-child(4), .board td:nth-child(4) { width: 18%; }
  .board th:nth-child(5), .board td:nth-child(5) { width: 10%; }
  .board th:nth-child(6), .board td:nth-child(6) { width: 16%; }

  .input-dock {
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  }
  /* 键盘弹起时隐藏顶栏与状态行,并让屏幕高度跟随视觉视口 */
  #game-screen.keyboard-active .topbar,
  #game-screen.keyboard-active .status-line { display: none; }
  #game-screen.keyboard-active { height: var(--visual-viewport-height, 100dvh); min-height: 0; }
  .autocomplete { left: 0; right: 0; }
  .suggestions {
    left: 14px;
    right: 14px;
    max-height: 48dvh;
  }

  .legend { gap: 10px; font-size: 0.72rem; margin-top: 10px; }
  .legend i { width: 10px; height: 10px; }

  .overlay { padding: 12px; }
  .overlay-card { padding: 20px 16px; border-radius: 16px; }
  .answer-name { font-size: 1.5rem; }
  .overlay-actions { flex-direction: column; }
  .overlay-actions .btn { width: 100%; min-height: 44px; }
  .info-table td { padding: 7px 4px; font-size: 0.84rem; }

  .row-avatar { width: 20px; height: 20px; margin-right: 4px; vertical-align: -6px; }
  span.row-avatar { font-size: 0.7rem; }
  .sug-avatar { width: 22px; height: 22px; }
  .portrait-chip { width: 96px; height: 96px; border-radius: 22px; font-size: 52px; }
  .portrait-img { max-width: min(100%, 220px); max-height: 280px; border-radius: 12px; }

  .footer { font-size: 0.7rem; padding: 10px; }
}

@media (max-width: 400px) {
  table.board { border-spacing: 1px; }
  .board th { padding: 4px 0; font-size: 0.62rem; }
  .board td { padding: 5px 1px; font-size: 0.66rem; }
  .board td .dir { font-size: 7px; }
  .topbar .actions .btn { padding: 6px 8px; font-size: 0.76rem; }
}
