.py-catch {
    --catch-bg: #17130b;
    --catch-deep: #211a0e;
    --catch-panel: #2b2415;
    --catch-line: #604c22;
    --catch-gold: #f6cf3c;
    --catch-cream: #fff6cf;
    --catch-red: #ce5252;
    --catch-green: #77b769;
    --catch-blue: #6d83df;
    --catch-navy: #2c2d63;
    width: min(1540px, 100%);
    margin: 0 auto;
    padding: 22px;
}

.py-catch [hidden] {
    display: none !important;
}

.py-catch button,
.py-catch input,
.py-catch select {
    font: inherit;
}

.py-catch button:focus-visible,
.py-catch a:focus-visible,
.py-catch input:focus-visible,
.py-catch select:focus-visible {
    outline: 3px solid var(--catch-gold);
    outline-offset: 2px;
}

.py-catch-hero {
    min-height: 242px;
}

.py-catch-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-top: 14px;
}

.py-catch-tabs button {
    display: grid;
    grid-template-columns: 29px minmax(0, 1fr);
    gap: 1px 8px;
    min-height: 61px;
    padding: 9px 10px;
    border: 1px solid var(--catch-line);
    border-radius: 6px;
    background: #211a0e;
    color: #b8a66c;
    text-align: left;
    cursor: pointer;
}

.py-catch-tabs button:hover,
.py-catch-tabs button.is-active {
    border-color: #aa8127;
    background: linear-gradient(90deg, rgba(246, 207, 60, .09), transparent), #292112;
}

.py-catch-tabs button.is-active {
    box-shadow: inset 0 -4px 0 var(--catch-gold);
}

.py-catch-tabs button > span {
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border: 2px solid #17130b;
    border-radius: 50%;
    background: #6b5220;
    color: #fff1b2;
    font-size: 8px;
    font-weight: 950;
}

.py-catch-tabs button.is-active > span {
    background: var(--catch-gold);
    color: #17130b;
}

.py-catch-tabs strong,
.py-catch-tabs small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.py-catch-tabs strong {
    color: #eee0b5;
    font-size: 10px;
}

.py-catch-tabs small {
    color: #887748;
    font-size: 8px;
}

.py-catch-workbench {
    margin-top: 14px;
}

.py-catch-tool-panel {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--catch-line);
    border-radius: 8px;
    background: rgba(43, 36, 21, .97);
    box-shadow: 0 13px 28px rgba(0, 0, 0, .22);
}

.py-catch-tool-panel[data-panel="calculator"] {
    display: grid;
    grid-template-columns: minmax(330px, .72fr) minmax(520px, 1.28fr);
}

.py-catch-form-column,
.py-catch-result-column {
    min-width: 0;
    padding: 16px;
}

.py-catch-form-column {
    border-right: 1px solid var(--catch-line);
    background: #261f11;
}

.py-catch-result-column {
    background: radial-gradient(circle at 100% 0, rgba(246, 207, 60, .09), transparent 34%), #211a0e;
}

.py-catch-section-head,
.py-catch-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.py-catch-section-head {
    min-height: 48px;
    padding-bottom: 11px;
    border-bottom: 1px solid #51401f;
}

.py-catch-section-head > div > span {
    color: var(--catch-gold);
    font-size: 8px;
    font-weight: 950;
    letter-spacing: .12em;
}

.py-catch-section-head h2 {
    margin: 2px 0 0;
    color: var(--catch-cream);
    font-size: 20px;
}

.py-catch-section-head > a,
.py-catch-section-head > p {
    margin: 0;
    color: #cbb36e;
    font-size: 9px;
    font-weight: 800;
}

.py-catch-field {
    display: grid;
    gap: 5px;
    margin-top: 12px;
}

.py-catch-field > span {
    color: #a9955c;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.py-catch-field select,
.py-catch-field input {
    width: 100%;
    min-height: 37px;
    padding: 7px 9px;
    border: 1px solid #735b25;
    border-radius: 4px;
    background: #17130b;
    color: #f4e6b9;
}

.py-catch-field select {
    padding-right: 30px;
}

.py-catch-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 9px;
}

.py-catch-selected-mon,
.py-catch-safari-mon {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 9px;
    min-height: 70px;
    margin-top: 9px;
    padding: 7px;
    border: 1px solid #57431e;
    border-radius: 5px;
    background: #1c160c;
}

.py-catch-selected-mon img,
.py-catch-safari-mon img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    image-rendering: pixelated;
}

.py-catch-selected-mon strong,
.py-catch-selected-mon span,
.py-catch-selected-mon small,
.py-catch-safari-mon strong,
.py-catch-safari-mon span,
.py-catch-safari-mon small {
    display: block;
}

.py-catch-selected-mon strong,
.py-catch-safari-mon strong {
    color: #f0e2b6;
    font-size: 13px;
}

