:root {
    --iv-ink: #342733;
    --iv-muted: #756674;
    --iv-line: rgba(64, 44, 58, 0.14);
    --iv-soft-line: rgba(35, 132, 139, 0.17);
    --iv-teal: #188b91;
    --iv-teal-dark: #0d686d;
    --iv-teal-soft: #e6f7f5;
    --iv-coral: #e85f7c;
    --iv-coral-dark: #b83958;
    --iv-amber: #c9801a;
    --iv-red: #b9384f;
    --iv-paper: rgba(255, 255, 255, 0.88);
    --iv-paper-solid: #fffefe;
    --iv-grid: rgba(24, 139, 145, 0.055);
    --iv-shadow: 0 28px 80px rgba(69, 43, 59, 0.13);
    --iv-radius: 24px;
}

.iv-page .page-bg {
    background:
        radial-gradient(circle at 8% 8%, rgba(239, 190, 210, 0.75), transparent 25%),
        radial-gradient(circle at 88% 2%, rgba(152, 227, 218, 0.38), transparent 24%),
        radial-gradient(circle at 74% 72%, rgba(255, 220, 141, 0.24), transparent 28%),
        linear-gradient(145deg, #fff7fa 0%, #fbfffe 49%, #fff8f4 100%);
}

.iv-page .page-bg::after {
    background:
        linear-gradient(var(--iv-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--iv-grid) 1px, transparent 1px);
    background-size: 34px 34px;
    opacity: 0.72;
}

.iv-page main {
    min-width: 0;
}

.iv-page [hidden] {
    display: none !important;
}

.iv-page .breadcrumbs {
    padding-top: 0.1rem;
    padding-bottom: 0.35rem;
}

.iv-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(290px, 380px);
    align-items: center;
    gap: clamp(1.4rem, 4vw, 4rem);
    padding-top: 0.45rem !important;
    padding-bottom: 1.15rem !important;
}

.iv-kicker,
.iv-step,
.iv-state-code,
.iv-subcode,
.iv-result-code,
.iv-calibration-label {
    display: block;
    color: var(--iv-teal-dark);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    line-height: 1.35;
    text-transform: uppercase;
}

.iv-hero h1 {
    max-width: 760px;
    margin: 0.28rem 0 0.6rem;
    font-size: clamp(2.2rem, 5.2vw, 4.65rem) !important;
    line-height: 0.98 !important;
    letter-spacing: -0.065em !important;
}

.iv-hero .lead {
    max-width: 780px;
    margin: 0;
    color: var(--iv-muted);
    font-size: clamp(0.96rem, 1.55vw, 1.12rem);
    line-height: 1.68;
}

.iv-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem;
    margin-top: 1rem;
}

.iv-primary,
.iv-secondary,
.iv-quiet,
.iv-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.68rem 1rem;
    border: 1px solid transparent;
    border-radius: 13px;
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 900;
    line-height: 1.1;
    text-align: center;
    text-decoration: none !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.iv-primary {
    border-color: var(--iv-teal-dark);
    background: linear-gradient(145deg, var(--iv-teal), var(--iv-teal-dark));
    color: #fff !important;
    box-shadow: 0 12px 26px rgba(24, 139, 145, 0.22);
}

.iv-secondary {
    border-color: rgba(24, 139, 145, 0.22);
    background: #f5fffd;
    color: var(--iv-teal-dark);
}

.iv-quiet {
    border-color: var(--iv-line);
    background: rgba(255, 255, 255, 0.75);
    color: var(--iv-muted);
}

.iv-danger {
    border-color: var(--iv-red);
    background: var(--iv-red);
    color: #fff;
}

.iv-primary:hover,
.iv-secondary:hover,
.iv-quiet:hover,
.iv-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(70, 43, 58, 0.14);
}

