:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4f6;
  --bg-frost: rgba(243, 244, 246, 0.9);
  --card: #ffffff;
  --chip: #f1f2f6;
  --chip-focus: #ffffff;
  --rim: #e1e3ea;
  --rim-strong: #c5c9d4;
  --text: #17181c;
  --dim: #73788a;
  --muted: #6b7280;
  --line: #e4e7ec;
  --line-soft: #eef1f6;
  --primary: #1c1c21;
  --primary-hover: #33333a;
  --primary-text: #ffffff;
  --accent: #007aff;
  --accent-soft: #eef6ff;
  --danger: #b42318;
  --danger-soft: #fff6f5;
  --danger-rim: #f5c2c0;
  --ok: #2e7d32;
  --shadow: 0 1px 2px rgba(17, 19, 24, 0.04);
  --shadow-lg: 0 16px 40px rgba(17, 19, 24, 0.18);
  --overlay: rgba(17, 19, 24, 0.45);
  --slot: #eef0f4;
  --slot-hint: #9aa0ae;
  --ghost-bg: #ffffff;
  --ghost-hover: #f7f8fa;
  --seg: #e7e8ee;
  --seg-on: #ffffff;
  --radius: 18px;
  --radius-sm: 11px;
  --dock: 96px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1014;
  --bg-frost: rgba(15, 16, 20, 0.88);
  --card: #191b21;
  --chip: #101117;
  --chip-focus: #22242c;
  --rim: #2a2d36;
  --rim-strong: #454a58;
  --text: #f2f3f7;
  --dim: #8b90a0;
  --muted: #8b90a0;
  --line: #2a2d36;
  --line-soft: #24262e;
  --primary: #f2f3f7;
  --primary-hover: #ffffff;
  --primary-text: #111318;
  --accent: #0a84ff;
  --accent-soft: #152036;
  --danger: #ff6b6b;
  --danger-soft: #2a1515;
  --danger-rim: #5a2a28;
  --ok: #5bd67a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.5);
  --overlay: rgba(0, 0, 0, 0.64);
  --slot: #101117;
  --slot-hint: #6d7280;
  --ghost-bg: #22242c;
  --ghost-hover: #2b2e38;
  --seg: #101117;
  --seg-on: #2a2d36;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

body {
  padding-bottom: calc(var(--dock) + 48px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg-frost);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 24px 8px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mark-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mark-badge {
  font-size: 11px;
  font-weight: 700;
  min-height: 14px;
  color: var(--ok);
}

.mark-badge.is-used {
  color: var(--danger);
}

.unit-hint {
  font-size: 11px;
  color: var(--dim);
  white-space: nowrap;
  align-self: center;
}

.payload-box {
  max-width: 1120px;
  margin: 12px auto 0;
  padding: 0 24px;
  color: var(--dim);
  font-size: 12px;
}

.payload-box summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 6px;
}

.payload-text {
  margin: 0;
  padding: 10px 12px;
  background: var(--slot);
  border-radius: 10px;
  max-height: 140px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
}

.dock-actions .btn.is-hidden,
body.mode-docs .dock-usa,
body.hide-mock .dock-mock {
  display: none !important;
}

.dock-actions .btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}

.date-mode-row {
  display: flex;
  gap: 10px;
  align-items: end;
  margin-bottom: 4px;
}

.brand-word {
  display: block;
  width: auto;
  height: 44px;
  image-rendering: pixelated;
}

.auth-logo {
  display: block;
  width: auto;
  height: 52px;
  margin: 0 auto 18px;
  image-rendering: pixelated;
}

.top-filters {
  display: flex;
  gap: 12px;
  flex: 1;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.theme {
  display: flex;
  padding: 2px;
  border-radius: 999px;
  background: var(--seg);
}

.theme-btn {
  border: 0;
  background: transparent;
  color: var(--dim);
  font: 12px/1 inherit;
  font-weight: 700;
  padding: 6px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.lang-menu {
  position: relative;
}

.lang-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--ghost-bg);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.lang-current:hover {
  border-color: var(--rim-strong);
}

.lang-flag {
  font-size: 16px;
  line-height: 1;
}

.lang-caret {
  font-size: 10px;
  color: var(--muted);
}

.lang-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 168px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 40;
}