.py-catch-selected-mon span,
.py-catch-safari-mon span {
    margin-top: 2px;
    color: #a18d55;
    font-size: 8px;
}

.py-catch-selected-mon small,
.py-catch-safari-mon small {
    color: var(--catch-gold);
    font-size: 8px;
    font-weight: 900;
    text-align: right;
}

.py-catch-range {
    display: grid;
    gap: 7px;
    margin-top: 13px;
}

.py-catch-range > span {
    display: flex;
    justify-content: space-between;
    color: #a9955c;
    font-size: 8px;
    text-transform: uppercase;
}

.py-catch-range output {
    color: var(--catch-gold);
    font-weight: 900;
}

.py-catch-range input {
    width: 100%;
    accent-color: var(--catch-gold);
}

.py-catch-estimate,
.py-catch-completion-actions button {
    min-height: 33px;
    margin-top: 11px;
    padding: 6px 9px;
    border: 1px solid #715825;
    border-radius: 4px;
    background: #332a18;
    color: #dfce9e;
    font-size: 8px;
    font-weight: 850;
    cursor: pointer;
}

.py-catch-estimate:hover,
.py-catch-completion-actions button:hover {
    border-color: var(--catch-gold);
}

.py-catch-source-note,
.py-catch-mechanic-note {
    color: #8d7b4b;
    font-size: 8px;
    line-height: 1.5;
}

.py-catch-source-note {
    margin: 10px 0 0;
}

.py-catch-result-hero {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    align-items: center;
    gap: 18px;
    min-height: 190px;
    padding: 14px;
    border: 1px solid #654e20;
    border-radius: 7px;
    background: linear-gradient(120deg, rgba(246, 207, 60, .08), transparent), #17130b;
}

.py-catch-probability-ring {
    display: grid;
    place-items: center;
    width: 140px;
    height: 140px;
    border: 12px solid #493918;
    border-top-color: var(--result-color);
    border-right-color: var(--result-color);
    border-radius: 50%;
    background: #211a0e;
    transform: rotate(-45deg);
}

.py-catch-probability-ring > span {
    transform: rotate(45deg);
    text-align: center;
}

.py-catch-probability-ring strong,
.py-catch-probability-ring small {
    display: block;
}

.py-catch-probability-ring strong {
    color: var(--result-color);
    font-size: 27px;
    line-height: 1;
}

.py-catch-probability-ring small {
    margin-top: 4px;
    color: #998750;
    font-size: 7px;
    font-weight: 900;
    text-transform: uppercase;
}

.py-catch-result-copy > span {
    color: var(--catch-gold);
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .09em;
}

.py-catch-result-copy h2 {
    margin: 4px 0 0;
    color: var(--catch-cream);
    font-size: 28px;
}

.py-catch-result-copy p {
    margin: 7px 0 0;
    color: #ad9a60;
    font-size: 9px;
    line-height: 1.5;
}

.py-catch-result-stats,
.py-catch-completion-stats {
    display: grid;
    gap: 7px;
    margin-top: 11px;
}

.py-catch-result-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.py-catch-result-stat,
.py-catch-completion-stat {
    padding: 10px;
    border: 1px solid #51401e;
    border-radius: 5px;
    background: #1b160c;
}

.py-catch-result-stat span,
.py-catch-result-stat strong,
.py-catch-completion-stat span,
.py-catch-completion-stat strong {
    display: block;
}

.py-catch-result-stat span,
.py-catch-completion-stat span {
    color: #8c7a48;
    font-size: 7px;
    font-weight: 850;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.py-catch-result-stat strong,
.py-catch-completion-stat strong {
    margin-top: 3px;
    color: #eee1b6;
    font-size: 14px;
}

.py-catch-formula {
    margin-top: 11px;
    padding: 11px;
    border: 1px solid #51401e;
    border-radius: 5px;
    background: #1b160c;
}

.py-catch-formula h3 {
    margin: 0 0 7px;
    color: #e4d5a8;
    font-size: 11px;
}

.py-catch-formula-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
}

.py-catch-formula-grid div {
    padding: 6px;
    border: 1px solid #403219;
    border-radius: 3px;
    color: #8d7b49;
    font-size: 7px;
}

.py-catch-formula-grid strong {
    display: block;
    margin-top: 2px;
    color: #daca99;
    font-size: 9px;
}

.py-catch-wide-head {
    padding: 15px 16px 11px;
    background: #261f11;
}

.py-catch-encounter-controls,
.py-catch-completion-toolbar {
    display: grid;
    align-items: end;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #51401e;
    background: #211a0e;
}

.py-catch-encounter-controls {
    grid-template-columns: minmax(220px, 1.2fr) minmax(150px, .8fr) 130px minmax(190px, .8fr);
}

