/* =========================================================================
   猜猜平台 · 视觉设计系统 (Design System)
   纯 CSS 重写 — 不依赖任何外部框架。所有 id / class 保持与 JS 一致。
   ========================================================================= */

:root {
  color-scheme: light;

  /* --- 中性色阶 (pure white + cool grays · 纯白舞台) --- */
  --bg:            #ffffff;
  --bg-tint:       #f8f9fb;
  --surface:       #ffffff;
  --surface-2:     #f6f7f9;
  --surface-3:     #eceef2;
  --line:          #e7e9ed;
  --line-strong:   #d2d6dd;

  --text:          #15171c;
  --text-2:        #3e4350;
  --muted:         #6d7380;
  --muted-2:       #9ba1ad;

  /* --- 主题强调色 (品牌青→蓝 · 取自框框猜 logo，用作点睛渐变) --- */
  --accent:        oklch(0.54 0.12 235);
  --accent-hover:  oklch(0.48 0.125 237);
  --accent-press:  oklch(0.42 0.12 239);
  --accent-soft:   oklch(0.96 0.02 230);
  --accent-line:   oklch(0.87 0.045 228);
  --accent-text:   oklch(0.47 0.12 237);
  --accent-bright: oklch(0.72 0.125 205);
  --ring:          oklch(0.54 0.13 235 / 0.30);

  /* --- 品牌渐变 (青 → 蓝：主按钮 / 顶部饰条 / 序号等点睛处专用) --- */
  --grad-brand: linear-gradient(135deg, oklch(0.70 0.125 208), oklch(0.50 0.13 248));
  --grad-brand-strong: linear-gradient(135deg, oklch(0.64 0.13 212), oklch(0.44 0.13 250));

  /* --- 反馈状态色 (绿/黄/灰 — 游戏格子的核心色，保持醒目) --- */
  --green:         oklch(0.62 0.13 158);
  --green-soft:    oklch(0.95 0.046 158);
  --amber:         oklch(0.745 0.135 80);
  --amber-soft:    oklch(0.955 0.058 85);
  --slate:         oklch(0.64 0.014 240);
  --slate-soft:    oklch(0.945 0.006 240);
  --danger:        oklch(0.55 0.16 22);
  --danger-soft:   oklch(0.96 0.03 22);
  --danger-line:   oklch(0.85 0.07 22);

  /* --- 圆角 (适度圆润，轻松但不气泡) --- */
  --r-xs: 5px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  /* --- 阴影 (纯白底上的柔和浮起) --- */
  --shadow-xs: 0 1px 2px rgba(18, 21, 28, 0.05);
  --shadow-sm: 0 1px 2px rgba(18, 21, 28, 0.04), 0 2px 8px rgba(18, 21, 28, 0.05);
  --shadow:    0 4px 16px rgba(18, 21, 28, 0.08);
  --shadow-lg: 0 16px 40px rgba(18, 21, 28, 0.16);

  /* --- 字体 --- */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC",
    system-ui, sans-serif;
  --font-num: "SF Mono", "Segoe UI Mono", "Roboto Mono", ui-monospace, var(--font-sans);

  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* =========================================================================
   深色模式 — 跟随系统设置。只重写设计 token + 少量需要反转前景色的组件。
   反馈色（绿/黄/灰，白字底）保持中等明度，浅色/深色下都可读；只把它们的
   "-soft"（浅底深字）变体改为深底，再单独把对应组件的前景色调亮。
   ========================================================================= */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg:            #101216;
    --bg-tint:       #14161b;
    --surface:       #171a20;
    --surface-2:     #1e222a;
    --surface-3:     #262b34;
    --line:          #2a2f38;
    --line-strong:   #3b414d;

    --text:          #e9ecf1;
    --text-2:        #c4c9d4;
    --muted:         #939aa7;
    --muted-2:       #6b7280;

    --accent:        oklch(0.65 0.11 230);
    --accent-hover:  oklch(0.71 0.11 224);
    --accent-press:  oklch(0.75 0.10 218);
    --accent-soft:   oklch(0.30 0.05 235);
    --accent-line:   oklch(0.42 0.06 233);
    --accent-text:   oklch(0.80 0.09 220);
    --accent-bright: oklch(0.74 0.12 205);
    --ring:          oklch(0.65 0.11 230 / 0.38);

    --grad-brand: linear-gradient(135deg, oklch(0.66 0.12 208), oklch(0.52 0.13 248));
    --grad-brand-strong: linear-gradient(135deg, oklch(0.60 0.125 212), oklch(0.46 0.13 250));

    --green:         oklch(0.62 0.12 157);
    --green-soft:    oklch(0.31 0.055 157);
    --amber:         oklch(0.74 0.13 78);
    --amber-soft:    oklch(0.34 0.06 84);
    --slate:         oklch(0.56 0.012 250);
    --slate-soft:    oklch(0.30 0.006 250);
    --danger:        oklch(0.66 0.16 22);
    --danger-soft:   oklch(0.32 0.07 22);
    --danger-line:   oklch(0.46 0.09 22);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.32);
    --shadow:    0 2px 10px rgba(0, 0, 0, 0.38);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.52);
  }

  /* 浅底深字的组件，深色下底变深，前景色需调亮才看得清。 */
  .win-status,
  .game-won .answer-box {
    color: oklch(0.82 0.12 157);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0.1px;
}

/* 全站签名：视口顶端一条品牌渐变饰条（够宽，读作装饰而非进度条） */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--grad-brand);
  z-index: 80;
  pointer-events: none;
}

body:not(.developer-mode) .developer-only {
  display: none !important;
}

::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

/* Scrollbars — quiet, modern */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
  background-clip: padding-box;
  border: 2px solid transparent;
}

h1, h2, h3 {
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text);
  font-weight: 680;
  line-height: 1.2;
}

h1 { font-size: 24px; }

.muted {
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.55;
}

/* 题库介绍（首页卡片 / 游戏页）+ 私密分享链接（后台） */
.dataset-author {
  margin: 2px 0 0;
  font-size: 0.85em;
  color: var(--muted);
}
#gameAuthor.dataset-author {
  font-size: 0.95rem;
}
#gameAuthor.hidden {
  display: none;
}
.dataset-author-field,
.dataset-invite-field {
  display: block;
  margin-top: 10px;
}
.invite-link-line {
  display: flex;
  gap: 8px;
  align-items: center;
}
.invite-link-line input {
  flex: 1;
  min-width: 0;
}
.invite-hint {
  font-size: 0.8em;
}
.dataset-invite-field.invite-muted {
  opacity: 0.5;
}

.landing-page {
  min-height: 100vh;
  background: var(--bg);
}

.landing-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.landing-panel {
  width: min(520px, 100%);
  text-align: center;
}

.landing-panel h1 {
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1.05;
  margin-bottom: 24px;
  letter-spacing: 0;
}

