/* ClosetTube: one stylesheet for every closet view.
   Light by default (ClosetTube and the profile are white pages); .ct--game is
   the MMO bag's dark panel. The hover card is always the dark MapleStory panel
   in EXPtube's turquoise, like the game's own item card. */

.ct {
  --ct-fg: #0f0f10;
  --ct-dim: #5f6470;
  --ct-line: rgba(0, 0, 0, .1);
  --ct-tile: #f3f4f7;
  --ct-card: #ffffff;
  --ct-accent: #0fb5a6;
  --ct-accent-soft: rgba(15, 181, 166, .12);
  --ct-radius: 12px;
  color: var(--ct-fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-width: 0;
}
.ct [hidden] { display: none !important; }
.ct *, .ct-tip-host *, .ct-sheet * { box-sizing: border-box; }

.ct-loading { display: flex; align-items: center; gap: 10px; padding: 28px 4px; color: var(--ct-dim); font-size: 14px; }
.ct-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ct-line); border-top-color: var(--ct-accent); animation: ct-spin .8s linear infinite; }
@keyframes ct-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ct-spin { animation: none; } }

.ct-h { margin: 0 0 10px; font-size: 15px; font-weight: 800; letter-spacing: .01em; }
.ct-note { margin: 6px 0 14px; color: var(--ct-dim); font-size: 12px; line-height: 1.45; }

/* ---- owner controls ---- */
.ct-ownerbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0 0 14px; padding: 10px 12px;
  border: 1px solid var(--ct-line); border-radius: var(--ct-radius); background: var(--ct-tile); font-size: 13px; }
.ct-toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 600; }
.ct-toggle input { width: 16px; height: 16px; accent-color: var(--ct-accent); }

/* ---- stats ---- */
.ct-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ct-stat { padding: 14px 16px; border: 1px solid var(--ct-line); border-radius: var(--ct-radius); background: var(--ct-card); }
.ct-stat__value { font-size: 26px; font-weight: 850; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ct-stat__label { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--ct-dim); text-transform: uppercase; letter-spacing: .05em; }
.ct-stat__note { margin-top: 6px; font-size: 11.5px; color: var(--ct-dim); }

