:root {
    color-scheme: light;
    --bg: #f4f6fb;
    --card: rgba(255, 255, 255, .94);
    --text: #172033;
    --muted: #68738a;
    --line: #dfe5ef;
    --accent: #315efb;
    --accent-dark: #2449ca;
    --success: #16794b;
    --danger: #b42318;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 10%, rgba(49, 94, 251, .12), transparent 35%),
        radial-gradient(circle at 90% 15%, rgba(94, 53, 177, .10), transparent 30%),
        var(--bg);
    color: var(--text);
}

.shell { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 10vh 0 40px; }
.stats-shell { padding-top: 48px; }
.error-shell { max-width: 620px; text-align: center; }
.card {
    background: var(--card);
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 24px;
    box-shadow: 0 22px 70px rgba(28, 39, 71, .12);
    padding: clamp(24px, 6vw, 52px);
    backdrop-filter: blur(14px);
}
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 12px 0 10px; font-size: clamp(34px, 7vw, 58px); line-height: 1.08; letter-spacing: -.04em; }
h2 { margin: 34px 0 12px; font-size: 20px; }
.lead { color: var(--muted); font-size: 17px; line-height: 1.7; margin: 0 0 32px; }
label { display: block; font-weight: 700; margin: 18px 0 8px; }
label span { color: var(--muted); font-weight: 500; font-size: 13px; }
input {
    width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 13px;
    padding: 0 15px; background: #fff; color: var(--text); font: inherit; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(49, 94, 251, .12); }
.custom-row { display: grid; grid-template-columns: auto 1fr; align-items: center; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: #fff; }
.custom-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(49, 94, 251, .12); }
.custom-row input { border: 0; border-radius: 0; box-shadow: none; }
.prefix { color: var(--muted); padding-left: 15px; white-space: nowrap; font-size: 14px; }
button, .button-link {
    min-height: 52px; border: 0; border-radius: 13px; background: var(--accent); color: #fff;
    font: inherit; font-weight: 800; cursor: pointer; padding: 0 22px; text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
}
form > button { width: 100%; margin-top: 24px; }
button:hover, .button-link:hover { background: var(--accent-dark); }
button:disabled { opacity: .65; cursor: wait; }
button.secondary { min-height: 42px; background: #eef2ff; color: var(--accent); }
.message { min-height: 24px; margin-top: 14px; font-size: 14px; }
.message.success { color: var(--success); }
.message.error { color: var(--danger); }
.result { margin-top: 12px; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fbfcff; }
.result-label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.result-line { display: flex; align-items: center; gap: 12px; }
.result-line a { min-width: 0; flex: 1; color: var(--accent); font-size: 18px; font-weight: 800; overflow-wrap: anywhere; }
.stats-link, .back { color: var(--muted); display: inline-block; margin-top: 14px; text-decoration: none; }
.back { margin: 0 0 16px; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 22px; }
.primary-link { color: var(--accent); font-size: 20px; font-weight: 800; overflow-wrap: anywhere; }
.original { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 28px; }
.metric { border: 1px solid var(--line); border-radius: 15px; padding: 18px; }
.metric strong { display: block; font-size: 26px; }
.metric span { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
tr:last-child td { border-bottom: 0; }
.source-cell { max-width: 560px; overflow-wrap: anywhere; }
.notice { padding: 14px; border-radius: 12px; background: #f3f5fa; color: var(--muted); }

@media (max-width: 620px) {
    .shell { padding-top: 28px; }
    .card { border-radius: 19px; }
    .custom-row { grid-template-columns: 1fr; }
    .prefix { padding: 12px 15px 0; }
    .result-line { align-items: stretch; flex-direction: column; }
    .metric-grid { grid-template-columns: 1fr; }
}
