.captcha-dialog {
  box-sizing: border-box;
  width: min(440px, calc(100vw - 28px));
  max-height: min(90dvh, 680px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
.captcha-dialog::backdrop { background: var(--scene-scrim, #071223b8); }
.captcha-card {
  box-sizing: border-box;
  position: relative;
  min-width: 0;
  padding: 28px;
  font-family: var(--font-ui, sans-serif);
  color: var(--text);
}
.captcha-inline {
  padding: 20px;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-soft);
}
.captcha-heading { display: flex; align-items: center; gap: 12px; padding-right: 30px; }
.captcha-heading > div { min-width: 0; }
.captcha-emblem {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 46px;
  color: var(--accent-bright);
}
.captcha-emblem svg { display: block; width: 40px; height: 40px; }
.captcha-emblem path:first-child { fill: var(--accent-dim); stroke: currentColor; stroke-width: 1.5; }
.captcha-emblem path:last-child { fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.captcha-eyebrow { display: block; margin-bottom: 5px; font-size: .65rem; font-weight: 800; color: var(--accent-bright); }
.captcha-card h2 { margin: 0; font-size: 1.18rem; line-height: 1.3; font-weight: 850; color: var(--text-bright); }
.captcha-card .captcha-intro { margin: 18px 0 12px; color: var(--text); font-size: .9rem; line-height: 1.5; }
.captcha-picture {
  box-sizing: border-box;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 106px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 15px;
  overflow: hidden;
  background: #f4f7fb;
}
.captcha-picture img { display: block; width: 100%; max-width: 330px; height: 100px; object-fit: contain; user-select: none; }
.captcha-placeholder { color: #526071; font-size: .85rem; line-height: 1.5; text-align: center; }
.captcha-controls { margin-top: 18px; }
.captcha-controls > label { display: block; margin-bottom: 8px; color: var(--text); font-size: .78rem; font-weight: 750; }
.captcha-answer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.captcha-card .captcha-answer {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text-bright);
  font: 700 1.25rem/1 var(--font-mono, monospace);
  letter-spacing: .15em;
  text-align: center;
}
.captcha-confirm, .captcha-refresh { box-sizing: border-box; min-height: 44px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 13px; font: 750 .82rem/1.4 var(--font-ui, sans-serif); cursor: pointer; touch-action: manipulation; }
.captcha-confirm { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.captcha-refresh { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; margin-top: 10px; background: transparent; color: var(--text); }
.captcha-refresh > span { font-size: 1.2rem; line-height: 1; }
.captcha-confirm:disabled, .captcha-refresh:disabled { opacity: .5; cursor: default; }
.captcha-card .captcha-message { min-height: 21px; margin: 13px 0 0; color: var(--success-bright); font-size: .78rem; line-height: 1.55; }
.captcha-card .captcha-error { color: var(--error); }
.captcha-card .captcha-note { margin: 8px 0 0; color: var(--text-muted); font-size: .74rem; line-height: 1.55; }
.captcha-card .captcha-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: 0;
  cursor: pointer;
}
.captcha-close::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 6 12 12M18 6 6 18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 6 12 12M18 6 6 18' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.captcha-card :is(button, input):focus-visible { outline: 3px solid var(--accent-bright); outline-offset: 3px; }
.captcha-card [hidden] { display: none !important; }
@media (hover: hover) { .captcha-refresh:hover, .captcha-close:hover { background: var(--accent-dim); border-color: var(--accent); color: var(--text-bright); } }
@media (max-width: 600px), (pointer: coarse) {
  .captcha-card { padding: 22px 18px; }
  .captcha-inline { padding: 18px 14px; }
  .captcha-heading { padding-right: 32px; gap: 8px; align-items: start; }
  .captcha-emblem { flex-basis: 32px; width: 32px; height: 38px; }
  .captcha-emblem svg { width: 32px; height: 32px; }
  .captcha-card h2 { font-size: 1.06rem; }
  .captcha-answer-row { grid-template-columns: minmax(0, 1fr); }
  .captcha-confirm { width: 100%; }
  .captcha-card .captcha-close { width: 44px; height: 44px; min-width: 44px; min-height: 44px; top: 8px; right: 8px; }
}