.iv-primary:focus-visible,
.iv-secondary:focus-visible,
.iv-quiet:focus-visible,
.iv-danger:focus-visible,
.iv-page input:focus-visible,
.iv-page select:focus-visible,
.iv-remove-observation:focus-visible,
.iv-switch input:focus-visible + span {
    outline: 3px solid rgba(24, 139, 145, 0.22);
    outline-offset: 2px;
}

.iv-primary-compact {
    min-height: 36px;
    padding: 0.5rem 0.72rem;
    font-size: 0.72rem;
}

.iv-primary:disabled,
.iv-secondary:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
    box-shadow: none;
}

.iv-text-link {
    color: var(--iv-coral-dark) !important;
    font-size: 0.84rem;
    font-weight: 900;
    text-decoration: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 4px;
}

.iv-calibration-card {
    position: relative;
    overflow: hidden;
    padding: 1.1rem 1.15rem 1rem;
    border: 1px solid rgba(24, 139, 145, 0.2);
    border-radius: 22px;
    background:
        linear-gradient(135deg, rgba(242, 255, 252, 0.95), rgba(255, 253, 250, 0.9)),
        repeating-linear-gradient(90deg, transparent 0 19px, rgba(24, 139, 145, 0.06) 19px 20px);
    box-shadow: 0 22px 55px rgba(49, 95, 96, 0.12);
}

.iv-calibration-card::before,
.iv-calibration-card::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(24, 139, 145, 0.15);
    border-radius: 50%;
    pointer-events: none;
}

.iv-calibration-card::before {
    top: -58px;
    right: -42px;
    width: 150px;
    height: 150px;
}

.iv-calibration-card::after {
    top: -34px;
    right: -18px;
    width: 100px;
    height: 100px;
}

.iv-calibration-card > div:not(.iv-calibration-line) {
    position: relative;
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.68rem 0;
    border-bottom: 1px dashed rgba(24, 139, 145, 0.17);
}

.iv-calibration-card > div strong {
    color: var(--iv-ink);
    font-size: 0.82rem;
}

.iv-calibration-card > div span {
    color: var(--iv-muted);
    font-size: 0.76rem;
    line-height: 1.45;
}

.iv-calibration-line {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    align-items: end;
    gap: 5px;
    height: 28px;
    padding-top: 0.65rem;
}

.iv-calibration-line i {
    display: block;
    height: 8px;
    border-radius: 4px 4px 0 0;
    background: var(--iv-teal);
    opacity: 0.24;
}

.iv-calibration-line i:nth-child(2),
.iv-calibration-line i:nth-child(6) { height: 15px; opacity: 0.42; }
.iv-calibration-line i:nth-child(3),
.iv-calibration-line i:nth-child(7) { height: 23px; opacity: 0.68; }
.iv-calibration-line i:nth-child(4),
.iv-calibration-line i:nth-child(8) { height: 28px; opacity: 0.9; }

.iv-workbench {
    min-width: 0;
    padding-bottom: 2rem !important;
}

