/* Styles for the free tool pages. Layered on top of blog.css so the tool
   surface matches the rest of the site without duplicating its tokens. */

.tool-panel {
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 14px;
    padding: 22px;
    margin: 26px 0 30px;
    background: rgba(15, 23, 42, 0.02);
}

.tool-field {
    display: block;
    margin-bottom: 14px;
}

.tool-field > span {
    display: block;
    font-weight: 600;
    font-size: 0.94rem;
    margin-bottom: 6px;
}

.tool-panel input[type="text"],
.tool-panel input[type="url"],
.tool-panel input[type="number"],
.tool-panel input[type="password"] {
    width: 100%;
    padding: 11px 13px;
    font: inherit;
    border: 1px solid rgba(15, 23, 42, 0.22);
    border-radius: 9px;
    background: #fff;
    color: inherit;
    box-sizing: border-box;
}

.tool-panel input:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.tool-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.tool-row .tool-field {
    flex: 1 1 180px;
    margin-bottom: 0;
}

.tool-check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.94rem;
    margin: 14px 0;
}

.tool-check input {
    width: 16px;
    height: 16px;
}

.tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-top: 18px;
}

.tool-button {
    appearance: none;
    border: 0;
    border-radius: 9px;
    padding: 12px 20px;
    font: inherit;
    font-weight: 600;
    color: #fff;
    background: #dc2626;
    cursor: pointer;
}

.tool-button:hover:not(:disabled) { background: #b91c1c; }
.tool-button:disabled { opacity: 0.55; cursor: progress; }

.tool-button.secondary {
    background: #fff;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.24);
}

.tool-button.secondary:hover { background: rgba(15, 23, 42, 0.05); }

.tool-status {
    margin-top: 14px;
    font-size: 0.94rem;
    min-height: 1.2em;
}

.tool-status.is-error { color: #b91c1c; }
.tool-status.is-busy { color: #475569; }

.tool-hint {
    font-size: 0.86rem;
    color: #64748b;
    margin-top: 6px;
}

.tool-advanced-toggle {
    appearance: none;
    background: none;
    border: 0;
    padding: 0;
    margin-top: 16px;
    font: inherit;
    font-size: 0.9rem;
    color: #2563eb;
    cursor: pointer;
    text-decoration: underline;
}

#advanced-panel {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed rgba(15, 23, 42, 0.18);
}

.tool-results { margin-top: 22px; }

.tool-table-wrap { overflow-x: auto; }

.tool-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 12px;
}

.tool-table th,
.tool-table td {
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    vertical-align: top;
}

.tool-table th {
    font-weight: 600;
    background: rgba(15, 23, 42, 0.04);
}

@media (prefers-color-scheme: dark) {
    .tool-panel {
        border-color: rgba(226, 232, 240, 0.16);
        background: rgba(226, 232, 240, 0.04);
    }

    .tool-panel input[type="text"],
    .tool-panel input[type="url"],
    .tool-panel input[type="number"],
    .tool-panel input[type="password"] {
        background: #0f172a;
        border-color: rgba(226, 232, 240, 0.24);
        color: #e2e8f0;
    }

    .tool-button.secondary {
        background: transparent;
        color: #e2e8f0;
        border-color: rgba(226, 232, 240, 0.3);
    }

    .tool-table th { background: rgba(226, 232, 240, 0.06); }

    .tool-table th,
    .tool-table td { border-bottom-color: rgba(226, 232, 240, 0.12); }

    .tool-hint { color: #94a3b8; }
    .tool-status.is-error { color: #fca5a5; }
    .tool-status.is-busy { color: #94a3b8; }
}

.cf-turnstile {
    margin-top: 16px;
    min-height: 65px;
}

/* Nothing rendered (challenge not configured) should not leave a gap. */
.cf-turnstile:empty { min-height: 0; margin-top: 0; }

.winners { list-style: none; padding: 0; margin: 12px 0 24px; display: flex; flex-direction: column; gap: 10px; }

.winners li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 14px 16px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 10px;
    background: #fff;
}

.winner-rank {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.winner-comment { margin: 3px 0 0; font-size: 0.9rem; color: #475569; }

.receipt {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 18px;
    margin: 10px 0 20px;
    font-size: 0.9rem;
}

.receipt dt { font-weight: 600; }
.receipt dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

@media (prefers-color-scheme: dark) {
    .winners li { background: rgba(226, 232, 240, 0.04); border-color: rgba(226, 232, 240, 0.16); }
    .winner-comment { color: #94a3b8; }
}

.matches { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }

.matches li {
    padding: 13px 15px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    border-radius: 9px;
    background: #fff;
}

.match-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.match-date { font-size: 0.8rem; color: #64748b; font-variant-numeric: tabular-nums; }
.match-text { margin: 5px 0 8px; font-size: 0.92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.match-text mark { background: #fde68a; color: inherit; padding: 0 1px; border-radius: 2px; }
.match-link { font-size: 0.84rem; }

@media (prefers-color-scheme: dark) {
    .matches li { background: rgba(226, 232, 240, 0.04); border-color: rgba(226, 232, 240, 0.16); }
    .match-date { color: #94a3b8; }
    .match-text mark { background: #7c5e10; color: #fdf3d0; }
}
