
/* Pet growth calculator — legible, responsive controls and result hierarchy. */
body.pet-growth-page {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(160deg, #f5f3ff 0%, #f8fafc 38%, #f0f9ff 100%);
    color: #172033;
    font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.pet-growth-page *,
body.pet-growth-page *::before,
body.pet-growth-page *::after { box-sizing: border-box; }

body.pet-growth-page .pet-growth-shell {
    width: min(1160px, calc(100% - 36px));
    margin: 92px auto 64px;
    min-width: 0;
}
body.pet-growth-page .pet-growth-hero {
    max-width: 740px;
    margin: 0 auto 22px;
    text-align: center;
}
body.pet-growth-page .pet-growth-hero .eyebrow {
    margin: 0 0 7px;
    color: #6d28d9;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .15em;
}
body.pet-growth-page .pet-growth-hero h1 {
    margin: 0;
    color: #312e81 !important;
    -webkit-text-fill-color: #312e81 !important;
    background: none !important;
    text-shadow: none !important;
    letter-spacing: -.05em !important;
    font-size: clamp(1.9rem, 4vw, 2.8rem) !important;
    font-weight: 900 !important;
}
body.pet-growth-page .pet-growth-hero > p:last-child {
    margin: 9px 0 0;
    color: #64748b;
    line-height: 1.55;
    font-size: 14px;
    font-weight: 600;
}
body.pet-growth-page .data-status { margin-bottom: 18px; }

.pet-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    max-width: 590px;
    padding: 5px;
    margin: 0 auto 22px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #e9edf5;
}
body.pet-growth-page .pet-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-width: 0;
    min-height: 46px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #64748b;
    box-shadow: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.3;
    transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
body.pet-growth-page .pet-tab:hover { background: #fff; color: #4338ca; }
body.pet-growth-page .pet-tab.active {
    border-color: #d8b4fe;
    background: #fff;
    color: #5b21b6;
    box-shadow: 0 4px 12px rgba(60, 32, 119, .10);
}
.pet-tab-icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 9px;
    background: #ede9fe;
    font-size: 15px;
    font-weight: 900;
    color: #7c3aed;
}
body.pet-growth-page .pet-tab.active .pet-tab-icon { background: #ddd6fe; }
.pet-panel { display: none; }
.pet-panel.active { display: block; }
.pet-panel[hidden],
.pet-row[hidden],
.rarity-group[hidden],
.table-scroll[hidden],
.roster-empty[hidden],
.result-empty[hidden] { display: none !important; }

.panel-grid {
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
    gap: 16px;
    align-items: start;
}
.optimizer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, .78fr);
    gap: 16px;
    align-items: start;
}
.optimizer-inputs { display: grid; gap: 14px; min-width: 0; }

body.pet-growth-page .pet-card {
    min-width: 0;
    padding: 24px;
    border: 1px solid #e3e3f0;
    border-radius: 19px;
    background: #fff;
    box-shadow: 0 5px 26px rgba(39, 35, 82, .05);
}
.pet-section-head,
.pet-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}
.pet-section-head > div,
.pet-card-head > div { min-width: 0; }
.section-overline {
    display: block;
    margin-bottom: 5px;
    color: #7c3aed;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.4;
    letter-spacing: .10em;
}
body.pet-growth-page .pet-card h2 {
    margin: 0 !important;
    color: #312e81 !important;
    -webkit-text-fill-color: #312e81 !important;
    font-size: 1.13rem !important;
    font-weight: 900 !important;
    text-shadow: none !important;
}
.pet-card h2 small {
    color: #64748b;
    font-size: 11px;
    font-weight: 650;
}
.section-index {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 35px;
    height: 35px;
    border-radius: 12px;
    border: 1px solid #e9d5ff;
    background: #f5f3ff;
    color: #7c3aed;
    font-size: 12px;
    font-weight: 900;
}
.section-intro,
.helper {
    margin: 0 0 16px;
    color: #64748b;
    font-size: 12px;
    font-weight: 550;
    line-height: 1.65;
}
.helper { margin: 8px 0 0; }
.pet-card .helper + .helper { margin-top: 4px; }