.lang-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.lang-opt:hover,
.lang-opt.is-on {
  background: var(--chip);
}

.theme-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
}

.theme-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-btn[data-theme-set="dark"] svg {
  fill: currentColor;
  stroke: none;
}

.theme-btn.is-on {
  background: var(--seg-on);
  color: var(--text);
}

.kind-switch {
  display: flex;
  align-self: end;
  padding: 3px;
  border-radius: 999px;
  background: var(--seg);
  margin-bottom: 1px;
}

.kind-btn {
  border: 0;
  background: transparent;
  color: var(--dim);
  font: 12px/1 inherit;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.kind-btn.is-on {
  background: var(--seg-on);
  color: var(--text);
}

.kind-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.userbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--ghost-bg);
  border-radius: 999px;
  padding: 4px 10px 4px 6px;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}

.user-chip:hover {
  border-color: var(--rim-strong);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--chip);
  display: grid;
  place-items: center;
  font-size: 14px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
  min-width: 0;
}

.user-email {
  font-size: 12px;
  font-weight: 600;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-credits {
  font-size: 11px;
  color: var(--muted);
}

.user-caret {
  font-size: 10px;
  color: var(--muted);
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 40;
}

.user-drop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px 10px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 4px;
}

.user-drop-head strong {
  color: var(--text);
  font-size: 14px;
}

.user-drop-note {
  margin: 0;
  padding: 8px 10px 10px;
  color: var(--slot-hint);
  font-size: 12px;
  user-select: none;
}

.pay-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--overlay);
}

.pay-overlay[hidden] {
  display: none !important;
}

.pay-card {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 18px;
  padding: 20px 20px 16px;
  box-shadow: var(--shadow-lg);
}

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

.pay-packs {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.pay-pack {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--ghost-bg);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 16px;
  font: inherit;
  cursor: pointer;
}

.pay-pack:hover:not(:disabled) {
  border-color: var(--rim-strong);
}

.pay-pack span {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--dim);
}

.pay-pack small {
  font-size: 12px;
  color: var(--slot-hint);
}

.pay-pack:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pay-err {
  margin: 10px 0 0;
  color: var(--danger);
}

.pay-qr {
  display: flex;
  justify-content: center;
  margin: 8px auto 12px;
  width: fit-content;
  padding: 10px;
  background: #fff;
  border-radius: 14px;
}

.pay-qr img,
.pay-qr canvas {
  width: 180px;
  height: 180px;
  border-radius: 12px;
}

.pay-addr {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
  background: var(--chip);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--text);
}

.pay-addr .edge {
  font-weight: 700;
  color: var(--text);
}

.pay-addr .mid {
  font-weight: 400;
  color: var(--dim);
}

.clip-warn {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.4;
  margin: 8px 0 12px;
}

.pay-copy-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.pay-amount-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--chip);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.pay-amount-box strong {
  display: block;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

#payFeeLine {
  margin: 4px 0 0;
  font-size: 12px;
}

#payStepCoins .btn.grow,
#payStepDone .btn.grow {
  width: 100%;
  margin-top: 12px;
}

.pay-tx {
  display: inline-block;
  margin: 8px 0 14px;
  color: var(--accent);
}

.admin-card {
  width: min(760px, 100%);
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: min(58vh, 560px);
  overflow: auto;
}

.admin-row {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--chip);
}

.admin-row.is-banned {
  background: var(--danger-soft);
  border-color: var(--danger-rim);
}

.admin-who {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.admin-who strong {
  font-size: 14px;
}

.admin-who span {
  color: var(--muted);
  font-size: 12px;
}

.admin-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.admin-amt {
  width: 88px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: var(--chip);
  color: var(--text);
}

.admin-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-card {
  width: min(720px, 100%);
}

.history-note {
  margin: 0 0 10px;
  font-size: 13px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(68vh, 640px);
  overflow: auto;
}

.history-row {
  display: grid;
  grid-template-columns: 148px 1fr;
  gap: 12px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.history-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}

.history-meta span {
  color: var(--muted);
}

.history-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-shots a {
  display: block;
  width: 180px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--chip);
}

.history-shots img {
  display: block;
  width: 100%;
  height: auto;
}

.user-drop-item[hidden] {
  display: none;
}

