:root,
html[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --text: #000000;
  --heading: #000000;
  --muted: #333333;
  --faint: #666666;
  --line: #e0e0e0;
  --link: #0051c3;
  --widget-bg: #fafafa;
  --widget-border: #dadada;
  --box-bg: #ffffff;
  --box-border: #c1c1c1;
  --box-hover: #8d8d8d;
  --track: #e0e0e0;
  --orange: #f6821f;
  --success: #00a63e;
  --fail: #d93025;
  --legal: #888888;
  --focus: #0051c3;
  --overlay: rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --text: #e8e8e8;
  --heading: #ffffff;
  --muted: #d0d0d0;
  --faint: #9a9a9a;
  --line: #2a2a2a;
  --link: #8ab4f8;
  --widget-bg: #161616;
  --widget-border: #3a3a3a;
  --box-bg: #1c1c1c;
  --box-border: #8d8d8d;
  --box-hover: #c4c4c4;
  --track: #3d3d3d;
  --orange: #f6821f;
  --success: #2ecc40;
  --fail: #ff6b6b;
  --legal: #9a9a9a;
  --focus: #8ab4f8;
  --overlay: rgba(0, 0, 0, 0.72);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #000000;
    --text: #e8e8e8;
    --heading: #ffffff;
    --muted: #d0d0d0;
    --faint: #9a9a9a;
    --line: #2a2a2a;
    --link: #8ab4f8;
    --widget-bg: #161616;
    --widget-border: #3a3a3a;
    --box-bg: #1c1c1c;
    --box-border: #8d8d8d;
    --box-hover: #c4c4c4;
    --track: #3d3d3d;
    --orange: #f6821f;
    --success: #2ecc40;
    --fail: #ff6b6b;
    --legal: #9a9a9a;
    --focus: #8ab4f8;
    --overlay: rgba(0, 0, 0, 0.72);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.main-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  width: 100%;
  max-width: 60rem;
  margin: 8rem auto 2rem;
  padding: 0 1.5rem;
}

.site-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
  color: var(--text);
  font-size: 1.25rem;
}

.favicon {
  display: inline-flex;
  width: 20px;
  height: 20px;
}

.favicon svg {
  width: 20px;
  height: 20px;
}

.hostname {
  font-weight: 600;
}

.h1 {
  margin: 0;
  color: var(--heading);
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.core-msg {
  margin: 0.85rem 0 1.75rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.125rem;
}

.cf-turnstile {
  display: flex;
  align-items: stretch;
  width: 300px;
  height: 65px;
  background: var(--widget-bg);
  border: 1px solid var(--widget-border);
  border-radius: 2px;
  overflow: hidden;
}

.cf-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
}

.cf-turnstile[data-state="idle"] .cf-body {
  cursor: pointer;
}

.cf-body:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -3px;
}

