/* Base: the design system (the --variables: colours, category colours, spacing, text sizes, radii,
   shadows, timing), page reset, and the controls used everywhere: buttons, icon buttons, fields,
   switches, segmented controls, chips, tags and badges.
   The app is dark-only on purpose, to sit comfortably next to the game.
   One primary action per view: .btn.primary. Everything else is a plain .btn, .btn.ghost or a link. */

:root {
  color-scheme: dark;
  /* surfaces */
  --bg: #0a0e10;
  --surface: #11171a; /* header and panel */
  --surface-2: #161e22; /* cards */
  --surface-3: #1c262b; /* fields, hover */
  --surface-4: #26333a; /* pressed */
  --field: #0e1417;
  --line: #222d33;
  --line-2: #2f3d45;
  --line-3: #3b4c55;
  /* text (AA on --surface and --surface-2) */
  --text: #e9edeb;
  --text-2: #a9b6b2;
  --text-3: #85948f;
  /* meaning */
  --accent: #f2a33a;
  --accent-hover: #f8b658;
  --accent-ink: #1f1300;
  --accent-soft: rgba(242, 163, 58, 0.14);
  --accent-line: rgba(242, 163, 58, 0.45);
  --ok: #3fcb9c;
  --ok-soft: rgba(63, 203, 156, 0.14);
  --warn: #f2c14e;
  --warn-soft: rgba(242, 193, 78, 0.13);
  --danger: #ef6b5e;
  --danger-soft: rgba(239, 107, 94, 0.13);
  --door: #e0584a;
  /* categories (also in js/core/taxonomy.js, which the map uses) */
  --c-key: #f4d35e;
  --c-weapon: #f07a5f;
  --c-attachment: #8ea4ff;
  --c-gear: #4cc3d9;
  --c-event: #f28bc4;
  --c-infected: #93d46b;
  --c-cosmetic: #e8b07e;
  --c-other: #b193f0;
  /* spacing */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  /* text: four sizes */
  --t-xs: 12px;
  --t-sm: 13px;
  --t-md: 14px;
  --t-lg: 18px;
  /* radii */
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  /* shadows */
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  /* timing */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fast: 0.12s;
  --mid: 0.2s;
  /* type */
  --f: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --f-cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  /* layout */
  --top-h: 58px;
  --panel-w: 400px;
  --tap: 40px; /* smallest touch target */
  --logo-ink: #1f1300;
}
*,
*::before,
*::after {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--t-md) / 1.5 var(--f);
  font-feature-settings: "cv11", "ss01";
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
.ic {
  flex: none;
  display: block;
}
b,
strong {
  font-weight: 600;
}
h1,
h2,
h3,
h4 {
  font-weight: 650;
}
kbd {
  font: 500 11px/1 var(--f-mono);
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: var(--surface-3);
  color: var(--text-2);
}
.skip {
  position: fixed;
  z-index: 400;
  left: var(--s3);
  top: -60px;
  padding: var(--s2) var(--s3);
  border-radius: var(--r);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.skip:focus {
  top: var(--s3);
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.mono {
  font-family: var(--f-mono);
  font-size: 0.9em;
  font-weight: 500;
}
.muted {
  color: var(--text-2);
  margin: var(--s1) 0 var(--s3);
}
.muted2 {
  color: var(--text-3);
}
.small {
  font-size: var(--t-xs);
}
.center {
  text-align: center;
}
.warn {
  color: var(--warn);
}
::selection {
  background: rgba(242, 163, 58, 0.35);
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #2a363d;
  border-radius: 10px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: #384850;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--surface-3);
  color: var(--text);
  font-weight: 550;
  font-size: var(--t-md);
  white-space: nowrap;
  text-decoration: none;
  transition:
    background var(--fast),
    border-color var(--fast),
    color var(--fast),
    transform 0.1s;
  user-select: none;
}
.btn:hover:not(:disabled) {
  background: var(--surface-4);
  border-color: var(--line-3);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}
.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn.on {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}
.btn.on:hover:not(:disabled) {
  background: rgba(242, 163, 58, 0.22);
  border-color: rgba(242, 163, 58, 0.7);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn.ghost:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: transparent;
  color: var(--text);
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #2a0905;
}
.btn.danger:hover:not(:disabled) {
  background: #f5857a;
  border-color: #f5857a;
}
.btn.danger-text {
  color: var(--danger);
}
.btn.danger-text:hover:not(:disabled) {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn.sm {
  min-height: 34px;
  padding: 0 11px;
  font-size: var(--t-sm);
  gap: 6px;
  border-radius: var(--r-sm);
}
.btn.lg {
  min-height: 48px;
  padding: 0 20px;
  font-size: 15px;
  border-radius: 12px;
}
.btn.wide {
  width: 100%;
}
.ibtn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  flex: none;
  border-radius: var(--r);
  border: 0;
  background: transparent;
  color: var(--text-2);
  transition:
    background var(--fast),
    color var(--fast);
}
.ibtn:hover {
  background: var(--surface-3);
  color: var(--text);
}
.ibtn.sm {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
}
.ibtn .nag {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--surface);
}
.linkbtn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  padding: 0;
  color: var(--accent);
  font-weight: 550;
  font-size: inherit;
  text-decoration: none;
}
.linkbtn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- fields ---------- */
.inp,
.ta,
.sel {
  width: 100%;
  min-width: 0;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--field);
  color: var(--text);
  transition:
    border-color var(--fast),
    box-shadow var(--fast),
    background var(--fast);
}
.inp,
.sel {
  height: var(--tap);
  padding: 0 12px;
}
.ta {
  display: block;
  padding: 9px 12px;
  resize: none;
  line-height: 1.5;
  min-height: var(--tap);
}
.inp::placeholder,
.ta::placeholder {
  color: var(--text-3);
}
.inp:hover,
.ta:hover,
.sel:hover {
  border-color: var(--line-3);
}
.inp:focus,
.ta:focus,
.sel:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 163, 58, 0.18);
  background: #0c1214;
}
.inp:disabled {
  opacity: 0.55;
}
.sel {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a5b2ae' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.sel option {
  background: var(--surface-2);
}
.sel.sm {
  height: 32px;
  font-size: var(--t-sm);
  padding: 0 30px 0 10px;
  background-position: right 8px center;
  border-radius: var(--r-sm);
  width: auto;
}
input[type="search"]::-webkit-search-cancel-button {
  filter: invert(0.7);
}
.field {
  margin-top: 14px;
}
.field:first-child {
  margin-top: 0;
}
.flabel {
  display: block;
  margin-bottom: 6px;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--text-2);
}
.flabel small {
  font-weight: 400;
  color: var(--text-3);
  margin-left: 4px;
}
.fhint {
  margin: 6px 0 0;
  font-size: var(--t-xs);
  color: var(--text-3);
}
.ferr {
  margin: 6px 0 0;
  font-size: var(--t-sm);
  color: var(--danger);
}
.ferr:empty {
  display: none;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--t-sm);
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.searchbox {
  position: relative;
  flex: 1;
  min-width: 0;
}
.searchbox .ic {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.searchbox input {
  width: 100%;
  height: var(--tap);
  padding: 0 10px 0 34px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--field);
  transition:
    border-color var(--fast),
    box-shadow var(--fast);
}
.searchbox input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242, 163, 58, 0.18);
}

