/* ---------------------------------------------------------------- loading */
.loading__inner {
  width: min(460px, 100%);
  text-align: center;
}

.loading__stage {
  margin: 2.2rem 0 .9rem;
  font-size: .9rem;
  letter-spacing: .06em;
  color: var(--text-2);
  text-shadow: var(--hud-shadow);
}

.progress {
  height: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #0c0a07;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .7);
}

.progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  box-shadow: 0 0 12px -2px rgba(223, 169, 74, .7);
  transition: width 240ms var(--ease-out);
}

.loading__tip {
  margin: 1.4rem 0 0;
  min-height: 3em;
  font-size: .84rem;
  line-height: 1.6;
  color: var(--text-3);
}

/* ---------------------------------------------------------------- menu */
.menu__stack {
  display: grid;
  gap: clamp(1.75rem, 5vh, 3rem);
  width: min(360px, 100%);
  justify-items: stretch;
}

.menu__buttons { display: grid; gap: .55rem; }
.menu__row { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }

.menu__meta {
  margin: 0;
  text-align: center;
  font-size: .8rem;
  color: var(--text-3);
  text-shadow: var(--hud-shadow);
  min-height: 1.4em;
}

.menu__credit {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 14px;
  margin: 0;
  text-align: center;
  font-size: .72rem;
  letter-spacing: .04em;
  color: rgba(214, 205, 189, .5);
  text-shadow: var(--hud-shadow);
}

/* ---------------------------------------------------------------- tabs */
.tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--line-soft);
}

.tab {
  appearance: none;
  min-height: 44px;
  padding: .5rem .95rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-3);
  font-size: .87rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--t-fast) ease, border-color var(--t-fast) ease;
}

@media (hover: hover) and (pointer: fine) { .tab:hover { color: var(--text-2); } }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.tabpanel { display: grid; gap: .3rem; }

/* ---------------------------------------------------------------- setting rows */
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  align-items: center;
  gap: 1rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.row:last-child { border-bottom: 0; }

.row__label { display: grid; gap: .15rem; }
.row__label label { font-size: .9rem; font-weight: 600; }
.row__desc { font-size: .78rem; line-height: 1.45; color: var(--text-3); }
.row__value {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  text-align: right;
}

.row__control { display: grid; gap: .3rem; }

input[type="range"] {
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: var(--r);
  background: linear-gradient(90deg, var(--accent-soft) var(--pct, 50%), #0d0b08 var(--pct, 50%));
  border: 1px solid var(--line);
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 20px;
  margin-top: -8px;
  border: 1px solid #f0d79a;
  border-radius: var(--r);
  background: linear-gradient(180deg, #f0cd85, var(--accent-soft));
  box-shadow: var(--shadow-2);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: var(--r);
  background: #0d0b08;
  border: 1px solid var(--line);
}

input[type="range"]::-moz-range-progress { height: 6px; background: var(--accent-soft); }

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 18px;
  border: 1px solid #f0d79a;
  border-radius: var(--r);
  background: linear-gradient(180deg, #f0cd85, var(--accent-soft));
}

select, input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: .4rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #100e0a;
  color: var(--text);
  font-size: .88rem;
}

select { cursor: pointer; }

.switch {
  appearance: none;
  position: relative;
  width: 100%;
  min-height: 44px;
  padding: 0 .7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #100e0a;
  color: var(--text-2);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--t-fast) ease, border-color var(--t-fast) ease;
}

.switch::after {
  content: "";
  width: 34px;
  height: 18px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: #221d16;
  box-shadow: inset 12px 0 0 -10px var(--text-3);
  transition: box-shadow var(--t) var(--ease-out), background var(--t) ease;
}

.switch[aria-checked="true"] { color: var(--text); border-color: var(--accent-soft); }
.switch[aria-checked="true"]::after { background: var(--accent-dim); box-shadow: inset -12px 0 0 -10px var(--accent); }

.segmented { display: flex; gap: 2px; border: 1px solid var(--line); border-radius: var(--r); padding: 2px; background: #100e0a; }

.seg {
  appearance: none;
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text-3);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}

.seg.is-active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 246, 228, .08); }

