.pd-tool {
    --pd-bg: #f7f4ec;
    --pd-surface: #ffffff;
    --pd-surface-soft: #f1eee6;
    --pd-text: #1f2a28;
    --pd-muted: #64706d;
    --pd-border: #d9ddd8;
    --pd-accent: #1d6a5d;
    --pd-accent-strong: #124d44;
    --pd-accent-soft: #dfeee9;
    --pd-warning: #8a5a12;
    --pd-warning-soft: #fff3d9;
    --pd-danger: #8a2f2f;
    --pd-danger-soft: #fbeaea;
    --pd-radius: 18px;
    --pd-radius-sm: 12px;
    --pd-shadow: 0 18px 50px rgba(28, 45, 41, 0.09);
    --pd-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    --pd-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    color: var(--pd-text);
    font-family: var(--pd-font);
    font-size: 16px;
    line-height: 1.55;
    margin: 32px 0;
}

.pd-tool,
.pd-tool * {
    box-sizing: border-box;
}

.pd-tool p {
    margin: 0;
}

.pd-shell {
    background: var(--pd-bg);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius);
    box-shadow: var(--pd-shadow);
    padding: clamp(20px, 4vw, 38px);
}

.pd-sr-only {
    border: 0;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.pd-heading {
    max-width: 820px;
    margin-bottom: 26px;
}

.pd-kicker {
    color: var(--pd-accent-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.pd-title {
    color: var(--pd-text);
    font-family: var(--pd-font);
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 10px;
}

.pd-intro,
.pd-disclaimer,
.pd-help,
.pd-score-note,
.pd-callout-text {
    color: var(--pd-muted);
}

.pd-layout {
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
}

.pd-panel {
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius-sm);
    padding: 20px;
}

.pd-panel-title {
    color: var(--pd-text);
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 16px;
}

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

.pd-field {
    min-width: 0;
}

.pd-field-wide {
    grid-column: 1 / -1;
}

.pd-field label {
    color: var(--pd-text);
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 7px;
}

.pd-input-wrap {
    align-items: center;
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: 10px;
    display: flex;
    min-height: 48px;
    overflow: hidden;
}

.pd-input-wrap:focus-within,
.pd-tool select:focus-visible,
.pd-details-wrap:focus-visible,
.pd-reset:focus-visible {
    border-color: var(--pd-accent);
    box-shadow: 0 0 0 3px rgba(29, 106, 93, 0.18);
    outline: none;
}

.pd-tool input,
.pd-tool select {
    color: var(--pd-text);
    font: inherit;
    font-size: 16px;
}

.pd-tool input {
    background: transparent;
    border: 0;
    min-width: 0;
    padding: 11px 12px;
    width: 100%;
}

.pd-tool input:focus {
    outline: none;
}

.pd-tool input.pd-is-invalid {
    color: var(--pd-danger);
}

.pd-input-wrap:has(input.pd-is-invalid) {
    background: var(--pd-danger-soft);
    border-color: var(--pd-danger);
}

.pd-tool select {
    appearance: auto;
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: 10px;
    min-height: 48px;
    padding: 10px 12px;
    width: 100%;
}

.pd-prefix,
.pd-suffix {
    color: var(--pd-muted);
    flex: 0 0 auto;
    font-weight: 700;
}

.pd-prefix {
    padding-left: 12px;
}

.pd-suffix {
    padding-right: 12px;
}

.pd-help {
    font-size: 0.76rem;
    margin-top: 6px;
}

.pd-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.pd-reset {
    background: var(--pd-surface);
    border: 1px solid var(--pd-border);
    border-radius: 999px;
    color: var(--pd-accent-strong);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    min-height: 40px;
    padding: 8px 18px;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.pd-reset:hover {
    background: var(--pd-accent-soft);
    border-color: var(--pd-accent);
}

.pd-results {
    display: flex;
    flex-direction: column;
}

.pd-score-card {
    background: var(--pd-surface-soft);
    border-radius: var(--pd-radius-sm);
    padding: 16px;
}

.pd-score-copy {
    align-items: baseline;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.pd-score-label {
    color: var(--pd-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.pd-score-value {
    color: var(--pd-text);
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.pd-badge {
    background: var(--pd-warning-soft);
    border-radius: 999px;
    color: var(--pd-warning);
    display: inline-block;
    font-size: 0.76rem;
    font-weight: 800;
    margin-top: 8px;
    padding: 5px 10px;
}

.pd-meter {
    margin-top: 14px;
}

.pd-meter-track {
    background: #dfe3df;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.pd-meter-fill {
    background: var(--pd-accent);
    border-radius: inherit;
    height: 100%;
    transition: width 220ms ease;
    width: 0;
}

.pd-score-note {
    font-size: 0.79rem;
    margin-top: 10px;
}

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

.pd-stat {
    border: 1px solid var(--pd-border);
    border-radius: 10px;
    padding: 12px;
}

.pd-stat-label {
    color: var(--pd-muted);
    font-size: 0.75rem;
    line-height: 1.3;
}

.pd-stat-value {
    color: var(--pd-text);
    font-size: 1rem;
    font-weight: 800;
    margin-top: 4px;
}

.pd-callout {
    background: var(--pd-accent-soft);
    border-left: 4px solid var(--pd-accent);
    border-radius: 10px;
    margin-top: auto;
    padding: 14px 14px 14px 16px;
}

.pd-callout-title {
    color: var(--pd-accent-strong);
    font-weight: 800;
}

.pd-callout-text {
    font-size: 0.82rem;
    margin-top: 3px;
}

.pd-details-wrap {
    border: 1px solid var(--pd-border);
    border-radius: var(--pd-radius-sm);
    margin-top: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.pd-details {
    background: var(--pd-surface);
    min-width: 690px;
}

.pd-detail-row {
    display: grid;
    gap: 16px;
    grid-template-columns: 1.15fr 1.55fr 1fr;
    padding: 11px 14px;
}

.pd-detail-row + .pd-detail-row {
    border-top: 1px solid var(--pd-border);
}

.pd-detail-row > div:nth-child(2) {
    color: var(--pd-muted);
    font-family: var(--pd-mono);
    font-size: 0.82rem;
}

.pd-detail-row > div:last-child {
    font-weight: 800;
    text-align: right;
}

.pd-detail-head {
    background: var(--pd-surface-soft);
    color: var(--pd-muted);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.pd-disclaimer {
    font-size: 0.78rem;
    margin-top: 14px;
}

@media (max-width: 820px) {
    .pd-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 580px) {
    .pd-tool {
        margin: 24px 0;
    }

    .pd-shell {
        border-radius: 14px;
        padding: 18px;
    }

    .pd-grid,
    .pd-stats {
        grid-template-columns: 1fr;
    }

    .pd-field-wide {
        grid-column: auto;
    }

    .pd-panel {
        padding: 16px;
    }

    .pd-actions {
        justify-content: stretch;
    }

    .pd-reset {
        width: 100%;
    }

    .pd-score-copy {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pd-tool *,
    .pd-tool *::before,
    .pd-tool *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
