﻿:root {
  --bg-0: #040611;
  --bg-1: #0a1030;
  --bg-2: #071a3b;
  --panel: rgba(10, 20, 46, 0.74);
  --panel-strong: rgba(8, 16, 38, 0.92);
  --line: rgba(80, 224, 255, 0.34);
  --line-soft: rgba(80, 224, 255, 0.16);
  --text: #e9f5ff;
  --muted: #9cb8ca;
  --accent: #5be7ff;
  --accent-2: #25b7ff;
  --danger: #ff5d8f;
  --radius: 16px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.44);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 18%, rgba(91, 231, 255, 0.14), transparent 38%),
    radial-gradient(circle at 85% 12%, rgba(37, 183, 255, 0.14), transparent 35%),
    linear-gradient(150deg, var(--bg-0), var(--bg-1), var(--bg-2));
  overflow-x: hidden;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 100%);
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(60px);
  z-index: -2;
  pointer-events: none;
}

.bg-glow-left {
  left: -140px;
  top: 20%;
  background: rgba(91, 231, 255, 0.22);
}

.bg-glow-right {
  right: -160px;
  top: 10%;
  background: rgba(37, 183, 255, 0.2);
}

.container-main {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding: 28px;
  min-height: 100vh;
}

.left-panel,
.center-panel,
.right-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-reveal {
  animation: panelIn 700ms ease-out both;
}

.center-panel.panel-reveal {
  animation-delay: 120ms;
}

.right-panel.panel-reveal {
  animation-delay: 220ms;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card,
.wide-card,
.output-card {
  background: linear-gradient(160deg, rgba(9, 24, 56, 0.86), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(9px);
  box-shadow: var(--shadow);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.card::before,
.wide-card::before,
.output-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  background: linear-gradient(130deg, rgba(91, 231, 255, 0.2), transparent 26%, transparent 74%, rgba(37, 183, 255, 0.2));
  pointer-events: none;
}

.draggable-block {
  position: relative;
  z-index: 1;
  user-select: auto;
}

.draggable-block button,
.draggable-block input,
.draggable-block textarea,
.draggable-block select,
.draggable-block label,
.draggable-block a,
.draggable-block [contenteditable="true"] {
  cursor: auto;
  user-select: auto;
  touch-action: auto;
}

.draggable-block.dragging {
  z-index: 30;
}

.drag-handle {
  display: inline-block;
  width: fit-content;
  cursor: grab;
  user-select: none;
}

.draggable-block.dragging .drag-handle {
  cursor: grabbing;
}

.resizable-block {
  min-width: 240px;
  min-height: 140px;
}

.draggable-block.resizing {
  z-index: 35;
  user-select: none;
}

.resize-handle {
  position: absolute;
  z-index: 40;
}

.resize-n {
  top: 0;
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: ns-resize;
}

.resize-s {
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: ns-resize;
}

.resize-e {
  top: 10px;
  right: 0;
  bottom: 10px;
  width: 8px;
  cursor: ew-resize;
}

.resize-w {
  top: 10px;
  left: 0;
  bottom: 10px;
  width: 8px;
  cursor: ew-resize;
}

.resize-ne {
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  cursor: nesw-resize;
}

.resize-nw {
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
}

.resize-se {
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
}

.resize-sw {
  left: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  cursor: nesw-resize;
}

h2,
h3 {
  margin-top: 0;
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.03em;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1rem;
}

button,
.file-input-btn {
  border: 1px solid rgba(91, 231, 255, 0.55);
  background: linear-gradient(115deg, rgba(91, 231, 255, 0.24), rgba(37, 183, 255, 0.2));
  color: var(--text);
  border-radius: 10px;
  padding: 10px 13px;
  margin-top: 10px;
  margin-bottom: 10px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.79rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

button:hover,
.file-input-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 231, 255, 0.15), 0 10px 24px rgba(0, 0, 0, 0.36);
}

input,
textarea {
  width: 100%;
  border-radius: 9px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  margin-top: 6px;
  margin-bottom: 10px;
  background: rgba(7, 17, 41, 0.74);
  color: var(--text);
  outline: none;
  transition: border-color 180ms ease, box-shadow 200ms ease;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(91, 231, 255, 0.15);
}

.output-count {
  max-width: 70px;
}

.search-box {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-bottom: 10px;
  background: linear-gradient(var(--panel-strong), rgba(8, 16, 38, 0));
}

.search-box button {
  width: 100%;
}

.item-list {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 6px;
}

#pasteArea {
  border: 1px dashed rgba(91, 231, 255, 0.76);
  min-height: 96px;
  border-radius: 12px;
  background: rgba(9, 26, 58, 0.78);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 12px;
}