.iv-state-card,
.iv-panel {
    min-width: 0;
    border: 1px solid rgba(61, 45, 56, 0.13);
    border-radius: var(--iv-radius);
    background: var(--iv-paper);
    box-shadow: var(--iv-shadow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.iv-state-card {
    display: grid;
    justify-items: center;
    padding: 3.5rem 1rem;
    text-align: center;
}

.iv-state-card h2 {
    margin: 0.75rem 0 0.2rem;
    color: var(--iv-ink);
    font-size: 1.35rem;
}

.iv-state-card p {
    max-width: 620px;
    margin: 0;
    color: var(--iv-muted);
}

.iv-state-card .iv-primary {
    margin-top: 1rem;
}

.iv-error {
    border-color: rgba(185, 56, 79, 0.24);
    background: rgba(255, 246, 247, 0.94);
}

.iv-loader {
    width: 42px;
    height: 42px;
    border: 4px solid rgba(24, 139, 145, 0.14);
    border-top-color: var(--iv-teal);
    border-radius: 50%;
    animation: iv-spin 0.8s linear infinite;
}

@keyframes iv-spin {
    to { transform: rotate(360deg); }
}

#ivApp {
    display: grid;
    gap: 1rem;
}

.iv-panel {
    padding: 1rem;
}

.iv-section-heading,
.iv-subpanel-heading,
.iv-observation-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.iv-section-heading h2,
.iv-subpanel-heading h3,
.iv-observation-card-head strong {
    margin: 0.1rem 0 0;
    color: var(--iv-ink);
}

.iv-section-heading h2 {
    font-size: clamp(1.18rem, 2.4vw, 1.5rem);
    line-height: 1.16;
}

.iv-section-heading p,
.iv-subpanel-heading p {
    max-width: 720px;
    margin: 0.18rem 0 0;
    color: var(--iv-muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.iv-heading-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.45rem;
}

.iv-local-badge {
    flex: 0 0 auto;
    padding: 0.38rem 0.66rem;
    border: 1px solid rgba(24, 139, 145, 0.2);
    border-radius: 999px;
    background: var(--iv-teal-soft);
    color: var(--iv-teal-dark);
    font-size: 0.7rem;
    font-weight: 900;
    white-space: nowrap;
}

.iv-setup-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1.45fr) repeat(3, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.9rem;
}

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

.iv-pokemon-field {
    grid-row: span 1;
}

.iv-field > label:not(.iv-switch),
.iv-effort-grid label,
.iv-judge-grid label,
.iv-observation-grid label {
    display: grid;
    gap: 0.28rem;
    min-width: 0;
    color: var(--iv-muted);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.iv-field small {
    display: block;
    margin-top: 0.28rem;
    color: var(--iv-muted);
    font-size: 0.68rem;
    line-height: 1.38;
}

.iv-page input,
.iv-page select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 43px;
    padding: 0.58rem 0.68rem;
    border: 1px solid rgba(68, 50, 62, 0.18);
    border-radius: 11px;
    background: var(--iv-paper-solid);
    color: var(--iv-ink);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: normal;
    text-transform: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.iv-page input:hover,
.iv-page select:hover {
    border-color: rgba(24, 139, 145, 0.4);
}

.iv-page input[aria-invalid="true"],
.iv-page select[aria-invalid="true"] {
    border-color: var(--iv-red);
    box-shadow: 0 0 0 3px rgba(185, 56, 79, 0.13);
}

.iv-field .iv-field-error {
    color: var(--iv-red);
    font-weight: 800;
}

.iv-judge-toggle-field {
    display: grid;
    align-content: start;
    padding-top: 1.15rem;
}

.iv-switch {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    cursor: pointer;
    color: var(--iv-ink);
    font-size: 0.78rem;
}

.iv-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.iv-switch span {
    position: relative;
    display: block;
    pointer-events: none;
    width: 40px;
    height: 23px;
    border: 1px solid rgba(72, 52, 65, 0.2);
    border-radius: 999px;
    background: #e8e1e5;
    transition: background 0.18s ease;
}

.iv-switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(52, 39, 51, 0.25);
    transition: transform 0.18s ease;
}

.iv-switch input:checked + span {
    background: var(--iv-teal);
}

.iv-switch input:checked + span::after {
    transform: translateX(17px);
}

.iv-pokemon-preview {
    display: grid;
    grid-template-columns: 100px minmax(190px, 0.8fr) minmax(420px, 1.5fr);
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    margin-top: 0.9rem;
    padding: 0.72rem;
    border: 1px solid var(--iv-soft-line);
    border-radius: 17px;
    background:
        linear-gradient(120deg, rgba(235, 250, 248, 0.8), rgba(255, 255, 255, 0.72)),
        repeating-linear-gradient(90deg, transparent 0 29px, rgba(24, 139, 145, 0.04) 29px 30px);
}

.iv-preview-image {
    display: grid;
    width: 88px;
    height: 88px;
    place-items: center;
    border: 1px solid rgba(24, 139, 145, 0.14);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.8);
}