.landing-start-button {
  display: inline-flex;
  width: auto;
  min-width: 220px;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hidden {
  display: none !important;
}

/* =========================================================================
   顶部导航
   ========================================================================= */

.top-nav {
  display: flex;
  gap: 6px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 11px clamp(16px, 4vw, 30px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.nav-tab {
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 14px;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.nav-tab:hover:not(:disabled) {
  background: var(--surface-3);
  color: var(--text);
}

.nav-tab.active {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 650;
}

/* =========================================================================
   开发者头像入口
   ========================================================================= */

.developer-avatar-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.developer-avatar-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.developer-avatar-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.developer-mode .developer-avatar-button {
  outline: 2px solid color-mix(in srgb, var(--green) 60%, transparent);
  outline-offset: 2px;
}

/* 联系方式 / 投喂弹窗：浮现在头像左上方 */
.contact-popover {
  position: fixed;
  right: 18px;
  bottom: 78px;
  z-index: 26;
  width: 268px;
  max-width: calc(100vw - 36px);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 12px;
}

/* 投喂介绍语（请作者喝咖啡之类） */
.contact-note {
  margin: 0 2px 8px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

/* 收款码卡片 */
.contact-qr {
  margin: 0 0 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm, 8px);
  background: var(--surface-2);
}

.contact-qr.hidden {
  display: none;
}

.contact-qr img {
  width: 100%;
  max-width: 176px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 8px;
  /* 收款码多为白底，深色模式下也强制白底，保证可扫 */
  background: #fff;
  padding: 6px;
  box-sizing: border-box;
}

.contact-qr figcaption {
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}

.contact-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 650;
  font-size: 13px;
  margin-bottom: 8px;
}

.contact-popover-body {
  display: grid;
  gap: 6px;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm, 8px);
  background: var(--surface-2);
  font-size: 13px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.contact-item:hover {
  background: var(--surface-3);
}

.contact-item .contact-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contact-item .contact-hint {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.contact-empty {
  font-size: 12px;
  margin: 0;
}

/* 通栏页脚：左侧品牌，右侧入口链接与备案号，细线分隔。
   所在页面外壳为纵向 flex 时（各子项目首页），margin-top:auto 把它推到视口底部。 */
.site-footer {
  margin-top: auto;
  padding: 20px 0 4px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  color: var(--muted);
  font-size: 12.5px;
}

.site-footer .result-footer-brand {
  color: var(--text-2);
  font-weight: 650;
  letter-spacing: 0.01em;
}

.icp-record {
  color: var(--muted);
  text-decoration: none;
}

.icp-record:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-footer-link {
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 12px;
  text-decoration: none;
}

.site-footer-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-footer-link:not(:empty)::before {
  content: "";
  margin-right: 0;
}

/* 右侧信息组：入口链接 + 备案号靠右排 */
.site-footer .site-footer-link {
  margin-left: auto;
}

@media (max-width: 640px) {
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .site-footer .site-footer-link {
    margin-left: 0;
  }
}

/* =========================================================================
   表单控件基础 (input / select / button)
   ========================================================================= */

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  padding: 9px 12px;
  transition: border-color 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

input:hover:not(:disabled),
select:hover:not(:disabled),
textarea:hover:not(:disabled) {
  border-color: var(--muted-2);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

button:focus-visible {
  box-shadow: 0 0 0 3px var(--ring);
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

/* --- 按钮族 --- */

.primary-button,
.ghost-button,
.danger-button {
  width: 100%;
  min-height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background 140ms ease, border-color 140ms ease,
    color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.primary-button {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 2px 10px -3px oklch(0.54 0.13 235 / 0.55);
}
.primary-button:hover:not(:disabled) {
  background: var(--grad-brand-strong);
  box-shadow: 0 4px 14px -4px oklch(0.54 0.13 235 / 0.65);
}
.primary-button:active:not(:disabled) {
  background: var(--grad-brand-strong);
  box-shadow: 0 1px 6px -2px oklch(0.54 0.13 235 / 0.5);
  transform: translateY(1px);
}
/* 禁用态用中性灰，而非把强调蓝整体降透明度（那样会变成辨识度低的淡蓝）。 */
.primary-button:disabled {
  background: var(--surface-3);
  color: var(--muted);
  border-color: var(--line);
  box-shadow: none;
  opacity: 1;
}

/* 链接形态的按钮：与 <button> 呈现一致 */
a.primary-button,
a.ghost-button,
a.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.ghost-button {
  margin-top: 10px;
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text-2);
}
.ghost-button:hover:not(:disabled) {
  border-color: var(--text-2);
  background: var(--surface);
  color: var(--text);
}
.ghost-button:active:not(:disabled) {
  transform: translateY(1px);
}

.danger-button {
  background: var(--surface);
  border-color: var(--danger-line);
  color: var(--danger);
}
.danger-button:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}
.danger-button:active:not(:disabled) {
  transform: translateY(1px);
}

.small {
  width: auto;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
  margin-top: 0;
  border-radius: var(--r-xs);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

label {
  display: block;
}

/* =========================================================================
   首页 / 题库选择视图
   ========================================================================= */

/* =========================================================================
   子项目统一页面外壳与页头
   Griddle (.manager-shell/.manager-header) 与 对比模式/Bingo (.tool-header)
   共用同一套版心宽度、页头格式与页脚宽度，保证跨项目风格一致。
   ========================================================================= */

.manager-shell {
  width: min(1160px, calc(100% - 40px));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0 auto;
  padding: 24px 0 20px;
}

/* flex 容器里各版心保持原有宽度与居中 */
.manager-shell > * {
  width: 100%;
}

.manager-shell > .site-footer {
  padding-top: 24px;
}

.manager-shell > .dataset-manager-list {
  margin-bottom: 40px;
}

.manager-header,
.tool-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.manager-title-row,
.tool-title-row {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.tool-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tool-nav .ghost-button {
  width: auto;
  margin-top: 0;
}

/* 页头主标题：四个入口统一字号层级 */
.manager-header h2,
.manager-header h3,
.tool-header h1,
.tool-header h2 {
  margin: 0;
  font-size: clamp(22px, 2.6vw, 30px);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.18;
}

@media (max-width: 720px) {
  .manager-header,
  .tool-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .manager-header-right {
    justify-content: flex-start;
  }

  .mode-logo {
    width: 116px;
  }
}

.mode-logo {
  display: block;

  width: clamp(120px, 15vw, 190px);
  height: auto;

  flex: 0 0 auto;

  object-fit: contain;

  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.manager-header .muted {
  font-size: 14px;
  max-width: 52ch;
}

.manager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.manager-actions .ghost-button,
.manager-actions .primary-button,
.manager-readme-button {
  width: auto;
  margin-top: 0;
}

.manager-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.manager-header-right .ghost-button {
  width: auto;
  margin-top: 0;
}

.manager-user-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.manager-user-row .ghost-button {
  width: auto;
  margin-top: 0;
}

/* =========================================================================
   模式切换按钮（框框猜 ⇄ 对比模式）—— 上面是对方模式的 logo 缩略图
   ========================================================================= */
.mode-switch-button {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 7px 14px 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 150ms ease, box-shadow 150ms ease,
    transform 150ms ease, background 150ms ease;
}
.mode-switch-button:hover {
  border-color: var(--text-2);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.mode-switch-button:active {
  transform: translateY(0);
}
.mode-switch-eyebrow {
  display: grid;
  gap: 1px;
  text-align: right;
  line-height: 1.1;
}
.mode-switch-eyebrow b {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.mode-switch-eyebrow span {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.mode-switch-thumb {
  display: grid;
  place-items: center;
  height: 38px;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.mode-switch-thumb img {
  display: block;
  height: 26px;
  width: auto;
  max-width: 116px;
  object-fit: contain;
}
.mode-switch-arrow {
  color: var(--muted);
  font-weight: 700;
  font-size: 16px;
  transition: transform 150ms ease, color 150ms ease;
}
.mode-switch-button:hover .mode-switch-arrow {
  color: var(--text);
  transform: translateX(2px);
}

@media (max-width: 600px) {
  .mode-switch-button {
    padding: 6px 11px 6px 11px;
    gap: 8px;
  }
  .mode-switch-eyebrow b { font-size: 12px; }
  .mode-switch-eyebrow span { display: none; }
  .mode-switch-thumb { height: 32px; padding: 4px 7px; }
  .mode-switch-thumb img { height: 20px; max-width: 88px; }
}

#managerStatus {
  max-width: 1160px;
  margin: 14px auto 0;
  font-size: 13.5px;
  font-weight: 500;
}

.dataset-manager-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 20px;
  max-width: 1160px;
  margin: 24px auto 0;
}

.dataset-manager-card {
  position: relative;
  display: grid;
  grid-template-rows: 186px auto;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 180ms cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 180ms ease, border-color 180ms ease;
}

.dataset-manager-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.dataset-manager-card.dragging {
  opacity: 0.5;
}

.dataset-manager-card.drag-over {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dataset-card-art {
  position: relative;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.dataset-card-art img {
  max-width: 74%;
  max-height: 144px;
  object-fit: contain;
  transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1), opacity 320ms ease;
}

.dataset-manager-card:hover .dataset-card-art img {
  transform: scale(1.03);
}

.dataset-card-body {
  padding: 16px 18px 18px;
}

.dataset-card-body h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.3;
}

.dataset-card-body p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}

.dataset-manager-card .drag-handle {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 2;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px);
}

.dataset-admin-button {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  width: auto;
  margin: 0;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(6px);
}

/* 私密题库角标：标在封面图左下角，红字提示 */
.dataset-private-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 2px 10px;
  border: 1px solid var(--danger-line);
  border-radius: var(--r-pill);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

/* 题库选择页「显示私密题库」开关（开发者限定），与搜索框同行时保持紧凑 */
.dataset-search-row .private-datasets-toggle {
  min-height: 40px;
  padding: 5px 12px;
}

/* =========================================================================
   游戏视图 · 整体布局 + 侧边栏
   ========================================================================= */

.app-shell {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  /* 桌面双栏：整体撑满视口，左右两栏各自内部滚动。
     用固定高度而非 min-height，否则较高的一栏（字段列表）会把整行撑高，
     导致较矮的游戏栏下方出现大片空白。 */
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.app-shell.side-collapsed {
  grid-template-columns: 0 minmax(0, 1fr);
}

.side-panel {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 22px 22px 32px;
  overflow-y: auto;
  transition: opacity 160ms ease, padding 160ms ease;
}

.side-collapsed .side-panel {
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
  pointer-events: none;
  overflow: hidden;
}

.side-dataset-logo {
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 18px 16px;
  margin-bottom: 18px;
}

.side-dataset-logo img {
  max-width: 170px;
  width: 70%;
  height: 92px;
  object-fit: contain;
}

.side-dataset-logo span {
  color: var(--text-2);
  font-weight: 650;
  font-size: 15px;
  text-align: center;
  letter-spacing: -0.01em;
}

.side-toggle-button {
  position: fixed;
  left: 14px;
  top: 66px;
  z-index: 24;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow);
  font-size: 19px;
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.side-toggle-button:hover {
  background: var(--surface-2);
  color: var(--text);
  transform: translateY(-1px);
}

/* 抽屉遮罩：仅移动端抽屉模式使用，桌面双栏不渲染。 */
.side-backdrop {
  display: none;
}

.panel-section {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.panel-section.start-section {
  border-top: 0;
  padding-top: 0;
}

.start-section .primary-button {
  min-height: 48px;
  font-size: 15px;
  font-weight: 650;
}

.panel-section.compact {
  padding-bottom: 4px;
}

.compact-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.compact-actions .ghost-button {
  margin-top: 0;
}

.developer-section {
  margin: 0 -14px;
  padding: 16px 14px;
  border-radius: var(--r-md);
  border-top: 1px solid var(--accent-line);
  background: var(--accent-soft);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 15px;
  font-weight: 650;
}

.field-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
}

.field-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-pill {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 500;
  transition: border-color 130ms ease, background 130ms ease,
    color 130ms ease, transform 120ms ease;
}

.field-pill:hover {
  border-color: var(--muted-2);
  background: var(--surface-2);
}

.field-pill:active {
  transform: scale(0.97);
}

.field-pill.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

/* =========================================================================
   游戏视图 · 主面板
   ========================================================================= */

.game-panel {
  min-width: 0;
  min-height: 0;          /* 允许作为 grid 项收缩，从而内部滚动而非撑高整页 */
  overflow-y: auto;
  padding: clamp(22px, 3vw, 36px);
}

/* 边栏收起时，浮动的 ☰ 按钮固定在左上角，给标题区留出避让空间，避免压住眉标题。 */
.side-collapsed .game-panel {
  padding-left: clamp(66px, 3vw + 44px, 84px);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 22px;
}

.game-header h2 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.game-header-actions {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.game-header-actions .ghost-button {
  width: auto;
  margin-top: 0;
}

.counter {
  min-width: 188px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 11px 16px;
  text-align: center;
  color: var(--text-2);
  font-weight: 600;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--shadow-xs);
}

/* --- 搜索行 --- */

.search-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 88px 124px;
  gap: 10px;
  align-items: center;
}

.search-row .ghost-button {
  margin-top: 0;
}

.search-row input[type="search"] {
  min-height: 46px;
  font-size: 15px;
}

.search-row .primary-button,
.search-row .ghost-button {
  min-height: 46px;
}

.image-toggle {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 7px 12px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 130ms ease, background 130ms ease;
}

.image-toggle:hover {
  border-color: var(--muted-2);
}

.image-toggle {
  position: relative;
}

.image-toggle input {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* 兜底：任何视图都不该产生横向滚动（防止个别绝对定位元素把页面撑宽） */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

.toggle-track {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: var(--r-pill);
  background: var(--line-strong);
  transition: background 160ms ease;
}

.toggle-thumb {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(20, 30, 46, 0.28);
  transition: transform 160ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.image-toggle input:checked + .toggle-track {
  background: var(--accent);
}

.image-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

/* --- 候选结果 --- */

.search-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 52px;
  margin: 14px 0 10px;
}

.candidate {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: auto;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 6px 12px 6px 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: border-color 130ms ease, background 130ms ease,
    box-shadow 130ms ease, transform 110ms ease;
}

.candidate:hover {
  border-color: var(--muted-2);
  box-shadow: var(--shadow-xs);
}

.candidate:active {
  transform: scale(0.98);
}

.candidate-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.candidate-img.image-missing,
.candidate-img.hidden {
  display: none;
}

.candidate.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: 0 0 0 1px var(--accent);
}

/* --- 状态 / 答案提示框 --- */

.status-box,
.answer-box {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  padding: 14px 16px;
  margin: 14px 0;
  line-height: 1.55;
  box-shadow: var(--shadow-xs);
}

.answer-box {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 600;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.win-status,
.game-won .answer-box {
  border-color: color-mix(in srgb, var(--green) 55%, var(--line));
  background: var(--green-soft);
  color: oklch(0.42 0.1 157);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 16%, transparent);
  animation: winPulse 900ms ease-out 1;
}

.game-won .table-wrap table {
  box-shadow: var(--shadow-sm),
    0 0 0 2px color-mix(in srgb, var(--green) 38%, transparent);
}

/* =========================================================================
   反馈结果表格 (核心) + 绿/黄/灰状态色块
   ========================================================================= */

.table-wrap {
  /* 跟随容器宽度：4K 屏上 20+ 字段也能尽量铺开；真放不下时才横向滚动。 */
  width: 100%;
  margin: 18px auto 0;
  overflow-x: auto;
  border-radius: var(--r-lg);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  /* 不能用 overflow:hidden，否则会破坏第一列的 position:sticky 冻结效果 */
  box-shadow: var(--shadow-sm);
}

th, td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 12px 10px;
  text-align: center;
  vertical-align: middle;
  font-size: 15px;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tr:last-child td {
  border-bottom: 0;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 13px 10px;
  white-space: nowrap;
}

/* 数据列保持舒适的最小宽度：窄屏时整张表横向滚动，而不是把单元格压扁导致文字竖排 */
tbody td {
  min-width: 70px;
}

/* 第一列（图片 + 名字）冻结在左侧，横向滚动时始终可见，方便对照是哪一次猜测 */
th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}

thead th:first-child {
  z-index: 4;
  background: var(--surface-3);
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr:hover {
  background: var(--surface-2);
}

tbody tr:hover td:first-child {
  background: var(--surface-2);
}

.pokemon-cell {
  min-width: 144px;
}

.pokemon-cell strong {
  display: block;
  max-width: 10em;
  margin: 0 auto;
  font-weight: 650;
  font-size: 14px;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pokemon-img {
  display: block;
  width: 92px;
  height: 92px;
  object-fit: contain;
  margin: 0 auto 6px;
  filter: drop-shadow(0 6px 10px rgba(20, 30, 46, 0.12));
}

.image-missing {
  visibility: hidden;
}

/* --- 状态色块 token --- */

.token {
  display: block;
  width: 100%;
  margin: 3px 0;
  border-radius: var(--r-xs);
  padding: 8px 9px;
  color: #fff;
  font-weight: 650;
  font-size: 14px;
  letter-spacing: 0.01em;
  line-height: 1.25;
  /* 不让文字逐字竖排：每个值保持一行，必要时整张表横向滚动而不是把列压扁 */
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -2px 6px rgba(0, 0, 0, 0.08);
  animation: tokenIn 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

#resultTable td,
#resultAnswerTable td,
#resultGuessTable td {
  overflow-wrap: anywhere;
  word-break: break-word;
}

#resultTable .pokemon-cell strong,
#resultGuessTable .pokemon-cell strong,
.result-answer-name {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#resultTable .token,
#resultAnswerTable .token,
#resultGuessTable .token {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.status-green {
  background: var(--green);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.14);
}

.status-yellow {
  background: var(--amber);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.16);
}

.status-gray {
  background: var(--slate);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

/* =========================================================================
   开发者后台
   ========================================================================= */

.admin-shell {
  min-height: calc(100vh - 56px);
  padding: clamp(18px, 3vw, 28px);
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-header h2 {
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-actions .primary-button,
.admin-actions .ghost-button,
.admin-actions .danger-button,
.admin-table-actions .ghost-button,
.admin-table-actions .danger-button,
.admin-tool-row .ghost-button,
.admin-tool-row .danger-button {
  width: auto;
  margin-top: 0;
  white-space: nowrap;
}

.admin-tools {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 16px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  box-shadow: var(--shadow-sm);
}

.admin-dataset-section {
  grid-column: 1 / -1;
}

/* 字段设置/图库管理各占整行，给字段行（含「提示」开关）足够横向空间。 */
.admin-subsection {
  grid-column: 1 / -1;
}

.admin-subsection {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 14px;
}

.admin-dataset-section.admin-subsection {
  background: var(--surface);
}

.admin-subsection h2 {
  font-size: 15px;
  font-weight: 650;
}

.admin-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.dataset-settings-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 196px;
  gap: 18px;
  align-items: stretch;
}

.dataset-settings-stack {
  display: grid;
  gap: 14px;
  align-content: start;
}

.dataset-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 200px) auto;
  gap: 12px;
  align-items: end;
}

.dataset-visibility-field {
  display: grid;
  gap: 8px;
  align-content: start;
}

.dataset-visibility-field .image-toggle {
  width: 100%;
  justify-content: space-between;
}

.dataset-logo-editor {
  display: grid;
  gap: 8px;
  align-content: start;
}

.dataset-logo-editor img {
  width: 100%;
  height: 110px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-3);
  padding: 10px;
}

.preset-admin-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}

.field-config-list,
.image-config-list {
  display: grid;
  gap: 8px;
}

.image-config-row {
  display: grid;
  grid-template-columns: 34px 96px 126px 88px 138px 48px;
  gap: 8px;
  align-items: center;
}

.field-config-row {
  display: grid;
  grid-template-columns: 34px minmax(120px, 1fr) 88px 78px 84px minmax(150px, 220px) 64px 48px;
  gap: 8px;
  align-items: center;
}

.image-config-row input,
.field-config-row input,
.field-config-row select {
  min-height: 36px;
  padding: 6px 9px;
}

.config-spacer {
  display: block;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.check-line input {
  width: auto;
  min-height: auto;
}

.muted-control {
  opacity: 0.45;
}

.ordered-config {
  display: grid;
  grid-template-columns: minmax(68px, 1fr) 58px;
  gap: 6px;
  align-items: center;
}

.tolerance-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}

.tolerance-control.with-unit {
  grid-template-columns: auto minmax(64px, 1fr) auto;
}

.tolerance-unit {
  white-space: nowrap;
}

/* --- 拖拽手柄 --- */

.drag-handle {
  display: grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--muted);
  cursor: grab;
  font-weight: 700;
  margin: 0;
  padding: 0;
  user-select: none;
  touch-action: none;
  transition: background 120ms ease, color 120ms ease;
}

.drag-handle:hover {
  background: var(--surface-3);
  color: var(--text-2);
}

.drag-handle:active {
  cursor: grabbing;
}

.field-config-row.dragging,
.image-config-row.dragging {
  opacity: 0.5;
}

.field-config-row.drag-over,
.image-config-row.drag-over {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.delete-field-button,
.delete-image-option-button {
  width: 48px;
  min-width: 48px;
  padding: 5px 0;
}

.check-image-option-button {
  width: 138px;
  min-width: 138px;
  padding: 5px 8px;
}

.upload-gallery-button {
  width: 88px;
  min-width: 88px;
  padding: 5px 8px;
}

/* --- 全数据库表格 --- */

.admin-table-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0 10px;
}

.admin-table-header h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 650;
}

.admin-table-actions {
  display: grid;
  grid-template-columns: minmax(240px, 360px) auto auto;
  gap: 10px;
  align-items: center;
}

.admin-table-wrap {
  width: 100%;
  max-height: calc(100vh - 280px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.admin-table {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.admin-table th,
.admin-table td {
  min-width: 104px;
  padding: 7px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.admin-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-3);
  text-transform: none;
  letter-spacing: 0.01em;
}

.admin-table th:first-child,
.admin-table td:first-child {
  min-width: 46px;
  width: 46px;
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1),
.admin-table th:nth-child(2),
.admin-table td:nth-child(2),
.admin-table th:nth-child(3),
.admin-table td:nth-child(3),
.admin-table th:nth-child(4),
.admin-table td:nth-child(4) {
  position: sticky;
  background: var(--surface);
}

.admin-table thead th:nth-child(1),
.admin-table thead th:nth-child(2),
.admin-table thead th:nth-child(3),
.admin-table thead th:nth-child(4) {
  background: var(--surface-3);
}

.admin-table th:nth-child(1),
.admin-table td:nth-child(1) {
  left: 0;
  z-index: 3;
}

.admin-table th:nth-child(2),
.admin-table td:nth-child(2) {
  left: 46px;
  z-index: 3;
}

.admin-table th:nth-child(3),
.admin-table td:nth-child(3) {
  left: 188px;
  z-index: 3;
}

.admin-table th:nth-child(4),
.admin-table td:nth-child(4) {
  left: 316px;
  z-index: 3;
}

.admin-table th:nth-child(-n + 4) {
  z-index: 5;
}

.admin-table tbody tr:hover td {
  background: var(--surface-2);
}

.admin-table tbody tr:hover td:nth-child(-n + 4) {
  background: var(--surface-2);
}

.sort-button {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font-weight: 650;
  padding: 2px;
  border-radius: var(--r-xs);
  transition: color 120ms ease;
}

.sort-button:hover {
  color: var(--accent-text);
}

.admin-table input,
.admin-table select {
  min-height: 32px;
  padding: 5px 7px;
  font-size: 13px;
  border-radius: var(--r-xs);
}

.input-error {
  border-color: var(--danger) !important;
  background: var(--danger-soft) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 14%, transparent);
}

.admin-image-cell {
  min-width: 142px;
  width: 142px;
}

.admin-table .name-column {
  min-width: 118px;
  width: 128px;
}

.admin-table .slug-column {
  min-width: 126px;
  width: 136px;
}

.admin-table .field-number {
  min-width: 72px;
  width: 78px;
}

.admin-table .field-ordered {
  min-width: 94px;
  width: 104px;
}

.admin-table .field-text {
  min-width: 104px;
  width: 116px;
}

.admin-table .field-date,
.admin-table .field-time {
  min-width: 104px;
  width: 120px;
}

.admin-table .field-multi {
  min-width: 122px;
  width: 132px;
}

.admin-thumb {
  display: block;
  width: 56px;
  height: 56px;
  object-fit: contain;
  margin: 0 auto 6px;
}

.multi-editor {
  display: grid;
  gap: 5px;
}

.token-input {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) 28px;
  gap: 4px;
}

.token-input button,
.tiny-button {
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 700;
  padding: 0;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.token-input button:hover,
.tiny-button:hover {
  background: var(--surface-2);
  border-color: var(--muted-2);
  color: var(--text);
}

/* =========================================================================
   弹窗 / 模态框
   ========================================================================= */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(18, 26, 38, 0.42);
  backdrop-filter: blur(3px);
  animation: backdropIn 160ms ease-out;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: min(760px, calc(100vw - 32px));
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 22px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  animation: modalIn 200ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.advanced-modal {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.entity-selection-modal,
.selection-modal {
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

/* 统一选区编辑器：字段批量工具（可折叠） */
.selection-batch-tools {
  margin: 6px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md, 10px);
  background: var(--surface-2, rgba(127, 127, 127, 0.05));
  padding: 4px 12px;
}

.selection-batch-tools > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 2px;
  user-select: none;
}

.selection-batch-tools .advanced-field-list {
  padding-bottom: 10px;
}

.selection-filter-input {
  min-height: 34px;
  padding: 5px 10px;
  min-width: 160px;
  flex: 1 1 160px;
}

/* 后台「配置预设」：可拖拽、每行可编辑 */
.preset-config-list {
  display: grid;
  gap: 8px;
}

.preset-config-row {
  display: grid;
  grid-template-columns: 34px minmax(140px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}

.preset-config-row input {
  min-height: 36px;
  padding: 6px 9px;
}

.preset-config-row.dragging {
  opacity: 0.5;
}

.preset-config-row.drag-over {
  outline: 2px dashed var(--accent, #f2c84b);
  outline-offset: 2px;
}

.preset-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-section-hint,
.admin-empty-hint {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
  line-height: 1.5;
}

/* 三块设置的「收起 / 展开」 */
.section-heading-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.admin-subsection.collapsed .collapse-body {
  display: none;
}

.gallery-check-modal {
  width: min(940px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.readme-modal {
  width: min(840px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

/* =========================================================================
   游戏结果弹窗
   ========================================================================= */

.result-modal {
  /* 按内容宽度自适应（字段越多越宽），上限为屏幕宽度，避免内部左右滑动 */
  width: max-content;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 0;
}

/* 弹窗内表格用自然宽度、不内部滚动；并关闭吸顶/冻结（弹窗不滚动，且 sticky 会让导出图片表头错位） */
.result-modal .table-wrap {
  overflow: visible;
  width: auto;
}

.result-modal table {
  min-width: 0;
}

.result-modal thead th,
.result-modal th:first-child,
.result-modal td:first-child {
  position: static;
}

.result-capture {
  padding: 24px;
  background: var(--surface);
}

.result-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.result-answer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  min-width: 150px;
}

.result-answer-label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 600;
}

.result-answer-img {
  width: 160px;
  height: 160px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(20, 30, 46, 0.16));
}

.result-answer-name {
  display: block;
  max-width: 10em;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.result-main {
  min-width: 0;
}

.result-verdict {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.result-verdict.is-won { color: var(--green); }
.result-verdict.is-lost { color: var(--slate); }

.result-subline {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 12px;
}

.result-guesses {
  margin-top: 22px;
}

.result-section-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text-2);
  margin-bottom: 8px;
}

.result-footer {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 13px;
}

.result-footer-brand {
  font-weight: 650;
}

.result-footer-url {
  color: var(--muted);
}

.result-footer-url:not(:empty)::before {
  content: "";
  margin-right: 0;
}

.result-modal .table-wrap {
  margin: 0;
}

/* 答案表格已去掉图片列，整体居中显示 */
.result-answer-table-wrap {
  display: flex;
  justify-content: center;
}

.result-answer-table-wrap table {
  width: auto;
  min-width: 0;
}

.result-modal-actions {
  padding: 16px 24px 22px;
}

/* 截图模式：临时展开所有表格，让保存的图片不会被横向滚动裁掉列 */
.result-capture.capturing {
  width: max-content;
  font-size: 15px;
  line-height: 1.55;
}

.result-capture.capturing *,
.result-capture.capturing *::before,
.result-capture.capturing *::after {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

.result-capture.capturing .result-top {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 22px;
  justify-items: stretch;
  text-align: left;
}

.result-capture.capturing .result-main {
  width: auto;
}

.result-capture.capturing .result-answer-img {
  width: 160px;
  height: 160px;
  filter: none;
}

.result-capture.capturing .result-verdict {
  font-size: 24px;
}

.result-capture.capturing .table-wrap {
  overflow: visible;
  width: max-content;
  max-width: none;
}

/* 截图时强制还原为表格布局，无论屏幕宽度 */
.result-capture.capturing .table-wrap table {
  display: table;
  min-width: 760px;
  table-layout: fixed;
  width: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: none;
}
.result-capture.capturing .table-wrap thead { display: table-header-group; }
.result-capture.capturing .table-wrap tbody { display: table-row-group; }
.result-capture.capturing .table-wrap tr {
  display: table-row;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.result-capture.capturing .table-wrap td,
.result-capture.capturing .table-wrap th {
  display: table-cell;
  border-bottom: 1px solid var(--line);
  width: 112px !important;
  min-width: 112px !important;
  padding: 12px 10px;
  font-size: 15px;
  text-align: center;
  gap: normal;
  box-shadow: none;
}
.result-capture.capturing .table-wrap tbody td::before { display: none; }

.result-capture.capturing .table-wrap th:first-child,
.result-capture.capturing .table-wrap td:first-child {
  position: static;
  box-shadow: none;
}

.result-capture.capturing .result-answer-table-wrap {
  justify-content: flex-start;
}

/* 截图时去掉阴影与图片投影：html2canvas 渲染 inset 阴影会让色块出现内外色差/锯齿 */
.result-capture.capturing .token {
  box-shadow: none;
  text-shadow: none;
  width: 100% !important;
  min-width: 0 !important;
  margin: 3px 0 !important;
  padding: 8px 9px !important;
  font-size: 14px !important;
  line-height: 1.25 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-all !important;
}

.result-capture.capturing .pokemon-cell {
  width: 144px !important;
  min-width: 144px !important;
}

.result-capture.capturing .pokemon-cell strong {
  font-size: 14px;
}

.result-capture.capturing .pokemon-img {
  width: 92px;
  height: 92px;
  filter: none;
}

@media (max-width: 680px) {
  .result-top {
    grid-template-columns: 1fr;
    gap: 14px;
    justify-items: center;
    text-align: center;
  }

  .result-main {
    width: 100%;
  }

  .result-answer-img {
    width: 120px;
    height: 120px;
  }

  .result-verdict {
    font-size: 20px;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 650;
}

.modal-header .ghost-button {
  width: auto;
  margin-top: 0;
}

.token-cloud {
  max-height: 110px;
  overflow: auto;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.modal textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 12px;
  font: inherit;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 12px;
}

/* --- 高级选项 / 筛选编辑 --- */

.advanced-field-list {
  display: grid;
  gap: 12px;
}

.advanced-profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.advanced-profile-row .danger-button {
  width: auto;
}

.advanced-field {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px;
  background: var(--surface);
}

.advanced-field h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 650;
}

.range-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.range-filter label {
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
}

.range-filter input,
.range-filter select {
  margin-top: 6px;
}

.token-filter-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.token-filter-tools .ghost-button {
  width: auto;
  margin-top: 0;
}

.filter-mode-row {
  display: inline-flex;
  grid-column: 1 / -1;
  width: fit-content;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
}

.filter-mode-row.compact {
  margin-right: auto;
}

.mode-toggle {
  min-height: 32px;
  border: 0;
  border-right: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  transition: background 120ms ease, color 120ms ease;
}

.mode-toggle:last-child {
  border-right: 0;
}

.mode-toggle:hover:not(.active) {
  background: var(--surface-2);
  color: var(--text-2);
}

.mode-toggle.active {
  background: var(--accent);
  color: #fff;
}

.token-filter-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  padding: 2px;
}

.token-check {
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xs);
  background: var(--surface);
  padding: 7px 9px;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.token-check:hover {
  border-color: var(--muted-2);
  background: var(--surface-2);
}

.token-check input {
  width: auto;
  min-height: auto;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.modal-actions .ghost-button,
.modal-actions .primary-button,
.modal-actions .danger-button {
  width: auto;
  margin-top: 0;
}

.modal-feedback {
  min-height: 20px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.bottom-feedback {
  margin: 12px 0 0;
  text-align: right;
}

/* 页脚内的跨项目导航与版本号；页脚本体样式见上方 .site-footer。 */

.site-footer-nav {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.site-footer-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer-nav a:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

.site-footer-version {
  font-family: var(--font-num);
  font-size: 12px;
  color: var(--muted);
}

/* --- 页内居中弹窗（shared/modal.js，替代原生 alert/confirm/prompt） --- */

.ui-modal {
  width: min(460px, calc(100vw - 32px));
}

.ui-modal.ui-modal-wide {
  width: min(600px, calc(100vw - 32px));
}

.ui-modal-message {
  margin: 0 0 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ui-modal-message:empty {
  display: none;
}

.ui-modal-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font: inherit;
  line-height: 1.6;
  background: var(--surface);
  color: var(--text);
  margin-bottom: 8px;
}

textarea.ui-modal-input {
  resize: vertical;
  min-height: 120px;
}

.ui-modal-counter {
  margin: 0 0 6px;
  text-align: right;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ui-modal-hint {
  margin: 0 0 10px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.ui-modal .modal-feedback {
  color: var(--danger);
}

.ui-modal .modal-feedback:empty {
  min-height: 0;
  margin: 0;
}

/* 弹窗打开时锁定背景滚动，避免手机上背景跟着滑动。 */
body.ui-modal-open {
  overflow: hidden;
}

/* --- 自定义题库 / 实体选择表 --- */

.entity-selection-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.entity-selection-toolbar .ghost-button {
  width: auto;
  margin-top: 0;
}

.entity-selection-table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.entity-selection-table {
  /* table-layout:fixed 是性能关键：行数很多时，auto 布局会在每次勾选/取消时
     重新测量全部单元格（曾达 3.5s 卡顿）；fixed 让列宽与内容无关，勾选近乎瞬时。 */
  table-layout: fixed;
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.entity-selection-table th,
.entity-selection-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.entity-selection-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-3);
  font-weight: 650;
  text-transform: none;
  letter-spacing: 0;
}

/* 列宽（fixed 布局）：勾选框窄、名称宽，其余字段平分剩余。 */
.entity-selection-table th:first-child,
.entity-selection-table td:first-child {
  width: 54px;
  text-align: center;
}

.entity-selection-table th:nth-child(2),
.entity-selection-table td:nth-child(2) {
  width: 22%;
}

.entity-selection-table th.sortable-col {
  cursor: pointer;
  user-select: none;
}

.entity-selection-table th.sortable-col:hover {
  background: var(--surface-2);
}

.entity-selection-table tbody tr:hover td {
  background: var(--surface-2);
}

.entity-selection-check {
  width: auto;
  min-height: auto;
}

/* --- 图库完整性检查 --- */

.gallery-check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.gallery-check-grid h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 650;
}

.gallery-check-list {
  max-height: 54vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 8px;
}

.gallery-check-list p {
  margin: 0;
  padding: 6px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.gallery-check-list p:last-child {
  border-bottom: 0;
}

.gallery-check-list span {
  color: var(--muted);
  font-size: 12px;
}

/* --- Markdown 说明 --- */

.markdown-body {
  line-height: 1.74;
  color: var(--text-2);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin: 18px 0 8px;
  color: var(--text);
}

.markdown-body h1 { font-size: 20px; }
.markdown-body h2 { font-size: 17px; }
.markdown-body h3 { font-size: 15px; }

.markdown-body p {
  margin: 8px 0;
}

.markdown-body ul {
  margin: 8px 0 8px 20px;
  padding: 0;
}

.markdown-body li {
  margin: 4px 0;
}

.markdown-body code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-3);
  padding: 1px 6px;
  font-family: var(--font-num);
  font-size: 0.9em;
}

.markdown-body strong {
  color: var(--text);
  font-weight: 650;
}

/* =========================================================================
   胜利动画
   ========================================================================= */

.win-burst {
  position: fixed;
  left: 50%;
  top: 30%;
  z-index: 50;
  pointer-events: none;
}

.win-burst span {
  position: absolute;
  width: 9px;
  height: 15px;
  border-radius: 2px;
  background: var(--green);
  animation: burstPiece 1100ms ease-out forwards;
  animation-delay: var(--delay);
}

.win-burst span:nth-child(3n) { background: var(--amber); }
.win-burst span:nth-child(4n) { background: var(--accent); }
.win-burst span:nth-child(5n) { background: var(--danger); }

@keyframes winPulse {
  0%   { transform: scale(0.99); }
  55%  { transform: scale(1.008); }
  100% { transform: scale(1); }
}

@keyframes burstPiece {
  0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--x), var(--y)) rotate(240deg); opacity: 0; }
}

@keyframes tokenIn {
  0%   { transform: translateY(-3px) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes modalIn {
  0%   { opacity: 0; transform: translateY(8px) scale(0.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* =========================================================================
   响应式
   ========================================================================= */

@media (max-width: 1024px) {
  /* iPad 横屏(1024)及以下：侧边栏改为左侧滑入的抽屉，游戏区独占整幅宽度。
     抽屉脱离文档流，收起时不再把页面撑出空白，也不用给悬浮按钮整栏让位。 */
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    /* 单栏时改回随页面自然滚动，避免两栏挤在一屏内各自滚动。 */
    height: auto;
    overflow: visible;
  }

  .app-shell.side-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .game-panel {
    overflow: visible;
  }

  .side-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 33;
    width: min(320px, 86vw);
    padding-top: 64px; /* 给悬浮 ‹ 按钮让出顶部 */
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: transform 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
  }

  /* 覆盖桌面收起态的淡出规则：移动端收起 = 整体滑出屏幕，内容保持完整可交互。 */
  .side-collapsed .side-panel {
    transform: translateX(-108%);
    opacity: 1;
    padding-left: 22px;
    padding-right: 22px;
    pointer-events: auto;
    overflow-y: auto;
  }

  .side-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 32;
    background: rgba(10, 12, 18, 0.44);
    opacity: 1;
    transition: opacity 200ms ease;
  }

  .side-collapsed .side-backdrop {
    opacity: 0;
    pointer-events: none;
  }

  /* 悬浮开关：收起时在屏幕左上角，展开时贴到抽屉右上角，行为与桌面 ☰/‹ 一致。 */
  .side-toggle-button {
    top: 14px;
    left: 14px;
    z-index: 34;
    transition: left 220ms cubic-bezier(0.2, 0.7, 0.2, 1),
      background 140ms ease, color 140ms ease, transform 140ms ease;
  }

  .app-shell:not(.side-collapsed) .side-toggle-button {
    left: calc(min(320px, 86vw) - 52px);
  }

  /* 抽屉模式下游戏区不再需要 66px 左侧让位，只缩进标题行避开悬浮按钮。 */
  .side-collapsed .game-panel {
    padding-left: clamp(22px, 3vw, 36px);
  }

  .game-header {
    flex-direction: column;
    padding-left: 46px;
  }

  .game-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .counter {
    flex: 1;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .image-toggle {
    justify-content: space-between;
  }

  .admin-tools {
    grid-template-columns: 1fr;
  }

  .range-filter {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    display: grid;
  }

  .modal-actions .ghost-button,
  .modal-actions .primary-button,
  .modal-actions .danger-button {
    width: 100%;
  }

  .admin-header,
  .manager-header,
  .admin-actions,
  .admin-table-header,
  .admin-table-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 14.5px;
  }

  .dataset-settings-grid,
  .preset-admin-row,
  .dataset-title-row,
  .advanced-profile-row,
  .gallery-check-grid {
    grid-template-columns: 1fr;
  }

  .field-config-row,
  .image-config-row {
    grid-template-columns: 1fr 1fr;
  }

  .field-config-row .drag-handle,
  .image-config-row .drag-handle {
    grid-column: 1 / -1;
    width: 100%;
  }

  .admin-table-actions {
    grid-template-columns: 1fr;
  }

  .pokemon-img {
    width: 64px;
    height: 64px;
  }

  .pokemon-cell {
    min-width: 96px;
  }

  th, td {
    padding: 9px 7px;
    font-size: 14px;
  }

  tbody td {
    min-width: 62px;
  }

  .token {
    font-size: 13px;
    padding: 6px 7px;
  }

  .modal {
    padding: 18px;
  }
}

/* 极窄屏（小手机竖屏）：进一步压缩，保证横向滚动顺畅且不至于太宽 */
@media (max-width: 460px) {
  .pokemon-img {
    width: 52px;
    height: 52px;
  }

  .pokemon-cell {
    min-width: 84px;
  }

  .pokemon-cell strong {
    font-size: 13px;
  }

  table {
    min-width: 0;
  }

  th, td {
    padding: 8px 6px;
  }

  tbody td {
    min-width: 56px;
  }

  .token {
    font-size: 12.5px;
    padding: 5px 6px;
  }
}

/* =========================================================================
   卡片式布局（手机 / 平板竖屏）：把宽表格的每一行变成一张卡片，
   字段名用 ::before 从 data-label 取出，彻底告别左右滑动。
   纯 CSS、按宽度切换 —— 拖拽浏览器即可在表格 / 卡片间无缝切换。
   ========================================================================= */
@media (max-width: 820px) {
  .table-wrap {
    overflow-x: visible;
  }
  .table-wrap table {
    min-width: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .table-wrap thead {
    display: none; /* 表头隐藏，字段名移到每个单元格里 */
  }
  .table-wrap tbody {
    display: block;
  }
  .table-wrap tr {
    display: block;
    max-width: 380px;          /* 卡片更窄、居中，不再撑满整屏 */
    margin: 0 auto 14px;
    padding: 2px 16px 6px;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
  }
  /* 用 tbody 提高特异性，盖过基础规则 tr:last-child td{border-bottom:0}，
     否则只有一条猜测时整张卡片的字段分界线会消失。 */
  .table-wrap tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0 !important;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--line);   /* 字段间清晰实线分界 */
    text-align: right;
  }
  .table-wrap tbody tr td:last-child {
    border-bottom: 0;
  }
  .table-wrap td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-2);
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
  }
  /* 取消第一列冻结；图片+名字单元格作为卡片标题，居中、不显示 label */
  .table-wrap th:first-child,
  .table-wrap td:first-child {
    position: static;
    box-shadow: none;
  }
  .table-wrap td.pokemon-cell {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    border-bottom: 2px solid var(--line-strong);
    padding: 10px 0 8px;
  }
  .table-wrap td.pokemon-cell::before {
    content: none;
  }
  /* 状态色块在卡片里只占右侧、宽度自适应内容，更紧凑 */
  .table-wrap td .token {
    width: auto;
    min-width: 56px;
    margin: 0;
    padding: 5px 12px;
  }
}

/* =========================================================================
   提示功能
   ========================================================================= */
.hint-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 2px;
}
.hint-row .ghost-button {
  width: auto;
  margin-top: 0;
}
.hint-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.hint-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid color-mix(in srgb, var(--green) 45%, var(--line));
  font-size: 12.5px;
  font-weight: 650;
}

.cover-rotate-toggle {
  margin-top: 10px;
  width: 100%;
  justify-content: space-between;
}

/* =========================================================================
   多人游戏
   ========================================================================= */
.mp-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px);
}
/* 大厅首页用窄一点的版心更好看；房间内则尽量铺满给猜测表让位。 */
.mp-home {
  max-width: 1180px;
  margin: 0 auto;
}

.mp-home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
  margin-top: 18px;
}
.mp-card {
  display: grid;
  gap: 12px;
  align-content: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.mp-card h3 {
  margin: 0;
  font-size: 18px;
}
.mp-card label {
  display: grid;
  gap: 6px;
}
.mp-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mp-room-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.mp-room-header code {
  font-family: var(--font-num);
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: var(--r-xs);
}
.mp-room-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.mp-room-actions button {
  width: auto;
  margin-top: 0;
  min-width: 100px;
}
.mp-room-actions .ready-on {
  background: var(--green);
}

.mp-room-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 256px;
  gap: 18px;
  align-items: start;
}
.mp-self-panel {
  min-width: 0;
}
.mp-lobby-hint {
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 26px 20px;
  text-align: center;
}
.mp-conn-banner {
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 14px;
  text-align: center;
}
.mp-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.mp-timer {
  font-weight: 700;
  font-family: var(--font-num);
  color: var(--muted);
  font-size: 15px;
}
.mp-timer-urgent {
  color: var(--danger);
}

.mp-players-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 14px;
}
.mp-panel-title {
  margin: 0 0 12px;
  font-size: 15px;
}
.mp-players-list {
  display: grid;
  gap: 10px;
}
.mp-player-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 11px 12px;
  background: var(--surface-2);
}
.mp-player-card.left {
  opacity: 0.55;
}
/* 多人对战临场感：高亮「我」的进度卡，已猜出的玩家泛绿——无需改动 JS。 */
.mp-player-card:has(.mp-badge.me) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--ring);
}
.mp-player-card:has(.mp-solved):not(:has(.mp-badge.me)) {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green-soft) 62%, var(--surface));
}
.mp-player-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.mp-player-name {
  font-weight: 700;
}
.mp-player-score {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent-text);
  font-size: 13px;
}
.mp-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  color: var(--muted);
}
.mp-badge.host {
  background: var(--amber-soft);
  color: var(--amber);
}
.mp-badge.me {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.mp-ready {
  font-size: 12px;
  font-weight: 650;
  color: var(--green);
}
.mp-spectate {
  font-size: 12px;
  color: var(--muted);
}
.mp-blocks {
  display: grid;
  gap: 3px;
  margin-top: 9px;
}
.mp-block-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}
.mp-sq {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background: var(--slate);
  display: inline-block;
}
/* 提高特异性，覆盖通用 .status-* —— 否则因源码顺序 .mp-sq 会把状态色盖成灰。 */
.mp-sq.status-green { background: var(--green); }
.mp-sq.status-yellow { background: var(--amber); }
.mp-sq.status-gray { background: var(--slate); }
.mp-progress-tag {
  margin-top: 7px;
  font-size: 12px;
}
.mp-solved {
  color: var(--green);
  font-weight: 700;
}
.mp-failed {
  color: var(--danger);
  font-weight: 650;
}
.mp-turns {
  color: var(--muted);
}

