@font-face {
  font-family: "AccanthisADFStd-Regular";
  src:
    url("https://db.onlinewebfonts.com/t/c943a6bdda24d4d7316e1c88956174bf.woff2")
      format("woff2"),
    url("https://db.onlinewebfonts.com/t/c943a6bdda24d4d7316e1c88956174bf.woff")
      format("woff");
  font-display: swap;
}

:root {
  --bg-deep: #000;
  --bg-panel: #170a346e;
  --bg-panel-strong: #34056d4a;
  --border-purple: #34056d;
  --border-purple-lite: #490091;
  --accent: #7a46db;
  --accent-hover: #a179eb;
  --text: #fff;
  --text-dim: #a2a9b1;
  --green: #2cb491;
  --blue: #6b8edf;
  --dark: #101418;
  --slider-blue: #2f6fed;
  --slider-thumb: #5b9bff;
}

html {
  background-color: var(--bg-deep);
  min-height: 100%;
}
body {
  background-image:
    linear-gradient(rgba(0, 0, 0, 0) 0%, rgb(0, 0, 0) 100%),
    url("NullscapeBackgroundA.png");
  background-repeat: no-repeat, no-repeat;
  background-size:
    100% 56.25vw,
    100% 56.25vw;
  background-position:
    center -10vh,
    center -10vh;
  background-attachment: scroll, scroll;
  background-color: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  margin: 0;
  font-family: "Source Sans Pro", sans-serif;
  text-shadow:
    #000 0 0 2px,
    #000 0 0 2px;
  padding-bottom: 100px;
}

.page {
  max-width: 1000px;
  margin: 0 auto;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 1em 2em;
  background-color: rgba(0, 0, 0, 0.4);
}

h2,
h3,
h4 {
  font-family: "AccanthisADFStd-Regular", serif;
  font-weight: 500;
  color: var(--text);
  margin: 0.5em 0 0.25em;
  text-align: center;
}
h2 {
  font-size: 3em;
  background: linear-gradient(#000, #2a0057 30%);
  -webkit-text-stroke: 6px transparent;
  -webkit-background-clip: text;
  background-clip: text;
  text-align: center;
}
h3 {
  font-size: 2em;
  background: linear-gradient(#000, #3bc5fb 50%);
  -webkit-text-stroke: 4px transparent;
  -webkit-background-clip: text;
  background-clip: text;
  padding: 0;
}
h4 {
  font-size: 1.5em;
}

a {
  color: var(--accent);
  transition:
    color 0.3s,
    text-shadow 0.3s;
}
a:hover {
  text-shadow: 0 0 6px rgba(192, 143, 255, 0.6);
  color: var(--accent-hover);
}
a:visited {
  color: var(--accent);
}

input,
select,
button {
  background: var(--bg-panel-strong);
  color: var(--text);
  border: 2px solid var(--border-purple);
  border-radius: 3px;
  padding: 4px 8px;
  font: inherit;
}
input[type="number"] {
  width: 4em;
}
button {
  cursor: pointer;
  background: linear-gradient(#420087 30%, #000);
  border-color: var(--border-purple-lite);
}
button:hover {
  border-color: var(--accent-hover);
  text-shadow: 0 0 6px rgba(192, 143, 255, 0.6);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin: 0.5em 0 1.2em;
}
.stat {
  display: flex;
  align-items: center;
  background: var(--bg-panel);
  border: 3px solid var(--border-purple);
  border-radius: 3px;
  padding: 0.5em 1em;
}
.stat.over {
  border-color: #fd7865;
  color: #fd7865;
}
#cost {
  color: #fd7865;
}
#budget::after,
#cost::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  vertical-align: -3px;
  background: url("https://static.wikitide.net/nullscapewiki/thumb/3/35/GoldGiftIcon.png/20px-GoldGiftIcon.png")
    no-repeat center / contain;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: var(--bg-panel);
  border: 2px solid var(--border-purple);
  border-radius: 3px;
  padding: 2px 8px;
}
.toggle img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
  margin: 0.5em 0;
}

.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2em;
  align-items: flex-start;
  justify-content: center;
  margin: 0.5em 0 1em;
}
.field-stack {
  display: flex;
  flex-direction: column;
  gap: 1em;
}
.field {
  text-align: center;
}
.field-label {
  font-family: "AccanthisADFStd-Regular", serif;
  font-size: 1.3em;
  text-align: center;
  margin-bottom: 0.4em;
}

.settings-row .field input[type="number"],
.settings-row .field .toggle {
  box-sizing: border-box;
  height: 36px;
}

