* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #1a1a1a;
    color: #daa520;
    min-height: 100vh;
    display: flex; flex-direction: column;
    border-top: 3px solid #daa520;
}
body:has(.theme-red) { border-top-color: #e53935; }
body:has(.theme-green) { border-top-color: #43a047; }
.container {
    /* Centred when the window is taller than the content; the auto margins collapse otherwise. */
    margin: auto; width: 100%; max-width: 640px; text-align: center;
    padding: 1rem;
}
h1 { font-size: 1.5rem; margin-bottom: 0.75rem; color: #daa520; line-height: 1.2; }
h1 .subtitle { display: block; font-size: 0.65em; font-weight: bold; margin-top: -0.1rem; color: inherit; }
.progress { font-size: 1.15rem; font-weight: bold; margin-bottom: 1rem; letter-spacing: 0.05em; text-transform: uppercase; color: #b0b0b0; }
.message { font-size: 0.9rem; font-weight: bold; margin-bottom: 2.5rem; color: #b0b0b0; line-height: 1.5; }

/* Structured challenge-error layout: a lead paragraph, an optional "how to fix"
   box, and a muted hint. Used by challenge_error.html. */
.msg-lead { font-size: 1rem; font-weight: bold; color: #d0d0d0; line-height: 1.5; margin-bottom: 1.5rem; }
.info-box {
    text-align: center;
    background: #141414;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 0 auto 1.5rem;
    max-width: 640px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #b0b0b0;
}
.info-box-title { font-weight: bold; color: #d0d0d0; margin-bottom: 0.75rem; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; }
.info-box dl { margin: 0; }
.info-box dt { font-weight: bold; color: #daa520; margin-top: 0.75rem; }
.info-box dt:first-child { margin-top: 0; }
.info-box dd { margin: 0.15rem 0 0; }
.info-box dd.no-label { margin: 0; }
.msg-box-text { margin: 0 0 0.75rem; }
.msg-box-text.session-id { margin: 1rem 0 0; font-size: 0.78rem; color: #888; line-height: 1.7; }
.msg-box-text.session-id b { color: #b0b0b0; word-break: break-all; }
.msg-hint {
    margin-top: 1.5rem;
    font-size: 0.8rem;
    font-weight: normal;
    color: #888;
    line-height: 1.5;
}
code { background: #2a2a2a; padding: 0.1em 0.35em; border-radius: 3px; font-size: 0.9em; }

/* The Try-again button is framed with generous space on every message page. */
.redir { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-top: 1.5rem; margin-bottom: 1.5rem; }
/* Shared look of every button: an accent outline that fills on hover. The
   challenge scripts give their buttons the g-btn class. */
.g-btn, .redir a { color: var(--g-puzzle-accent, #daa520); display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; text-decoration: none; font-family: inherit; font-size: 1rem; font-weight: bold; background-color: transparent; border: 1px solid var(--g-puzzle-accent, #daa520); border-radius: 6px; cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }
.g-btn { padding: 0.6rem 1.2rem; min-width: 44px; min-height: 44px; }
.redir a { padding: 0.75rem 2rem; }
@media (hover: hover) { .g-btn:hover:not(:disabled), .redir a:hover { background-color: var(--g-puzzle-accent, #daa520); color: #0a0a0a; } }
.g-btn:focus-visible { outline: 2px solid var(--g-puzzle-accent, #daa520); outline-offset: 2px; }
.g-btn:disabled { color: #b0b0b0; border-color: #5a5a5a; cursor: default; }
/* While the retry countdown runs the link holds its size, drops its href and
   fills up from the left. Without JavaScript it never enters this state. */
.redir a { min-width: 13rem; justify-content: center; }
.redir a.counting {
    color: #b0b0b0;
    border-color: #5a5a5a;
    cursor: default;
    background-image: linear-gradient(to right, rgba(218, 165, 32, 0.22) var(--g-progress, 0%), transparent var(--g-progress, 0%));
    background-repeat: no-repeat;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.redir a.counting:hover { background-color: transparent; color: #b0b0b0; }
.notice { font-size: 0.7rem; margin-top: 2.5rem; color: #b0b0b0; line-height: 1.5; }
.state { font-size: 0.6rem; margin-top: 2rem; color: #b0b0b0; line-height: 1.5; }
.contact-links { display: flex; justify-content: center; gap: 1.5rem; flex-wrap: wrap; margin-top: 1rem; }
.contact-link { color: #daa520; display: flex; align-items: center; gap: 0.5rem; text-decoration: none; font-size: 0.9rem; transition: opacity 0.2s ease; padding: 0.5rem; border-radius: 4px; cursor: pointer; }
.contact-link:hover { background-color: rgba(67, 160, 71, 0.1); opacity: 0.8; }
.spinner {
    width: 60px; height: 60px; margin: 0 auto 2.5rem;
    border: 3px solid #333; border-top-color: #daa520;
    border-radius: 50%; animation: spin 1s linear infinite;
}
.altcha-wrapper {
    margin: 0 auto;
    width: 320px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.probes {
    position: absolute;
    left: -10000px;
    top: 0;
    pointer-events: none;
}
.probes div {
    width: 1px;
    height: 1px;
}
.confirm {
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}
#g-challenge {
    display: none !important;
}

.theme-red h1,
.theme-red .icon { color: #e53935; }

.theme-green h1,
.theme-green .icon { color: #43a047; }

.icon { margin: 0 auto 1.25rem; display: block; text-align: center; }
.icon svg { width: 64px; height: 64px; }
.icon img { width: 300px; max-width: 35vw; width: clamp(180px, 35vw, 300px); height: auto; filter: invert(1) drop-shadow(0 0 12px rgba(255, 255, 255, 0.4)); }
.hidden { display: none !important; }

@media (min-width: 768px) {
    h1 { font-size: 2rem; }
    .message { font-size: 1rem; }
    .notice { font-size: 0.9rem; }
    .state { font-size: 0.75rem; }
}

#countdown {
    display: block;
    margin: 0.5rem 0;
    font-size: 2rem;
    font-weight: bold;
    color: #daa520;
    letter-spacing: 0.05em;
}

/* Room around a challenge widget (the scripts set their own spacing inline). */
.content .g-puzzle { margin-top: 2.5rem !important; margin-bottom: 2.5rem !important; }

/* Footer line: product, version, session id and the help panel. */
.g-foot { display: flex; flex-wrap: wrap; white-space: nowrap; justify-content: center; align-items: center; gap: 0.25rem 0.9rem; margin-top: 1.25rem; padding-top: 0.6rem; border-top: 1px solid #333; font-size: 0.75rem; color: #888; }
.g-foot a { color: #daa520; font-weight: bold; text-decoration: none; }
.g-foot > * { flex: none; }
/* Items of the footer line never break inside; the smallest phones get a
   slightly smaller type so the full session ID still fits. */
@media (max-width: 340px) { body:not(.embed) .g-foot { font-size: 0.68rem; } }

/* The help panel: a details element whose body covers the window, so it costs
   no height while closed and needs no script. The toggle reads "Get help"
   followed by (?); frames show the (?) alone. */
/* On normal pages the help toggle always sits on a line of its own. */
body:not(.embed) .g-help { flex-basis: 100%; justify-content: center; margin-top: 0.6rem; }
/* The summary fills the line and centers its own content. */
body:not(.embed) .g-help:not([open]) > summary { display: flex; justify-content: center; }
.g-help summary { line-height: 16px; list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem; color: #daa520; font-weight: bold; }
.g-help summary::-webkit-details-marker { display: none; }
.g-help summary::after { content: "?"; width: 16px; height: 16px; line-height: 14px; text-align: center; border: 1px solid #daa520; border-radius: 50%; }
.g-help[open] summary::after { content: "\00d7"; width: 28px; height: 28px; line-height: 26px; font-size: 1.3rem; background: #1a1a1a; }
.g-help-body { display: none; }
.g-help[open] { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(640px, calc(100% - 2rem)); max-height: calc(100% - 2rem); overflow: auto; padding: 2.5rem 1rem 0.5rem; background: #1a1a1a; border: 1px solid #333; border-radius: 8px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.7); white-space: normal; z-index: 10; }
.g-help[open] .g-help-body { display: block; }
/* Open, the toggle becomes the close button in the corner of the box. */
.g-help[open] summary { position: absolute; top: 6px; right: 6px; }
.g-help[open] .g-help-label { display: none; }
/* The panel is the box already, so the help content sits on it without a box of its own. */
.g-help-body .info-box { background: none; border-radius: 0; padding: 0; margin-bottom: 1rem; }

/* Compact sizes for pages shown inside a frame (embed*.html). */
body.embed .container { max-width: 480px; padding: 0.6rem 0.75rem; }
body.embed h1 { font-size: 0.95rem; margin-bottom: 0.4rem; }
body.embed .progress { font-size: 0.7rem; margin-bottom: 0.4rem; letter-spacing: 0.04em; }
body.embed .message { font-size: 0.8rem; margin-bottom: 0.6rem; line-height: 1.35; }
body.embed .spinner { width: 28px; height: 28px; margin: 0 auto 0.6rem; border-width: 2px; }
body.embed .icon { margin: 0 auto 0.4rem; }
body.embed .icon svg { width: 32px; height: 32px; }
body.embed .g-foot { flex-wrap: nowrap; gap: 0.6rem; margin-top: 0.6rem; padding-top: 0.4rem; font-size: 0.65rem; white-space: nowrap; overflow: hidden; }
body.embed .g-foot span:last-child { overflow: hidden; text-overflow: ellipsis; }
body.embed .g-help-label { display: none; }
body.embed .g-help-body { font-size: 0.75rem; }
/* In a frame the panel fills the whole frame. */
body.embed .g-help[open] { top: 0; left: 0; transform: none; width: 100%; height: 100%; max-height: none; padding: 2.5rem 0.75rem 0.75rem; border: 0; border-radius: 0; box-shadow: none; }
body.embed .g-help-body .info-box { padding: 0; margin-bottom: 0.6rem; font-size: 0.75rem; line-height: 1.45; }
body.embed .g-help-body .contact-links { margin-top: 0.4rem; }
body.embed .redir { margin: 0.6rem 0; gap: 1rem; }
body.embed .redir a { padding: 0.4rem 1rem; min-width: 0; font-size: 0.85rem; }
body.embed .content .message p { margin-bottom: 0.4rem; }

/* Below the native frame size (560 x 315) the challenge heading steps aside for
   screen readers only and the instruction line is set smaller. */
@media (max-width: 559px), (max-height: 314px) {
    body.embed .embed-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    body.embed #g-message { font-size: 0.7rem; }
    /* The help panel gives up height it cannot spare: a smaller close button and less room above the text. */
    body.embed .g-help[open] { padding-top: 1rem; }
    body.embed .g-help[open] summary { top: 3px; right: 3px; }
    body.embed .g-help[open] summary::after { width: 18px; height: 18px; line-height: 16px; font-size: 1rem; }
}

/* In a frame the answer button and "Get new challenge" shrink and sit closer
   together; "Start challenge" keeps its size. The challenge scripts set the
   spacing inline, hence !important. */
body.embed .g-puzzle { padding: 0 !important; margin: 0 auto 0.4rem !important; }
body.embed .g-skip-wrap { margin: 0 0 0.3rem !important; }
body.embed .g-actions { margin-top: 0.4rem !important; }
body.embed .g-btn-verify, body.embed .g-btn-skip { padding: 0.25rem 0.8rem; min-width: 0; min-height: 30px; font-size: 0.8rem; }

/* Short frames: the message line is the instruction, the heading steps aside
   for screen readers only. */
@media (max-height: 199px) {
    body.embed .container { padding: 0.25rem 0.6rem; }
    body.embed header { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    body.embed .message { margin-bottom: 0.3rem; }
    body.embed .theme-red .message { color: #e53935; }
    body.embed .theme-green .message { color: #43a047; }
    body.embed .g-foot { margin-top: 0.25rem; padding-top: 0.2rem; border-top: 0; }
    body.embed .g-ver { display: none; }
}

/* Challenge error page in a frame: the fix list stays readable at small size. */
body.embed h1 .subtitle { font-size: 0.7em; margin-top: 0; }
body.embed .msg-lead { font-size: 0.85rem; margin-bottom: 0.6rem; }
body.embed .message .info-box { padding: 0.5rem 0.7rem; margin-bottom: 0.6rem; font-size: 0.75rem; line-height: 1.4; }
body.embed .message .info-box dt { margin-top: 0.4rem; }
body.embed .msg-hint { margin-top: 0.6rem; font-size: 0.72rem; }