/* 多人结果窗口 */
.mp-result-modal {
  max-width: min(1100px, 96vw);
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}
.mp-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.mp-result-answer {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mp-result-answer .result-answer-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.mp-result-board-wrap {
  overflow-x: auto;
  padding-bottom: 8px;
}
.mp-result-columns {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.mp-result-col {
  flex: 0 0 auto;
  min-width: 132px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px;
}
.mp-result-col-head {
  display: grid;
  gap: 2px;
  text-align: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.mp-result-col-head .muted {
  font-size: 11.5px;
}
.mp-guess-cell {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.mp-guess-cell:last-child {
  border-bottom: 0;
}
.mp-guess-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}
.mp-guess-name {
  font-size: 12.5px;
  font-weight: 650;
  text-align: center;
  max-width: 10em;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.mp-result-leaderboards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
.mp-board-table {
  width: 100%;
  border-collapse: collapse;
}
.mp-board-table th,
.mp-board-table td {
  text-align: left;
  padding: 7px 9px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  white-space: nowrap;
}
.mp-board-table th {
  color: var(--muted);
  font-size: 12px;
}
.mp-board-me {
  background: var(--accent-soft);
  font-weight: 700;
}

@media (max-width: 880px) {
  .mp-room-body {
    grid-template-columns: 1fr;
  }
  .mp-players-panel {
    position: static;
  }
  .mp-result-leaderboards {
    grid-template-columns: 1fr;
  }
}

/* =========================================================================
   v1.1.1 新增：题库卡片按钮 / 搜索栏 / 导航按钮 / 表情 / 观战 / 连胜
   ========================================================================= */
.dataset-search-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 6px 0 16px;
  max-width: 1160px;
  margin-left: auto;
  margin-right: auto;
}
#datasetSearchInput {
  flex: none;
  width: clamp(220px, 36vw, 420px);
}
.dataset-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.dataset-card-actions .primary-button,
.dataset-card-actions .ghost-button {
  width: auto;
  margin-top: 0;
  flex: 1;
}
.nav-button-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.nav-button-row .ghost-button {
  width: auto;
  margin-top: 0;
  flex: 1;
}
.mp-home-nav {
  display: flex;
  gap: 8px;
}
.mp-home-nav .ghost-button {
  width: auto;
  margin-top: 0;
}

/* 表情反应 */
.mp-reaction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.mp-reaction-button {
  width: auto;
  margin-top: 0;
  font-size: 18px;
  line-height: 1;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}
.mp-reaction-button:hover {
  transform: translateY(-2px) scale(1.08);
  background: var(--surface-3);
}
/* 弹幕冷却：整条栏短暂禁用，给出“正在冷却”的视觉反馈。 */
.mp-reaction-bar.cooling {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.4);
}
.mp-reaction-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
}
.mp-reaction-float {
  position: absolute;
  bottom: 18%;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 6px 14px;
  box-shadow: var(--shadow);
  animation: mpFloatUp 2.2s ease-out forwards;
}
@keyframes mpFloatUp {
  0% { opacity: 0; transform: translateY(20px) scale(0.8); }
  15% { opacity: 1; transform: translateY(0) scale(1); }
  80% { opacity: 1; transform: translateY(-120px); }
  100% { opacity: 0; transform: translateY(-180px); }
}

