:root {
  color-scheme: dark;
  --bg: #111316;
  --panel: #1b1f24;
  --panel-2: #23282e;
  --slot: #3b3f46;
  --slot-inner: #25292f;
  --text: #f3f0e8;
  --muted: #a7adba;
  --line: #343a42;
  --red: #a51f2d;
  --gold: #e0b75b;
  --green: #64bd6a;
  --aqua: #55d4df;
  --blue: #6aa8ff;
  --black: #08090b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, rgba(165, 31, 45, 0.22), transparent 34rem), var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #262b31;
  color: var(--text);
}

.mc-picker {
  position: relative;
  min-width: 0;
}

.mc-picker-button {
  position: relative;
  width: 100%;
  justify-content: flex-start;
  overflow: hidden;
  padding-right: 30px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mc-picker-button::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  transform: translateY(-35%);
}

.mc-picker-panel {
  position: absolute;
  z-index: 20;
  inset: calc(100% + 6px) 0 auto 0;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: #101317;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  padding: 8px;
}

.mc-picker-search {
  margin-bottom: 8px;
}

.mc-picker-list {
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 3px;
}

.mc-picker-option {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  overflow: hidden;
  padding: 0 8px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mc-picker-option:hover,
.mc-picker-option:focus-visible,
.mc-picker-option[aria-selected="true"] {
  border-color: var(--line);
  background: #262b31;
}

.mc-picker-empty {
  color: var(--muted);
  padding: 8px;
}

button {
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover,
button:focus-visible,
select:hover,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  border-color: var(--gold);
  outline: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.preview h2,
.section-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button:first-child {
  background: var(--red);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 48px) 48px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 31, 36, 0.94);
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.28);
}

.editor {
  min-height: 680px;
  overflow: hidden;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  border-bottom: 1px solid var(--line);
}

.tab {
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.tab:last-child {
  border-right: 0;
}

.tab.is-active {
  background: #262b31;
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--red);
}

.section {
  display: none;
  padding: 18px;
}

.section.is-active {
  display: block;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field-grid .wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101317;
  color: var(--text);
  min-height: 40px;
  padding: 9px 10px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.45;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.slot-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.selected-slot {
  display: grid;
  gap: 2px;
  min-width: 120px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101317;
  padding: 8px 10px;
}

.selected-slot span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.selected-slot strong {
  color: var(--gold);
  font-size: 18px;
}

.section-head,
.preview-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.preview-head > div {
  min-width: 140px;
}

#preview-title {
  line-height: 1.15;
  white-space: nowrap;
}

.rows {
  display: grid;
  gap: 12px;
}

.row-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 14px;
}

.row-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.row-grid.punish {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.row-grid.shop-item-row {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) auto;
  margin-top: 10px;
}

.row-grid.reward-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 0.7fr) auto;
}

.row-grid.kit-row,
.row-grid.shop-section-row,
.row-grid.vulcan-row,
.row-grid.offence-row,
.row-grid.daily-day-row {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
}

.row-grid.kit-item-row,
.row-grid.stage-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 0.8fr) auto;
}

.row-grid.command-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.nested-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.nested-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nested-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 19, 23, 0.52);
  padding: 12px;
}

.advanced-options {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.22);
  margin-top: 12px;
  padding: 10px 12px;
}

.advanced-options summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.advanced-options[open] summary {
  margin-bottom: 10px;
  color: var(--gold);
}

.advanced-options .field-grid,
.advanced-options .row-grid,
.advanced-options .toggle-grid {
  margin-top: 10px;
}

.advanced-options.nested-list {
  display: block;
}

.inline-check {
  align-self: end;
  margin-top: 0;
  min-height: 40px;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 8px 10px;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
}