.py-catch-encounter-controls .py-catch-field,
.py-catch-completion-toolbar .py-catch-field {
    margin-top: 0;
}

.py-catch-encounter-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    padding: 12px 16px 0;
}

.py-catch-encounter-list {
    display: grid;
    gap: 8px;
    padding: 12px 16px 16px;
}

.py-catch-encounter-row {
    display: grid;
    grid-template-columns: 54px minmax(180px, 1.15fr) repeat(4, minmax(85px, .55fr)) auto;
    align-items: center;
    gap: 9px;
    min-height: 68px;
    padding: 7px 9px;
    border: 1px solid #51401e;
    border-radius: 5px;
    background: #211a0e;
}

.py-catch-encounter-row.is-best {
    border-color: #aa8127;
    box-shadow: inset 4px 0 0 var(--catch-gold);
}

.py-catch-encounter-row img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    image-rendering: pixelated;
}

.py-catch-encounter-place strong,
.py-catch-encounter-place span,
.py-catch-encounter-place small {
    display: block;
}

.py-catch-encounter-place strong {
    color: #eee0b3;
    font-size: 11px;
}

.py-catch-encounter-place span {
    margin-top: 2px;
    color: var(--catch-gold);
    font-size: 8px;
}

.py-catch-encounter-place small {
    margin-top: 2px;
    color: #857342;
    font-size: 7px;
}

.py-catch-encounter-metric span,
.py-catch-encounter-metric strong {
    display: block;
}

.py-catch-encounter-metric span {
    color: #837142;
    font-size: 7px;
    text-transform: uppercase;
}

.py-catch-encounter-metric strong {
    margin-top: 3px;
    color: #dfd0a1;
    font-size: 10px;
}

.py-catch-map-button {
    padding: 6px 8px;
    border: 1px solid #755b22;
    border-radius: 4px;
    background: #17130b;
    color: #e3c970;
    font-size: 8px;
    font-weight: 850;
}

.py-catch-empty {
    padding: 45px 20px;
    color: #968350;
    text-align: center;
}

.py-catch-empty strong,
.py-catch-empty span {
    display: block;
}

.py-catch-empty strong {
    color: var(--catch-cream);
    font-size: 17px;
}

.py-catch-empty span {
    margin-top: 5px;
    font-size: 9px;
}

.py-catch-safari-layout {
    display: grid;
    grid-template-columns: minmax(300px, .72fr) minmax(520px, 1.28fr);
}

.py-catch-safari-inputs,
.py-catch-safari-results {
    min-width: 0;
    padding: 16px;
}

.py-catch-safari-inputs {
    border-right: 1px solid #51401e;
    background: #261f11;
}

.py-catch-safari-results {
    background: #211a0e;
}

.py-catch-strategy-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.py-catch-strategy-card {
    padding: 12px;
    border: 1px solid #57441f;
    border-radius: 6px;
    background: #19140b;
}

.py-catch-strategy-card.is-best {
    border-color: var(--catch-green);
    box-shadow: inset 0 4px 0 var(--catch-green);
}

.py-catch-strategy-card > span {
    color: #97834c;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .08em;
}

.py-catch-strategy-card h3 {
    margin: 5px 0 0;
    color: #eee1b7;
    font-size: 15px;
}

.py-catch-strategy-rate {
    margin-top: 11px;
    color: var(--strategy-color);
    font-size: 25px;
    font-weight: 950;
}

.py-catch-strategy-card p {
    margin: 7px 0 0;
    color: #92804d;
    font-size: 8px;
    line-height: 1.5;
}

.py-catch-safari-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 11px;
}

.py-catch-mechanic-note {
    margin: 0;
    padding: 11px 16px;
    border-top: 1px solid #51401e;
    background: #1b160c;
}

.py-catch-mechanic-note strong {
    color: var(--catch-gold);
}

.py-catch-completion-actions {
    display: flex;
    gap: 6px;
}

.py-catch-completion-actions button {
    margin-top: 0;
}

.py-catch-completion-actions button.is-danger {
    border-color: rgba(206, 82, 82, .55);
    color: #efa39a;
}

.py-catch-completion-stats {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 12px 16px;
    border-bottom: 1px solid #51401e;
}

.py-catch-choice-section {
    padding: 14px 16px;
    border-bottom: 1px solid #51401e;
    background: #241d10;
}

.py-catch-subhead h3 {
    margin: 0;
    color: #eadcb0;
    font-size: 14px;
}

.py-catch-subhead span {
    color: #8c7948;
    font-size: 8px;
}

.py-catch-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 9px;
}

.py-catch-choice-card {
    padding: 10px;
    border: 1px solid #53411e;
    border-radius: 5px;
    background: #19140b;
}

.py-catch-choice-card > strong {
    color: #eee0b4;
    font-size: 10px;
}

