/* =====================================================================
   Character screen (idle ARPG): level bar, tabs, equipment, inventory,
   skills, item sheet, vendor. Same pixel-bevel language as bay.css.
   ===================================================================== */
:root {
  --r-normal: #c9cfe4;
  --r-magic: #6fa8ff;
  --r-rare: #ffd23f;
  --r-epic: #ff8a2a;
}
.bevel, #tabs button, .tile, .plus, .acts button, .crafts button, #autoSell {
  border: 0; clip-path: var(--notch);
}

/* level and xp */
#lvRow { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 0 2px; }
#lvNum { font-family: var(--px); font-size: 9px; font-weight: 400; color: var(--gold); text-shadow: 1px 1px 0 var(--ink); }
#lvRow .xp { flex: 1; height: 8px; background: var(--ink); box-shadow: 0 0 0 1px #2f3870; }
#lvRow .xp i { display: block; height: 100%; width: 0; background: linear-gradient(#b58cff, #7a3fb0); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3); }
#xpTxt { font-size: 14px; color: var(--dim); min-width: 64px; text-align: right; }

/* tabs */
#tabs { flex: 0 0 30px; display: flex; gap: 6px; }
#tabs button {
  flex: 1; font-family: var(--px); font-size: 9px; color: var(--dim);
  background: #151a38; box-shadow: inset 0 0 0 2px var(--ink), inset 0 -3px 0 #0c0f26;
}
#tabs button.on {
  color: #fff; background: linear-gradient(180deg, #2c356a, #1a2045);
  box-shadow: inset 0 0 0 2px var(--ink), inset 3px 3px 0 var(--metal-hi), inset 0 -3px 0 var(--accent);
}
#tabs button i { font-style: normal; display: inline-block; min-width: 14px; padding: 2px 3px; background: var(--gold); color: var(--ink); }
#tabs button i:empty { display: none; }
.tab { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.tab.hidden { display: none; }

/* item tiles */
.tile {
  position: relative; display: flex; align-items: center; justify-content: center; padding: 0;
  --rc: var(--r-normal);
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rc) 22%, #151a38), #0c0f26 75%);
  box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 4px var(--rc), inset 0 -6px 0 rgba(0, 0, 0, .35);
}
.tile img { width: 66%; height: 66%; image-rendering: pixelated; pointer-events: none; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .6)); }
.tile.r-magic { --rc: var(--r-magic); }
.tile.r-rare { --rc: var(--r-rare); }
.tile.r-epic { --rc: var(--r-epic); }
.tile.empty { --rc: #262e5c; background: #0b0e24; }
.tile.empty img { opacity: .22; filter: grayscale(1); }
.tile.hole { background: #0b0e24; box-shadow: inset 0 0 0 2px #070818, inset 3px 3px 0 #05060f, inset -2px -2px 0 #1c2350; }
.tile.new::before {
  content: "NEW"; position: absolute; left: 4px; top: 4px; font-family: var(--px); font-size: 5px;
  padding: 2px 2px 1px; background: var(--accent); color: var(--ink);
}
.tile.up::after {
  content: ""; position: absolute; right: 5px; bottom: 6px; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid #58d68d;
  filter: drop-shadow(1px 1px 0 var(--ink));
}
.tile:active { transform: translateY(1px); }

/* equipment row */
#doll { flex: 0 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.slot .tile { width: 100%; aspect-ratio: 1; }
.slot small { font-family: var(--px); font-size: 5px; color: var(--dim); }
#statLine {
  flex: 0 0 auto; display: flex; justify-content: space-between; padding: 4px 8px;
  background: #0b0e24; box-shadow: inset 0 0 0 2px var(--ink); clip-path: var(--notch);
  font-family: var(--px); font-size: 6px; color: var(--dim);
}
#statLine b { font-weight: 400; color: var(--text); }

/* inventory */
.bayHead #autoSell {
  order: 3; padding: 4px 6px; font-family: var(--px); font-size: 5px; color: var(--dim);
  background: #151a38; box-shadow: inset 0 0 0 1px #2f3870;
}
.bayHead i { order: 4; }
#inv {
  --t: min(44px, calc((100vw - 64px) / 6));
  flex: 0 0 auto; align-self: center; display: grid; grid-template-columns: repeat(6, var(--t));
  grid-auto-rows: var(--t); gap: 4px; padding: 6px;
  background: var(--metal-lo);
  box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 2px #2f3870, 0 0 0 4px var(--ink);
}
#inv .tile { width: 100%; height: 100%; min-height: 0; }