.user-drop-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 10px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}

.user-drop-item:hover {
  background: var(--chip);
}

.user-drop-item.danger {
  color: var(--danger);
}

.field.is-bad .well,
.field.is-bad input,
.field.is-bad select {
  outline: 1px solid var(--danger);
}

body.guest .app-only {
  display: none !important;
}

body.authed .guest-only {
  display: none !important;
}

body.need-token .app-only,
body.need-token .guest-only,
body.need-token .dock {
  display: none !important;
}

#tokenPage {
  display: none !important;
}

body.need-token #tokenPage {
  display: flex !important;
}

.token-card h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.token-warn {
  color: var(--danger);
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 16px;
  user-select: none;
}

#tokenValue {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: 0.04em;
}

.token-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 14px 0 12px;
  font-size: 14px;
  color: var(--text);
}

.token-check input {
  margin-top: 3px;
}

#tokenCopy {
  margin-top: 8px;
}

body.guest {
  padding-bottom: 24px;
}

.auth-page {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: min(400px, 100%);
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 26px 24px;
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 12px;
  background: var(--chip);
}

.auth-tab {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  font-weight: 650;
  color: var(--dim);
  cursor: pointer;
}

.auth-tab.is-on {
  background: var(--seg-on);
  color: var(--text);
}

.auth-lead,
.auth-note {
  color: var(--dim);
  font-size: 13px;
  margin: 0 0 16px;
}

.auth-note {
  margin: 16px 0 0;
  font-size: 12px;
}

.auth-card .field {
  margin-bottom: 12px;
}

.auth-card .signup-only {
  display: none;
}

.auth-card.is-signup .signup-only {
  display: flex;
  flex-direction: column;
}

.auth-card .btn.primary {
  width: 100%;
  margin-top: 6px;
}

.human-check {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0 0 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--chip);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.human-check[data-state="ok"] {
  cursor: default;
}

.human-box {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1.5px solid var(--rim-strong);
  border-radius: 4px;
  background: transparent;
}

.human-check[data-state="checking"] .human-box {
  border-color: var(--accent);
  border-top-color: transparent;
  animation: human-spin 0.7s linear infinite;
}

.human-check[data-state="ok"] .human-box {
  border-color: var(--ok);
  background: var(--ok);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M3.2 8.2 6.4 11.4 12.8 4.6' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
  animation: human-pop 0.22s ease;
}

.human-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.human-title {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
}

.human-sub {
  font-size: 12px;
  color: var(--dim);
  line-height: 1.3;
}

.human-shield {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: var(--dim);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.human-check[data-state="ok"] .human-shield {
  stroke: var(--ok);
}

.captcha-modal[hidden] {
  display: none;
}

.captcha-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.captcha-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
  animation: captcha-fade 0.18s ease;
}

.captcha-dialog {
  position: relative;
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px 18px;
  box-shadow: var(--shadow-lg);
  animation: captcha-pop 0.18s ease;
}

.captcha-dialog h3 {
  margin: 0 36px 8px 0;
  font-size: 18px;
}

.captcha-lead {
  margin: 0 0 14px;
  color: var(--dim);
  font-size: 13px;
}

.captcha-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.captcha-x:hover {
  background: var(--chip);
  color: var(--text);
}

.turnstile-slot {
  display: flex;
  justify-content: center;
  min-height: 68px;
}

.extra-ref,
.extra-board {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 12px;
  border-radius: 10px;
  background: var(--chip);
}

.extra-board {
  width: 100%;
  height: 72px;
  object-fit: contain;
}

.extra-choices,
.extra-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.extra-cell {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--chip);
  padding: 4px;
  cursor: pointer;
}

.extra-cell img {
  display: block;
  width: 100%;
  height: auto;
}

.extra-cell.is-on {
  border-color: var(--accent);
}

#extraSlide {
  width: 100%;
  margin: 0 0 12px;
}

#extraRefresh {
  margin-top: 4px;
}

@keyframes human-spin {
  to { transform: rotate(360deg); }
}

@keyframes human-pop {
  from { transform: scale(0.8); }
  to { transform: scale(1); }
}

