.pet-system{--pet-bg:var(--card-bg,var(--bg-card,#fff));--pet-text:var(--text,#192c45);--pet-muted:var(--text-muted,#61718a);--pet-line:var(--border,#dbe3ed);--pet-accent:var(--primary,#6366f1);--pet-on-accent:var(--on-primary,#fff);--pet-soft:var(--bg-2,#f1f5f9);color:var(--pet-text);font-family:inherit;font-size:14px;line-height:1.6}
#portalPetContent{--pet-bg:var(--card);--pet-text:var(--text);--pet-muted:var(--text2);--pet-line:var(--border);--pet-soft:var(--card2);--pet-accent:var(--primary)}
dialog.pet-system{margin:auto;overflow:auto}.pet-system .pet-footer{position:sticky;bottom:-26px;background:var(--pet-bg);padding:14px 0;z-index:1}
.pet-system *{box-sizing:border-box}.pet-system h2,.pet-system h3{margin:0}.pet-system .pet-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px}.pet-system p{color:var(--pet-muted);margin:8px 0 18px}.pet-system .pet-card{border:1px solid var(--pet-line);border-radius:14px;background:var(--pet-bg);padding:22px;margin-bottom:18px}.pet-system .pet-scroll{overflow:auto}.pet-system table{border-collapse:collapse;width:100%;white-space:nowrap}.pet-system th,.pet-system td{padding:14px 12px;border-bottom:1px solid var(--pet-line);text-align:left}.pet-system th{font-weight:500;color:var(--pet-muted)}.pet-system td small{display:block;color:var(--pet-muted);white-space:normal;max-width:340px;min-width:160px}.pet-system button,.pet-system select,.pet-system input{font:inherit}.pet-system button{cursor:pointer;border:1px solid var(--pet-line);background:var(--pet-bg);color:var(--pet-text);border-radius:8px;padding:8px 14px}.pet-system button:hover{border-color:var(--pet-accent)}.pet-system button.primary,.pet-system .pet-tabs button.active{background:var(--pet-accent);border-color:var(--pet-accent);color:var(--pet-on-accent)}.pet-system button:disabled{opacity:.45;cursor:not-allowed}.pet-system .pet-buttons,.pet-system .pet-tabs{display:flex;gap:10px;flex-wrap:wrap}.pet-system .pet-tabs{margin-bottom:20px}.pet-system .pet-badge{display:inline-block;padding:3px 10px;border-radius:20px;background:var(--pet-soft);color:var(--pet-text);font-size:12px}.pet-system .pet-switch{appearance:none;width:42px;height:24px;border:0;border-radius:20px;background:#68768b;cursor:pointer;vertical-align:middle;position:relative;margin:0}.pet-system .pet-switch:before{content:'';position:absolute;width:18px;height:18px;top:3px;left:3px;border-radius:50%;background:white;transition:transform .15s}.pet-system .pet-switch:checked{background:var(--pet-accent)}.pet-system .pet-switch:checked:before{transform:translateX(18px)}.pet-system .pet-switch:focus-visible{outline:3px solid var(--pet-accent);outline-offset:3px}
dialog.pet-system{width:min(920px,94vw);max-height:90vh;border:1px solid var(--pet-line);border-radius:16px;background:var(--pet-bg);padding:26px;color:var(--pet-text)}dialog.pet-system::backdrop{background:rgba(0,0,0,.65)}.pet-system .pet-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.pet-system label{display:flex;flex-direction:column;gap:6px}.pet-system label.inline{flex-direction:row;align-items:center}.pet-system input:not([type=checkbox]),.pet-system select{width:100%;border:1px solid var(--pet-line);border-radius:8px;padding:9px 12px;background:var(--pet-bg);color:var(--pet-text)}.pet-system fieldset{border:1px solid var(--pet-line);border-radius:10px;margin:18px 0;padding:16px}.pet-system fieldset:disabled{opacity:.5}.pet-system .pet-full{grid-column:1/-1}.pet-system .pet-error{color:var(--danger,#e87870);white-space:pre-wrap}.pet-system .pet-footer{display:flex;justify-content:flex-end;gap:10px;margin-top:22px}.pet-system .pet-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:18px;margin:20px 0}.pet-system .pet-stat small{display:block;color:var(--pet-muted)}.pet-system .pet-stat strong{font-size:20px;font-weight:600}.pet-system progress{width:100%;height:12px;accent-color:var(--success,#37af82)}.pet-system .pet-empty{padding:48px;text-align:center;color:var(--pet-muted)}.pet-system .pet-notice{padding:12px 16px;border:1px solid var(--pet-line);border-radius:8px;margin-bottom:16px;color:var(--pet-muted)}.pet-system .pet-weapons{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
@media(max-width:700px){.pet-system .pet-grid,.pet-system .pet-weapons{grid-template-columns:1fr}.pet-system .pet-head{align-items:flex-start}.pet-system .pet-card{padding:16px}dialog.pet-system{padding:18px}}

.pet-system h2,.pet-system h3,.pet-system strong{color:var(--pet-text);-webkit-text-fill-color:currentColor}
.pet-system th{background:var(--pet-soft)}.pet-system button:focus-visible,.pet-system input:focus-visible,.pet-system select:focus-visible{outline:2px solid var(--pet-accent);outline-offset:3px}
#portalPetContent .pet-card{border-radius:var(--radius,14px);box-shadow:0 12px 35px #00000018}
#portalPetContent .pet-head{flex-wrap:wrap}#portalPetContent .pet-head h2{font-size:22px;font-weight:700}#portalPetContent .pet-head p{margin-bottom:0}
#portalPetContent button{background:var(--pet-soft);color:var(--pet-text);-webkit-text-fill-color:currentColor;min-height:38px;transition:background .15s,border-color .15s}
#portalPetContent button:hover:not(:disabled){border-color:var(--pet-accent);color:var(--pet-accent)}
#portalPetContent .pet-badge{border:1px solid var(--pet-line);color:var(--pet-accent)}
#portalPetContent .pet-notice{background:var(--bg2);color:var(--pet-muted)}
#portalPetContent .pet-stat{min-width:0}#portalPetContent .pet-stat strong{overflow-wrap:anywhere;font-size:18px}
#portalPetContent progress{appearance:none;border:0;border-radius:999px;overflow:hidden;background:var(--pet-soft)}
#portalPetContent progress::-webkit-progress-bar{background:var(--pet-soft)}#portalPetContent progress::-webkit-progress-value{background:var(--success);border-radius:999px}#portalPetContent progress::-moz-progress-bar{background:var(--success);border-radius:999px}
@media(max-width:700px){#portalPetContent .pet-buttons button{flex:1 0 auto}#portalPetContent .pet-empty{padding:32px 16px}}

.pet-system .pet-portrait{display:flex;align-items:center;justify-content:center;min-width:0;height:218px;overflow:hidden;border-radius:12px;background:radial-gradient(ellipse at 50% 75%,color-mix(in srgb,var(--pet-accent) 18%,transparent),transparent 66%),var(--pet-soft)}
.pet-system .pet-portrait img{display:block;width:190px;height:196px;object-fit:contain;filter:drop-shadow(0 12px 12px #0004)}
.pet-system .pet-portrait.compact{width:76px;height:82px;flex:0 0 76px;border:1px solid var(--pet-line)}
.pet-system .pet-portrait.compact img{width:70px;height:76px}
.pet-system .pet-identity{display:flex;align-items:center;gap:14px;min-width:215px}.pet-system .pet-identity strong{font-size:15px}.pet-system .pet-identity small{display:block;min-width:0;color:var(--pet-muted)}
.pet-system .pet-art-note{display:block;color:var(--pet-muted);font-size:11px;line-height:1.5;margin:12px 0 0}
.pet-system .pet-collection{display:grid;grid-template-columns:repeat(auto-fill,minmax(285px,1fr));gap:20px}
.pet-system .pet-warehouse-card{padding:0;overflow:hidden;margin:0}.pet-system .pet-warehouse-card>.pet-portrait{border-radius:0;border-bottom:1px solid var(--pet-line)}
.pet-system .pet-warehouse-body{padding:20px}.pet-system .pet-warehouse-body .pet-head{margin-bottom:10px}.pet-system .pet-warehouse-body h3{font-size:18px}.pet-system .pet-warehouse-body>button{width:100%;font-weight:600}
.pet-system .pet-description{min-height:45px;font-size:13px;line-height:1.7}.pet-system .pet-facts{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:20px 0;padding:16px 0;border-top:1px solid var(--pet-line);border-bottom:1px solid var(--pet-line)}
.pet-system .pet-facts dt{font-size:12px;color:var(--pet-muted)}.pet-system .pet-facts dd{margin:3px 0 0;font-weight:600;font-size:14px;overflow-wrap:anywhere}
.pet-system .pet-active-hero{display:grid;grid-template-columns:210px 1fr;gap:26px;align-items:center;padding-bottom:22px;border-bottom:1px solid var(--pet-line)}.pet-system .pet-active-hero h3{font-size:26px}.pet-system .pet-eyebrow{display:block;color:var(--pet-accent);letter-spacing:1px;margin-bottom:12px}.pet-system .pet-active-hero .pet-head{margin:0}.pet-system .pet-stat{padding:14px;background:var(--pet-soft);border-radius:10px}
#portalPetContent button.primary{background:var(--pet-accent);color:var(--pet-on-accent)}#portalPetContent button.primary:hover:not(:disabled){color:var(--pet-on-accent);filter:brightness(1.08)}
@media(max-width:700px){.pet-system .pet-collection{grid-template-columns:1fr}.pet-system .pet-active-hero{grid-template-columns:1fr;gap:16px}.pet-system .pet-active-hero>.pet-portrait{height:190px}.pet-system .pet-active-hero h3{font-size:22px}.pet-system .pet-warehouse-body{padding:16px}.pet-system .pet-warehouse-card{padding:0}}

html body.player-portal.scene-fx #portalPetContent button{background:var(--pet-soft)!important;color:var(--pet-text)!important;-webkit-text-fill-color:currentColor!important;border-color:var(--pet-line)!important;box-shadow:none!important;background-image:none!important}
html body.player-portal.scene-fx #portalPetContent button.primary{background:var(--pet-accent)!important;color:var(--pet-on-accent)!important}
html:not(.portal-light) #portalPetContent{--pet-on-accent:#141b2f}html.portal-light #portalPetContent{--pet-on-accent:#fffaf0}

/* Compact pet cards and an explicit, single-row authorization duration. */
.pet-system .pet-duration-setting{padding:14px 16px;background:var(--pet-soft);border:1px solid var(--pet-line);border-radius:10px}
.pet-system .pet-duration-row{display:flex;align-items:flex-end;gap:12px;flex-wrap:nowrap}
.pet-system .pet-duration-row>label:first-child{flex:1;min-width:80px;max-width:260px}
.pet-system .pet-duration-row>span{padding-bottom:10px}.pet-system .pet-duration-row>label.inline{white-space:nowrap;align-self:flex-end;min-height:44px;gap:8px}
.pet-system .pet-duration-setting small{display:block;color:var(--pet-muted);margin-top:8px;line-height:1.7}
.pet-system #grant-days:disabled{opacity:1;color:var(--pet-accent);font-weight:600}
.pet-system .pet-collection{grid-template-columns:repeat(auto-fill,minmax(224px,1fr));gap:14px;align-items:stretch}
#portalPetContent .pet-warehouse-card{padding:0;display:flex;flex-direction:column;box-shadow:0 4px 16px #0000000c}
.pet-system .pet-warehouse-card>.pet-portrait{height:132px;flex-shrink:0}.pet-system .pet-warehouse-card>.pet-portrait img{width:125px;height:124px}
.pet-system .pet-warehouse-body{padding:14px;display:flex;flex-direction:column;flex:1;min-width:0}
.pet-system .pet-warehouse-body .pet-head{margin-bottom:8px;gap:6px}.pet-system .pet-warehouse-body h3{font-size:16px}.pet-system .pet-warehouse-body>.pet-badge{align-self:flex-start;font-size:11px;padding:2px 8px}
.pet-system .pet-warehouse-body .pet-description{min-height:0;margin:8px 0 0;font-size:12px}.pet-system .pet-warehouse-body .pet-facts{gap:10px;margin:12px 0;padding:10px 0}.pet-system .pet-warehouse-body .pet-facts dd{font-size:13px}.pet-system .pet-warehouse-body>button,.pet-system .pet-warehouse-body>.pet-notice{margin-top:auto}
.pet-system .pet-warehouse-body .pet-art-note{font-size:10px;margin-top:8px}
@media(max-width:520px){.pet-system .pet-collection{grid-template-columns:1fr}.pet-system .pet-warehouse-card>.pet-portrait{height:118px}.pet-system .pet-warehouse-card>.pet-portrait img{height:112px}.pet-system .pet-duration-row{gap:8px}.pet-system .pet-duration-setting{padding:12px}}

.pet-system .pet-warehouse-body>.pet-notice{font-size:12px;padding:8px 10px;margin-bottom:0}
.pet-system .pet-action-error{margin:0 0 18px;padding:16px;border:1px solid var(--pet-line);border-left:3px solid var(--pet-accent);border-radius:12px;background:var(--pet-soft);color:var(--pet-text);min-width:0;overflow-wrap:anywhere}
.pet-system .pet-action-error p{margin:8px 0;color:var(--pet-muted);line-height:1.7}.pet-system .pet-action-error summary{cursor:pointer;margin-top:10px}.pet-system .pet-action-error pre{margin:10px 0 0;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font:12px/1.8 Consolas,monospace;color:var(--pet-text)}
