:root {
    color-scheme: light;
    --ink: #18242c;
    --muted: #5f7280;
    --line: #d8e3ea;
    --panel: #ffffff;
    --soft: #f5f8fa;
    --accent: #7a4bdb;
    --accent-dark: #5931ad;
    --green: #198754;
    --warn: #b26a00;
    --shadow: 0 16px 40px rgba(30, 52, 70, 0.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 0;
    background: linear-gradient(180deg, #f4f0ff 0%, #ffffff 34%, #f5f8fa 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,
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 {
    overflow-wrap: anywhere;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.6rem);
    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: 820px;
    margin: 12px 0 0;
}

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

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

.warning-panel {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-color: #eed59a;
    background: #fff9e8;
}

.warning-panel strong {
    display: block;
    color: #754600;
}

.warning-panel p {
    margin: 4px 0 0;
}

.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
    gap: 18px;
    align-items: start;
}

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

.panel {
    padding: 20px;
}

.panel-head p:last-child {
    margin-bottom: 0;
}

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

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

textarea {
    width: 100%;
    min-height: 280px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    padding: 12px;
    resize: vertical;
}

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

button {
    border: 1px solid #c9bbeb;
    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 {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
}

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

.score-card {
    display: grid;
    place-items: center;
    min-height: 210px;
    margin-top: 14px;
    border: 1px solid #d6caee;
    border-radius: 8px;
    background: radial-gradient(circle at 50% 35%, #ffffff 0%, #f5f0ff 58%, #eee8fb 100%);
    text-align: center;
}

.score-label,
#scoreTag {
    color: var(--muted);
    font-weight: 700;
}

#scoreValue {
    color: var(--accent-dark);
    font-size: clamp(3rem, 12vw, 5.4rem);
    line-height: 1;
}

.metric-bars {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.metric-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 48px;
    gap: 10px;
    align-items: center;
    font-size: 0.9rem;
}

.bar-track {
    height: 9px;
    overflow: hidden;
    border-radius: 999px;
    background: #ece5f8;
}

.bar-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #7a4bdb, #21a6a6);
}

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

.detail-grid,
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

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

.detail-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    padding: 12px;
}

.detail-card strong {
    display: block;
}

.detail-card span {
    display: block;
    color: var(--muted);
    font-size: 0.88rem;
}

.empty-detail {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
}

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

.tool-links {
    display: grid;
    grid-template-columns: repeat(4, 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.86rem;
}

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

.app-comments,
.app-comment-form-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

@media (max-width: 900px) {
    .tool-layout,
    .text-grid,
    .info-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

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

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

    .panel {
        padding: 14px;
    }

    textarea {
        min-height: 220px;
    }

    .action-row button {
        flex: 1 1 140px;
    }

    .metric-row {
        grid-template-columns: 82px minmax(0, 1fr) 42px;
        gap: 8px;
    }

    .tool-links {
        grid-template-columns: 1fr;
    }
}