/* skills */
#skillHead { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; font-family: var(--px); font-size: 7px; color: var(--dim); }
#skillHead b { font-weight: 400; font-size: 11px; color: var(--dim); }
#skillHead b.has { color: var(--gold); }
#skillHead small { margin-left: auto; font-family: var(--body); font-size: 14px; }
#skillList { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 2px; }
.skill {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; flex: 0 0 auto;
  background: #141938; box-shadow: inset 0 0 0 2px var(--ink); clip-path: var(--notch);
}
.skill.learned { background: linear-gradient(90deg, #1d2654, #141938); box-shadow: inset 0 0 0 2px var(--ink), inset 3px 0 0 var(--accent); }
.skill.locked { opacity: .45; }
.sicon { flex: 0 0 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: #0b0e24; box-shadow: inset 0 0 0 2px #2f3870; }
.sicon img { width: 26px; height: 26px; image-rendering: pixelated; }
.sicon.fire { animation: fireGlow .2s steps(2); }
.stxt { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 1px 6px; }
.stxt b { font-family: var(--px); font-size: 7px; font-weight: 400; color: var(--text); }
.stxt em { font-style: normal; font-family: var(--px); font-size: 6px; color: var(--gold); text-align: right; }
.stxt em i { font-style: normal; color: var(--r-magic); }
.stxt span { grid-column: 1 / 3; font-size: 14px; line-height: 1; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plus {
  flex: 0 0 30px; height: 30px; font-family: var(--px); font-size: 12px; color: var(--ink);
  background: linear-gradient(180deg, #ffe27a, #d9a514); box-shadow: inset 0 0 0 2px var(--ink), inset 2px 2px 0 #fff3b8;
}
.plus:disabled { color: #3a4170; background: #151a38; box-shadow: inset 0 0 0 2px var(--ink); }

/* item sheet */
#itemSheet { position: absolute; inset: 0; z-index: 25; background: rgba(6, 7, 20, .72); display: flex; align-items: flex-end; }
#itemSheet.hidden { display: none; }
#itemBody { position: relative; padding: 14px 12px calc(12px + env(safe-area-inset-bottom)); max-height: 78%; overflow-y: auto; }
#itemBody.flash { animation: fireGlow .25s steps(2); }
#itemBody .x {
  position: absolute; right: 10px; top: 10px; width: 30px; height: 30px; border: 0; clip-path: var(--notch);
  font-family: var(--px); font-size: 9px; background: #2a1020; box-shadow: inset 0 0 0 2px var(--ink); color: #ff9aa8;
}
.iname { font-family: var(--px); font-size: 10px; line-height: 1.4; padding-right: 36px; text-shadow: 2px 2px 0 var(--ink); }
.iname.r-normal { color: var(--r-normal); }
.iname.r-magic { color: var(--r-magic); }
.iname.r-rare { color: var(--r-rare); }
.iname.r-epic { color: var(--r-epic); }
.ibase { font-family: var(--px); font-size: 6px; color: var(--dim); margin: 4px 0 6px; }
#itemBody ul, .vinfo ul { list-style: none; display: flex; flex-direction: column; gap: 1px; font-size: 17px; line-height: 1.05; }
#itemBody li, .vinfo li { color: #9fc4ff; }
#itemBody li.imp { color: var(--dim); }
#itemBody h4 { font-family: var(--px); font-size: 6px; color: var(--dim); margin-bottom: 4px; }
#itemBody h5 { font-family: var(--px); font-size: 7px; font-weight: 400; color: var(--accent); margin: 10px 0 6px; }
.cmp { margin-top: 8px; padding: 6px 8px; background: #0b0e24; box-shadow: inset 0 0 0 2px var(--ink); font-family: var(--px); font-size: 6px; color: var(--dim); }
.cmp div { display: flex; gap: 12px; margin-top: 4px; font-size: 7px; }
.cmp .pos { color: #7dff9a; }
.cmp .neg { color: #ff7b88; }
#itemBody details { margin-top: 6px; font-size: 15px; color: var(--dim); }
#itemBody details summary { font-family: var(--px); font-size: 6px; cursor: pointer; }
#itemBody details .iname { font-size: 8px; margin-top: 6px; }
.acts { display: flex; gap: 6px; margin-top: 10px; }
.acts button {
  flex: 1; height: 40px; font-family: var(--px); font-size: 8px; color: #fff;
  background: linear-gradient(180deg, #2c356a, #1a2045);
  box-shadow: inset 0 0 0 2px var(--ink), inset 3px 3px 0 var(--metal-hi), inset -3px -3px 0 var(--metal-lo);
}
.acts .primary { background: linear-gradient(180deg, #33d8ff, #0c6e90); box-shadow: inset 0 0 0 2px var(--ink), inset 3px 3px 0 #a8f3ff, inset -3px -3px 0 #07506a; }
.acts .danger { background: repeating-linear-gradient(135deg, #3a1220 0 6px, #2a0c18 6px 12px); box-shadow: inset 0 0 0 2px var(--ink), inset 3px 3px 0 #7a3040; color: #ff9aa8; }
.crafts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.crafts button {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 4px;
  background: linear-gradient(180deg, #2a2050, #17123a);
  box-shadow: inset 0 0 0 2px var(--ink), inset 3px 3px 0 #5f3fa8, inset -3px -3px 0 #0d0a22;
}
.crafts b { font-family: var(--px); font-size: 7px; font-weight: 400; color: #e3d4ff; }
.crafts small { font-size: 13px; line-height: 1; color: var(--dim); text-align: center; }
.crafts i { font-style: normal; font-family: var(--px); font-size: 7px; color: var(--gold); }
.crafts button:disabled { opacity: .4; }

/* vendor: one item per row */
#cards { flex-direction: column; }
.card.vcard { flex-direction: row; align-items: center; text-align: left; padding: 8px; gap: 10px; }
.card.vcard .pic { flex: 0 0 52px; height: 52px; }
.card.vcard .pic .tile { width: 52px; height: 52px; }
.vinfo { flex: 1; min-width: 0; }
.vinfo .iname { font-size: 8px; padding: 0; }
.vinfo .ibase { margin: 2px 0 3px; }
.vinfo ul { font-size: 14px; }
.card.vcard .price { flex: 0 0 64px; margin: 0; width: auto; }
.upTag { font-style: normal; color: #7dff9a; }
.card.sold { min-height: 40px; justify-content: center; }

/* top strip: experience bar, stage progress as text */
.unit.xpbar .hp i { left: 0; right: auto; background: linear-gradient(#c9a6ff, #7a3fb0); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .3); }
.unit.xpbar .nm span { color: var(--gold); }
.unit.xpbar .nm b { color: var(--text); }
.unit.xpbar.bossing .nm b { color: #ff9ad8; }

/* sell drop zone under the bag */
#sellZone {
  flex: 0 0 38px; display: flex; align-items: center; justify-content: center; gap: 10px;
  clip-path: var(--notch);
  background: repeating-linear-gradient(135deg, #3a1220 0 6px, #2a0c18 6px 12px);
  box-shadow: inset 0 0 0 2px var(--ink), inset 3px 3px 0 #7a3040, inset -3px -3px 0 #1a0710;
  color: #ff9aa8; text-shadow: 1px 1px 0 var(--ink); font-family: var(--px);
}
#sellZone b { font-weight: 400; font-size: 9px; }
#sellZone small { font-size: 6px; color: #c97a88; }
#tabGear { gap: 7px; }

/* dragging */
.tile.dragging { opacity: .25; }
.ghostTile { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .55)); }
.dropHint .tile { box-shadow: inset 0 0 0 2px var(--ink), inset 0 0 0 4px #58d68d; }
.dropOk { outline: 3px solid #58d68d; outline-offset: 1px; }
.dropBad { outline: 3px solid #ff4d5e; outline-offset: 1px; }
#sellZone.dropOk { outline: 0; background: repeating-linear-gradient(135deg, #8a2234 0 6px, #5a1424 6px 12px); color: #fff; }

[hidden] { display: none !important; }