#pasteArea img {
  max-width: 100%;
  max-height: 240px;
  border-radius: 10px;
}

.new-item-card {
  width: 320px;
  max-width: 340px;
}

.workspace-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
}

.workspace-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.paste-card {
  width: 500px;
  max-width: 620px;
}

.craft-card {
  width: 390px;
  align-items: center;
}

.craft-card h3 {
  text-align: center;
}

#craftGrid {
  border-collapse: collapse;
}

#craftGrid td {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(91, 231, 255, 0.42);
  background: rgba(7, 17, 41, 0.75);
  padding: 0;
  text-align: center;
}

#craftGrid td input {
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 0 3px;
  text-align: left;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: transparent;
  color: var(--text);
}

.buttons-row {
  display: flex;
  width: 100%;
  gap: 10px;
  flex-wrap: wrap;
}

.item-preview {
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  background: rgba(8, 20, 47, 0.62);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

.item-preview img {
  max-width: 60px;
  border-radius: 6px;
  vertical-align: middle;
}

.item-preview button {
  margin-right: 6px;
  padding: 6px 10px;
}

.result-panel {
  min-width: 370px;
  background: linear-gradient(160deg, rgba(209, 255, 255, 0.95), rgba(187, 246, 255, 0.92));
  color: #042033;
}

.result-panel button {
  color: #05253b;
  border-color: rgba(4, 32, 51, 0.3);
  background: linear-gradient(115deg, rgba(54, 215, 255, 0.45), rgba(8, 133, 232, 0.3));
}

#scrollTopBtn {
  position: fixed;
  right: 22px;
  bottom: 20px;
  z-index: 99;
  width: 46px;
  height: 46px;
  margin: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

#itemList {
  scrollbar-color: var(--accent-2) rgba(7, 17, 41, 0.72);
  scrollbar-width: thin;
}

#itemList::-webkit-scrollbar {
  width: 8px;
}

#itemList::-webkit-scrollbar-track {
  background: rgba(7, 17, 41, 0.72);
  border-radius: 10px;
}

#itemList::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 10px;
}

.minecraft-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 4, 14, 0.87);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  text-align: center;
  padding: 20px;
}

.minecraft-popup-image {
  width: min(300px, 92vw);
  border-radius: 12px;
  box-shadow: 0 0 24px rgba(91, 231, 255, 0.6);
}

.minecraft-popup-title {
  margin-top: 18px;
  margin-bottom: 8px;
}

.minecraft-popup-btn {
  margin-top: 18px;
}

@media (max-width: 1260px) {
  .container-main {
    flex-wrap: wrap;
    gap: 20px;
  }

  .workspace-layout {
    flex-direction: column;
  }

  .paste-card,
  .craft-card,
  .result-panel,
  .new-item-card,
  .wide-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
}

@media (max-width: 760px) {
  .container-main {
    padding: 14px;
  }

  .buttons-row button {
    width: 100%;
  }

  #craftGrid td {
    width: 32px;
    height: 32px;
  }

  button,
  .file-input-btn {
    font-size: 0.74rem;
    padding: 9px 10px;
  }
}