/* 观战：玩家卡片里展示每条猜测的名字 + 色块 */
.mp-spec-guess {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.mp-spec-name {
  font-size: 12px;
  font-weight: 600;
  min-width: 64px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-badge.streak {
  background: var(--amber-soft);
  color: var(--amber);
}
.mp-reaction-button.ready-on,
.ready-on {
  /* 准备/观战选中态由各自按钮的基色处理 */
}

/* 猜对横幅 */
.mp-won-banner {
  margin-top: 14px;
  padding: 12px 18px;
  background: var(--green-soft);
  color: oklch(0.38 0.1 157);
  border: 1px solid oklch(0.78 0.07 157);
  border-radius: var(--r-md);
  font-weight: 650;
  font-size: 15px;
  text-align: center;
}

/* 多人结果文字排行榜 */
.mp-board-text {
  font-size: 14px;
  line-height: 1.9;
  white-space: pre-line;
  color: var(--text);
}
.mp-board-text .mp-board-me-line {
  font-weight: 700;
  color: var(--accent-text);
}

/* 结果弹窗底部三按钮等宽 */
.mp-result-footer-actions {
  justify-content: stretch;
}
.mp-result-footer-actions button {
  flex: 1;
  min-width: 0;
}

/* 结果导出：玩家列居中排列 */
.mp-result-columns {
  justify-content: center;
}

/* Export-only QR badge for generated result/share images. */
.export-qr-badge {
  display: none;
}

.capturing .export-qr-badge {
  width: var(--export-qr-badge-width, 156px);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 3px 8px;
  border: 1px solid color-mix(in oklab, var(--line), #000 8%);
  border-radius: 16px;
  background: #fff;
  color: #111827;
  box-shadow: none;
  flex: none;
}

.capturing .export-qr-image {
  display: block;
  width: auto;
  height: auto;
  flex: none;
  image-rendering: pixelated;
}

.capturing .export-qr-caption {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.capturing .export-footer-layout {
  display: block;
  min-height: 0;
  padding: 8px 26px;
  text-align: left;
}

.capturing .export-footer-inner {
  width: min(880px, 100%);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 20px;
}

.capturing .export-footer-info {
  flex: 1 1 200px;
  min-width: 200px;
  display: grid;
  gap: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.capturing .export-footer-link {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.capturing .export-footer-dataset {
  color: var(--text-2);
  font-weight: 700;
  font-size: 14px;
}

/* Export-only brand logos (Skald Lab + project), shown side by side at the
   bottom-left of saved images; wraps above the info/QR row on narrow captures. */
.export-footer-brands {
  display: none;
}

.capturing .export-footer-brands {
  flex: none;
  align-self: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
}

.capturing .export-brand-logo {
  display: block;
  height: 52px;
  width: auto;
}

/* Bingo inline variant: single project logo sits in the footer row itself,
   and the QR caption moves below the code (see qr.js options.inlineBrand). */
.export-brand-inline {
  display: none;
}

.capturing .export-brand-inline {
  display: block;
  flex: none;
  height: 40px;
  width: auto;
}

.capturing .export-qr-badge.export-qr-vertical {
  flex-direction: column;
  gap: 6px;
  width: auto;
  padding: 0;
  border: none;
  background: transparent;
}

.capturing .export-qr-badge.export-qr-vertical .export-qr-image {
  width: 104px;
  padding: 8px;
  background: #fff;
  border: 1px solid color-mix(in oklab, var(--line), #000 8%);
  border-radius: 14px;
  box-sizing: border-box;
}

.capturing .export-qr-badge.export-qr-vertical .export-qr-caption {
  display: none;
}

.result-capture.capturing,
.bingo-capture.capturing {
  position: relative;
}

.result-capture.capturing,
.bingo-capture.capturing {
  padding-bottom: 0;
}


/* Account UI */
#userButton {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-modal {
  width: min(440px, calc(100vw - 32px));
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 650;
}

.auth-form input {
  width: 100%;
}

.user-menu.hidden {
  display: none;
}

.user-menu {
  position: fixed;
  top: 76px;
  right: 22px;
  z-index: 45;
  width: min(300px, calc(100vw - 28px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.user-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-menu-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}

.user-tier-badge {
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.user-tier-badge.admin {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}

.user-tier-badge.premium {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.user-menu .ghost-button {
  width: 100%;
  margin-top: 8px;
}

.user-creator-hint {
  margin: 10px 0 0;
  font-size: 12px;
}

.danger-text {
  color: var(--danger);
  border-color: var(--danger-line);
}

.danger-text:hover:not(:disabled) {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.history-modal {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

.history-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.history-stat {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.history-stat b {
  display: block;
  color: var(--text);
  font-size: 20px;
  line-height: 1.15;
}

.history-table-wrap {
  max-height: 54vh;
  overflow: auto;
}

.history-table-wrap table {
  width: 100%;
  min-width: 720px;
}

.history-table-wrap a {
  color: var(--accent-text);
  font-weight: 700;
  text-decoration: none;
}

.history-table-wrap a:hover {
  text-decoration: underline;
}

.history-row-actions {
  display: flex;
  gap: 12px;
  white-space: nowrap;
}

@media (max-width: 680px) {
  #userButton {
    max-width: 132px;
  }

  .user-menu {
    top: 68px;
    right: 14px;
    left: 14px;
    width: auto;
  }

  .history-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Shared account entry used by Portal / Compare / Bingo. */
.shared-account-host {
  position: relative;
  z-index: 50;
  flex: none;
}

.shared-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(300px, calc(100vw - 28px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.shared-account-menu.hidden {
  display: none;
}

/* ===================== 创作者审核 / 通知 / 工单 ===================== */

.notification-badge {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 999px;
  color: #fff;
  background: #c92a2a;
  font-size: 11px;
  line-height: 1;
}

.notification-badge.hidden {
  display: none;
}

.creator-review-status {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid #cbd9e8;
  border-radius: 12px;
  background: #f5f9fd;
}

.creator-review-status.hidden {
  display: none;
}

.creator-review-status[data-status="pending_review"] {
  border-color: #e7c768;
  background: #fff8df;
}

.creator-review-status[data-status="approved"] {
  border-color: #8bc99a;
  background: #edf9f0;
}

.creator-review-status[data-status="changes_requested"],
.creator-review-status[data-status="rejected"] {
  border-color: #e1a19d;
  background: #fff1f0;
}

.disclaimer-modal {
  width: min(760px, calc(100vw - 28px));
}

.disclaimer-body {
  max-height: min(52vh, 520px);
  overflow: auto;
  padding: 16px 18px;
  border: 1px solid #d8e0e9;
  border-radius: 12px;
  background: #f8fafc;
  white-space: pre-wrap;
  line-height: 1.72;
}

.disclaimer-confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  background: #fff7df;
}

.disclaimer-confirm-row input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.notification-modal,
.creator-tickets-modal {
  width: min(820px, calc(100vw - 28px));
}

.ticket-modal {
  width: min(620px, calc(100vw - 28px));
}

.inline-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.notification-list,
.creator-tickets-list {
  display: grid;
  gap: 10px;
  max-height: 62vh;
  overflow: auto;
}

.notification-item,
.creator-ticket-item {
  padding: 13px;
  border: 1px solid #d9e2ec;
  border-radius: 11px;
  background: #f9fbfd;
}

.notification-item.unread {
  border-color: #8db5e0;
  background: #edf6ff;
}

.notification-item-header,
.creator-ticket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notification-item p,
.creator-ticket-item p {
  margin: 7px 0 0;
  white-space: pre-wrap;
}

.ticket-status-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e7edf4;
  font-size: 0.78rem;
}

.ticket-status-badge.open,
.ticket-status-badge.triaged,
.ticket-status-badge.waiting_creator {
  color: #7a5000;
  background: #fff0bd;
}

.ticket-status-badge.resolved {
  color: #176b31;
  background: #daf3df;
}

.ticket-status-badge.dismissed {
  color: #8d2722;
  background: #f9dedc;
}

.creator-ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ticket-modal textarea,
.creator-tickets-modal textarea {
  box-sizing: border-box;
  width: 100%;
}

@media (max-width: 720px) {
  .inline-modal-actions,
  .notification-item-header,
  .creator-ticket-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .disclaimer-body {
    max-height: 48vh;
  }
}

.shared-account-menu .ghost-button {
  width: 100%;
  margin-top: 8px;
}

.shared-account-menu .muted {
  margin: 6px 0 2px;
}

@media (max-width: 680px) {
  .shared-account-menu {
    position: fixed;
    top: 62px;
    right: 14px;
  }
}