.iv-preview-image img {
    width: 82px;
    height: 82px;
    object-fit: contain;
}

.iv-preview-identity {
    min-width: 0;
}

.iv-preview-number {
    color: var(--iv-teal-dark);
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.iv-preview-identity > strong {
    display: block;
    overflow: hidden;
    margin-top: 0.05rem;
    color: var(--iv-ink);
    font-size: 1.15rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.iv-preview-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.35rem;
}

.iv-preview-types span {
    padding: 0.16rem 0.48rem;
    border: 1px solid rgba(24, 139, 145, 0.16);
    border-radius: 999px;
    background: #fff;
    color: var(--iv-muted);
    font-size: 0.66rem;
    font-weight: 900;
    text-transform: capitalize;
}

.iv-preview-warning {
    margin: 0.35rem 0 0;
    color: var(--iv-red);
    font-size: 0.72rem;
    font-weight: 800;
}

.iv-preview-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(54px, 1fr));
    gap: 0.38rem;
    min-width: 0;
}

.iv-preview-stats > div {
    display: grid;
    justify-items: center;
    padding: 0.42rem 0.25rem;
    border-left: 1px solid rgba(24, 139, 145, 0.11);
}

.iv-preview-stats span {
    color: var(--iv-muted);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.iv-preview-stats strong {
    color: var(--iv-ink);
    font-size: 0.96rem;
}

.iv-preview-empty {
    grid-column: 1 / -1;
    display: grid;
    gap: 0.1rem;
    padding: 0.5rem;
}

.iv-preview-empty strong { color: var(--iv-red); }
.iv-preview-empty span { color: var(--iv-muted); font-size: 0.78rem; }

.iv-subpanel {
    margin-top: 0.85rem;
    padding: 0.78rem;
    border: 1px solid rgba(65, 47, 59, 0.11);
    border-radius: 16px;
    background: rgba(255, 252, 253, 0.76);
}

.iv-subpanel-heading h3 {
    font-size: 0.96rem;
}

.iv-effort-grid,
.iv-judge-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(92px, 1fr));
    gap: 0.55rem;
    margin-top: 0.7rem;
}

.iv-observation-panel {
    position: relative;
    overflow: hidden;
}

.iv-observation-panel::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 11px;
    width: 1px;
    background: repeating-linear-gradient(to bottom, rgba(24, 139, 145, 0.18) 0 4px, transparent 4px 9px);
    pointer-events: none;
}

.iv-observation-heading {
    padding-left: 0.35rem;
}

.iv-observation-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 0.8rem;
    padding-left: 0.35rem;
}

.iv-observation-card {
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid rgba(65, 47, 59, 0.12);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
}

.iv-observation-card-head {
    align-items: center;
    padding-bottom: 0.55rem;
}