.diff-select {
  display: flex;
  flex-direction: column;
  width: 200px;
  border: 2px solid var(--border-purple-lite);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(#3a0a73, #2a0a52);
}
.diff-option {
  padding: 14px 16px;
  text-align: center;
  font-family: "AccanthisADFStd-Regular", serif;
  font-size: 1.4em;
  cursor: pointer;
  transition: background 0.15s;
}
.diff-option:hover {
  background: rgba(255, 255, 255, 0.08);
}
.diff-option.selected {
  background: rgba(255, 255, 255, 0.22);
}

.field .slider-control {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 280px;
}
.number-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.number-control input[type="number"] {
  text-align: center;
}
#money,
#level {
  -moz-appearance: textfield;
  appearance: textfield;
}
#money::-webkit-outer-spin-button,
#money::-webkit-inner-spin-button,
#level::-webkit-outer-spin-button,
#level::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.slider-btn {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1em;
  line-height: 1;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1 1 auto;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: var(--slider-blue);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--slider-thumb);
  border: 2px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: var(--slider-thumb);
  cursor: pointer;
}
input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: var(--slider-blue);
}
.slider-readout {
  position: relative;
  height: 2.4em;
  margin: 4px 36px 0;
}
.slider-value {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 1.3em;
  font-family: "AccanthisADFStd-Regular", serif;
  white-space: nowrap;
}
.slider-value::before {
  content: "";
  display: block;
  margin: 0 auto 2px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid var(--slider-thumb);
}

.grid {
  position: relative;
  z-index: 0;
  padding: 10px;
  background: linear-gradient(#140033bf, #05000cbf);
  border-radius: 3px;
  min-height: 110px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 5px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}
.grid::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  padding: 3px;
  border-radius: 3px;
  background: linear-gradient(#35038a, #1f0251);
  -webkit-mask:
    linear-gradient(#000 0 0) exclude,
    linear-gradient(#000 0 0) content-box;
  mask:
    linear-gradient(#000 0 0) exclude,
    linear-gradient(#000 0 0) content-box;
}
#obtained:empty::after {
  content: "No upgrades obtained yet.";
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  align-self: center;
  padding: 0.5em;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
  min-height: 100px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-purple);
  border-radius: 3px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.tile:hover {
  border-color: var(--accent-hover);
  box-shadow: 0 0 8px rgba(192, 143, 255, 0.5);
}
.tile img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.tile .placeholder {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.7em;
  color: var(--text-dim);
  background: rgba(52, 5, 109, 0.3);
  padding: 2px;
  box-sizing: border-box;
}
.tile .price {
  font-variant-numeric: tabular-nums;
  font-size: 0.95em;
  margin-top: 0;
  color: #fef6bb;
  -webkit-text-stroke: 0.5px black;
  paint-order: stroke fill;
}
.tile .price::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 3px;
  vertical-align: -3px;
  background: url("https://static.wikitide.net/nullscapewiki/thumb/3/35/GoldGiftIcon.png/20px-GoldGiftIcon.png")
    no-repeat center / contain;
}
.tile .stack-badge {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 0.7em;
  background: linear-gradient(#420087, #000);
  color: var(--text);
  padding: 1px 4px;
  border: 1px solid var(--border-purple-lite);
  border-radius: 3px;
}
.tile .level-badge {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 0.7em;
  background: linear-gradient(#420087, #000);
  color: var(--text);
  padding: 1px 4px;
  border: 1px solid var(--border-purple-lite);
  border-radius: 3px;
}

#tooltip {
  display: none;
  position: fixed;
  z-index: 100;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: pre-line;
  max-width: 260px;
  padding: 6px 10px;
  font-family: "AccanthisADFStd-Regular", serif;
  font-size: 1em;
  line-height: 1.35;
  color: var(--text);
  background: linear-gradient(#420087dd 30%, #000000dd);
  border: 2px solid var(--border-purple-lite);
  border-radius: 4px;
  text-shadow:
    #000 0 0 2px,
    #000 0 0 2px;
}
#tooltip .tip-name {
  font-weight: bold;
  font-size: 1.15em;
}
#tooltip .tip-desc {
  margin-top: 4px;
}
.tile.pending {
  background: linear-gradient(#1a2a6b, #0a1133);
  border-color: var(--blue);
  box-shadow: 0 0 8px rgba(107, 142, 223, 0.5);
}
.tile.locked {
  background: linear-gradient(#0d4b3a, #051d17);
  border-color: var(--green);
  box-shadow: 0 0 8px rgba(44, 180, 145, 0.5);
}
.tile.unaffordable {
  background: linear-gradient(#5a1410, #200705);
  border-color: #fd7865;
  box-shadow: 0 0 8px rgba(253, 120, 101, 0.5);
}
.tile.unaffordable .price {
  color: #fd7865;
}
.tile.unavailable {
  opacity: 0.4;
  cursor: default;
  filter: grayscale(0.5);
}
.tile.unavailable:hover {
  border-color: var(--border-purple);
  box-shadow: none;
}
