:root {
  --bg: #f5f3f8;
  --panel: #ffffff;
  --ink: #1d1a22;
  --muted: #6c6676;
  --line: #e4e0ea;
  --field: #f3f1f6;
  --accent: #7b3fe4;
  --nether: #c0392b;
  --chunk: #2b7bc0;
  --slime: #5cbd4a;
  --you: #e8590c;
  --map-bg: #efece4;
  --grid: rgba(0,0,0,.08);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(40,20,60,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131117;
    --panel: #1c1a21;
    --ink: #ece9f1;
    --muted: #9d97a8;
    --line: #2d2a34;
    --field: #24212a;
    --accent: #a77bff;
    --nether: #ff6b5b;
    --chunk: #64aef0;
    --slime: #4caf3c;
    --you: #ff922b;
    --map-bg: #22201a;
    --grid: rgba(255,255,255,.07);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }
header { padding: 44px 0 8px; }
h1 { margin: 0; font-size: clamp(30px, 6vw, 44px); letter-spacing: -0.02em; }
.lede { margin: 6px 0 0; color: var(--muted); font-size: 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 8px; }
.tabs a {
  text-decoration: none; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 14px;
}
.tabs a:hover { border-color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 22px; margin: 16px 0; box-shadow: var(--shadow); scroll-margin-top: 12px;
}
.card h2 { margin: 0 0 4px; font-size: 21px; display: flex; align-items: center; gap: 10px; }
.card h3 { font-size: 15px; margin: 20px 0 6px; }
.card > p.muted { margin: 0 0 14px; }
.dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.dot.nether { background: var(--nether); }
.dot.chunk { background: var(--chunk); }
.dot.slime { background: var(--slime); }

input[type=number], input[type=text] {
  width: 100%; font: 600 16px "JetBrains Mono", ui-monospace, monospace; color: var(--ink);
  background: var(--field); border: 1px solid transparent; border-radius: 8px; padding: 9px 10px;
}
input:focus { outline: none; border-color: var(--accent); }
input:disabled { opacity: .45; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
label.off { opacity: .55; }

.two { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; margin: 0; min-width: 0; }
legend { font-weight: 700; padding: 0 6px; }
.xyz { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.xyz.short { grid-template-columns: repeat(2, minmax(0, 160px)); }
.arrow { font-size: 24px; color: var(--muted); }
.answer { font-weight: 600; font-size: 17px; margin: 14px 0 6px; }
details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; color: var(--accent); }
details ul { margin: 8px 0 0; padding-left: 20px; }
details li { margin: 4px 0; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 16px 0 0; }
.facts dt { color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; font: 600 15px "JetBrains Mono", ui-monospace, monospace; overflow-wrap: anywhere; }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.controls label { width: 110px; }
.controls label.grow { flex: 1 1 240px; width: auto; }
.seg { display: flex; background: var(--field); border-radius: 10px; padding: 3px; align-self: end; }
.seg label { width: auto; display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg input:checked + span { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.map-wrap { position: relative; margin-top: 8px; }
canvas { width: 100%; height: auto; aspect-ratio: 1; display: block; border-radius: 10px; border: 1px solid var(--line); image-rendering: pixelated; cursor: crosshair; }
.tip {
  position: absolute; pointer-events: none; white-space: nowrap;
  background: var(--ink); color: var(--panel); font: 600 12px "JetBrains Mono", monospace;
  padding: 5px 8px; border-radius: 6px;
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin-top: 10px; font-size: 14px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }
.sw.slime { background: var(--slime); }
.sw.you { border: 3px solid var(--you); }
.nearest { margin: 0; padding-left: 22px; font: 14px/1.7 "JetBrains Mono", ui-monospace, monospace; }
.nearest:empty::before { content: "—"; color: var(--muted); }

.foot { color: var(--muted); font-size: 13px; padding-top: 28px; padding-bottom: 40px; }

@media (max-width: 560px) {
  .two { grid-template-columns: 1fr; }
  .arrow { text-align: center; transform: rotate(90deg); }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
  .controls label { width: calc(50% - 5px); }
  .tip { white-space: normal; max-width: 220px; }
}
