/* Skills panel (skillpanel.js): skill pool, 3 builds (loadout 6 + 1 each), modifiers, respec. Reuses .spanel / .shead / .sbody / .pxbtn
   (style.css) and the action-bar .slot look. */
#skillPanel { position:fixed; z-index:35; left:50%; top:50%; transform:translate(-50%, -50%); width:min(600px, calc(100vw - 16px));
  height:min(760px, calc(100dvh - 16px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px)));
  font-family:var(--ui-font); }
#skillPanel .shead { padding-bottom:4px; }
.skpts { margin-left:auto; padding:4px 12px; color:#bda97f; background:var(--ui-slot-bg); border-radius:999px; box-shadow:var(--ui-box);
  white-space:nowrap; }
.skpts b { font-size:18px; color:#f6e7c1; font-variant-numeric:tabular-nums; }
.skpts.some { box-shadow:var(--ui-box-sel), 0 0 10px rgba(232,180,74,.35); }
.skpts.some b { color:#ffd27a; }

/* safe-zone banner: red-brown outside, green inside */
.skzone { margin:0 16px 8px; padding:6px 12px; border-radius:10px; font-size:13px; color:#ffcfb8; background:#3a1a10;
  box-shadow:0 0 0 1px rgba(8,5,2,.85), inset 0 0 0 1px #8a3a24; }
.skzone.ok { color:#cfeec0; background:#1c2e14; box-shadow:0 0 0 1px rgba(8,5,2,.85), inset 0 0 0 1px #4f8a3a; }

/* build tabs (3 saved builds): the shown one is raised, the one in use has a green "in use" tag */
.skbuilds { margin:0 16px 6px; }
.skbtabs { display:flex; gap:6px; }
.skbtab { flex:1 1 0; min-width:0; min-height:40px; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:1px; padding:4px 8px; border:0; border-radius:10px 10px 4px 4px; cursor:pointer; font-family:var(--ui-font);
  color:#bda97f; background:var(--ui-slot-bg); box-shadow:var(--ui-box); }
.skbtab:hover { color:#f3e2b4; }
.skbtab.on { color:#f6e7c1; background:#2e2014; box-shadow:var(--ui-box-sel), 0 0 10px rgba(232,180,74,.25); }
.skbn { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:15px; font-weight:600; }
.skbuse { font-size:12px; letter-spacing:.04em; font-variant:small-caps; color:#8fd18b; }
.skbrow { display:flex; align-items:center; flex-wrap:wrap; gap:4px 8px; min-height:44px; padding:4px 2px 0; }
.skbrow .skhint { flex:1 1 160px; }
.skbname { flex:1 1 160px; min-width:0; height:34px; padding:0 10px; border-radius:8px; border:0; font:16px var(--ui-font);
  color:#f6e7c1; background:#120c08; box-shadow:inset 0 0 0 1px #e8b44a; }
.skbname:focus { outline:none; box-shadow:inset 0 0 0 2px #fff3c4, 0 0 8px rgba(255,220,140,.5); }

/* loadout row: 6 slots + the bigger gold ultimate slot */
.sklo { display:flex; justify-content:center; align-items:flex-end; gap:6px; padding:4px 12px 2px; }
.skcell { display:flex; flex-direction:column; align-items:center; gap:3px; width:62px; }
.skcell.ult { width:72px; margin-left:8px; }
.skslot.slot { width:56px; height:56px; }
.skslot.slot.ult { width:68px; height:68px; box-shadow:inset 0 0 0 3px #e8b44a, inset 0 0 0 4px #3a2410, 0 0 12px rgba(255,170,60,.35); }
.skslot .key { z-index:1; }
.skslot.empty { background:#1a120b; }
.skplus { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#6b5638; font-size:18px; font-weight:700; }
.skslot.ult .skplus { font-size:13px; color:#a07a3a; }
.skslot.can { animation:skcan 1.1s ease-in-out infinite; }
@keyframes skcan { 50% { box-shadow:inset 0 0 0 2px #fff3c4, 0 0 12px rgba(246,212,136,.7); } }
.skslot.sel, .skslot.over { box-shadow:inset 0 0 0 3px #fff3c4, 0 0 14px rgba(255,220,140,.8) !important; }
.skname { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:11px; color:#d6c193; }
.skcell.ult .skname { color:#f3cf7a; }
.sktools { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:0 6px; min-height:44px; padding:0 12px; }
.skhint { color:#a8977a; font-size:13px; }

/* modifier rune: a small gold diamond in the icon's corner (slots, list, inspect) */
.skrune { position:absolute; right:2px; bottom:2px; width:9px; height:9px; transform:rotate(45deg); z-index:1; pointer-events:none;
  background:linear-gradient(135deg, #fff3c4, #e8b44a 55%, #a9641d); box-shadow:0 0 0 1px #1e0f05, 0 0 5px rgba(255,200,90,.8); }

/* result line */
.sktoast { min-height:0; max-height:0; overflow:hidden; margin:0 16px; font-size:14px; color:#cfeec0; text-align:center; transition:max-height .2s; }
.sktoast.show { max-height:48px; padding:2px 0 6px; }
.sktoast.bad { color:#ff8a7a; }

/* the skill list */
.skbody { border-top:1px solid rgba(232,190,110,.2); }
.skbody .ih { color:#bda97f; font-size:16px; letter-spacing:.06em; font-variant:small-caps; font-weight:600; margin:10px 0 4px; }
.skrow { display:grid; grid-template-columns:48px 1fr; gap:4px 10px; padding:8px 6px; cursor:pointer; border-bottom:1px solid rgba(232,190,110,.1); }
.skrow:hover { background:rgba(255,220,150,.05); }
.skrow.sel { background:#2e2014; box-shadow:inset 0 0 0 2px #e8b44a; }
.skrow.locked { cursor:default; }
.skrow.locked .sktxt > :not(.skl1), .skrow.locked .skl1 b { opacity:.55; }
.skrow.locked .skico canvas { opacity:.5; }
.skrow.dragging { opacity:.5; }
.skico { position:relative; width:48px; height:48px; background:var(--ui-slot-bg); border-radius:10px; box-shadow:var(--ui-slot), inset 0 0 10px rgba(0,0,0,.6);
  touch-action:none; cursor:grab; }
.skrow.ult .skico { box-shadow:inset 0 0 0 2px #c98a2e, inset 0 0 10px rgba(0,0,0,.8); }
.skrow.locked .skico { cursor:default; }
.skico canvas { position:absolute; left:8%; top:8%; width:84%; height:84%; image-rendering:pixelated; image-rendering:crisp-edges; }
.skin { position:absolute; left:2px; top:1px; font:bold 10px/1 Georgia, serif; color:#f6d488; text-shadow:0 1px 1px #000, 0 0 2px #000; }
.sktxt { min-width:0; }
.skl1 { display:flex; flex-wrap:wrap; align-items:baseline; gap:2px 8px; }
.skl1 b { color:#f3cf7a; font-size:15px; }
.sklv { padding:0 5px; font-size:12px; color:#2a1606; background:#a8977a; }
.skon { font-size:13px; letter-spacing:.04em; font-variant:small-caps; color:#8fd18b; }
.skcd { margin-left:auto; font-size:12px; color:#a8977a; font-variant-numeric:tabular-nums; }
.skmod { font-size:12px; color:#ffd27a; }
.skmod::before { content:'\25C6  '; color:#e8b44a; }
.skdesc { font-size:13px; color:#d8ccb0; line-height:1.35; }

/* modifiers of the selected skill */
.skmods { grid-column:1 / -1; margin-top:4px; padding:6px 8px 2px; background:rgba(0,0,0,.22); border-radius:10px; box-shadow:inset 0 0 0 1px rgba(232,190,110,.18); cursor:default; }
.skmh { color:#bda97f; font-size:14px; letter-spacing:.05em; font-variant:small-caps; margin-bottom:2px; }
.skmrow { display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid rgba(107,74,42,.3); }
.skmrow:last-child { border-bottom:0; }
.skmrow .sktxt { flex:1; }
.skmrow.on .skl1 b { color:#ffd27a; }
.skmrow.on .skl1 b::before { content:'\25C6  '; color:#e8b44a; }
.skmrow.locked .sktxt { opacity:.6; }
.pxbtn.skmb { flex:none; min-width:92px; margin:6px 8px 10px; }
#skillPanel .pxbtn:disabled { cursor:not-allowed; filter:grayscale(.6) brightness(.75); }
#skillPanel .pxbtn:disabled:active { transform:none; }
#skillPanel .pxbtn.skact:disabled { cursor:default; filter:none; --face1:#c8f0a8; --face2:#7fc45a; --lip:#3f7a2a; --hi:#efffe0; }
.skrespec { margin-top:12px; padding:4px 6px; }
.skrespec .sask { position:static; }

/* outside a safe zone: edit controls look disabled (still browsable) */
#skillPanel.ro .skslot { cursor:default; }

/* drag ghost */
.skghost { position:fixed; left:0; top:0; z-index:60; width:44px; height:44px; pointer-events:none; background:#120c08;
  box-shadow:inset 0 0 0 2px #e8b44a, 0 0 14px rgba(255,200,90,.6); opacity:.92; }
.skghost canvas { position:absolute; left:8%; top:8%; width:84%; height:84%; image-rendering:pixelated; }
#skillPanel.dragging .skbody { touch-action:none; }

/* phones */
body.touch .skrow { padding:10px 6px; }
body.touch .pxbtn.skmb { min-height:44px; }
@media (max-width: 520px) {
  .sklo { gap:3px; padding:2px 4px; }
  .skcell { width:44px; } .skcell.ult { width:54px; margin-left:3px; }
  .skslot.slot { width:44px; height:44px; } .skslot.slot.ult { width:54px; height:54px; }
  .skname { font-size:10px; }
  .skbuilds { margin:0 10px 4px; } .skbn { font-size:14px; }
  .skzone { margin:0 10px 6px; font-size:12px; }
  .skpts { padding:3px 7px; } .skpts span { display:none; }
  .skpts::after { content:' pts'; color:#bda97f; }
  .skmrow { flex-wrap:wrap; gap:0 8px; }
  .skmrow .sktxt { flex:1 1 100%; }
  .pxbtn.skmb { margin:6px 8px 10px auto; }
}
/* landscape phones: short screen -> compact header, no slot names */
@media (max-height: 520px) {
  #skillPanel { height:calc(100dvh - 8px); top:calc(50% + env(safe-area-inset-top,0px) / 2); }
  #skillPanel .shead { padding:4px 12px 0; }
  #skillPanel .sclose.pxbtn { min-height:34px; padding:4px 12px; }
  .skzone { margin-bottom:4px; padding:3px 8px; font-size:12px; }
  .skname { display:none; }
  .sktools { min-height:36px; }
  .skslot.slot { width:46px; height:46px; } .skslot.slot.ult { width:54px; height:54px; }
  .skbtab { min-height:34px; flex-direction:row; gap:6px; } .skbrow { min-height:36px; padding-top:2px; }
}
.skinfo { margin:0 16px 8px; padding:7px 12px; border-radius:10px; font-size:13px; line-height:1.35; color:#d8c8a4;
  background:rgba(0,0,0,.22); box-shadow:inset 0 0 0 1px rgba(232,190,110,.2); }
.skinfo b { color:#ffd27a; font-weight:600; }
.sklock { margin:2px 0 4px; padding:4px 10px; border-radius:8px; font-size:13px; color:#ffcfb8; background:rgba(90,30,16,.45);
  box-shadow:inset 0 0 0 1px rgba(200,90,60,.45); }
@media (max-width: 520px) { .skinfo { margin:0 10px 6px; padding:5px 10px; font-size:12px; } }