.input-grid { display: grid; gap: 12px; }
.input-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.input-grid label,
.single-field,
.priority-level-field,
.mini-label { display: block; min-width: 0; }
.input-grid label > span,
.single-field > span {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}
body.pet-growth-page .pet-growth-shell input:not([type="checkbox"]),
body.pet-growth-page .pet-growth-shell select {
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 10px 11px;
    border: 1px solid #d5dce9 !important;
    border-radius: 11px !important;
    background: #fff !important;
    color: #0f172a;
    box-shadow: none !important;
    font-family:inherit;font-size:16px;font-weight:650;
    line-height: 1.3;
    outline: none;
}
body.pet-growth-page .pet-growth-shell input:focus-visible,
body.pet-growth-page .pet-growth-shell select:focus-visible,
body.pet-growth-page .pet-growth-shell button:focus-visible,
body.pet-growth-page .pet-growth-shell a:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
}
body.pet-growth-page .pet-growth-shell input:not([type="checkbox"]):focus,
body.pet-growth-page .pet-growth-shell select:focus {
    border-color: #8b5cf6 !important;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, .12) !important;
}
body.pet-growth-page .pet-growth-shell input:disabled,
body.pet-growth-page .pet-growth-shell select:disabled {
    opacity: .57;
    background: #f8fafc !important;
}
body.pet-growth-page .pet-growth-shell input[type="checkbox"] {
    accent-color: #7c3aed;
    cursor: pointer;
}
.pet-growth-shell .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Upgrade calculator */
.level-presets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 18px;
}
.level-presets > span {
    margin-right: 2px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
}
body.pet-growth-page .level-preset {
    min-height: 32px;
    padding: 5px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}
