@property --tpc-glow-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes tpc-glow-spin { to { --tpc-glow-angle: 360deg; } }
@keyframes tpc-glow-fade { 0% { opacity: 0; } 10% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tpc-intro-pop { 0% { transform: scale(.985); } 100% { transform: scale(1); } }
@keyframes tpc-prefill { 0% { background-color: rgba(127, 211, 239, .45); } 100% { background-color: rgba(255, 255, 255, .1); } }
@keyframes tpc-nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
@keyframes tpc-pulse { 0% { box-shadow: 0 0 0 0 rgba(127, 211, 239, .75); } 70% { box-shadow: 0 0 0 9px rgba(127, 211, 239, 0); } 100% { box-shadow: 0 0 0 0 rgba(127, 211, 239, 0); } }
@keyframes tpc-shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

.tpc2 {
    --tpc-navy: #1d3461;
    --tpc-navy-dark: #1a2f58;
    --tpc-blue: #247ba0;
    --tpc-sky: #7fd3ef;
    --tpc-pink: #ff1861;
    --tpc-radius: 5px;
    --tpc-radius-lg: 10px;
    --tpc-ease: cubic-bezier(.22, 1, .36, 1);
    --tpc-shadow-card: 0 1px 2px rgba(29, 52, 97, .06), 0 2px 8px rgba(29, 52, 97, .05);
    --tpc-shadow-cta: 0 4px 14px rgba(255, 24, 97, .35);
    --tpc-shadow-cta-hover: 0 8px 22px rgba(255, 24, 97, .45);
    --tpc-sticky-top: 16px;

    container-type: inline-size;
    margin: 8px 0 28px;
    font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.4;
    color: var(--tpc-navy);
    -webkit-font-smoothing: antialiased;
}

/* Neutralise common theme styles on elements inside the calculator */
.tpc2 *, .tpc2 *::before, .tpc2 *::after { box-sizing: border-box; }
.tpc2 h2, .tpc2 p, .tpc2 ul, .tpc2 li { margin: 0; padding: 0; }
.tpc2 h2 { font-family: inherit; letter-spacing: normal; text-transform: none; }
.tpc2 ul { list-style: none; }
.tpc2 button, .tpc2 input, .tpc2 select {
    margin: 0;
    min-height: 0;
    font-family: inherit;
    letter-spacing: normal;
    line-height: normal;
    text-transform: none;
    text-shadow: none;
}
.tpc2 [hidden] { display: none !important; }
.tpc2 .hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ── Layout ── */
.tpc2 .tp-calc-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ── Setup card ── */
.tpc2 .tp-setup {
    position: relative;
    z-index: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px 22px 22px;
    border-radius: var(--tpc-radius-lg);
    box-shadow: 0 6px 18px rgba(29, 52, 97, .18);
    color: #fff;
}
.tpc2 .tp-setup::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(180deg, var(--tpc-navy) 0%, var(--tpc-navy-dark) 100%);
}
/* Glow ring shown once on load */
.tpc2 .tp-setup::before {
    content: "";
    position: absolute;
    inset: -4px;
    z-index: -2;
    border-radius: calc(var(--tpc-radius-lg) + 4px);
    background: conic-gradient(from var(--tpc-glow-angle), var(--tpc-pink), #ff7ba8, var(--tpc-blue), var(--tpc-sky), var(--tpc-blue), #ff7ba8, var(--tpc-pink));
    filter: blur(8px);
    opacity: 0;
    pointer-events: none;
}
.tpc2 .tp-setup.tp-intro { animation: tpc-intro-pop .6s var(--tpc-ease) both; }
.tpc2 .tp-setup.tp-intro::before { animation: tpc-glow-spin 4s linear infinite, tpc-glow-fade 9s ease-in-out forwards; }

.tpc2 .tp-setup-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tpc2 .tp-setup-title { margin: 0 0 2px; font-size: 19.2px; font-weight: 700; line-height: 1.3; color: #fff; }
.tpc2 .tp-howto-link { display: inline-flex; align-items: center; gap: 4px; color: rgba(231, 248, 255, .7); font-size: 13px; font-weight: 500; text-decoration: none; box-shadow: none; }
.tpc2 .tp-howto-link:hover { color: #fff; text-decoration: underline; }
.tpc2 .tp-howto-link:focus-visible { outline: 2px solid var(--tpc-sky); outline-offset: 2px; border-radius: 3px; }

.tpc2 .tp-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; align-items: start; }
.tpc2 .tp-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.tpc2 .tp-label { color: rgba(231, 248, 255, .8); font-size: 12px; font-weight: 700; letter-spacing: .06em; line-height: 16px; text-transform: uppercase; }
.tpc2 .tp-hint { color: rgba(231, 248, 255, .6); font-size: 12px; line-height: 1.4; }
.tpc2 .tp-hint a { color: rgba(231, 248, 255, .9); text-decoration: underline; }
.tpc2 .tp-prefill-note { color: var(--tpc-sky); }

/* Inputs and selects */
.tpc2 .tp-control {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: var(--tpc-radius);
    box-shadow: none;
    font-size: 16px;
    transition: border-color .18s, background .18s, box-shadow .18s;
}
.tpc2 select.tp-control {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 32px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11.2px center;
    background-size: 15.2px;
}
.tpc2 select.tp-control option, .tpc2 select.tp-control optgroup { color: var(--tpc-navy); background: #fff; }
.tpc2 .tp-control::placeholder { color: rgba(231, 248, 255, .55); opacity: 1; }
.tpc2 .tp-control:hover { border-color: rgba(255, 255, 255, .45); }
.tpc2 .tp-control:focus { outline: none; border-color: var(--tpc-sky); background-color: rgba(255, 255, 255, .16); box-shadow: 0 0 0 3px rgba(127, 211, 239, .3); }
.tpc2 .tp-control[aria-invalid="true"] { border-color: #ff5c8a; background-color: rgba(255, 24, 97, .16); box-shadow: 0 0 0 3px rgba(255, 92, 138, .3); }
.tpc2 input.tp-control { -moz-appearance: textfield; }
.tpc2 input.tp-control::-webkit-outer-spin-button, .tpc2 input.tp-control::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tpc2 .tp-control.tp-prefilled, .tpc2 .tp-joined.tp-prefilled { animation: tpc-prefill 1.2s ease-out; }

/* Keep typed text white even when the theme styles inputs on focus or autofill */
.tpc2 .tp-setup input.tp-control,
.tpc2 .tp-setup input.tp-control:focus,
.tpc2 .tp-setup select.tp-control,
.tpc2 .tp-setup select.tp-control:focus { color: #fff !important; -webkit-text-fill-color: #fff; }
.tpc2 .tp-setup input.tp-control:-webkit-autofill,
.tpc2 .tp-setup input.tp-control:-webkit-autofill:focus { -webkit-text-fill-color: #fff; caret-color: #fff; box-shadow: 0 0 0 1000px #2c4270 inset; transition: background-color 9999s; }

/* Input with a fixed "mm" on the right */
.tpc2 .tp-suffix { position: relative; }
.tpc2 .tp-suffix .tp-control { padding-right: 44px; }
.tpc2 .tp-suffix span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: rgba(231, 248, 255, .65); font-size: 14px; font-weight: 700; pointer-events: none; }

/* Segmented buttons (kg/lbs, Dry/Wet, Hooked/Hookless) */
.tpc2 .tp-seg { display: flex; height: 42px; padding: 3px; gap: 3px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--tpc-radius); }
.tpc2 .tp-seg button { flex: 1; padding: 0 14px; border: 0; border-radius: 3px; background: none; box-shadow: none; color: rgba(231, 248, 255, .85); font-size: 15px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.tpc2 .tp-seg button:hover { color: #fff; background: none; }
.tpc2 .tp-seg button[aria-pressed="true"] { background: #fff; color: var(--tpc-navy); }
.tpc2 .tp-seg button:focus-visible { outline: 2px solid var(--tpc-sky); outline-offset: 1px; }

/* Weight input and kg/lbs joined into one box */
.tpc2 .tp-joined { display: flex; height: 42px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--tpc-radius); transition: border-color .18s, box-shadow .18s, background .18s; }
.tpc2 .tp-joined:hover { border-color: rgba(255, 255, 255, .45); }
.tpc2 .tp-joined:focus-within { border-color: var(--tpc-sky); background-color: rgba(255, 255, 255, .16); box-shadow: 0 0 0 3px rgba(127, 211, 239, .3); }
.tpc2 .tp-joined .tp-control { flex: 1; height: 100%; border: 0; background: transparent; box-shadow: none; border-radius: var(--tpc-radius) 0 0 var(--tpc-radius); }
.tpc2 .tp-joined .tp-control:focus { box-shadow: none; background: transparent; }
.tpc2 .tp-joined .tp-seg { height: 100%; flex: 0 0 auto; border: 0; border-left: 1px solid rgba(255, 255, 255, .2); border-radius: 0 var(--tpc-radius) var(--tpc-radius) 0; background: transparent; }
.tpc2 .tp-joined:has(.tp-control[aria-invalid="true"]) { border-color: #ff5c8a; background-color: rgba(255, 24, 97, .16); box-shadow: 0 0 0 3px rgba(255, 92, 138, .3); }

/* Guide: pulse the next empty required field */
.tpc2 .tp-control.tp-attn { border-color: var(--tpc-sky); animation: tpc-pulse 1.6s ease-out infinite; }
.tpc2 .tp-joined:has(.tp-attn) { border-color: var(--tpc-sky); animation: tpc-pulse 1.6s ease-out infinite; }
.tpc2 .tp-joined .tp-control.tp-attn { animation: none; }

.tpc2 .tp-error {
    position: relative;
    margin: 0;
    padding: 10px 12px 10px 40px;
    border: 1px solid #ffc2d3;
    border-radius: var(--tpc-radius);
    background: #ffe8ef;
    color: var(--tpc-navy);
    font-size: 14px;
    font-weight: 600;
    animation: tpc-shake .4s var(--tpc-ease);
}
.tpc2 .tp-error::before { content: "!"; position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: var(--tpc-pink); color: #fff; font: 700 12px/18px Roboto, sans-serif; text-align: center; }

/* Calculate button, same glow as the /tools/gears/ call-to-action */
.tpc2 .tp-calc {
    position: relative;
    z-index: 0;
    width: 100%;
    height: 50px;
    margin-top: 4px;
    padding: 0 16px;
    border: 0;
    border-radius: var(--tpc-radius);
    background: linear-gradient(135deg, #ff1861 0%, #e01050 100%);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: var(--tpc-shadow-cta);
    transition: box-shadow .18s var(--tpc-ease), filter .18s var(--tpc-ease);
}
.tpc2 .tp-calc::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: linear-gradient(135deg, #ff1861 0%, #e01050 100%); }
.tpc2 .tp-calc::before {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: -2;
    border-radius: calc(var(--tpc-radius) + 2px);
    background: conic-gradient(from var(--tpc-glow-angle), var(--tpc-pink), #ff7ba8, var(--tpc-blue), var(--tpc-sky), var(--tpc-blue), #ff7ba8, var(--tpc-pink));
    filter: blur(3px);
    opacity: 0;
    transition: opacity .25s var(--tpc-ease);
    animation: tpc-glow-spin 4s linear infinite;
}
.tpc2 .tp-calc:hover { box-shadow: var(--tpc-shadow-cta-hover); filter: saturate(1.05); color: #fff; }
.tpc2 .tp-calc:hover::before { opacity: 1; }
.tpc2 .tp-calc:focus-visible { outline: 3px solid var(--tpc-sky); outline-offset: 2px; }
.tpc2 .tp-calc:disabled { opacity: .7; cursor: wait; }

/* ── Result panel ── */
.tpc2 .tp-result { position: sticky; top: var(--tpc-sticky-top); min-height: 300px; padding: 24px; background: #fff; border: 1px solid #eaeff4; border-radius: var(--tpc-radius-lg); box-shadow: var(--tpc-shadow-card); }
.tpc2 .tp-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 250px; padding: 20px; text-align: center; border-radius: var(--tpc-radius); background: linear-gradient(180deg, #f7fbfd 0%, #fff 100%); }
.tpc2 .tp-empty-arrow { display: inline-flex; margin-bottom: 8px; color: var(--tpc-pink); animation: tpc-nudge 1.4s ease-in-out infinite; }
.tpc2 .tp-empty-title { font-size: 18px; font-weight: 700; color: var(--tpc-navy); }
.tpc2 .tp-empty-text { margin: 4px 0 16px; color: #475569; font-size: 15px; }
.tpc2 .tp-ghost { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 320px; }
.tpc2 .tp-ghost div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: var(--tpc-radius); background: #f4f8fb; }
.tpc2 .tp-ghost span { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; }
.tpc2 .tp-ghost b { font-size: 28px; color: #cbd5e1; }

.tpc2 .tp-result-title { margin: 0 0 14px; font-size: 19.2px; font-weight: 700; line-height: 1.3; color: var(--tpc-navy); text-align: center; }
.tpc2 .tp-wheels { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 16px; }
.tpc2 .tp-wheel { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 8px; text-align: center; }
.tpc2 .tp-wheel + .tp-wheel { border-left: 1px solid rgba(29, 52, 97, .12); }
.tpc2 .tp-wheel-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tpc-navy); }
.tpc2 .tp-wheel-psi { font-size: 52px; font-weight: 700; line-height: 1.05; color: var(--tpc-pink); font-variant-numeric: tabular-nums; }
.tpc2 .tp-wheel-psi small { margin-left: .2em; font-size: .35em; color: var(--tpc-navy); }
.tpc2 .tp-wheel-bar { font-size: 16px; font-weight: 600; color: var(--tpc-navy); }
.tpc2 .tp-wheel-range { font-size: 13px; color: #94a3b8; }
.tpc2 .tp-send { margin: 0; padding: 10px 14px; border-radius: var(--tpc-radius); background: #e8f7ee; color: #14532d; font-size: 14px; font-weight: 500; }
.tpc2 .tp-send.is-error { background: #ffe8ef; color: #7a0027; }

.tpc2 .tp-notes { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid #eef2f6; }
.tpc2 .tp-notes li { position: relative; padding-left: 28px; color: var(--tpc-navy); font-size: 14px; line-height: 1.55; }
.tpc2 .tp-notes li::before { content: "i"; position: absolute; left: 0; top: 1px; width: 18px; height: 18px; border-radius: 50%; background: var(--tpc-navy); color: #fff; font: 700 11px/18px Georgia, serif; text-align: center; }
.tpc2 .tp-notes li.warn { color: #7a0027; }
.tpc2 .tp-notes li.warn::before { content: "!"; background: var(--tpc-pink); font-family: Roboto, sans-serif; }
.tpc2 .tp-sidewall { margin-top: 12px; font-size: 13px; font-weight: 700; color: var(--tpc-navy); }
.tpc2 .tp-sidewall strong { color: var(--tpc-navy); }

/* ── Narrow containers ── */
@container (max-width: 820px) {
    .tpc2 .tp-calc-grid { grid-template-columns: minmax(0, 1fr); }
    .tpc2 .tp-result { position: static; min-height: 0; }
    .tpc2 .tp-empty { min-height: 0; }
}
@container (max-width: 480px) {
    .tpc2 .tp-setup, .tpc2 .tp-result { padding: 18px 16px; }
    .tpc2 .tp-row { grid-template-columns: minmax(0, 1fr); }
    .tpc2 .tp-wheel-psi { font-size: 41.6px; }
}

@media (prefers-reduced-motion: reduce) {
    .tpc2 .tp-empty-arrow, .tpc2 .tp-control.tp-attn, .tpc2 .tp-joined:has(.tp-attn) { animation: none; }
    .tpc2 .tp-control.tp-attn, .tpc2 .tp-joined:has(.tp-attn) { box-shadow: 0 0 0 3px rgba(127, 211, 239, .45); }
    .tpc2 .tp-joined .tp-control.tp-attn { box-shadow: none; }
}
