:root {
    color-scheme: light;
    --ink: #17242d;
    --muted: #5d717f;
    --line: #d8e4ec;
    --panel: #ffffff;
    --soft: #f4f8fb;
    --accent: #2f6389;
    --accent-dark: #204a67;
    --green: #198754;
    --warn: #946400;
    --shadow: 0 16px 40px rgba(28, 50, 68, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 0;
    background: linear-gradient(180deg, #edf5fb 0%, #ffffff 35%, #f6f9fb 100%);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic", sans-serif;
    line-height: 1.7;
}

a {
    color: var(--accent-dark);
}

button,
input,
textarea {
    max-width: 100%;
    font: inherit;
}

.site-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 44px;
}

.hero {
    padding: 28px 0 22px;
}

.series-label,
.section-kicker,
.ad-label {
    margin: 0 0 8px;
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

h1,
h2,
h3,
p,
li,
pre,
code {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.45rem);
    line-height: 1.12;
}

h2 {
    margin: 0 0 10px;
    font-size: 1.35rem;
}

.subtitle {
    margin: 12px 0 0;
    font-size: 1.08rem;
    font-weight: 700;
}

.lead {
    max-width: 860px;
    margin: 12px 0 0;
}

.note,
.status-line,
.result-note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.panel,
.site-return-link,
.mothership-link {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.tool-layout,
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.tool-layout > *,
.info-grid > *,
.panel {
    min-width: 0;
}

.panel {
    padding: 20px;
}

.text-label {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    padding: 11px 12px;
}

textarea {
    min-height: 340px;
    resize: vertical;
    font-family: Consolas, "Courier New", monospace;
    font-size: 0.9rem;
    line-height: 1.55;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.option-grid label {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.option-grid input {
    width: auto;
    margin-top: 0.35em;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

button {
    border: 1px solid #bad0df;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    padding: 9px 12px;
    cursor: pointer;
}

button:hover,
button:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.primary-button,
.save-button {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

.save-button {
    border-color: var(--green);
    background: var(--green);
}

.quiet-button {
    color: var(--muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.stats-grid div {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    text-align: center;
}

.stats-grid strong,
.stats-grid span {
    display: block;
}

.stats-grid strong {
    color: var(--accent-dark);
    font-size: 1.2rem;
}

.stats-grid span {
    color: var(--muted);
    font-size: 0.82rem;
}

.copy-fallback {
    min-height: 120px;
    margin-top: 12px;
    white-space: pre;
}

.copy-fallback[hidden] {
    display: none;
}

.ad-row {
    margin: 18px 0;
    min-height: 250px;
    padding: 12px;
    border: 1px dashed #cbd7df;
    border-radius: 8px;
    background: rgba(255,255,255,0.7);
}

.related-tools,
.app-comment-section {
    margin-top: 18px;
}

.tool-links {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.tool-links a {
    display: block;
    min-height: 96px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
}

.tool-links a:hover,
.tool-links a:focus-visible {
    border-color: var(--accent);
    outline: none;
}

.tool-links strong,
.tool-links span {
    display: block;
}

.tool-links span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.88rem;
}

.site-return-link,
.mothership-link {
    max-width: 560px;
    margin: 18px auto 0;
    padding: 14px;
    text-align: center;
}

.site-return-link span,
.mothership-link span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.site-return-link a,
.mothership-link a {
    display: inline-block;
    margin-top: 4px;
    font-weight: 700;
}

.site-return-link p,
.mothership-link p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.lab-footer {
    margin-top: 22px;
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}

@media (max-width: 760px) {
    .site-shell {
        width: min(100% - 20px, 680px);
        padding-top: 18px;
    }

    .tool-layout,
    .info-grid,
    .tool-links,
    .option-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    textarea {
        min-height: 250px;
    }

    .panel {
        padding: 16px;
    }
}