.iv-observation-card-head > div {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.iv-observation-index,
.iv-observation-anchor {
    padding: 0.2rem 0.42rem;
    border-radius: 6px;
    background: var(--iv-teal-soft);
    color: var(--iv-teal-dark);
    font-size: 0.62rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

.iv-observation-anchor {
    background: #f4eef1;
    color: var(--iv-muted);
}

.iv-remove-observation {
    padding: 0.2rem 0;
    border: 0;
    background: transparent;
    color: var(--iv-coral-dark);
    cursor: pointer;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 900;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.iv-observation-grid {
    display: grid;
    grid-template-columns: 0.72fr repeat(6, minmax(82px, 1fr));
    gap: 0.48rem;
    min-width: 0;
}

.iv-observation-grid label {
    padding-left: 0.45rem;
    border-left: 2px solid rgba(24, 139, 145, 0.12);
}

.iv-observation-grid .iv-level-input {
    border-left-color: var(--iv-coral);
}

.iv-observation-note {
    margin: 0.55rem 0 0;
    padding: 0.42rem 0.55rem;
    border-radius: 9px;
    background: #f5f1ff;
    color: #655582;
    font-size: 0.7rem;
}

.iv-observation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-left: 0.35rem;
}

.iv-observation-actions .iv-primary {
    margin-left: auto;
}

.iv-results-panel {
    border-color: rgba(24, 139, 145, 0.2);
}

.iv-result-stamp {
    flex: 0 0 auto;
    padding: 0.38rem 0.65rem;
    border: 1px solid rgba(24, 139, 145, 0.24);
    border-radius: 8px;
    background: var(--iv-teal-soft);
    color: var(--iv-teal-dark);
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transform: rotate(-1deg);
}

.iv-result-stamp[data-status="conflict"] {
    border-color: rgba(185, 56, 79, 0.25);
    background: #fff0f2;
    color: var(--iv-red);
}

.iv-result-summary {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.8rem;
    padding: 0.8rem;
    border: 1px solid var(--iv-soft-line);
    border-radius: 16px;
    background: linear-gradient(120deg, rgba(232, 249, 246, 0.78), rgba(255, 255, 255, 0.82));
}

.iv-result-summary h3 {
    margin: 0.14rem 0 0;
    color: var(--iv-ink);
    font-size: 1.05rem;
}

.iv-result-summary p {
    max-width: 760px;
    margin: 0.18rem 0 0;
    color: var(--iv-muted);
    font-size: 0.78rem;
}

.iv-result-meter {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 34px;
}

.iv-result-meter i {
    display: block;
    width: 7px;
    height: 9px;
    border-radius: 3px 3px 0 0;
    background: var(--iv-teal);
    opacity: 0.22;
}

.iv-result-meter i:nth-child(2) { height: 13px; opacity: 0.34; }
.iv-result-meter i:nth-child(3) { height: 17px; opacity: 0.46; }
.iv-result-meter i:nth-child(4) { height: 22px; opacity: 0.58; }
.iv-result-meter i:nth-child(5) { height: 28px; opacity: 0.72; }
.iv-result-meter i:nth-child(6) { height: 34px; opacity: 0.9; }

.iv-conflict-panel {
    margin-top: 0.7rem;
    padding: 0.78rem;
    border: 1px solid rgba(185, 56, 79, 0.22);
    border-radius: 14px;
    background: #fff5f6;
    color: var(--iv-red);
}

.iv-conflict-panel strong {
    display: block;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
}

.iv-conflict-panel ul {
    margin: 0.4rem 0 0;
    padding-left: 1.1rem;
    color: #78434e;
    font-size: 0.78rem;
}

.iv-result-table-wrap {
    overflow-x: auto;
    max-width: 100%;
    margin-top: 0.75rem;
    border: 1px solid rgba(65, 47, 59, 0.12);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.72);
    -webkit-overflow-scrolling: touch;
}

.iv-result-table {
    width: 100%;
    min-width: 780px;
    border-collapse: collapse;
    color: var(--iv-ink);
    font-size: 0.76rem;
}

.iv-result-table th,
.iv-result-table td {
    padding: 0.65rem 0.7rem;
    border-bottom: 1px solid rgba(65, 47, 59, 0.09);
    text-align: left;
    vertical-align: middle;
}

.iv-result-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f3fbf9;
    color: var(--iv-muted);
    font-size: 0.64rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.iv-result-table tbody th {
    min-width: 110px;
    background: #fffafb;
    font-weight: 900;
}

.iv-result-table tbody tr:last-child th,
.iv-result-table tbody tr:last-child td {
    border-bottom: 0;
}

.iv-count-chip,
.iv-evidence-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0.18rem 0.45rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 900;
}

.iv-count-chip {
    min-width: 24px;
    justify-content: center;
    background: var(--iv-teal);
    color: #fff;
}