/* switch: <input type="checkbox" class="switch"> */
.switch {
  appearance: none;
  flex: none;
  position: relative;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 22px;
  background: #33424a;
  cursor: pointer;
  transition: background 0.18s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #dfe5e2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 0.18s var(--ease);
}
.switch:checked {
  background: var(--accent);
}
.switch:checked::after {
  transform: translateX(16px);
  background: #fff;
}
.switch:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.switch-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  min-height: var(--tap);
  cursor: pointer;
}
.switch-row + .switch-row {
  border-top: 1px solid var(--line);
}
.switch-row > span {
  flex: 1;
  min-width: 0;
}
.switch-row b {
  display: block;
  font-weight: 550;
}
.switch-row small {
  display: block;
  color: var(--text-3);
  font-size: var(--t-xs);
  line-height: 1.4;
  margin-top: 1px;
}

/* segmented control: <div class="seg"><button aria-checked="true"> */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r);
  background: var(--field);
  border: 1px solid var(--line);
}
.seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  font-weight: 550;
  font-size: var(--t-sm);
  white-space: nowrap;
  transition:
    background var(--fast),
    color var(--fast);
}
.seg button:hover {
  color: var(--text);
}
.seg button[aria-checked="true"] {
  background: var(--surface-4);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.seg.full {
  display: flex;
  width: 100%;
}
.seg.full button {
  flex: 1;
}

/* filter chips */
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: var(--s3) calc(-1 * var(--s4)) 0;
  padding: 0 var(--s4) 2px;
}
.chips.wrap {
  flex-wrap: wrap;
  overflow: visible;
  margin: 0;
  padding: 0;
}
.chips::-webkit-scrollbar {
  display: none;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 34px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--text-2);
  font-size: var(--t-sm);
  font-weight: 550;
  transition:
    background var(--fast),
    color var(--fast),
    border-color var(--fast);
}
.chip:hover {
  color: var(--text);
  border-color: var(--line-3);
}
.chip > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c);
}
.chip .ic {
  color: var(--c, currentColor);
}
.chip .n {
  font: 500 11px var(--f-mono);
  color: var(--text-3);
}
.chip[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: #0d1214;
}
.chip[aria-pressed="true"] .n {
  color: #4b5753;
}
.chip[aria-pressed="true"] .ic {
  color: #0d1214;
}

/* tags and badges */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 14%, transparent);
  white-space: nowrap;
}
/* the one way an unconfirmed spot is marked, everywhere */
.unc-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px dashed rgba(242, 193, 78, 0.6);
  color: var(--warn);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.catb {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 9px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 26%, transparent);
}
/* an item's own picture in place of the category icon */
.catb.pic {
  overflow: hidden;
  background: #11181c;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 55%, transparent);
}
.catb.pic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 3%;
}
.spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
/* touch screens: every control at least 40 px tall */
@media (pointer: coarse) {
  .btn.sm,
  .chip,
  .seg button,
  .sel.sm {
    min-height: var(--tap);
  }
  .ibtn.sm,
  .sel.sm {
    width: var(--tap);
    height: var(--tap);
  }
  .sel.sm {
    width: auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
