/* Alles im Minecraft-Raster: 1 GUI-Pixel = 2 CSS-Pixel, Schrift nur in Vielfachen von 8px */
@font-face { font-family: 'MC'; src: url(assets/mc.woff2) format('woff2'); font-display: block; }
* { box-sizing: border-box; border-radius: 0; }
[hidden] { display: none !important; }
html { background: #26313f; color-scheme: light; }
body {
  margin: 0; min-height: 100vh; font: 16px/20px 'MC', monospace; color: #fff;
  -webkit-font-smoothing: none; font-synthesis: none;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1;
  background: linear-gradient(#0006, #0009), url(assets/panorama.jpg) center / cover;
}
h1, h2, p, ul, ol { margin: 0; padding: 0; font-weight: normal; }
ul, ol { list-style: none; }
b, i { font-weight: normal; font-style: normal; }
b { color: #202020; }

header { position: relative; width: max-content; margin: 24px auto 20px; }
#logo { display: block; image-rendering: pixelated; max-width: calc(100vw - 32px); }
.splash {
  position: absolute; left: calc(100% + 6px); bottom: 2px; transform-origin: left; color: #ff0; text-shadow: 2px 2px #3f3f00;
  transform: rotate(-14deg); animation: splash 1s ease-in-out infinite alternate; white-space: nowrap;
}
@keyframes splash { to { transform: rotate(-14deg) scale(1.06); } }

main {
  display: grid; gap: 18px; padding: 0 18px; max-width: 1720px; margin: 0 auto; align-items: start;
  grid-template-columns: 356px minmax(0, 1fr) 356px;
}

/* Inventar-Fenster */
.panel {
  margin: 2px; padding: 14px 14px 16px; background: #c6c6c6; color: #3f3f3f;
  box-shadow: inset 4px 4px #fff, inset -4px -4px #555, 0 -2px #000, 0 2px #000, -2px 0 #000, 2px 0 #000;
}
.panel > * + * { margin-top: 6px; }
.panel h2 { display: flex; justify-content: space-between; font-size: 16px; line-height: 20px; }
.panel * + h2 { margin-top: 18px; }
.hint { color: #555; }

button, select, input { font: inherit; color: #fff; text-shadow: 2px 2px #3f3f3f; }
button, select {
  display: block; width: 100%; height: 40px; padding: 0 8px; cursor: pointer; text-align: center; text-align-last: center;
  background: none; appearance: none; image-rendering: pixelated;
  border: 6px solid transparent; border-image: url(assets/gui/button.png) 3 fill / 6px stretch; white-space: nowrap;
}
button:hover, button:focus-visible, select:hover, select:focus-visible { border-image-source: url(assets/gui/button_highlighted.png); outline: none; }
button:disabled { border-image-source: url(assets/gui/button_disabled.png); color: #a0a0a0; cursor: default; }
select option { background: #2b2b2b; color: #fff; text-align: left; }
.tabs button[aria-pressed=true] { border-image-source: url(assets/gui/button_disabled.png); color: #ffffa0; }
button.link { width: auto; height: 20px; padding: 0; border: 0; color: #3f3f3f; text-shadow: none; text-decoration: underline; text-underline-offset: 4px; }
button.link:hover, button.link:focus-visible { color: #fff; text-shadow: 2px 2px #3f3f3f; }

.slider { position: relative; display: block; height: 40px; }
.slider input {
  appearance: none; display: block; width: 100%; height: 40px; margin: 0; cursor: pointer; image-rendering: pixelated;
  background: none; border: 2px solid transparent; border-image: url(assets/gui/slider.png) 1 fill / 2px stretch;
}
.slider input { padding: 0; }
.slider input::-webkit-slider-runnable-track { height: 40px; margin: -2px; }
.slider input::-webkit-slider-thumb { appearance: none; width: 16px; height: 40px; background: url(assets/gui/slider_handle.png) 0 0 / 16px 40px; image-rendering: pixelated; }
.slider input::-moz-range-thumb { width: 16px; height: 40px; border: 0; border-radius: 0; background: url(assets/gui/slider_handle.png) 0 0 / 16px 40px; image-rendering: pixelated; }
.slider input:hover::-webkit-slider-thumb, .slider input:focus-visible::-webkit-slider-thumb { background-image: url(assets/gui/slider_handle_highlighted.png); }
.slider input:hover::-moz-range-thumb, .slider input:focus-visible::-moz-range-thumb { background-image: url(assets/gui/slider_handle_highlighted.png); }
.slider input:focus-visible { outline: none; }
.slider span { position: absolute; inset: 0; line-height: 40px; text-align: center; color: #fff; text-shadow: 2px 2px #3f3f3f; pointer-events: none; }

.row { display: flex; align-items: center; gap: 8px; }
.sizes label { flex: 1; display: flex; align-items: center; gap: 8px; }
input[type=number] {
  flex: 1; width: 0; height: 40px; padding: 0 8px; appearance: textfield; image-rendering: pixelated; background: none;
  border: 2px solid transparent; border-image: url(assets/gui/text_field.png) 1 fill / 2px stretch;
}
input[type=number]:focus { outline: none; border-image-source: url(assets/gui/text_field_highlighted.png); }
input::-webkit-inner-spin-button { display: none; }

/* Slots */
.slots { display: grid; grid-template-columns: repeat(9, 36px); justify-content: center; }
.slots button { width: 36px; height: 36px; padding: 2px; border: 0; background: url(assets/gui/slot.png) 0 0 / 36px 36px; }
.slots canvas, #materials canvas, #runs canvas { display: block; width: 32px; height: 32px; }
.slots button:hover, .slots button:focus-visible { box-shadow: inset 0 0 0 2px #fff; }
.slots button[aria-pressed=false] canvas { opacity: .18; filter: grayscale(1); }

#materials li { display: grid; grid-template-columns: 36px 1fr auto; gap: 0 10px; align-items: center; min-height: 42px; }
#materials .slot, #runs .slot { width: 36px; height: 36px; padding: 2px; background: url(assets/gui/slot.png) 0 0 / 36px 36px; image-rendering: pixelated; }
#materials { max-height: 396px; overflow-y: auto; scrollbar-color: #8b8b8b #c6c6c6; }
#materials small { font-size: 16px; color: #666; }
#materials div { line-height: 18px; }
details { padding-top: 4px; }
summary { cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
summary:hover, summary:focus-visible { color: #fff; text-shadow: 2px 2px #3f3f3f; outline: none; }
details p { margin-top: 10px; overflow-wrap: anywhere; }
details i { color: #20208a; }

/* Bühne */
.stage { position: sticky; top: 16px; }
.bar { display: flex; gap: 8px; margin-bottom: 8px; }
.bar .wide { flex: 1 1 200px; }
.tabs { flex: 2 1 360px; display: flex; gap: 4px; }
.view {
  position: relative; height: max(420px, calc(100vh - 262px)); background: #1b1b1bd9; margin: 2px;
  box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #555;
}
.planning .view { height: max(300px, calc(100vh - 426px)); }
#canvas { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); touch-action: none; cursor: grab; }
#canvas:active { cursor: grabbing; }
.planning #canvas { cursor: crosshair; }
.zoom { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 4px; }
.zoom button { width: 40px; }
.zoom #zoomFit { width: 76px; }
.drop { display: none; position: absolute; inset: 2px; place-items: center; background: #000b; font-size: 32px; text-shadow: 4px 4px #3f3f3f; pointer-events: none; }
.dragging .drop { display: grid; }
.status { display: flex; justify-content: space-between; gap: 16px; min-height: 20px; margin: 8px 2px 0; text-shadow: 2px 2px #3f3f3f; }
.status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hover { flex-shrink: 0; max-width: 70%; }

.plan { margin-top: 10px; }
.plan select { flex: 1 1 220px; min-width: 0; }
.plan button { flex: 0 0 44px; }
.plan output { flex: 0 0 170px; text-align: center; }
#runs { display: flex; flex-wrap: wrap; gap: 4px 14px; height: 76px; align-content: flex-start; overflow-y: auto; scrollbar-color: #8b8b8b #c6c6c6; }
#runs li { display: flex; align-items: center; gap: 6px; }

footer { max-width: 900px; margin: 28px auto 20px; padding: 0 18px; text-align: center; color: #d0d0d0; text-shadow: 2px 2px #2a2a2a; }

#tooltip {
  position: fixed; z-index: 9; left: 0; top: 0; padding: 6px 8px; pointer-events: none; white-space: pre; background: #100010f0;
  text-shadow: 2px 2px #3f3f3f; border: 2px solid; border-color: #28007f #28007f #1b0050; box-shadow: 0 -2px #100010f0, 0 2px #100010f0, -2px 0 #100010f0, 2px 0 #100010f0;
}

@media (max-width: 1279px) {
  main { grid-template-columns: 1fr 1fr; max-width: 900px; }
  .stage { grid-column: 1 / -1; grid-row: 1; position: static; min-width: 0; }
  .view, .planning .view { height: 60vh; min-height: 320px; }
}
@media (max-width: 779px) {
  main { grid-template-columns: minmax(0, 1fr); padding: 0 8px; }
  .splash { left: auto; right: 0; bottom: -34px; transform-origin: center; }
  header { margin-bottom: 52px; }
  .bar { flex-direction: column; }
  .bar .wide, .tabs { flex: none; width: 100%; }
  .slots { grid-template-columns: repeat(auto-fit, 36px); }
  .status { flex-direction: column; gap: 4px; }
  #hover { max-width: none; min-height: 20px; }
  .plan .row { flex-wrap: wrap; }
  .plan select { flex-basis: 100%; }
  .plan output { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { .splash { animation: none; } }
