.tgtool {
    --tg-bg: #f6f8fc;
    --tg-card: #ffffff;
    --tg-text: #172033;
    --tg-muted: #667085;
    --tg-border: #e4e8f0;
    --tg-primary: #4f46e5;
    --tg-primary-dark: #3730a3;
    --tg-success: #067647;
    --tg-shadow: 0 16px 45px rgba(16, 24, 40, 0.08);
    color: var(--tg-text);
    font-family: inherit;
    margin: 30px auto;
}

.tgtool * { box-sizing: border-box; }

.tgtool-shell {
    max-width: 1050px;
    margin: 0 auto;
    background: var(--tg-bg);
    border: 1px solid var(--tg-border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--tg-shadow);
}

.tgtool-hero {
    padding: 42px 38px 28px;
    background: linear-gradient(135deg, #111827 0%, #312e81 55%, #4f46e5 100%);
    color: #fff;
}

.tgtool-badge {
    display: inline-block;
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.tgtool-hero h2 {
    color: #fff;
    margin: 16px 0 10px;
    font-size: clamp(30px, 5vw, 48px);
    line-height: 1.05;
}

.tgtool-hero p {
    max-width: 720px;
    margin: 0;
    color: rgba(255,255,255,.84);
    font-size: 17px;
    line-height: 1.65;
}

.tgtool-form {
    padding: 30px 38px;
    background: #fff;
}

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

.tgtool-wide { grid-column: 1 / -1; }

.tgtool-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 750;
}

.tgtool-field input,
.tgtool-field select {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #d5dae5;
    border-radius: 11px;
    background: #fff;
    color: var(--tg-text);
    font: inherit;
    outline: none;
}

.tgtool-field input:focus,
.tgtool-field select:focus {
    border-color: var(--tg-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.tgtool-field small {
    display: block;
    margin-top: 7px;
    color: var(--tg-muted);
    font-size: 12px;
    line-height: 1.45;
}

.tgtool-input-suffix {
    display: flex;
    align-items: center;
    border: 1px solid #d5dae5;
    border-radius: 11px;
    overflow: hidden;
}

.tgtool-input-suffix input {
    border: 0;
    box-shadow: none !important;
}

.tgtool-input-suffix span {
    padding: 0 14px;
    color: var(--tg-muted);
}

.tgtool-range-row {
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 48px;
}

.tgtool-range-row input {
    min-height: auto;
    padding: 0;
    flex: 1;
    accent-color: var(--tg-primary);
}

.tgtool-range-row output {
    min-width: 42px;
    text-align: center;
    padding: 8px 9px;
    border-radius: 8px;
    background: #eef0ff;
    color: var(--tg-primary-dark);
    font-weight: 800;
}

.tgtool-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
}

.tgtool-actions button,
.tgtool-link-grid a {
    border: 0;
    border-radius: 11px;
    padding: 13px 19px;
    font: inherit;
    font-weight: 750;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.tgtool-primary {
    background: var(--tg-primary);
    color: #fff;
}

.tgtool-primary:hover { background: var(--tg-primary-dark); }

.tgtool-secondary {
    background: #eef0f4;
    color: #273044;
}

.tgtool-note,
.tgtool-source {
    color: var(--tg-muted);
    font-size: 12px;
    line-height: 1.55;
    margin: 16px 0 0;
}

.tgtool-results {
    padding: 0 38px 38px;
    background: #fff;
}

.tgtool-score-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 28px;
    border: 1px solid var(--tg-border);
    border-radius: 18px;
    background: linear-gradient(135deg, #f8f9ff, #fff);
}

.tgtool-result-label {
    display: block;
    color: var(--tg-muted);
    font-size: 13px;
    font-weight: 700;
}

.tgtool-score {
    font-size: 64px;
    line-height: 1;
    font-weight: 900;
    color: var(--tg-primary);
    margin-top: 8px;
}

.tgtool-verdict {
    max-width: 300px;
    text-align: right;
    font-size: 20px;
    font-weight: 850;
}

.tgtool-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-top: 14px;
}

.tgtool-metric {
    padding: 17px;
    border: 1px solid var(--tg-border);
    border-radius: 14px;
    background: #fff;
}

.tgtool-metric span {
    display: block;
    color: var(--tg-muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.tgtool-metric strong { font-size: 15px; }

.tgtool-section {
    margin-top: 22px;
    padding: 24px;
    border: 1px solid var(--tg-border);
    border-radius: 18px;
}

.tgtool-section h3 {
    margin: 0 0 10px;
    font-size: 20px;
}

.tgtool-section p {
    line-height: 1.65;
}

.tgtool-section ul {
    margin: 12px 0 0 20px;
}

.tgtool-section li {
    margin: 8px 0;
    line-height: 1.5;
}

.tgtool-ideas {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.tgtool-ideas a {
    display: block;
    padding: 12px 14px;
    border: 1px solid var(--tgtool-border, #e4e8f0);
    border-radius: 10px;
    color: var(--tg-primary-dark);
    text-decoration: none;
    font-weight: 650;
    background: #fafbff;
}

.tgtool-ideas a:hover { text-decoration: underline; }

.tgtool-link-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.tgtool-link-grid a {
    background: #eef0ff;
    color: var(--tg-primary-dark);
    text-align: center;
}

@media (max-width: 760px) {
    .tgtool-hero,
    .tgtool-form,
    .tgtool-results { padding-left: 20px; padding-right: 20px; }

    .tgtool-grid,
    .tgtool-metrics,
    .tgtool-ideas,
    .tgtool-link-grid {
        grid-template-columns: 1fr;
    }

    .tgtool-wide { grid-column: auto; }

    .tgtool-score-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .tgtool-verdict {
        text-align: left;
        max-width: none;
    }

    .tgtool-actions {
        flex-direction: column;
    }

    .tgtool-actions button {
        width: 100%;
    }
}