.iv-evidence-chip {
    margin: 0.12rem 0.18rem 0.12rem 0;
    border: 1px solid rgba(24, 139, 145, 0.14);
    background: #f3fbfa;
    color: var(--iv-teal-dark);
}

.iv-trace-panel {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border: 1px dashed rgba(24, 139, 145, 0.24);
    border-radius: 15px;
    background:
        repeating-linear-gradient(0deg, rgba(24, 139, 145, 0.025) 0 1px, transparent 1px 27px),
        rgba(252, 255, 254, 0.8);
}

.iv-trace-panel ol {
    display: grid;
    gap: 0.35rem;
    margin: 0.55rem 0 0;
    padding-left: 1.2rem;
    color: var(--iv-muted);
    font-size: 0.76rem;
}

.iv-content {
    padding-top: 0.5rem !important;
    padding-bottom: 2.5rem !important;
}

.iv-content-intro {
    max-width: 920px;
    padding: 0 0 0.7rem;
}

.iv-content-intro h2 {
    margin: 0.2rem 0 0.45rem;
    color: var(--iv-ink);
    font-size: clamp(1.45rem, 3.2vw, 2.2rem);
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.iv-content-intro p {
    margin: 0;
    color: var(--iv-muted);
}

.iv-content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.iv-content-grid article {
    position: relative;
    overflow: hidden;
    min-width: 0;
    padding: 0.95rem;
    border: 1px solid var(--iv-line);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 14px 36px rgba(70, 43, 58, 0.06);
}

.iv-content-grid article::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 52px;
    height: 3px;
    background: var(--iv-teal);
}

.iv-content-grid article:nth-child(3n + 2)::before { background: var(--iv-coral); }
.iv-content-grid article:nth-child(3n + 3)::before { background: var(--iv-amber); }

.iv-content-grid h2 {
    margin: 0 0 0.38rem;
    color: var(--iv-ink);
    font-size: 1rem;
    line-height: 1.28;
}

.iv-content-grid p {
    margin: 0.45rem 0 0;
    color: var(--iv-muted);
    font-size: 0.8rem;
    line-height: 1.68;
}

.iv-content-grid code {
    padding: 0.1rem 0.28rem;
    border-radius: 5px;
    background: #edf8f6;
    color: var(--iv-teal-dark);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.75em;
}

.iv-faq {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--iv-line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.8);
}

.iv-faq > h2 {
    margin: 0 0 0.65rem;
    color: var(--iv-ink);
    font-size: 1.25rem;
}

.iv-faq details {
    border-top: 1px solid rgba(65, 47, 59, 0.1);
}

.iv-faq details:last-child {
    border-bottom: 1px solid rgba(65, 47, 59, 0.1);
}

.iv-faq summary {
    padding: 0.72rem 0;
    color: var(--iv-ink);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 900;
}

.iv-faq details p {
    margin: -0.2rem 0 0.75rem;
    color: var(--iv-muted);
    font-size: 0.8rem;
}

.iv-related {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    margin-top: 1rem;
}