.py-catch-choice-card > p {
    margin: 4px 0 8px;
    color: #897747;
    font-size: 8px;
    line-height: 1.4;
}

.py-catch-choice-options {
    display: grid;
    gap: 5px;
}

.py-catch-choice-option {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 38px;
    padding: 4px 6px;
    border: 1px solid #443519;
    border-radius: 4px;
    background: #211a0e;
}

.py-catch-choice-option.is-caught {
    border-color: rgba(119, 183, 105, .52);
}

.py-catch-choice-option img {
    width: 31px;
    height: 31px;
    object-fit: contain;
    image-rendering: pixelated;
}

.py-catch-choice-option span {
    min-width: 0;
    color: #d9ca9d;
    font-size: 8px;
    line-height: 1.35;
}

.py-catch-completion-toolbar {
    grid-template-columns: minmax(240px, 1fr) 190px minmax(180px, .55fr);
}

.py-catch-completion-toolbar .py-ref-search {
    margin: 0;
}

.py-catch-dex-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 16px 16px;
}

.py-catch-dex-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 8px;
    min-width: 0;
    min-height: 89px;
    padding: 8px;
    border: 1px solid #51401e;
    border-radius: 5px;
    background: #211a0e;
}

.py-catch-dex-card.is-caught {
    border-color: rgba(119, 183, 105, .5);
    background: linear-gradient(90deg, rgba(119, 183, 105, .07), transparent), #211a0e;
}

.py-catch-dex-card > img {
    width: 56px;
    height: 56px;
    align-self: center;
    object-fit: contain;
    image-rendering: pixelated;
}

.py-catch-dex-copy {
    min-width: 0;
}

.py-catch-dex-copy > span {
    color: var(--catch-gold);
    font-size: 7px;
    font-weight: 900;
}

.py-catch-dex-copy h3 {
    margin: 2px 0 0;
    overflow: hidden;
    color: #eee0b4;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.py-catch-dex-copy p {
    display: -webkit-box;
    margin: 4px 0 0;
    overflow: hidden;
    color: #8b7948;
    font-size: 8px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.py-catch-dex-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.py-catch-dex-links a {
    color: #d9c06b;
    font-size: 7px;
    font-weight: 800;
}

.py-catch-toggle-caught {
    align-self: start;
    width: 27px;
    height: 27px;
    padding: 0;
    border: 2px solid #6b5423;
    border-radius: 4px;
    background: #17130b;
    color: transparent;
    cursor: pointer;
}

.py-catch-toggle-caught.is-caught {
    border-color: #9bd28e;
    background: var(--catch-green);
    color: #15210f;
    font-weight: 950;
}

@media (max-width: 1120px) {
    .py-catch-tool-panel[data-panel="calculator"],
    .py-catch-safari-layout {
        grid-template-columns: 1fr;
    }

    .py-catch-form-column,
    .py-catch-safari-inputs {
        border-right: 0;
        border-bottom: 1px solid var(--catch-line);
    }

    .py-catch-encounter-row {
        grid-template-columns: 50px minmax(180px, 1fr) repeat(2, minmax(80px, .55fr)) auto;
    }

    .py-catch-encounter-row .py-catch-encounter-metric:nth-of-type(3),
    .py-catch-encounter-row .py-catch-encounter-metric:nth-of-type(4) {
        display: none;
    }

    .py-catch-dex-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .py-catch {
        padding: 13px;
    }

    .py-catch-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .py-catch-result-hero {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .py-catch-result-stats,
    .py-catch-encounter-summary,
    .py-catch-safari-stats,
    .py-catch-completion-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .py-catch-encounter-controls,
    .py-catch-completion-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .py-catch-encounter-controls .py-ref-toggle,
    .py-catch-completion-toolbar .py-ref-toggle,
    .py-catch-completion-toolbar .py-ref-search {
        grid-column: 1 / -1;
    }

    .py-catch-choice-grid,
    .py-catch-strategy-grid {
        grid-template-columns: 1fr;
    }

    .py-catch-encounter-row {
        grid-template-columns: 50px minmax(0, 1fr) auto;
    }

    .py-catch-encounter-metric {
        display: none;
    }
}

@media (max-width: 520px) {
    .py-catch {
        padding: 8px;
    }

    .py-catch-tabs,
    .py-catch-field-grid,
    .py-catch-result-stats,
    .py-catch-formula-grid,
    .py-catch-encounter-controls,
    .py-catch-completion-toolbar,
    .py-catch-dex-list,
    .py-catch-completion-stats {
        grid-template-columns: 1fr;
    }

    .py-catch-completion-toolbar > * {
        grid-column: 1 !important;
    }

    .py-catch-wide-head,
    .py-catch-subhead {
        align-items: flex-start;
        flex-direction: column;
    }
}
