/* Loadout Manager. Standalone like /gkr/: the homepage's style.css is not loaded here.
   Fonts and colours match the homepage; positions are viewport shares taken from the mockup. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

:root {
  --font-display: "Segoe UI Variable Display Light", "Segoe UI Variable Display", "Segoe UI Light", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-button: "Liberation Sans", Arial, Helvetica, sans-serif;
  --font-mono: "Liberation Mono", "Courier New", Courier, monospace;

  --blue: #7f90ff;          /* bars and buttons */
  --ink: #000a2e;           /* text on blue */
  --white: #ffffff;
  --text: #b9c3ff;          /* muted text */
  --select: #1ec8ff;        /* selected frame */
  --green: #178c4e;         /* item tab */
  --panel: rgba(0, 3, 24, 0.72);
  --bar-h: clamp(32px, 5.4vh, 48px);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--white);
  font-family: var(--font-mono);
  background-color: #000318;
  background-image: url("../images/background.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ---- blue grid that follows the cursor (same as the homepage) ---- */
.grid {
  position: fixed;
  inset: -120px;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(90, 120, 255, 0.16) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(90, 120, 255, 0.16) 1px, transparent 1px);
  background-size: 180px 180px;
  transform: translate3d(var(--gx, 0px), var(--gy, 0px), 0);
  transition: transform 0.25s ease-out;
  will-change: transform;
}

/* ---- title bar across the top (same as /gkr/) ---- */
.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  height: var(--bar-h);
  background: var(--blue);
  color: var(--ink);
}

.bar-title {
  flex: 1 1 auto;
  margin: 0;
  padding: 0 calc(var(--bar-h) + 1vw);
  text-align: center;
  font-family: var(--font-button);
  font-weight: 700;
  font-size: clamp(13px, 1.6vw, 24px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--bar-h) * 1.2);
  height: var(--bar-h);
  color: var(--ink);
  transition: transform 0.18s ease-out;
}

.back svg {
  width: 62%;
  height: 62%;
  fill: currentColor;
}

.back:hover,
.back:focus-visible {
  transform: translateX(-4px);
}

.back:focus-visible,
.tab:focus-visible,
.group:focus-visible,
.item:focus-visible,
.step:focus-visible,
.reset:focus-visible,
.slot-clear:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.page {
  position: relative;
  z-index: 1;
  padding-top: var(--bar-h);
  min-height: 100vh;
}

/* ---- three columns: stat panels, gear, equipped ---- */
.manager {
  display: grid;
  grid-template-columns: 33vw minmax(0, 1fr) 20vw;
  gap: 0 2.5vw;
  min-height: calc(100vh - var(--bar-h));
  padding: 7vh 1.5vw 5vh 1.5vw;
}

/* ---- enter / preview boxes ---- */
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6vw;
  align-self: start;
}

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 72vh;
  padding: 1.2vh 1vw 2vh;
  border: 2px solid var(--white);
  background: var(--panel);
}

.panel-title {
  margin: 0 0 1.2vh;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: clamp(12px, 1.05vw, 16px);
  letter-spacing: 0.04em;
}

.points {
  margin: 0 0 2.4vh;
  text-align: center;
  font-size: clamp(10px, 0.8vw, 13px);
  color: var(--text);
}

.points.spent {
  color: var(--select);
}

.rows {
  display: flex;
  flex-direction: column;
  gap: 0.6vh;
}

.rows + .rows {
  margin-top: 3.2vh;
}

.gap {
  height: 2.2vh;
}

.row {
  display: flex;
  align-items: center;
  gap: 0.5vw;
  font-weight: 700;
  font-size: clamp(13px, 1.3vw, 20px);
  line-height: 1.25;
}

.row .label {
  width: 3.2em;
  flex: 0 0 auto;
}

.row .value {
  min-width: 1.4em;
  text-align: center;
}

/* a stepped-up value in the entry box, and any item bonus in the preview, glow cyan */
.row .value.up,
.row .bonus {
  color: var(--select);
}

.row .bonus {
  font-weight: 400;
  font-size: 0.7em;
}

.step {
  width: 1.5em;
  height: 1.5em;
  line-height: 1.4em;
  text-align: center;
  font-size: 0.85em;
  font-weight: 700;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  transition: border-color 0.15s ease-out, background 0.15s ease-out;
}

.step:hover,
.step:focus-visible {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.12);
}

.step:disabled {
  opacity: 0.3;
  cursor: default;
}

.step:disabled:hover {
  background: none;
  border-color: rgba(255, 255, 255, 0.55);
}

.reset {
  margin-top: auto;
  align-self: center;
  padding: 0.3em 0.9em;
  font-size: clamp(10px, 0.8vw, 13px);
  color: var(--text);
  border: 1.5px solid rgba(185, 195, 255, 0.5);
  transition: color 0.15s ease-out, border-color 0.15s ease-out;
}

