@font-face {
  font-family: "Minecraft";
  src: url("/static/font/minecraft.ttf") format("truetype");
}

:root {
  --bg-color: #1a1a1a;
  --win-bg: #c6c6c6;
  --border-light: #ffffff;
  --border-dark: #373737;
  --text-color: #404040;
  --slot-bg: #8b8b8b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  margin: 0;
  height: 100vh;
  background-color: var(--bg-color);
  background-image: linear-gradient(
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  font-family: "Minecraft", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-color);
  overflow: hidden;
}

.scaler {
  transform: scale(2);
  transform-origin: center;
}

.window {
  background: var(--win-bg);
  width: 380px;
  padding: 8px;
  border: 3px solid transparent;
  border-top-color: var(--border-light);
  border-left-color: var(--border-light);
  border-right-color: var(--border-dark);
  border-bottom-color: var(--border-dark);
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.border-inset {
  border: 2px solid transparent;
  border-top-color: var(--border-dark);
  border-left-color: var(--border-dark);
  border-bottom-color: var(--border-light);
  border-right-color: var(--border-light);
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 2px;
}
.title {
  margin: 0;
  font-size: 18px;
  text-shadow: 1px 1px 0 #fff;
}

.controls {
  display: flex;
  gap: 4px;
}
.icon-btn {
  background: var(--slot-bg);
  border: 2px solid var(--border-dark);
  border-bottom-color: var(--border-light);
  border-right-color: var(--border-light);
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}
.icon-btn:active {
  border-width: 2px 0 0 2px;
}

/* Slider */
.slider-wrapper {
  background: #222;
  height: 80px;
  position: relative;
  padding: 0 16px;
  margin-top: 4px;
}
.slider-track {
  position: absolute;
  top: 40px;
  left: 16px;
  right: 16px;
  height: 2px;
}
.tick {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
}
.tick-label {
  position: absolute;
  top: -24px;
  transform: translateX(-50%);
  font-size: 10px;
  color: #fff;
  text-shadow: 1px 1px 0 #000;
}
.arrow {
  position: absolute;
  width: 20px;
  height: 20px;
  transform: translateX(-50%);
  cursor: grab;
  z-index: 10;
  display: flex;
  justify-content: center;
}
.arrow:active {
  cursor: grabbing;
  z-index: 20;
}
.arrow img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}
#arrowRed {
  top: 18px;
}
#arrowGreen {
  top: 42px;
}
.val-display {
  position: absolute;
  width: 30px;
  text-align: center;
  font-size: 10px;
  color: #fff;
  pointer-events: none;
  text-shadow: 1px 1px 0 #000;
}
#valRed {
  top: -12px;
}
#valGreen {
  bottom: -12px;
}

/* Recipe */
.recipe-box {
  background: var(--win-bg);
  padding: 4px;
  text-align: center;
}
.lbl-shadow {
  text-shadow: 1px 1px 0 #fff;
  font-size: 12px;
  margin-bottom: 4px;
}
.slots-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.slot {
  width: 44px;
  height: 44px;
  background: var(--slot-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid #555;
  border-right-color: #fff;
  border-bottom-color: #fff;
}
.slot:active {
  border: 2px solid #333;
  border-right-color: #aaa;
  border-bottom-color: #aaa;
}
.slot img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

/* Tabs */
.tab-bar {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  margin-bottom: 4px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 6px;
  font-size: 12px;
  cursor: pointer;
  background: #777;
  color: #ccc;
  border: 2px solid #333;
  text-shadow: 1px 1px 0 #000;
}
.tab.active {
  background: #1e1e1e;
  color: #fff;
  border-bottom: none;
}

.content-area {
  background: #1e1e1e;
  height: 180px; /* Увеличено, так как убрана кнопка Calculate */
  overflow-y: auto;
  color: #fff;
  padding: 4px;
  font-size: 12px;
  text-shadow: 1px 1px 0 #000;
}

.step-row {
  display: flex;
  align-items: center;
  padding: 4px 2px;
  border-bottom: 1px solid #333;
}
.step-row img {
  width: 16px;
  height: 16px;
  margin-right: 6px;
  image-rendering: pixelated;
  pointer-events: none;
}

/* History Item */
.hist-item {
  padding: 6px;
  border-bottom: 1px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #252525;
  margin-bottom: 2px;
}
.hist-info {
  flex: 1;
  cursor: pointer;
}
.hist-name {
  color: #ffff55;
  font-weight: bold;
  margin-bottom: 2px;
}
.hist-vals {
  color: #ccc;
  font-size: 10px;
}
.hist-del {
  color: #ff5555;
  cursor: pointer;
  padding: 0 5px;
  font-weight: bold;
  font-size: 14px;
}
.hist-del:hover {
  color: #ff0000;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  justify-content: center;
  align-items: center;
}
.modal-win {
  background: var(--win-bg);
  padding: 8px;
  width: 360px; /* Увеличено */
  border: 3px solid #fff;
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.5);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  margin-bottom: 8px;
  text-shadow: 1px 1px 0 #fff;
  color: #404040;
}
.close-btn {
  color: #a00;
  cursor: pointer;
  font-weight: bold;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.grid-item {
  background: var(--slot-bg);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid #373737;
  border-right-color: #fff;
  border-bottom-color: #fff;
}
.grid-item:active {
  border: 2px solid #333;
  border-right-color: #aaa;
  border-bottom-color: #aaa;
}
.grid-item img {
  width: 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

/* Toast */
.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #222;
  border: 2px solid #fff;
  color: #fff;
  padding: 10px 20px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 200;
  text-shadow: 1px 1px 0 #000;
  box-shadow: 5px 5px 0 #000;
}
.toast.show {
  opacity: 1;
}

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #000;
}
::-webkit-scrollbar-thumb {
  background: #888;
  border: 1px solid #fff;
}
