*, *::before, *::after { box-sizing: border-box; }

html { color-scheme: dark; background: #061015; }
body { min-width: 0; margin: 0; color: var(--pal-text); background: #07161b; }
a { color: inherit; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

.skip-link { position: fixed; z-index: 2000; top: .6rem; left: .6rem; padding: .7rem 1rem; color: #041115; background: var(--pal-cyan); font-weight: 800; transform: translateY(-180%); }
.skip-link:focus { transform: none; }
:focus-visible { outline: 2px solid var(--pal-focus); outline-offset: 3px; }

.item-screen {
  position: relative;
  isolation: isolate;
  min-height: calc(100svh - 96px);
  padding: clamp(1rem, 2.2vw, 2.25rem) clamp(.8rem, 3vw, 3.5rem) clamp(3rem, 6vw, 6rem);
  overflow: hidden;
  background: #07161b url("../../../Image/PalworldUI/pal-status-background.svg") center top / cover fixed no-repeat;
}

.item-screen::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 5.5rem, rgba(143, 185, 193, .022) 5.56rem),
    linear-gradient(90deg, rgba(0, 8, 12, .34), transparent 25% 75%, rgba(0, 8, 12, .38));
  box-shadow: inset 0 0 5rem rgba(0, 0, 0, .55);
  content: "";
}

.item-content { width: min(100%, 1540px); margin-inline: auto; }

.item-profile-nav { min-width: 0; margin-bottom: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: #bed0d3; font-size: .78rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.item-profile-nav div { display: flex; gap: .45rem; }
.item-profile-nav a { min-height: 2.5rem; padding: .62rem .85rem; display: inline-flex; align-items: center; gap: .45rem; border: 1px solid rgba(143, 194, 201, .28); background: rgba(7, 23, 29, .78); text-decoration: none; transition: color 180ms ease, border-color 180ms ease, background 180ms ease; }
.item-profile-nav a:hover { color: #fff; border-color: rgba(77, 225, 236, .7); background: rgba(11, 43, 50, .9); }
.item-profile-nav a:not([href]) { opacity: .35; pointer-events: none; }

.item-hero { min-width: 0; display: grid; grid-template-columns: minmax(15rem, 20rem) minmax(22rem, 1fr) minmax(15rem, 19rem); gap: clamp(.75rem, 1.3vw, 1.25rem); align-items: stretch; }
.panel-cut { position: relative; border: 1px solid rgba(155, 196, 201, .3); background: linear-gradient(145deg, rgba(11, 31, 38, .96), rgba(7, 21, 27, .92)); clip-path: polygon(0 0, calc(100% - 15px) 0, 100% 15px, 100% 100%, 0 100%); box-shadow: inset 0 1px rgba(205, 240, 242, .04), 0 20px 50px rgba(0, 0, 0, .26); }
.panel-cut::before { position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, #57f1fc, rgba(87, 241, 252, .25) 58%, transparent); content: ""; }

.item-identity, .item-summary { min-width: 0; padding: clamp(1rem, 1.7vw, 1.55rem); }
.item-kicker { margin: 0 0 .42rem; color: #64e7ef; font-size: .66rem; font-weight: 850; letter-spacing: .14em; text-transform: uppercase; }
.item-identity h1 { margin: 0; overflow-wrap: anywhere; color: #f5fafa; font-size: clamp(1.55rem, 2.5vw, 2.65rem); line-height: 1.04; }
.item-id { margin: .75rem 0 0; color: #8ba4a9; font-size: .7rem; }
.item-id span { margin-right: .4rem; color: #4dddea; font-weight: 850; letter-spacing: .1em; }
.item-id code { overflow-wrap: anywhere; font-family: ui-monospace, "Cascadia Mono", monospace; }
.item-description { margin: 1.35rem 0; color: #bed0d2; font-size: .88rem; line-height: 1.62; white-space: pre-line; }

.item-primary-facts, .item-stat-list, .item-source { margin: 0; }
.item-primary-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.item-primary-facts div, .item-stat-list div { min-width: 0; border: 1px solid rgba(125, 177, 183, .2); background: rgba(2, 13, 17, .45); }
.item-primary-facts div { padding: .6rem .65rem; }
.item-primary-facts dt, .item-stat-list dt, .item-source dt { color: #78979c; font-size: .61rem; font-weight: 730; letter-spacing: .06em; text-transform: uppercase; }
.item-primary-facts dd { margin: .14rem 0 0; overflow-wrap: anywhere; color: #f1f7f8; font-size: .85rem; font-weight: 790; }

.item-model-stage { position: relative; isolation: isolate; min-width: 0; min-height: 34rem; overflow: hidden; border: 1px solid rgba(155, 196, 201, .25); background: radial-gradient(circle at 50% 58%, rgba(0, 211, 226, .13), transparent 35%), linear-gradient(145deg, rgba(6, 24, 30, .64), rgba(2, 12, 16, .48)); }
.item-model-stage::before { position: absolute; z-index: 0; inset: 8% 16%; border: 1px solid rgba(65, 212, 225, .12); border-radius: 50%; box-shadow: inset 0 0 3rem rgba(0, 222, 238, .06), 0 0 5rem rgba(0, 222, 238, .04); content: ""; }
.stage-heading { position: absolute; z-index: 8; top: 1.1rem; left: 1.2rem; }
.stage-heading h2 { margin: 0; color: #dce9ea; font-size: .9rem; font-weight: 650; }
.stage-polygons { position: absolute; z-index: 0; inset: 0; opacity: .25; background: linear-gradient(125deg, transparent 20%, rgba(149, 190, 194, .1) 20.1% 37%, transparent 37.1% 70%, rgba(149, 190, 194, .07) 70.1%); }
.stage-lines { position: absolute; z-index: 1; inset: auto 5% 0; height: 35%; opacity: .15; background: url("../../../Image/PalworldUI/T_prt_menu_bg_prt.png") center bottom / contain no-repeat; pointer-events: none; }
#itemModel,
#structureModel { position: absolute; z-index: 4; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: none; filter: drop-shadow(0 1.6rem 1.6rem rgba(0, 0, 0, .48)); }
#itemModel.is-dragging,
#structureModel.is-dragging { cursor: grabbing; }
.item-model-state { position: absolute; z-index: 5; inset: 4.5rem 1.2rem 1.2rem; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .9rem; text-align: center; }
.item-model-state img { width: min(74%, 25rem); height: min(60%, 22rem); object-fit: contain; filter: drop-shadow(0 1.4rem 1.4rem rgba(0, 0, 0, .52)); }
.item-model-state div { width: min(100%, 30rem); padding: .65rem .8rem; display: grid; gap: .2rem; border: 1px solid rgba(128, 181, 188, .23); background: rgba(3, 17, 21, .76); backdrop-filter: blur(7px); }
.item-model-state strong { color: #e7f3f4; font-size: .75rem; }
.item-model-state span { color: #8eaaae; font-size: .67rem; line-height: 1.45; }
.item-model-state.is-loading img { display: none; }
.item-model-state.is-loading::before { width: 1.7rem; height: 1.7rem; border: 3px solid rgba(82, 223, 235, .2); border-top-color: #55e8f2; border-radius: 50%; animation: item-spin .8s linear infinite; content: ""; }
.item-model-state.is-error strong { color: #ffd7a1; }
@keyframes item-spin { to { transform: rotate(1turn); } }

.item-summary { display: grid; align-content: start; gap: 1.5rem; }
.item-summary h2, .item-detail-panel h2 { margin: 0 0 .7rem; color: #e8f1f2; font-size: .88rem; font-weight: 680; }
.item-stat-list { display: grid; gap: .38rem; }
.item-stat-list div { padding: .56rem .62rem; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .7rem; }
.item-stat-list dd { margin: 0; overflow-wrap: anywhere; color: #edf7f8; font-size: .78rem; font-weight: 780; text-align: right; }

.item-detail-grid { min-width: 0; margin-top: 1rem; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(17rem, .85fr); gap: 1rem; align-items: start; }
.item-detail-panel { min-width: 0; padding: 1rem; }
.item-detail-panel > header { margin-bottom: .8rem; border-bottom: 1px solid rgba(131, 179, 185, .18); }
.item-detail-panel > header h2 { margin-bottom: .75rem; }
.item-source-panel { grid-column: 2; }
.item-empty-copy { margin: .3rem 0; color: #829da1; font-size: .76rem; line-height: 1.5; }

.item-recipe-list { display: grid; gap: .7rem; }
.item-recipe { min-width: 0; padding: .8rem; border: 1px solid rgba(120, 178, 185, .2); background: rgba(2, 13, 17, .42); }
.item-recipe > header { min-width: 0; display: flex; justify-content: space-between; gap: .6rem; color: #b9cdd0; font-size: .7rem; }
.item-recipe > header strong { overflow-wrap: anywhere; color: #f0f7f8; }
.item-recipe-meta { margin: .65rem 0 0; color: #8ba5a9; font-size: .68rem; }
.item-materials { margin: .7rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); gap: .45rem; list-style: none; }
.item-materials li { min-width: 0; padding: .42rem; display: grid; grid-template-columns: 2.2rem minmax(0, 1fr) auto; align-items: center; gap: .5rem; border: 1px solid rgba(128, 179, 185, .15); background: rgba(8, 30, 36, .64); }
.item-materials img { width: 2.2rem; height: 2.2rem; object-fit: contain; }
.item-materials span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #dbe8e9; font-size: .68rem; }
.item-materials b { color: #68e6ed; font-size: .72rem; }

.item-unlock-list { margin: 0; padding: 0; display: grid; gap: .5rem; list-style: none; }
.item-unlock-list li { min-width: 0; padding: .65rem; display: grid; gap: .18rem; border: 1px solid rgba(128, 179, 185, .18); background: rgba(2, 13, 17, .42); }
.item-unlock-list strong { overflow-wrap: anywhere; font-size: .76rem; }
.item-unlock-list span { color: #8fa8ac; font-size: .66rem; }

.item-source { display: grid; gap: .35rem; }
.item-source div { min-width: 0; padding: .52rem 0; border-bottom: 1px solid rgba(129, 179, 185, .15); }
.item-source dd { margin: .18rem 0 0; overflow-wrap: anywhere; color: #d8e6e8; font-size: .7rem; }
.item-source code { font-family: ui-monospace, "Cascadia Mono", monospace; }

.item-loading, .item-error { width: min(100%, 52rem); min-height: 55vh; margin-inline: auto; display: grid; place-content: center; justify-items: center; text-align: center; }
.item-loading span { width: 1.8rem; height: 1.8rem; border: 3px solid rgba(82, 223, 235, .2); border-top-color: #55e8f2; border-radius: 50%; animation: item-spin .8s linear infinite; }
.item-loading p, .item-error > p:not(.item-kicker) { color: #98afb3; }
.item-error h1 { margin: .2rem 0; font-size: clamp(1.8rem, 5vw, 3.5rem); }
.item-action { margin-top: 1rem; padding: .75rem 1rem; border: 1px solid rgba(80, 225, 235, .65); background: rgba(8, 41, 47, .88); font-weight: 780; text-decoration: none; }
.item-detail-page .item-detail-close,
.structure-detail-page .item-detail-close {
  position: fixed;
  z-index: 80;
  right: calc(clamp(1rem, 2vw, 1.8rem) - (100vw - 100%));
}

@media (max-width: 1100px) {
  .item-hero { grid-template-columns: minmax(15rem, .72fr) minmax(20rem, 1.28fr); }
  .item-summary { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .item-model-stage { min-height: 31rem; }
}

@media (max-width: 760px) {
  .item-screen { padding-inline: .7rem; }
  .item-profile-nav { align-items: stretch; flex-direction: column; }
  .item-profile-nav div { display: grid; grid-template-columns: 1fr 1fr; }
  .item-profile-nav a { justify-content: center; }
  .item-hero { display: flex; flex-direction: column; }
  .item-model-stage { min-height: min(118vw, 31rem); order: -1; }
  .item-summary { display: grid; grid-template-columns: 1fr; }
  .item-detail-grid { grid-template-columns: 1fr; }
  .item-source-panel { grid-column: auto; }
}

@media (max-width: 420px) {
  .item-primary-facts { grid-template-columns: 1fr; }
  .item-model-state { inset-inline: .6rem; }
  .item-materials { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
