:root {
    --tools-bg: linear-gradient(180deg, #f8fafc 0%, #ffffff 35%);
    --tools-accent: #22c55e;
    --tools-accent-dark: #16a34a;
    --tools-accent-soft: rgba(34, 197, 94, 0.12);
}

.tools-main {
    background: var(--tools-bg);
}

.webapp-main {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
    padding: 48px 20px 72px;
}

.webapp-shell {
    width: 100%;
    max-width: 760px;
}

.webapp-title {
    margin: 0 0 8px;
    text-align: center;
    color: var(--gray-900);
    font-size: clamp(1.9rem, 4vw, 2.9rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.webapp-subtitle {
    margin: 0 0 26px;
    text-align: center;
    color: var(--gray-600);
    font-size: 16px;
    line-height: 1.55;
}

.webapp-subtitle a {
    color: var(--primary-green-dark);
    font-weight: 600;
    text-decoration: underline;
}

.webapp-subtitle a:hover {
    color: var(--primary-green);
}

.webapp-card {
    border: 1px solid var(--gray-200);
    border-radius: 22px;
    background: #ffffff;
    box-shadow: var(--shadow-lg);
    padding: 28px;
}

.webapp-start {
    text-align: center;
    padding: 8px 4px;
}

.webapp-start-title {
    margin: 0 0 10px;
    color: var(--gray-900);
    font-size: clamp(1.5rem, 2.8vw, 2rem);
    line-height: 1.2;
}

.webapp-start-text {
    margin: 0 auto 20px;
    max-width: 44ch;
    color: var(--gray-600);
    line-height: 1.6;
}

.webapp-progress {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-full);
    overflow: hidden;
    background: var(--gray-100);
}

.webapp-progress-fill {
    width: 25%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    transition: width 0.25s ease;
}

.webapp-progress-text {
    margin: 10px 0 18px;
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 600;
}

.webapp-step {
    text-align: center;
}

.webapp-step-title {
    margin: 0;
    color: var(--gray-900);
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    line-height: 1.2;
}

.webapp-step-hint {
    margin: 10px auto 14px;
    max-width: 56ch;
    color: var(--gray-600);
}

.webapp-step-value {
    margin: 0 0 10px;
    color: var(--primary-green-dark);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1;
}

#stepInput {
    width: 100%;
    accent-color: var(--primary-green);
    cursor: grab;
}

#stepInput:hover {
    cursor: grab;
}

#stepInput:active {
    cursor: grabbing;
}

#stepInput::-webkit-slider-thumb {
    cursor: grab;
}

#stepInput:active::-webkit-slider-thumb {
    cursor: grabbing;
}

#stepInput::-moz-range-thumb {
    cursor: grab;
}

#stepInput:active::-moz-range-thumb {
    cursor: grabbing;
}

.webapp-actions {
    margin-top: 22px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

#stepFinishBtn {
    display: none;
}

.webapp-result {
    text-align: center;
}

.webapp-result-score {
    margin: 14px 0 4px;
    color: var(--gray-900);
    font-size: clamp(2.8rem, 7vw, 4rem);
    font-weight: 900;
    line-height: 1;
}