.toggle-row span {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-head {
  margin-top: 22px;
}

.shop-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shop-section-head div {
  display: grid;
  gap: 2px;
}

.shop-section-head strong {
  font-size: 16px;
}

.shop-section-head span {
  color: var(--muted);
  font-size: 12px;
}

.row-card textarea {
  grid-column: 1 / -1;
}

.help {
  margin: 0 0 14px;
  color: var(--muted);
}

code {
  color: var(--gold);
}

.preview {
  position: sticky;
  top: 16px;
  height: fit-content;
  padding: 18px;
}

.preview-head select {
  min-height: 38px;
  padding: 0 10px;
}

.minecraft-window {
  image-rendering: pixelated;
  border: 4px solid #2b2b2b;
  border-top-color: #f0f0f0;
  border-left-color: #f0f0f0;
  border-right-color: #555;
  border-bottom-color: #555;
  background: #c6c6c6;
  box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #dbdbdb, inset 0 0 0 4px #8b8b8b;
  padding: 16px;
  color: #3f3f3f;
  font-family: "Minecraft", "Segoe UI", Tahoma, sans-serif;
}

.inventory-title {
  height: 24px;
  font-size: 16px;
  color: #2c2c2c;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 0;
  border: 2px solid #373737;
  border-right-color: #fff;
  border-bottom-color: #fff;
  background: #8b8b8b;
}

.slot {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px solid #8b8b8b;
  border-top-color: #373737;
  border-left-color: #373737;
  border-right-color: #fff;
  border-bottom-color: #fff;
  background: #8b8b8b;
  min-width: 0;
  cursor: pointer;
}

.slot.is-selected {
  outline: 3px solid #ffff55;
  outline-offset: -5px;
  z-index: 2;
}

.item {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 80%;
  height: 80%;
  border: 0;
  border-radius: 0;
  color: #111;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  text-shadow: none;
  background: transparent;
}

.item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.35));
}

.item.glow {
  border-radius: 2px;
  background: rgba(130, 80, 180, 0.42);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 120, 0.36), 0 0 12px rgba(190, 100, 255, 0.55);
}

.tooltip {
  position: absolute;
  z-index: 3;
  left: 62%;
  top: 62%;
  display: none;
  width: max-content;
  max-width: 260px;
  border: 2px solid #25155b;
  background: rgba(18, 8, 38, 0.96);
  color: #fff;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  text-align: left;
  pointer-events: none;
}

.slot:hover .tooltip {
  display: block;
}

.tooltip strong {
  display: block;
  margin-bottom: 4px;
  color: #ffdf60;
}

.message-preview {
  display: grid;
  gap: 8px;
  border: 4px solid #0b0c0f;
  background: rgba(0, 0, 0, 0.72);
  min-height: 220px;
  padding: 14px;
  font-family: Consolas, "Courier New", monospace;
}

.chat-line {
  color: #ddd;
}

.mc-red { color: #ff5555; }
.mc-dark-red { color: #aa0000; }
.mc-gold { color: #ffaa00; }
.mc-yellow { color: #ffff55; }
.mc-gray { color: #aaaaaa; }
.mc-dark-gray { color: #555555; }
.mc-white { color: #ffffff; }
.mc-green { color: #55ff55; }
.mc-aqua { color: #55ffff; }

.yaml-view {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.yaml-view summary {
  cursor: pointer;
  color: var(--gold);
  font-weight: 700;
}

.yaml-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.yaml-meta span,
.file-action {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11151b;
  padding: 7px 9px;
}

.yaml-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.yaml-toolbar button,
.file-action {
  min-height: 34px;
  font-size: 12px;
  text-align: center;
}

.file-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #f3df9b;
  cursor: pointer;
}

.file-action input {
  display: none;
}

.yaml-editor {
  width: 100%;
  min-height: 360px;
  max-height: 520px;
  resize: vertical;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c0e11;
  padding: 12px;
  color: #d6d9df;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
}

pre {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c0e11;
  padding: 12px;
  color: #d6d9df;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .preview {
    position: static;
  }
}

@media (max-width: 640px) {
  .field-grid,
  .row-grid,
  .row-grid.punish,
  .row-grid.kit-row,
  .row-grid.shop-section-row,
  .row-grid.vulcan-row,
  .row-grid.offence-row,
  .row-grid.daily-day-row,
  .row-grid.kit-item-row,
  .row-grid.stage-row,
  .row-grid.command-row {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}
