:root {
  --color-navy: #f1ebdb;
  --color-cyan: #2ba0e0;
  --color-cyan-bright: #1f8fce;
  --color-ice: #bfe6f5;
  --color-orange: #6cbf3c;
  --color-text: #34302a;
  --color-muted: #6c6350;
  --color-faint: #8a7d63;
  --color-border: rgba(150,125,90,0.3);
  --color-border-2: rgba(150,125,90,0.4);
  --color-border-strong: rgba(108,191,60,0.5);
  --color-danger: #e5484d;

  --t-weapon: #f2683c; --t-armor: #2ba0e0; --t-accessory: #b06be0; --t-material: #d79a54;
  --t-food: #57c948; --t-consume: #35c8b0; --t-ammo: #f4a53c; --t-special: #e05aa0;
  --t-glider: #6fc6e0; --t-capture: #57cfe0;

  --shadow-card: 0 20px 46px rgba(60,78,112,0.13);
  --radius-md: 16px; --radius-xl: 26px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pal-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 16V8a2 2 0 0 0-1-1.7l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.7l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html {
  scrollbar-gutter: stable; min-height: 100%; background: var(--color-navy); color-scheme: light; }
body {
  min-height: 100vh; margin: 0; color: var(--color-text);
  font-family: "Manrope", system-ui, -apple-system, sans-serif; font-size: 15px; line-height: 1.5;
  background:
    radial-gradient(1200px 620px at 50% -8%, rgba(108,191,60,0.13), transparent 62%),
    radial-gradient(900px 520px at 88% 4%, rgba(108,191,60,0.09), transparent 60%),
    radial-gradient(760px 520px at 6% 20%, rgba(43,160,224,0.1), transparent 60%),
    linear-gradient(180deg, #fbf5ea 0%, #f1ebdb 46%, #f1ebdb 100%);
  background-attachment: fixed;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.wrap { position: relative; z-index: 1; width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 72px; }

/* hero */
.hero { max-width: 800px; margin-bottom: 24px; animation: rise 0.5s var(--ease) both; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; padding: 5px 12px 5px 10px;
  border: 1px solid var(--color-border-2); border-radius: 999px; color: var(--color-cyan-bright);
  background: rgba(108,191,60,0.08); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--color-cyan); box-shadow: 0 0 10px rgba(108,191,60,0.8); }
.hero h1 { font-family: "Baloo 2", "Manrope", system-ui, sans-serif;  margin: 0; font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.14; letter-spacing: -0.012em; font-weight: 800; }
.hero h1 .grad { color: transparent; background: linear-gradient(120deg, #2494d6, #5aa62e); -webkit-background-clip: text; background-clip: text; font-weight: 700; }
.tagline { max-width: 640px; margin: 14px 0 0; color: var(--color-muted); font-size: clamp(0.95rem, 2vw, 1.04rem); }

/* toolbar */
.panel { padding: clamp(16px, 2.4vw, 22px); border: 1px solid var(--color-border); border-radius: var(--radius-xl); background: linear-gradient(150deg, rgba(255,254,249,0.98), rgba(247,240,225,0.98)); box-shadow: var(--shadow-card); }
.toolbar-panel { position: relative; z-index: 10; margin-bottom: 20px; animation: rise 0.55s var(--ease) 0.05s both; }
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.field { position: relative; }
.field input { width: 100%; min-height: 50px; padding: 12px 92px 12px 46px; border: 1px solid var(--color-border-2); border-radius: 13px; outline: none; color: var(--color-text); background: rgba(255,255,255,0.72); transition: border-color 160ms, box-shadow 160ms; }
.field input::placeholder { color: rgba(125,115,96,0.6); }
.field input:focus { border-color: var(--color-cyan); background: rgba(255,254,250,0.96); box-shadow: 0 0 0 3px rgba(108,191,60,0.14); }
.field .ico { position: absolute; left: 16px; top: 50%; width: 18px; height: 18px; color: var(--color-muted); transform: translateY(-50%); pointer-events: none; }
.field .count { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--color-faint); font-size: 0.78rem; font-weight: 700; pointer-events: none; }
.select { display: grid; gap: 5px; }
.select > span { color: var(--color-faint); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding-left: 2px; }

/* dropdown */
.dd { position: relative; }
.dd-trigger { width: 100%; min-width: 150px; min-height: 44px; padding: 8px 12px 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--color-border-2); border-radius: 12px; color: var(--color-text); background: rgba(255,255,255,0.72); cursor: pointer; font-weight: 650; transition: border-color 140ms, box-shadow 140ms; }
.dd-trigger:hover { border-color: var(--color-border-strong); }
.dd.open .dd-trigger { border-color: var(--color-cyan); box-shadow: 0 0 0 3px rgba(108,191,60,0.14); }
.dd-caret { width: 15px; height: 15px; color: var(--color-muted); transition: transform 180ms var(--ease); flex: 0 0 auto; }
.dd.open .dd-caret { transform: rotate(180deg); }
.dd-menu { position: absolute; z-index: 90; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--color-border-strong); border-radius: 13px; background: #fbf5ea; box-shadow: 0 22px 55px rgba(60,78,112,0.15); opacity: 0; transform: translateY(-6px); pointer-events: none; transition: opacity 150ms var(--ease), transform 150ms var(--ease); }
.dd.open .dd-menu { opacity: 1; transform: none; pointer-events: auto; }
.dd-menu li { padding: 9px 12px; border-radius: 9px; cursor: pointer; font-weight: 650; font-size: 0.9rem; color: var(--color-text); transition: background 120ms; }
.dd-menu li:hover { background: rgba(108,191,60,0.1); }
.dd-menu li.sel { color: var(--color-cyan-bright); background: rgba(108,191,60,0.12); }

/* type filter chips */
.filter-group { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.filter-label { flex: 0 0 62px; color: var(--color-faint); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tchip { padding: 7px 13px; border: 1px solid var(--color-border); border-radius: 10px; background: rgba(255,255,255,0.5); color: var(--color-muted); cursor: pointer; font-size: 0.82rem; font-weight: 650; transition: 150ms var(--ease); }
.tchip:hover { border-color: var(--color-border-strong); color: var(--color-text); transform: translateY(-1px); }
.tchip.on { color: #f5efe2; border-color: transparent; background: linear-gradient(135deg, var(--color-cyan-bright), var(--color-cyan)); box-shadow: 0 4px 14px rgba(60,78,112,0.1); }
.filter-foot { margin-top: 14px; }
.clear-filters { padding: 7px 14px; border: 1px solid var(--color-border-2); border-radius: 10px; color: var(--color-muted); background: transparent; cursor: pointer; font-size: 0.82rem; }
.clear-filters:hover { color: var(--color-text); border-color: var(--color-border-strong); }

/* item icon frame (rounded square) */
.ic { --s: 60px; position: relative; width: var(--s); height: var(--s); flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 16px; border: 1px solid rgba(150,125,90,0.14); background: radial-gradient(circle at 50% 34%, #fefdf7 0%, #fbf5ea 60%, #f5efe2 100%); box-shadow: inset 0 0 0 1px rgba(60,78,112,0.08); }
.ic img { width: 84%; height: 84%; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(60,78,112,0.12)); }
.ic.failed::before { content: ""; width: 46%; height: 46%; background: var(--color-faint); opacity: 0.5; -webkit-mask: var(--pal-glyph) center / contain no-repeat; mask: var(--pal-glyph) center / contain no-repeat; }

/* type badge */
.type-badge { --c: var(--color-muted); display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); border-radius: 999px; color: color-mix(in srgb, var(--c) 84%, #ffffff); background: color-mix(in srgb, var(--c) 14%, transparent); font-size: 0.7rem; font-weight: 750; white-space: nowrap; }
.type-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 7px color-mix(in srgb, var(--c) 70%, transparent); }
.type-badge[data-type="Weapon"] { --c: var(--t-weapon); }
.type-badge[data-type="Armor"] { --c: var(--t-armor); }
.type-badge[data-type="Accessory"] { --c: var(--t-accessory); }
.type-badge[data-type="Material"] { --c: var(--t-material); }
.type-badge[data-type="Food"] { --c: var(--t-food); }
.type-badge[data-type="Consume"] { --c: var(--t-consume); }
.type-badge[data-type="Ammo"] { --c: var(--t-ammo); }
.type-badge[data-type="SpecialWeapon"] { --c: var(--t-special); }
.type-badge[data-type="Glider"] { --c: var(--t-glider); }
.type-badge[data-type="CaptureItemModifier"] { --c: var(--t-capture); }

/* level badge */
.lv-badge { display: inline-flex; align-items: center; padding: 2px 9px; border: 1px solid rgba(43, 160, 224, 0.55); border-radius: 999px; color: #12678f; background: #e6f2fb; box-shadow: 0 2px 6px rgba(60,78,112,0.16); font-size: 0.68rem; font-weight: 750; white-space: nowrap; }
.item-card .lv-badge { position: absolute; top: 10px; right: 10px; }

/* grid */
.grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.item-card { position: relative; padding: 16px 12px 14px; display: grid; justify-items: center; gap: 9px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: linear-gradient(180deg, rgba(0,0,0,0.035), transparent 60%), rgba(255,255,255,0.55); cursor: pointer; text-align: center; color: var(--color-text); transition: transform 170ms var(--ease), border-color 170ms, background 170ms, box-shadow 170ms; animation: rise 0.35s var(--ease) both; }
.item-card:hover { border-color: var(--color-border-strong); transform: translateY(-3px); background: linear-gradient(180deg, rgba(108,191,60,0.06), transparent 60%), rgba(255,255,255,0.8); box-shadow: 0 16px 34px rgba(60,78,112,0.11); }
.ic-name { font-size: 0.86rem; font-weight: 700; line-height: 1.25; max-width: 100%; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* status */
.status { min-height: 1.4em; margin-top: 18px; color: var(--color-muted); font-size: 0.86rem; text-align: center; }
.status .err { color: var(--color-danger); }
.loading { display: inline-flex; align-items: center; gap: 8px; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(108,191,60,0.16); border-top-color: var(--color-cyan); border-radius: 50%; animation: spin 0.65s linear infinite; }
.foot { margin: 28px 0 0; color: rgba(125,115,96,0.46); font-size: 0.72rem; text-align: center; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 12000; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(60,78,112,0.14); backdrop-filter: blur(6px); animation: fade 0.2s var(--ease); }
.modal-card { position: relative; width: min(680px, 100%); max-height: 88vh; overflow: auto; padding: clamp(18px, 3vw, 30px); border: 1px solid var(--color-border-strong); border-radius: var(--radius-xl); background: linear-gradient(160deg, #fbf6ec, #f7f1e4); box-shadow: 0 40px 90px rgba(60,78,112,0.15); animation: pop 0.22s var(--ease); }
.modal-close { position: sticky; float: right; top: 0; width: 36px; height: 36px; margin: -6px -6px 0 0; border: 1px solid var(--color-border-2); border-radius: 10px; color: var(--color-muted); background: rgba(255,255,255,0.7); cursor: pointer; font-size: 0.9rem; }
.modal-close:hover { color: var(--color-text); border-color: var(--color-border-strong); }
.modal-head { display: flex; align-items: center; gap: 18px; }
.modal-head .ic { --s: 96px; }
.mh-info { min-width: 0; display: grid; gap: 10px; justify-items: start; }
.mh-info h2 { margin: 0; font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 800; letter-spacing: -0.035em; }
.mh-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lore { margin: 18px 0 4px; color: var(--color-muted); font-size: 0.92rem; line-height: 1.6; }
.modal-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.block h3 { margin: 0 0 12px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-cyan); }
.muted { color: var(--color-faint); font-size: 0.85rem; }
.props { display: grid; gap: 7px; }
.prop { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: rgba(255,255,255,0.4); font-size: 0.85rem; }
.prop span { color: var(--color-muted); }
.passives { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.passives li { padding: 9px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: rgba(255,255,255,0.55); font-size: 0.84rem; color: var(--color-text); }
.mats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 0; }
.modal-body > .block { margin-top: 22px; }
.mat { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: 10px; background: rgba(255,255,255,0.4); font-size: 0.84rem; }
.mat span { flex: 1; min-width: 0; }
.mat b { color: var(--color-cyan-bright); }
.mat-ic { width: 26px; height: 26px; flex: 0 0 26px; object-fit: contain; border-radius: 7px; background: rgba(247, 240, 225, 0.7); }
.mat-ic.ph { display: inline-block; }

:focus-visible { outline: 2px solid var(--color-cyan); outline-offset: 3px; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: rgba(108,191,60,0.4) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; background-color: rgba(150,125,90,0.28); }
::-webkit-scrollbar-thumb:hover { background-color: rgba(108,191,60,0.5); }

@media (max-width: 760px) {
  .toolbar { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .modal-cols { grid-template-columns: 1fr; gap: 20px; }
  .filter-label { flex-basis: 100%; margin-bottom: -4px; }
  .filter-group { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.99); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.item-card { content-visibility: auto; contain-intrinsic-size: 170px 210px; }