@keyframes captcha-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes captcha-pop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.auth-card .btn.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.top-filters label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--dim);
  font-size: 13px;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 24px 32px;
}

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 28px;
  align-items: start;
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 24px 26px;
  box-shadow: var(--shadow);
}

#leftPane,
.media {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#docFields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}

.row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field > span {
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
}

.field-line {
  display: flex;
  gap: 6px;
  align-items: center;
}

.span-2 {
  grid-column: span 2;
}

.field-line.height-line .combo-wrap {
  flex: 0 0 76px;
  width: 76px;
  min-width: 76px;
}

.height-line .combo-btn {
  padding: 8px 26px 8px 12px;
  background-position: right 9px center;
}

.cat-field {
  grid-column: 1 / -1;
}

.cat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  background: var(--chip);
  border: 1px solid var(--rim);
  border-radius: var(--radius-sm);
}

.cat-check {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 4px 8px;
  border: 1px solid var(--rim);
  border-radius: 8px;
  background: var(--card);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.cat-check:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cat-check input {
  margin: 0;
  accent-color: var(--accent);
}

.field-line .combo {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

.combo,
.well,
.btn {
  font: inherit;
  color: var(--text);
}

.combo,
.well {
  background: var(--chip);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.combo:focus,
.well:focus-within {
  border-color: var(--rim-strong);
  background-color: var(--chip-focus);
}

.combo {
  appearance: none;
  padding: 8px 28px 8px 10px;
  min-height: 38px;
  width: 100%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%2373788a'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.combo.wide {
  width: 100%;
}

.combo-wrap {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
}

.field-line .combo-wrap,
.top-filters .combo-wrap {
  width: auto;
  flex: 1 1 auto;
}

.top-filters .combo-wrap {
  min-width: 148px;
}

.combo-wrap > select.combo {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  pointer-events: none;
}

.combo-btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 38px;
  margin: 0;
  padding: 8px 28px 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--chip);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%2373788a'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.combo-btn:focus,
.combo-wrap.is-open .combo-btn {
  border-color: var(--rim-strong);
  background-color: var(--chip-focus);
  outline: none;
}

.combo-menu {
  position: fixed;
  z-index: 80;
  margin: 0;
  padding: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  /* Do not pass wheel/touch overscroll to the page, which would dismiss the
     still-open dropdown through the global page-scroll listener. */
  overscroll-behavior: contain;
  background: var(--card);
  border: 1px solid var(--rim);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

.combo-option {
  display: block;
  width: 100%;
  margin: 0;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.combo-option:hover,
.combo-option.is-on {
  background: var(--chip);
}

.field.is-bad .combo-btn {
  outline: 1px solid var(--danger);
}

.well {
  display: flex;
  align-items: center;
  min-height: 38px;
}

.well.grow,
.grow {
  flex: 1;
  min-width: 0;
}

.well input,
.well textarea {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  outline: none;
  font: inherit;
  color: var(--text);
}

.well textarea {
  min-height: 72px;
  resize: vertical;
}

.well textarea.hint {
  color: var(--dim);
}

.well input::placeholder,
.well textarea::placeholder {
  color: var(--slot-hint);
  opacity: 1;
  user-select: none;
  -webkit-user-select: none;
}

.fullka-fold {
  margin-bottom: 8px;
}

.fullka-toggle {
  width: 42px;
  min-width: 42px;
  font-size: 22px;
  line-height: 1;
}

.fullka-sample {
  margin: 8px 0 10px;
  color: var(--slot-hint);
  font: 13px/1.45 inherit;
  white-space: pre-wrap;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.fullka-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.fullka-row .btn-row {
  flex-direction: column;
  margin: 0;
}

.btn {
  border: 1px solid var(--rim);
  background: var(--ghost-bg);
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:hover {
  background: var(--ghost-hover);
}

.btn.ghost.icon {
  width: 36px;
  padding: 7px 0;
}

#photoCut.is-on,
body.cut #photoCut {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

#photoCut.is-on:hover,
body.cut #photoCut:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-text);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-text);
  font-weight: 650;
}

.btn.primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-text);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.media > .btn-row,
.media > .mark-row,
.media > .well,
.media > .dim {
  width: 100%;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
}

.media > .btn-row.tight {
  justify-content: center;
}

.media > .mark-row {
  justify-content: center;
}

.dice {
  width: 36px;
  padding: 0;
  flex-shrink: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--dim);
}

.dim {
  color: var(--dim);
  font-size: 12px;
  min-height: 0;
  margin: 0;
}

.path {
  color: var(--dim);
  font-size: 12px;
  word-break: break-all;
}

.picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.picker label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
}

.photo-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

.photo-zoom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  width: 100%;
}

.photo-zoom-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
  flex: 0 0 auto;
}