/* ---- brands ---- */
.ct-brands { margin: 18px 0 6px; }
.ct-brand { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; grid-template-areas: "name bar num" "name bar val";
  align-items: center; gap: 2px 12px; width: 100%; padding: 7px 8px; border: 0; border-radius: 8px; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ct-brand:hover { background: var(--ct-tile); }
.ct-brand.is-active { background: var(--ct-accent-soft); }
.ct-brand:focus-visible { outline: 2px solid var(--ct-accent); outline-offset: 1px; }
.ct-brand__name { grid-area: name; font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-brand__bar { grid-area: bar; height: 10px; border-radius: 6px; background: var(--ct-tile); overflow: hidden; }
.ct-brand__bar span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--ct-accent), #2ee6d6); }
.ct-brand__num { grid-area: num; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ct-brand__val { grid-area: val; font-size: 11.5px; color: var(--ct-dim); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

/* ---- toolbar ---- */
.ct-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
.ct-search { flex: 1 1 220px; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--ct-line); border-radius: 10px;
  background: var(--ct-card); color: inherit; font: inherit; font-size: 14px; }
.ct-select { height: 38px; padding: 0 10px; border: 1px solid var(--ct-line); border-radius: 10px; background: var(--ct-card); color: inherit; font: inherit; font-size: 13px; max-width: 100%; }
.ct-search:focus-visible, .ct-select:focus-visible { outline: 2px solid var(--ct-accent); outline-offset: 1px; }
.ct-cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: thin; }
.ct-chip { flex: none; height: 30px; padding: 0 12px; border: 1px solid var(--ct-line); border-radius: 999px; background: var(--ct-card);
  color: inherit; font: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.ct-chip span { color: var(--ct-dim); font-weight: 600; margin-left: 2px; }
.ct-chip.is-active { background: var(--ct-fg); color: #fff; border-color: var(--ct-fg); }
.ct-chip.is-active span { color: rgba(255, 255, 255, .7); }

/* ---- grid ---- */
.ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.ct-tile { position: relative; min-width: 0; }
.ct-tile.is-hidden .ct-tile__pic { opacity: .45; }
.ct-tile__link { display: grid; gap: 3px; color: inherit; text-decoration: none; border-radius: var(--ct-radius); outline-offset: 3px; }
.ct-tile__link:focus-visible { outline: 2px solid var(--ct-accent); }
.ct-tile__pic { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; overflow: hidden;
  border-radius: var(--ct-radius); background: var(--ct-tile); box-shadow: inset 0 -3px 0 var(--ct-rarity, transparent); }
.ct-tile__pic img { width: 100%; height: 100%; object-fit: contain; padding: 8px; transition: transform .18s ease; }
.ct-tile__link:hover .ct-tile__pic img { transform: scale(1.04); }
.ct-tile__nopic { width: 40%; height: 40%; border-radius: 50%; background: var(--ct-line); }
.ct-tile__qty { position: absolute; right: 6px; bottom: 8px; padding: 1px 7px; border-radius: 999px; background: rgba(15, 15, 16, .82); color: #fff; font-size: 12px; font-weight: 800; }
.ct-tile__badge { position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%;
  background: var(--ct-accent); color: #fff; font-size: 12px; font-weight: 900; }
.ct-tile__name { margin-top: 5px; font-size: 13.5px; font-weight: 750; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ct-tile__meta { font-size: 12px; color: var(--ct-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-tile__status { justify-self: start; margin-top: 2px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; background: var(--ct-tile); color: var(--ct-dim); }
.ct-tile__status.is-claimed { background: var(--ct-accent-soft); color: #0a8076; }
.ct-tile__status.is-shipped, .ct-tile__status.is-processing { background: #fff4d6; color: #8a5a00; }
.ct-tile__status:empty { display: none; }
.ct-tile__hide { position: absolute; right: 6px; top: 6px; height: 24px; padding: 0 9px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .92); color: #0f0f10; font: 700 11px system-ui, sans-serif; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.ct-tile__hide[aria-pressed="true"], .ct-tile__hide.is-locked { background: #0f0f10; color: #fff; }
.ct-tile__hide.is-locked { display: inline-flex; align-items: center; cursor: help; }

.ct-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.ct-more-link { color: var(--ct-accent); font-weight: 800; font-size: 13px; text-decoration: none; }
.ct-more-link:hover { text-decoration: underline; }

.ct-btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; padding: 0 16px; border: 1px solid var(--ct-line);
  border-radius: 999px; background: var(--ct-card); color: inherit; font: 700 13px system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.ct-btn:hover { background: var(--ct-tile); }
.ct-btn:disabled { opacity: .55; cursor: default; }
.ct-btn--primary { background: #0f0f10; border-color: #0f0f10; color: #fff; }
.ct-btn--primary:hover { background: #26262a; }
.ct-btn--quiet { border-color: transparent; background: transparent; color: var(--ct-accent); }

.ct-empty { padding: 26px 4px; color: var(--ct-dim); font-size: 14px; }
.ct-empty--big { padding: 40px 20px; text-align: center; border: 1px dashed var(--ct-line); border-radius: var(--ct-radius); margin-top: 12px; }
.ct-empty__title { margin: 0 0 6px; font-size: 18px; font-weight: 850; color: var(--ct-fg); }
.ct-empty__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 14px; }

/* ---- compact (profile Items tab) ---- */
.ct--compact .ct-stats { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.ct--compact .ct-stat { padding: 10px 12px; }
.ct--compact .ct-stat__value { font-size: 20px; }
.ct--compact .ct-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }

/* ---- game (MMO bag) ---- */
.ct--game {
  --ct-fg: #e8ecf5; --ct-dim: #94a3b8; --ct-line: rgba(255, 255, 255, .12); --ct-tile: rgba(255, 255, 255, .06);
  --ct-card: rgba(255, 255, 255, .04); --ct-accent: #2ee6d6; --ct-accent-soft: rgba(46, 230, 214, .14);
  --ct-radius: 6px;
  font-size: 12px; max-height: 360px; overflow-y: auto; padding: 2px 2px 6px; scrollbar-width: thin;
}
.ct--game .ct-stats { grid-template-columns: repeat(2, 1fr); gap: 4px; }
.ct--game .ct-stat { padding: 6px 6px; text-align: center; }
.ct--game .ct-stat__value { font-size: 15px; }
.ct--game .ct-stat__label { font-size: 9.5px; letter-spacing: .03em; }
.ct--game .ct-stat__note { display: none; }
.ct--game .ct-toolbar { margin: 8px 0 6px; gap: 4px; }
.ct--game .ct-search, .ct--game .ct-select { height: 28px; font-size: 12px; border-radius: 6px; padding: 0 8px; }
.ct--game .ct-select { flex: 1 1 90px; }
.ct--game .ct-cats { margin-bottom: 6px; scrollbar-width: none; }
.ct--game .ct-cats::-webkit-scrollbar { display: none; }
.ct--game .ct-chip { height: 24px; padding: 0 9px; font-size: 11px; }
.ct--game .ct-chip.is-active { background: var(--ct-accent); color: #04211f; border-color: var(--ct-accent); }
.ct--game .ct-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; }
.ct--game .ct-tile__pic { border-radius: 5px; background: linear-gradient(180deg, #f4f5f8, #d9dce4); }
.ct--game .ct-tile__pic img { padding: 4px; }
.ct--game .ct-tile__name { font-size: 10.5px; -webkit-line-clamp: 1; margin-top: 2px; }
.ct--game .ct-tile__meta, .ct--game .ct-tile__status { display: none; }
.ct--game .ct-tile__qty { font-size: 10px; right: 3px; bottom: 4px; padding: 0 5px; }
.ct--game .ct-tile__badge { width: 15px; height: 15px; font-size: 9px; left: 3px; top: 3px; color: #04211f; }
.ct--game .ct-empty, .ct--game .ct-loading { padding: 16px 4px; font-size: 12px; }
.ct--game .ct-empty--big { padding: 18px 10px; }
.ct--game .ct-empty__title { font-size: 14px; }
.ct--game .ct-btn { height: 28px; padding: 0 12px; font-size: 11.5px; }
.ct--game .ct-btn--primary { background: var(--ct-accent); border-color: var(--ct-accent); color: #04211f; }
.ct--game .ct-foot { margin-top: 8px; }

/* ---- the item card: MapleStory's panel, EXPtube's colours ---- */
.ct-tip-host { position: fixed; z-index: 2147483000; pointer-events: none; left: 0; top: 0; }
.ct-tip {
  width: 300px; max-width: calc(100vw - 16px); padding: 11px 12px 11px;
  background: rgba(6, 8, 10, .96); border: 1px solid rgba(46, 230, 214, .45); border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55), 0 0 0 1px rgba(46, 230, 214, .08) inset;
  font: 12px/1.38 "Segoe UI", system-ui, -apple-system, sans-serif; color: #e8ecf5;
}
.ct-tip__name { font-size: 15px; font-weight: 850; line-height: 1.2; }
.ct-tip__qty { color: #9aa3aa; font-weight: 700; font-size: 13px; }
.ct-tip__edition { margin-top: 2px; color: #f6b93b; font-weight: 800; font-size: 11.5px; letter-spacing: .03em; }
.ct-tip__top { display: grid; grid-template-columns: 112px 1fr; gap: 11px; align-items: center; margin-top: 9px; }
.ct-tip__pic { display: flex; align-items: center; justify-content: center; height: 112px; border-radius: 4px; overflow: hidden;
  background: linear-gradient(180deg, #f4f5f8, #d9dce4); }
.ct-tip__pic img { max-width: 100%; max-height: 104px; object-fit: contain; }
.ct-tip__nopic { color: #55627a; font-size: 11px; }
.ct-tip__facts { display: grid; gap: 2px; min-width: 0; }
.ct-tip__fact { font-weight: 850; font-size: 13px; letter-spacing: .03em; }
.ct-tip__rarity { text-transform: uppercase; }
.ct-tip__rule { height: 2px; background: #ffffff; opacity: .85; margin: 9px 0 7px; }
.ct-tip__row { display: flex; justify-content: space-between; gap: 10px; }
.ct-tip__facts .ct-tip__row { display: grid; grid-template-columns: 1fr; gap: 0; }
.ct-tip__key { color: #8796ab; font-weight: 600; }
.ct-tip__val { color: #ffffff; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.ct-tip__facts .ct-tip__val { text-align: left; }
.ct-tip__row.is-serial .ct-tip__val { color: #9aa3aa; font-variant-numeric: tabular-nums; }
.ct-tip__row.is-good .ct-tip__val, .ct-tip__row.is-claimed .ct-tip__val { color: #2ee6d6; }
.ct-tip__row.is-dim .ct-tip__val { color: #9aa3aa; }
.ct-tip__label { margin-bottom: 4px; color: #2ee6d6; font-weight: 850; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.ct-tip__stats { list-style: none; margin: 0 0 4px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1px 14px; }
.ct-tip__stats li { position: relative; display: flex; justify-content: space-between; padding-left: 11px; font-weight: 700; }
.ct-tip__stats li::before { content: ''; position: absolute; left: 1px; top: 6px; width: 5px; height: 5px; border-radius: 50%; background: #2ee6d6; }
.ct-tip__stats li b { font-variant-numeric: tabular-nums; }
.ct-tip__stats.is-quality li::before { background: #f6b93b; }
.ct-tip__desc { margin: 0; color: #cbd5e1; font-size: 11.5px; }
.ct-tip__hint { margin-top: 8px; font-size: 10.5px; color: #7fd9d1; text-align: center; }
.ct-tip__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ct-tip__actions .ct-btn { background: transparent; color: #e8ecf5; border-color: rgba(255,255,255,.25); }
.ct-tip__actions .ct-btn--primary { background: #2ee6d6; border-color: #2ee6d6; color: #04211f; flex: 1 1 auto; }

/* ---- the tap sheet ---- */
.ct-sheet { position: fixed; inset: 0; z-index: 2147483001; display: flex; align-items: flex-end; justify-content: center; }
.ct-sheet__scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); }
.ct-sheet__panel { position: relative; width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; padding: 0 0 env(safe-area-inset-bottom);
  animation: ct-rise .18s ease-out; }
.ct-sheet__panel .ct-tip { background: #06080a; width: 100%; max-width: none; border-radius: 14px 14px 0 0; padding: 18px 16px 18px; font-size: 13px; }
.ct-sheet__panel .ct-tip__name { padding-right: 34px; font-size: 17px; }
.ct-sheet__close { position: absolute; right: 10px; top: 10px; z-index: 1; width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 15px; cursor: pointer; }
@keyframes ct-rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ct-sheet__panel { animation: none; } }
@media (min-width: 700px) { .ct-sheet { align-items: center; } .ct-sheet__panel .ct-tip { border-radius: 10px; } }

@media (max-width: 520px) {
  .ct-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ct--compact .ct-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-stat__value { font-size: 22px; }
  .ct-brand { grid-template-columns: 1fr auto; grid-template-areas: "name num" "bar bar" "val val"; }
  .ct-brand__val { text-align: left; }
}