/* ---------------------------------------------------------------- form */
.form { display: grid; gap: 1.1rem; }
.field { display: grid; gap: .4rem; border: 0; margin: 0; padding: 0; }
.field label, .field legend { font-size: .88rem; font-weight: 600; padding: 0; }
.field__hint { margin: 0; font-size: .78rem; font-weight: 400; color: var(--text-3); }
.form__warn {
  margin: 0;
  padding: .6rem .75rem;
  border: 1px solid #6d3325;
  border-left: 3px solid var(--danger);
  border-radius: var(--r);
  background: rgba(96, 40, 28, .25);
  color: #f0bdb1;
  font-size: .82rem;
}

/* ---------------------------------------------------------------- controls list */
.keys {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: .1rem 1.5rem;
  margin: 0;
}

.keys__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  border-bottom: 1px solid var(--line-soft);
}

.keys dt { color: var(--text-2); font-size: .87rem; }
.keys dd {
  margin: 0;
  display: flex;
  gap: 4px;
  flex: none;
}

kbd {
  display: inline-block;
  min-width: 26px;
  padding: .15rem .4rem;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--r);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: .74rem;
  text-align: center;
  color: var(--text);
}

/* ---------------------------------------------------------------- inventory */
.inv {
  display: grid;
  gap: 3px;
  justify-content: center;
  margin: 0 auto;
}

.inv--grid9 { grid-template-columns: repeat(9, var(--slot)); }
.inv__label {
  margin: 1rem 0 .4rem;
  font-size: .74rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-3);
}

#inv-hot { margin-top: 6px; }

.craft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.craft__grid { display: grid; gap: 3px; }
.craft__grid--2 { grid-template-columns: repeat(2, var(--slot)); }
.craft__grid--3 { grid-template-columns: repeat(3, var(--slot)); }

.craft__arrow {
  width: 34px;
  height: 24px;
  flex: none;
  background:
    linear-gradient(90deg, var(--text-3) 0 70%, transparent 70%) center/100% 6px no-repeat;
  position: relative;
  opacity: .75;
}

.craft__arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  translate: 0 -50%;
  border: 9px solid transparent;
  border-left-color: var(--text-3);
  border-right-width: 0;
}

.furnace {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.furnace__col { display: grid; gap: 10px; justify-items: center; }

.furnace__flame {
  width: 26px;
  height: 26px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom;
  image-rendering: pixelated;
  opacity: .25;
}

.furnace__progress {
  position: relative;
  width: 42px;
  height: 24px;
  background: linear-gradient(90deg, rgba(120, 112, 96, .3) 0 70%, transparent 70%) center/100% 6px no-repeat;
}

.furnace__progress i {
  position: absolute;
  left: 0;
  top: 50%;
  translate: 0 -50%;
  height: 6px;
  width: 0%;
  background: var(--accent);
  transition: width 120ms linear;
}

.slot--out { border-color: rgba(223, 169, 74, .35); background: rgba(52, 42, 26, .6); }
.slot--result { width: calc(var(--slot) + 8px); height: calc(var(--slot) + 8px); }

@media (hover: hover) and (pointer: fine) {
  .panel .slot:hover { border-color: rgba(255, 246, 228, .55); background: rgba(70, 60, 45, .7); }
}

.slot.is-drop-lit { border-color: var(--accent); }

/* ---------------------------------------------------------------- drag + tooltip */
#drag-item {
  position: fixed;
  z-index: 120;
  width: 46px;
  height: 46px;
  translate: -50% -50%;
  pointer-events: none;
}

#drag-item .slot__icon { inset: 0; filter: drop-shadow(3px 5px 4px rgba(0, 0, 0, .6)); }

#tooltip {
  position: fixed;
  z-index: 130;
  max-width: 260px;
  padding: .45rem .65rem;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(14, 11, 7, .96);
  box-shadow: var(--shadow-2);
  pointer-events: none;
  font-size: .82rem;
  line-height: 1.45;
}

#tooltip b { display: block; font-weight: 700; }
#tooltip span { color: var(--text-3); font-size: .76rem; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 640px) {
  :root { --slot: 42px; }
  .keys { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; gap: .4rem; }
  .row__value { text-align: left; }
}