.iv-related a {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
    padding: 0.8rem;
    border: 1px solid rgba(24, 139, 145, 0.16);
    border-radius: 15px;
    background: rgba(246, 255, 253, 0.82);
    color: var(--iv-ink) !important;
    text-decoration: none !important;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.iv-related a:hover {
    transform: translateY(-2px);
    border-color: rgba(24, 139, 145, 0.38);
    box-shadow: 0 12px 28px rgba(47, 91, 92, 0.09);
}

.iv-related strong {
    font-size: 0.82rem;
}

.iv-related span {
    color: var(--iv-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

.iv-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(39, 28, 35, 0.54);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.iv-dialog-backdrop[hidden] {
    display: none;
}

.iv-dialog {
    width: min(100%, 440px);
    padding: 1rem;
    border: 1px solid rgba(185, 56, 79, 0.2);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 32px 100px rgba(31, 23, 29, 0.3);
}

.iv-dialog h2 {
    margin: 0.2rem 0 0.3rem;
    color: var(--iv-ink);
    font-size: 1.25rem;
}

.iv-dialog p {
    margin: 0;
    color: var(--iv-muted);
    font-size: 0.82rem;
}

.iv-dialog > div:last-child {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.iv-dialog-open {
    overflow: hidden;
}

.iv-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 2200;
    max-width: min(360px, calc(100vw - 2rem));
    padding: 0.7rem 0.9rem;
    border: 1px solid rgba(24, 139, 145, 0.28);
    border-radius: 13px;
    background: #173f42;
    color: #fff;
    box-shadow: 0 18px 44px rgba(31, 52, 54, 0.24);
    font-size: 0.78rem;
    font-weight: 800;
}

.iv-toast[hidden] {
    display: none;
}

@media (max-width: 1020px) {
    .iv-hero {
        grid-template-columns: minmax(0, 1fr) 310px;
        gap: 1.3rem;
    }

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

    .iv-pokemon-field {
        grid-column: span 2;
    }

    .iv-pokemon-preview {
        grid-template-columns: 88px minmax(160px, 0.7fr) minmax(360px, 1.4fr);
    }

    .iv-effort-grid,
    .iv-judge-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .iv-observation-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

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

@media (max-width: 760px) {
    .iv-page .site-header-unified {
        margin-bottom: 0;
        padding-bottom: 0.45rem;
    }

    .iv-page .breadcrumbs {
        padding-top: 0;
    }

    .iv-hero {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding-top: 0.15rem !important;
    }

    .iv-hero h1 {
        max-width: 100%;
        font-size: clamp(2rem, 11vw, 3.15rem) !important;
    }

    .iv-calibration-card {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.45rem;
        padding: 0.75rem;
    }

    .iv-calibration-label,
    .iv-calibration-line {
        grid-column: 1 / -1;
    }

    .iv-calibration-card > div:not(.iv-calibration-line) {
        grid-template-columns: 1fr;
        gap: 0.1rem;
        padding: 0.45rem;
        border: 1px solid rgba(24, 139, 145, 0.13);
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.64);
    }

    .iv-calibration-line {
        height: 18px;
        padding-top: 0;
    }

    .iv-calibration-line i:nth-child(n) {
        max-height: 18px;
    }

    .iv-panel {
        padding: 0.78rem;
        border-radius: 19px;
    }

    .iv-section-heading,
    .iv-subpanel-heading {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.65rem;
    }

    .iv-observation-heading {
        grid-template-columns: 1fr;
    }

    .iv-observation-heading .iv-secondary {
        justify-self: start;
    }

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

    .iv-pokemon-field {
        grid-column: 1 / -1;
    }

    .iv-pokemon-preview {
        grid-template-columns: 78px minmax(0, 1fr);
    }

    .iv-preview-image {
        width: 72px;
        height: 72px;
    }

    .iv-preview-image img {
        width: 68px;
        height: 68px;
    }

    .iv-preview-stats {
        grid-column: 1 / -1;
        grid-template-columns: repeat(6, minmax(44px, 1fr));
        overflow-x: auto;
        max-width: 100%;
    }

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

    .iv-observation-actions .iv-primary {
        margin-left: 0;
    }

    .iv-result-summary {
        align-items: flex-start;
    }

    .iv-content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .iv-page .site-header-unified {
        padding-top: 0.35rem;
        padding-bottom: 0.25rem;
    }

    .iv-page .site-header-unified .site-header-inner {
        flex-wrap: nowrap;
        align-items: center;
        min-height: 54px;
        padding: 0.5rem 0.62rem;
        border-radius: 18px;
    }

    .iv-page .site-header-unified .site-logo {
        width: auto;
        font-size: 0.98rem;
    }

    .iv-page .site-header-unified .site-logo img {
        width: 27px;
        height: 27px;
    }

    .iv-page .site-header-unified .nav-links {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        padding-bottom: 0;
    }

    .iv-page .site-header-unified .nav-links a,
    .iv-page .site-header-unified .nav-group-trigger {
        min-height: 28px;
        padding: 0.25rem 0.45rem;
        font-size: 0.74rem;
    }

    .iv-page .breadcrumbs {
        display: none;
    }

    .iv-page .container {
        padding-left: 14px;
        padding-right: 14px;
    }

    .iv-page .site-header-unified .site-header-inner {
        margin-left: 10px;
        margin-right: 10px;
    }

    .iv-hero {
        padding-bottom: 0.8rem !important;
    }

    .iv-hero .lead {
        font-size: 0.88rem;
        line-height: 1.56;
    }

    .iv-hero-actions {
        margin-top: 0.72rem;
    }

    .iv-hero-actions .iv-primary {
        flex: 1 1 auto;
    }

    .iv-calibration-card {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.34rem;
        padding: 0.55rem;
    }

    .iv-calibration-label,
    .iv-calibration-line {
        grid-column: 1 / -1;
    }

    .iv-calibration-card > div:not(.iv-calibration-line) {
        grid-template-columns: 1fr;
        gap: 0.04rem;
        padding: 0.34rem;
    }

    .iv-calibration-card > div strong {
        font-size: 0.7rem;
    }

    .iv-calibration-card > div span {
        font-size: 0.61rem;
        line-height: 1.28;
    }

    .iv-calibration-line {
        display: none;
    }

    .iv-workbench {
        padding-bottom: 1.35rem !important;
    }

    .iv-section-heading,
    .iv-subpanel-heading {
        grid-template-columns: 1fr;
    }

    .iv-setup-panel > .iv-section-heading {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: start;
    }

    .iv-setup-panel .iv-heading-actions {
        display: flex;
        align-items: center;
    }

    .iv-setup-panel .iv-local-badge {
        display: none;
    }

    .iv-setup-panel .iv-primary-compact {
        max-width: 112px;
        min-height: 34px;
        padding: 0.42rem 0.55rem;
        font-size: 0.64rem;
        line-height: 1.18;
    }

    .iv-heading-actions {
        display: grid;
        justify-items: start;
    }

    .iv-local-badge,
    .iv-result-stamp {
        justify-self: start;
    }

    .iv-setup-grid {
        grid-template-columns: 1fr;
        gap: 0.62rem;
    }

    .iv-pokemon-field {
        grid-column: auto;
    }

    .iv-judge-toggle-field {
        padding-top: 0;
    }

    .iv-pokemon-preview {
        grid-template-columns: 66px minmax(0, 1fr);
        padding: 0.58rem;
    }

    .iv-preview-image {
        width: 60px;
        height: 60px;
        border-radius: 13px;
    }

    .iv-preview-image img {
        width: 58px;
        height: 58px;
    }

    .iv-preview-stats {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        overflow: visible;
    }

    .iv-preview-stats > div:nth-child(4) {
        border-left: 0;
    }

    .iv-effort-grid,
    .iv-judge-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .iv-observation-card-head {
        align-items: flex-start;
    }

    .iv-observation-card-head > div {
        display: grid;
        gap: 0.22rem;
    }

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

    .iv-observation-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .iv-observation-actions button {
        width: 100%;
    }

    .iv-observation-actions .iv-primary,
    .iv-observation-actions .iv-quiet {
        grid-column: 1 / -1;
    }

    .iv-result-summary {
        display: grid;
        grid-template-columns: 1fr;
    }

    .iv-result-meter {
        display: none;
    }

    .iv-result-table {
        min-width: 720px;
    }

    .iv-related {
        grid-template-columns: 1fr;
    }

    .iv-dialog > div:last-child {
        display: grid;
        grid-template-columns: 1fr;
    }

    .iv-toast {
        right: 0.75rem;
        bottom: 0.75rem;
    }
}

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