body.pet-growth-page .level-preset:hover,
body.pet-growth-page .level-preset.selected {
    border-color: #c4b5fd;
    background: #ede9fe;
    color: #5b21b6;
}
.pet-upgrade-hint {
    margin-top: 16px;
    padding: 10px 13px;
    border: 1px solid #e4e4f2;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    font-size: 12px;
    font-weight: 750;
}
.pet-upgrade-hint.invalid {
    border-color: #fecaca;
    background: #fff7f7;
    color: #b91c1c;
}
.upgrade-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
}
.summary-box {
    min-width: 0;
    padding: 18px 16px;
    border: 1px solid #e0e7ff;
    border-radius: 13px;
    background: #eef2ff;
}
.summary-box:nth-child(2) { border-color: #ddd6fe; background: #f5f3ff; }
.summary-box.warning {
    grid-column: 1 / -1;
    border-color: #fecaca;
    background: #fff7f7;
}
.summary-box span {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 750;
}
.summary-box strong {
    display: inline-block;
    margin-top: 8px;
    color: #312e81;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 950;
    letter-spacing: -.04em;
    line-height: 1.15;
    overflow-wrap: anywhere;
}
.summary-box small { margin-left: 5px; color: #64748b; font-size: 12px; font-weight: 700; }
.summary-box.warning strong { font-size: 14px; color: #b91c1c; }
.table-count {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid #e4e4f2;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}
.table-scroll {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}
.pet-table {
    width: 100%;
    min-width: 360px;
    border-collapse: collapse;
    background: #fff;
}
.pet-table th,
.pet-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf1f7;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
}
.pet-table tr:last-child td { border-bottom: none; }
.pet-table th {
    background: #f5f3ff;
    color: #4338ca;
    font-weight: 850;
}
.pet-table td { color: #334155; font-weight: 650; }
.pet-table tbody tr:nth-child(even) { background: #fafbff; }
.pet-table tbody tr:hover { background: #f0f7ff; }

/* Optimizer inputs */
.single-field { max-width: 360px; }
.priority-list { display: grid; gap: 8px; }
.priority-row {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 100px;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #fff;
}
.priority-row:has(.priority-toggle:checked) { border-color: #c4b5fd; background: #faf8ff; }
.priority-row .priority-toggle { width: 19px; height: 19px; justify-self: center; }
.priority-row .priority-level-field { position: relative; }
.priority-lv-suffix {
    position: absolute;
    right: 31px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 800;
}
body.pet-growth-page .priority-row .priority-min { padding-right: 32px; }
.priority-row.disabled select,
.priority-row.disabled input[type="number"] { opacity: .55; }

body.pet-growth-page .soft-button,
body.pet-growth-page .text-button {
    min-height: 34px;
    padding: 7px 10px;
    border: 1px solid #ddd6fe;
    border-radius: 9px;
    background: #f5f3ff;
    color: #6d28d9;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
}
body.pet-growth-page .soft-button:hover,
body.pet-growth-page .text-button:hover { background: #ede9fe; }
.roster-toolbar {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 16px;
}
.roster-search { position: relative; flex: 1; min-width: 0; }
.roster-search::before {
    content: "⌕";
    position: absolute;
    top: 50%;
    left: 13px;
    transform: translateY(-54%);
    color: #94a3b8;
    font-size: 23px;
    pointer-events: none;
}
body.pet-growth-page .roster-search input[type="search"] { padding-left: 37px; }
.owned-filter {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 5px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #475569;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
    cursor: pointer;
}
.owned-filter input { width: 16px; height: 16px; margin: 0; }
.roster-actions,
.roster-action-buttons {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}
.roster-actions { margin: 12px 0 10px; }
.roster-action-buttons { justify-content: flex-start; gap: 6px; }
.roster-count { color: #64748b; font-size: 12px; font-weight: 750; }
body.pet-growth-page .roster-action-buttons .text-button {
    border: 0;
    padding: 5px 8px;
    background: transparent;
}
.pet-roster { display: grid; gap: 12px; min-width: 0; }
.rarity-group {
    min-width: 0;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    background: #fff;
}
.rarity-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    padding: 12px 14px;
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    font-weight: 900;
}
.rarity-owned-count { font-size: 11px; font-weight: 700; color: #64748b; }
.pet-row {
    display: grid;
    grid-template-columns: 24px minmax(100px, 1fr) minmax(0, 92px) minmax(0, 106px);
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid #eef2f7;
}
.pet-row:has(.pet-unlocked:checked) { background: #fdfcff; }
.pet-row > .pet-unlocked {
    width: 18px;
    height: 18px;
    margin: 0;
    justify-self: center;
    align-self: center;
}
.pet-name {
    min-width: 0;
    overflow-wrap: anywhere;
    color: #334155;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.35;
}
.pet-name small {
    display: block;
    margin-top: 3px;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 550;
}
.mini-field-title {
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
}
body.pet-growth-page .pet-row input[type="number"] {
    min-height: 40px;
    padding: 7px 8px;
    font-size: 14px;
    text-align: center;
}
.roster-empty,
.result-empty {
    margin: 13px 0 0;
    padding: 15px;
    border: 1px dashed #d8d2f1;
    border-radius: 12px;
    background: #fafaff;
    color: #64748b;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

/* Optimizer results */
body.pet-growth-page .optimizer-result {
    position: sticky;
    top: 84px;
    scroll-margin-top: 90px;
}
.result-kicker {
    margin: 0;
    color: #7c3aed;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .10em;
}
.optimizer-total { margin: 7px 0 17px; }
.optimizer-total > strong {
    display: block;
    color: #312e81;
    font-size: clamp(2.7rem, 5vw, 3.5rem);
    font-weight: 950;
    letter-spacing: -.055em;
    line-height: 1;
}
.optimizer-total > span {
    display: block;
    margin-top: 5px;
    color: #64748b;
    font-size: 12px;
    font-weight: 750;
}
.optimizer-gain {
    margin: 12px 0 0;
    padding: 11px 13px;
    border: 1px solid #ddd6fe;
    border-radius: 10px;
    background: #f5f3ff;
    color: #64748b;
    font-size: 12px;
    font-weight: 650;
}
.optimizer-gain b { color: #4338ca; font-weight: 900; }
.optimizer-gain b#gainedLevels { color: #6d28d9; }
.resource-pills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.resource-pills > span {
    min-width: 0;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    font-weight: 750;
}
.resource-pills strong {
    display: block;
    margin-top: 4px;
    color: #312e81;
    font-size: 18px;
    font-weight: 900;
    overflow-wrap: anywhere;
}
.rarity-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}
.rarity-summary > div {
    min-width: 0;
    padding: 11px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
}
.rarity-summary span {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 10px;
    font-weight: 750;
}
.rarity-summary strong {
    display: block;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.rarity-summary > .rarity-placeholder {
    grid-column: 1 / -1;
    color: #64748b;
    font-size: 12px;
    font-weight: 650;
}
body.pet-growth-page .primary-button {
    display: block;
    width: 100%;
    min-height: 48px;
    margin: 18px 0 16px;
    padding: 10px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #6d28d9, #8b5cf6);
    color: #fff;
    font-size: 13px;
    font-weight: 850;
    cursor: pointer;
}
body.pet-growth-page .primary-button:disabled {
    opacity: .46;
    box-shadow: none !important;
    cursor: not-allowed;
}
.pet-result-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 18px 0 10px;
}
.pet-result-table-head h3 {
    margin: 0;
    color: #334155;
    font-size: 13px;
    font-weight: 850;
}
.result-filter { min-height: 34px; padding: 4px 7px; font-size: 11px; }
.table-scroll.detail { max-height: 420px; overflow: auto; }
.table-scroll.detail th { position: sticky; top: 0; z-index: 1; }
.starting-level { color: #94a3b8; }
.increased-level { color: #6d28d9; }

@media (max-width: 970px) {
    .panel-grid, .optimizer-layout { grid-template-columns: minmax(0, 1fr); }
    body.pet-growth-page .optimizer-result { position: static; }
    .input-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    body.pet-growth-page .pet-growth-shell {
        width: calc(100% - 20px);
        margin-top: 75px;
        margin-bottom: 34px;
    }
    body.pet-growth-page .pet-growth-hero { margin-bottom: 16px; }
    body.pet-growth-page .pet-growth-hero > p:last-child { font-size: 12px; }
    .pet-tabs { margin-bottom: 14px; }
    body.pet-growth-page .pet-tab { padding: 7px 8px; gap: 5px; font-size: 12px; }
    .pet-tab-icon { width: 23px; height: 23px; font-size: 12px; }
    body.pet-growth-page .pet-card { padding: 16px; border-radius: 16px; }
    .input-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .input-grid.three label:first-child { grid-column: 1 / -1; }
    .summary-box { padding: 15px 12px; }
    .summary-box strong { font-size: clamp(1.35rem, 6vw, 1.9rem); }
    .priority-row { grid-template-columns: 25px minmax(0, 1fr) 85px; gap: 6px; padding: 7px; }
    .pet-row {
        grid-template-columns: 25px minmax(0, 1fr) minmax(0, 1fr);
        gap: 7px 10px;
        padding: 11px 10px;
    }
    .pet-row > .pet-unlocked { grid-column: 1; grid-row: 1; }
    .pet-row .pet-name { grid-column: 2 / -1; grid-row: 1; }
    .pet-row .mini-label.level { grid-column: 2; grid-row: 2; }
    .pet-row .mini-label.copies { grid-column: 3; grid-row: 2; }
    body.pet-growth-page .pet-row input[type="number"] { min-height: 44px; }
    .rarity-title { padding: 10px 12px; }
    .roster-toolbar { flex-wrap: wrap; }
    .roster-search { flex-basis: 100%; }
    .owned-filter { min-height: 35px; }
    .pet-card-head { align-items: flex-start; }
    .pet-result-table-head { flex-wrap: wrap; }
    .pet-table { min-width: 340px; }
}
@media (max-width: 370px) {
    body.pet-growth-page .pet-card { padding: 12px; }
    .upgrade-summary { gap: 6px; }
    .roster-actions { gap: 6px; }
    .pet-table { min-width: 320px; }
}
@media (prefers-reduced-motion: reduce) {
    body.pet-growth-page .pet-tab,
    body.pet-growth-page .pet-card { transition: none !important; }
}

.result-jump {
    display: none;
    align-items: center;
    min-height: 34px;
    padding: 5px 10px;
    border-radius: 9px;
    background: #ede9fe;
    color: #5b21b6;
    font-size: 11px;
    font-weight: 800;
    text-decoration: none;
}
@media (max-width: 970px) {
    .result-jump { display: inline-flex; }
}

/* This page loads the shared calculator polish later; keep the active tab
   label legible instead of inheriting its dark background + dark text. */
body.calculator-page.pet-growth-page .pet-tabs { background: #e9edf5; }
body.calculator-page.pet-growth-page .pet-tab.active {
    border: 1px solid #d8b4fe;
    background: #fff !important;
    color: #5b21b6 !important;
    box-shadow: 0 4px 12px rgba(60,32,119,.10);
}
/* Prevent mobile Safari from zooming in on tiny roster number fields. */
@media (max-width: 600px) {
    body.pet-growth-page .pet-row input[type="number"] { font-size: 16px; }
}

/* PET PORTRAIT SOURCE 2026-10-09: 28 local artwork files */
body.pet-growth-page .pet-roster .pet-name{
    display:flex;align-items:center;gap:10px;min-width:0;
}
body.pet-growth-page .pet-roster .pet-row-icon{
    box-sizing:border-box;flex:0 0 44px;width:44px;height:44px;
    border:1px solid #e2e8f0;border-radius:11px;
    object-fit:contain;background:#f8f7ff;padding:3px;
}
body.pet-growth-page .pet-roster .pet-name-copy{min-width:0;overflow-wrap:anywhere;line-height:1.35}
@media(max-width:480px){
 body.pet-growth-page .pet-roster .pet-name{gap:6px}
 body.pet-growth-page .pet-roster .pet-row-icon{flex-basis:34px;width:34px;height:34px;border-radius:9px;padding:2px}
}