.cf-control {
  position: relative;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.cf-box {
  position: absolute;
  inset: 0;
  border: 2px solid var(--box-border);
  border-radius: 3px;
  background: var(--box-bg);
  transition:
    border-radius 180ms ease,
    border-color 180ms ease,
    border-width 180ms ease,
    background-color 180ms ease,
    opacity 160ms ease,
    transform 120ms ease;
}

.cf-turnstile[data-state="idle"] .cf-body:hover .cf-box {
  border-color: var(--box-hover);
}

.cf-turnstile[data-state="idle"] .cf-body:active .cf-box {
  transform: scale(0.92);
}

.cf-turnstile[data-state="verifying"] .cf-box {
  border-radius: 50%;
  border-width: 3px;
  border-color: var(--track);
  border-top-color: var(--orange);
  background: transparent;
  animation: cf-spin 0.65s linear infinite;
}

.cf-turnstile[data-state="success"] .cf-box,
.cf-turnstile[data-state="fail"] .cf-box {
  opacity: 0;
  transform: scale(0.72);
  animation: none;
  border-color: transparent;
  background: transparent;
}

.cf-check,
.cf-fail {
  position: absolute;
  inset: -2px;
  width: 28px;
  height: 28px;
  opacity: 0;
}

.cf-check path,
.cf-fail path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.cf-check path {
  stroke: var(--success);
  stroke-width: 2.6;
}

.cf-fail path {
  stroke: var(--fail);
  stroke-width: 2.3;
}

.cf-turnstile[data-state="success"] .cf-check {
  opacity: 1;
}

.cf-turnstile[data-state="success"] .cf-check path {
  animation: cf-draw 380ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cf-turnstile[data-state="fail"] .cf-fail {
  opacity: 1;
}

.cf-turnstile[data-state="fail"] .cf-fail path {
  animation: cf-draw 240ms ease forwards;
}

.cf-turnstile[data-state="fail"] .cf-fail-2 {
  animation-delay: 90ms;
}

.cf-label {
  font-size: 14px;
  color: var(--text);
  user-select: none;
}

.cf-brand {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.cf-cloud {
  display: block;
  width: 46px;
  height: 21px;
}

.cf-legal {
  margin: 0;
  font-size: 8px;
  line-height: 1;
  color: var(--legal);
  white-space: nowrap;
}

.cf-legal a {
  color: var(--legal);
  text-decoration: none;
}

.cf-legal a:hover {
  text-decoration: underline;
}

.troubleshoot {
  margin: 0.85rem 0 0;
  font-size: 0.95rem;
}

.troubleshoot button,
.modal-close {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  cursor: pointer;
}

.troubleshoot button:hover,
.modal-close:hover,
.footer-text a:hover {
  text-decoration: underline;
}

.footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
}

.footer-inner {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem 1.5rem 1.25rem;
  color: var(--faint);
  font-size: 0.75rem;
}

.ray-id code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.footer-text a {
  color: var(--faint);
  text-decoration: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--overlay);
}

.modal[hidden],
[hidden] { display: none !important; }

.modal-card {
  width: min(28rem, 100%);
  padding: 1.25rem 1.35rem 1.1rem;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
}

.modal-card h2 {
  margin: 0 0 0.55rem;
  color: var(--heading);
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-card p,
.modal-card li {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.modal-card ol {
  padding-left: 1.2rem;
}

.modal-close {
  margin: 0;
}

.challenge-zone {
  position: relative;
  max-width: 36rem;
}

.cf-agree {
  margin: 0 0 0.45rem;
  color: var(--faint);
  font-size: 0.85rem;
}

.cf-command {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 0.85rem;
  padding: 7px 8px 7px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--box-bg);
}

.cf-command-check {
  display: inline-flex;
  flex: 0 0 auto;
}

.cf-command code {
  flex: 1;
  min-width: 0;
  color: var(--heading);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cf-command .cf-q {
  color: var(--faint);
}

.cf-copy {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 16px;
  border: 0;
  border-radius: 5px;
  background: #48a04b;
  color: #fff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.cf-copy:hover {
  background: #3d8b40;
}

.cf-popover-card kbd.kbd-win {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 5px;
}

.cf-popover-card kbd.kbd-win svg {
  display: block;
}

.cf-wait {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0.15rem 0 0;
  color: var(--faint);
  font-size: 0.85rem;
}

.cf-wait-spin {
  width: 12px;
  height: 12px;
  border: 2px solid var(--track);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: cf-spin 0.65s linear infinite;
}

.cf-popover {
  position: relative;
  width: 100%;
  margin-top: 10px;
  transform-origin: 24px 0;
  animation: popover-from-check 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cf-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 18px;
  width: 12px;
  height: 12px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

.cf-popover-card {
  padding: 1.1rem 1.15rem 1rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.cf-popover-card h2 {
  margin: 0 0 0.5rem;
  color: var(--heading);
  font-size: 1.15rem;
  font-weight: 600;
}

.cf-popover-card p,
.cf-popover-card li {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.cf-popover-card p {
  margin: 0 0 0.75rem;
}

.cf-popover-card ol {
  margin: 0 0 0.9rem;
  padding-left: 1.15rem;
}

.cf-popover-card li + li {
  margin-top: 0.4rem;
}

.cf-popover-card kbd {
  display: inline-block;
  min-width: 1.35em;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--widget-bg);
  color: var(--heading);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

@keyframes popover-from-check {
  from {
    opacity: 0;
    transform: scale(0.18) translateY(-12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

@keyframes cf-draw {
  to { stroke-dashoffset: 0; }
}

@media (max-width: 640px) {
  .main-content { margin-top: 4.5rem; }
  .h1 { font-size: 1.85rem; }
  .site-row { font-size: 1.15rem; }
}