.zoom-h {
  flex: 1;
  width: 100%;
  min-width: 0;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.photo-frame {
  width: 168px;
  height: auto;
  aspect-ratio: 738 / 977;
  max-width: 100%;
  background: var(--slot);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.photo-frame.is-dragging {
  cursor: grabbing;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
  will-change: transform;
  pointer-events: none;
}

.slot-hint {
  position: absolute;
  color: var(--slot-hint);
  font-size: 13px;
  pointer-events: none;
}

.sig-plate {
  height: 96px;
  border-radius: 12px;
  background: var(--slot);
  color: var(--text);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.sig-plate svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sig-plate.is-dragging {
  outline: 2px solid var(--accent);
}

.sig-plate img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.more {
  color: var(--dim);
  font-size: 12px;
  margin-bottom: 8px;
}

.more[open] {
  padding-bottom: 4px;
}

.more summary {
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}

.more summary::-webkit-details-marker {
  display: none;
}

.slider-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 12px;
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: var(--bg-frost);
  backdrop-filter: blur(16px);
}

.dock-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 24px 16px;
}

.dock-meter {
  flex: 1;
  min-width: 120px;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.dock-meter-track {
  height: 8px;
  border-radius: 99px;
  background: var(--chip);
  overflow: hidden;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.dock-meter.is-busy .dock-meter-track {
  opacity: 1;
}

.dock-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease-out;
}

.dock-status {
  margin: 0;
  color: var(--dim);
  font-size: 13px;
  min-height: 1.2em;
}

.dock-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-pick {
  position: relative;
  flex: 0 1 280px;
}

.meta-chip {
  width: 100%;
  max-width: 280px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--rim);
  border-radius: 999px;
  background: var(--card);
  color: var(--dim);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-chip:hover {
  border-color: var(--rim-strong);
  color: var(--text);
}

.meta-pop {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 280px;
  max-height: 320px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--rim);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-lg);
}

.meta-pop button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.meta-pop button:hover,
.meta-pop button.is-on {
  background: var(--chip);
}

.meta-pop .meta-group {
  margin: 8px 10px 2px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.cut .photo-frame {
  outline: 2px solid var(--accent);
}

@media (max-width: 860px) {
  .sheet {
    grid-template-columns: 1fr;
  }
  .media {
    order: -1;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .row,
  .row.three {
    grid-template-columns: 1fr 1fr;
  }
  .fullka-row {
    grid-template-columns: 1fr;
  }
  .specimen-stage.is-pair {
    flex-direction: column;
  }
  .specimen-stage.is-pair .specimen-wrap {
    width: min(420px, 100%);
  }
}

.specimen {
  margin: 28px 0 108px;
}

.specimen-stage {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 22px;
  min-height: 160px;
}

.specimen-card {
  display: block;
  width: 100%;
  background: var(--card);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.specimen-card img {
  display: block;
  width: 100%;
  height: auto;
}

.specimen-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(640px, 100%);
}

.specimen-stage.is-pair .specimen-wrap {
  width: min(380px, 46%);
}

.specimen-stage.is-stack {
  flex-direction: column;
}

.specimen-stage.is-stack .specimen-wrap {
  width: min(640px, 100%);
}

.specimen-dl {
  color: var(--dim);
  font-size: 13px;
  text-decoration: none;
}

body:not(.cut) #cutHint {
  display: none;
}

.cut-hint {
  margin: 4px 0 0;
  color: var(--slot-hint);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

html[data-theme="dark"] .brand-word,
html[data-theme="dark"] .auth-logo {
  filter: invert(1);
}

html[data-theme="dark"] .combo,
html[data-theme="dark"] .combo-btn {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%238b90a0'/></svg>");
}

::selection {
  background: var(--accent);
  color: #fff;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--chip) inset;
  transition: background-color 99999s ease-out;
}
