/* ── Shared tool page layout ── */
.tool-page {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 1.75rem 1.5rem 3.5rem;
}

/* .tool-hero gradient → .hero-gradient (components.css §7) */
/* Layout-only stub — appearance provided by .hero-gradient */
.tool-hero {
    margin-bottom: 1.25rem;
    padding: 1.45rem;
    border-radius: 1.5rem;
}

.tool-page h1 {
    margin-bottom: 0.45rem;
    font-size: clamp(2rem, 4vw, 2.6rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.tool-header {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.tool-header p {
    max-width: 66ch;
    font-size: 0.97rem;
    line-height: 1.7;
}

.tool-example {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.52rem 0.85rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.12);
}

.tool-project-context {
    margin-top: 1rem;
    padding: 1rem 1.05rem;
    border-radius: 1.15rem;
    border: 1px solid rgba(37, 99, 235, 0.1);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(15, 118, 110, 0.08));
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.tool-project-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.tool-project-meta strong {
    font-size: 0.88rem;
}

.tool-project-meta span {
    font-size: 0.83rem;
    color: var(--color-text-secondary);
    line-height: 1.55;
}

.tool-project-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.62rem 0.92rem;
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: var(--color-surface);
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
}

.tool-project-back:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.tool-body {
    padding: 1.4rem;
    border-radius: 1.35rem;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-surface-elevated) 100%);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.045);
}

.tool-body form {
    display: grid;
    gap: 0.85rem;
}

/* .tool-body label → .form-label (components.css §20) */
/* .tool-body input/textarea/select → .form-input (components.css §20) */

/* 다크 모드: surface (#131c2e)와 bg (#0b1220)의 명도 차이가 너무 작아
   입력창이 배경과 구분이 안 됨 → surface-elevated (#1c2740)로 끌어올림 */
:root[data-theme="dark"] .tool-body input[type="text"],
:root[data-theme="dark"] .tool-body input[type="number"],
:root[data-theme="dark"] .tool-body textarea,
:root[data-theme="dark"] .tool-body select {
    background: var(--color-surface-elevated);
}

.tool-body button,
.tool-body button[type="submit"] {
    min-height: 38px;
    padding: 0.42rem 1.2rem;
    margin-top: 0.5rem;
    border-radius: 999px;
    font-weight: 700;
}

/* main.css의 .tool-body button.btn-cta(명시도 0,2,1)를 오버라이드 */
.tool-body .tab-panel .btn-cta,
.tool-body .tab-panel button.btn-cta {
    padding: 0.42rem 1.5rem;
    min-height: 38px;
    margin-top: 0.5rem;
}

/* 탭 패널 내 입력창·결과창 너비 제한 */
.tool-body .tab-panel input,
.tool-body .tab-panel select,
.tool-body .tab-panel textarea {
    max-width: 420px;
}

.tool-body .tab-panel .results-box {
    max-width: 480px;
}

.tool-body .error,
.tool-body .warning {
    margin-top: 1rem;
    border-radius: 1rem;
}

.tool-body table {
    overflow: hidden;
    border-radius: 1rem;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.tool-cta {
    margin-top: 1.2rem;
    padding: 1rem 1.15rem;
    border-top: none;
    border-radius: 1.2rem;
    border: 1px solid rgba(37, 99, 235, 0.1);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(15, 118, 110, 0.07));
}

.tool-cta a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 700;
}

/* ── Inline Favorite Button ── */
.tool-fav-wrap {
    text-align: right;
    margin-bottom: 0.5rem;
}

.inline-fav-btn {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-secondary);
}

/* ── Radar Chart ── */
.radar-chart {
    max-width: 50%;
    margin: 0 auto;
    position: relative;
}

/* ── Download button below radar chart ── */
.tool-dl-wrap {
    text-align: center;
    margin-top: 1.5rem;
}

.tool-dl-btn {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.tool-dl-btn:hover {
    background: var(--color-surface-hover);
}

.tab-panel { display: none; }
.tab-panel.tab-active { display: block; }

#ic50-export-area { display: none; margin-top: 0.75rem; }
#ic50-histogram { display: none; margin-top: 1.5rem; max-width: 100%; }

@media (max-width: 768px) {
    .tool-page {
        padding: 1.25rem 1rem 2.5rem;
    }

    .tool-hero,
    .tool-body {
        padding: 1.1rem;
    }

    .tool-project-context {
        align-items: flex-start;
    }
}