.reset:hover,
.reset:focus-visible {
  color: var(--white);
  border-color: var(--white);
}

.preview .rows:first-of-type {
  margin-top: 4.4vh;
}

.derived .row .label {
  width: 3.6em;
}

/* ---- gear: category tabs, sub-groups, item list ---- */
.gear {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 1.7vw;
  padding-left: 0.6vw;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(44px, 5.2vw, 72px);
  height: clamp(44px, 5.2vw, 72px);
  border: 2px solid var(--white);
  background: var(--panel);
  color: var(--white);
  transition: transform 0.15s ease-out, border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

.tab svg {
  width: 72%;
  height: 72%;
  fill: currentColor;
}

.tab.item-tab {
  background: var(--green);
}

.tab:hover,
.tab:focus-visible {
  transform: scale(1.06);
}

.tab[aria-selected="true"] {
  border-color: var(--select);
  box-shadow: 0 0 0 1px var(--select), 0 0 14px rgba(30, 200, 255, 0.45);
}

.groups {
  display: flex;
  gap: 0.35em;
  min-height: 1.8em;
  margin: 0.9vh 0 2.2vh;
  padding-left: 0.6vw;
  font-size: clamp(10px, 0.75vw, 12px);
}

.groups:empty {
  visibility: hidden;
}

.group {
  padding: 0.1em 0.3em;
  border: 1.5px solid transparent;
  transition: border-color 0.15s ease-out;
}

.group:hover,
.group:focus-visible {
  border-color: rgba(255, 255, 255, 0.6);
}

.group[aria-pressed="true"] {
  border-color: var(--select);
}

.group-sep {
  align-self: center;
}

.items {
  margin: 0;
  padding: 0 0 0 0.6vw;
  list-style: none;
}

.item {
  display: flex;
  align-items: baseline;
  gap: 0.6em;
  width: 100%;
  padding: 0.45em 0.4em;
  text-align: left;
  font-size: clamp(10px, 0.78vw, 13px);
  font-weight: 700;
  line-height: 1.3;
  transition: background 0.15s ease-out;
}

.item:hover,
.item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.item .tag {
  flex: 0 0 auto;
  min-width: 2.2em;
  padding: 0.05em 0.2em;
  border: 1.5px solid transparent;
  text-align: center;
}

.item[aria-pressed="true"] .tag {
  border-color: var(--select);
  box-shadow: 0 0 8px rgba(30, 200, 255, 0.45);
}

.item .name {
  word-break: break-word;
}

.item .bonus-hint {
  margin-left: auto;
  flex: 0 0 auto;
  padding-left: 1em;
  font-weight: 400;
  color: var(--text);
  opacity: 0;
  transition: opacity 0.15s ease-out;
}

.item:hover .bonus-hint,
.item:focus-visible .bonus-hint,
.item[aria-pressed="true"] .bonus-hint {
  opacity: 1;
}

/* ---- equipped column ---- */
.equipped {
  padding-top: 0.6vh;
}

.equipped-title {
  margin: 0 0 1.6vh;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(12px, 1vw, 16px);
}

.slots {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: clamp(10px, 0.78vw, 13px);
  font-weight: 700;
  line-height: 1.3;
}

.slot {
  display: flex;
  align-items: flex-start;
  gap: 0.4em;
  margin-bottom: 1.3vh;
}

.slot .slot-label {
  flex: 0 0 auto;
}

.slot .slot-value {
  min-width: 0;
  word-break: break-word;
}

.slot .slot-value.empty {
  color: var(--text);
  opacity: 0.6;
}

.slot-clear {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0 0.3em;
  color: var(--text);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s ease-out, color 0.15s ease-out;
}

.slot:hover .slot-clear,
.slot-clear:focus-visible {
  opacity: 1;
}

.slot-clear:hover {
  color: var(--white);
}

/* ---- small screens: stack everything ---- */
@media (max-width: 900px) {
  .bar-title {
    padding: 0 var(--bar-h);
    white-space: normal;
    font-size: 13px;
  }

  .manager {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 20px 16px 40px;
  }

  .panels {
    gap: 10px;
  }

  .panel {
    min-height: 0;
    padding: 10px 10px 16px;
  }

  .preview .rows:first-of-type {
    margin-top: 28px;
  }

  .row {
    font-size: 15px;
  }

  .tabs {
    gap: 12px;
    padding-left: 0;
  }

  .groups,
  .items {
    padding-left: 0;
  }

  .groups {
    font-size: 12px;
    margin: 10px 0 14px;
  }

  .item,
  .slots {
    font-size: 12px;
  }

  .slot-clear {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grid,
  .back,
  .tab,
  .item,
  .step {
    transition: none;
  }
}