.webapp-result-caption {
    margin: 0 0 14px;
    color: var(--gray-500);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.webapp-result-summary {
    margin: 0 auto 18px;
    max-width: 58ch;
    color: var(--gray-600);
}

.webapp-rec-title {
    margin: 0 0 10px;
    color: var(--gray-900);
    font-size: 20px;
}

.webapp-result .tips {
    list-style: none;
    margin: 0 auto 18px;
    padding: 0;
    max-width: 620px;
    display: grid;
    gap: 10px;
    text-align: left;
}

.webapp-result .tips li {
    margin: 0;
    padding: 10px 14px;
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: var(--radius-full);
    background: rgba(34, 197, 94, 0.1);
    color: #14532d;
    line-height: 1.5;
}

.fade-in {
    animation: webappFadeIn 0.28s ease-out;
}

@keyframes webappFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.archive-hero-band {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

.archive-hero-inner {
    padding: 64px 20px;
}

.tools-kicker.archive-kicker {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.98);
}

.archive-hero-title {
    margin: 18px 0 12px;
    color: #ffffff;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: -0.03em;
}

.archive-hero-subtitle {
    margin: 0;
    max-width: 75ch;
    color: rgba(255, 255, 255, 0.92);
    font-size: 18px;
    line-height: 1.65;
}

.tools-container {
    max-width: 1160px;
    margin: 0 auto;
    padding: 64px 20px 88px;
}

.tools-hero {
    position: relative;
    padding: 44px;
    border-radius: 24px;
    border: 1px solid var(--gray-200);
    background:
        radial-gradient(circle at right top, rgba(34, 197, 94, 0.18), transparent 45%),
        #ffffff;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.tools-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--tools-accent-soft);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-full);
    color: var(--tools-accent-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 8px 14px;
    text-transform: uppercase;
}

.tools-title {
    margin: 16px 0 12px;
    font-size: clamp(2rem, 3.8vw, 3.2rem);
    line-height: 1.12;
    letter-spacing: -0.03em;
    color: var(--gray-900);
}

.tools-subtitle {
    max-width: 70ch;
    margin: 0;
    color: var(--gray-600);
    font-size: 18px;
    line-height: 1.7;
}

.tools-list {
    margin: 22px 0 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tools-list li {
    padding: 7px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    background-color: #fff;
    color: var(--gray-700);
    font-size: 13px;
    font-weight: 500;
}

.tools-section {
    margin-top: 38px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 24px;
}

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

.tool-card {
    border: 1px solid var(--gray-200);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--shadow-md);
    padding: 26px;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.tool-card--compact {
    border-radius: 18px;
    padding: 20px;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: rgba(34, 197, 94, 0.35);
}

.tool-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    gap: 10px;
}

.tool-badge {
    display: inline-block;
    font-size: 11px;
    color: var(--tools-accent-dark);
    background: var(--tools-accent-soft);
    border: 1px solid rgba(34, 197, 94, 0.28);
    border-radius: var(--radius-full);
    padding: 6px 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tool-time {
    color: var(--gray-500);
    font-size: 12px;
    font-weight: 500;
}

.tool-title {
    font-size: 24px;
    line-height: 1.16;
    margin: 0 0 10px;
    color: var(--gray-900);
}

.tool-description {
    margin: 0 0 18px;
    color: var(--gray-600);
    line-height: 1.7;
}

.tool-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.tool-chip {
    font-size: 12px;
    color: var(--gray-700);
    background: var(--gray-100);
    border-radius: var(--radius-full);
    padding: 6px 10px;
}

.tool-link {
    margin-top: auto;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.calculator-layout {
    margin-top: 34px;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 22px;
}

.calculator-layout--focused {
    align-items: start;
}

.panel {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    padding: 24px;
}

.stepper-panel {
    position: sticky;
    top: 96px;
}

.panel h2 {
    margin: 0 0 8px;
    font-size: 28px;
    color: var(--gray-900);
}

.panel-subtitle {
    margin: 0 0 20px;
    color: var(--gray-600);
    line-height: 1.6;
}

.slider-row {
    margin-bottom: 20px;
}

.stepper-progress {
    width: 100%;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--gray-100);
    overflow: hidden;
    margin-bottom: 8px;
}

.stepper-progress-fill {
    width: 25%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    transition: width 0.25s ease;
}

.stepper-progress-text {
    margin: 0 0 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
}

.step-card {
    display: none;
    border: 1px solid var(--gray-200);
    border-radius: 14px;
    background: var(--gray-50);
    padding: 18px;
}

.step-card.active {
    display: block;
    animation: stepFadeIn 0.2s ease-out;
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.step-actions .btn {
    min-width: 110px;
}

#stepResultBtn {
    display: none;
}

.slider-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    gap: 12px;
}

.slider-head label {
    font-weight: 600;
    color: var(--gray-800);
}

.slider-value {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 600;
}

.slider-row input[type="range"] {
    width: 100%;
    accent-color: var(--tools-accent);
}

.slider-note {
    margin-top: 6px;
    color: var(--gray-500);
    font-size: 12px;
}

.score-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.risk-pill {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 8px 12px;
}

.results-panel {
    transition: opacity 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.results-panel.is-muted {
    opacity: 0.55;
    transform: translateY(2px);
}

.results-panel.is-active {
    opacity: 1;
    transform: translateY(0);
    box-shadow: var(--shadow-lg);
}

.gauge-wrap {
    display: grid;
    place-items: center;
    margin: 10px 0 18px;
}

.gauge {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(var(--tools-accent) calc(var(--score) * 1%), var(--gray-200) 0);
    transition: background 0.3s ease;
}

.gauge-inner {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: #fff;
    display: grid;
    place-items: center;
    border: 1px solid var(--gray-200);
    text-align: center;
}

.gauge-value {
    font-size: 38px;
    line-height: 1;
    font-weight: 800;
    color: var(--gray-900);
}

.gauge-caption {
    margin-top: 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    font-weight: 700;
}

.breakdown {
    margin: 18px 0;
    display: grid;
    gap: 10px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    border-bottom: 1px dashed var(--gray-200);
    padding-bottom: 8px;
}

.breakdown-item span:first-child {
    color: var(--gray-600);
}

.breakdown-item span:last-child {
    color: var(--gray-800);
    font-weight: 600;
}

.tips {
    margin: 10px 0 0;
    padding-left: 18px;
    color: var(--gray-700);
}

.tips li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.method-grid {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.method-card {
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 20px;
}

.method-card h3 {
    margin: 0 0 8px;
    color: var(--gray-900);
    font-size: 18px;
}

.method-card p,
.method-card li {
    color: var(--gray-600);
    line-height: 1.6;
}

.method-card ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.reference-list {
    margin-top: 8px;
    padding-left: 18px;
}

.reference-list li {
    margin-bottom: 8px;
}

.disclaimer {
    margin-top: 14px;
    font-size: 13px;
    color: var(--gray-500);
}

@media (max-width: 960px) {
    .stepper-panel {
        position: static;
    }

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

    .calculator-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .webapp-main {
        padding-top: 26px;
    }

    .webapp-card {
        padding: 20px;
    }

    .webapp-actions {
        flex-wrap: wrap;
    }

    .archive-hero-inner {
        padding: 44px 20px;
    }

    .tools-container {
        padding-top: 42px;
    }

    .tools-hero {
        padding: 26px;
    }

    .tools-grid--archive {
        grid-template-columns: 1fr;
    }

    .tool-title {
        font-size: 22px;
    }
}
