@font-face {
  font-family: "Chakra Petch";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/chakra-petch-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2");
}

:root {
  --bg: #110d18;
  --bg-2: #160f1f;
  --card: #1d1528;
  --card-2: #251b33;
  --line: #3a2d52;
  --line-soft: #2b2140;
  --text: #f0eaf8;
  --muted: #b6aac9;
  --violet: #b98cff;
  --violet-strong: #8b4dff;
  --violet-deep: #4a1fa0;
  --ow: #7fd68a;
  --ne: #ff7e52;
  --warn: #ffc761;
  --info: #93b8ff;
  --radius: 6px;
  --font-head: "Chakra Petch", ui-sans-serif, system-ui, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 520px at 50% -180px, rgba(139, 77, 255, 0.22), transparent 70%),
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  color: var(--text);
  font: 16px/1.6 var(--font-body);
}

a { color: var(--violet); text-underline-offset: 3px; }
a:hover { color: #d7bdff; }

:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10;
  background: var(--violet); color: #12091f; padding: 8px 14px; border-radius: var(--radius);
}
.skip:focus { top: 12px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.prose-wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; letter-spacing: 0.005em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); margin: 0 0 12px; }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); margin: 0 0 10px; }
h3 { font-size: 1.15rem; margin: 0 0 6px; }

code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
code { background: var(--card-2); padding: 1px 5px; border-radius: 4px; }

/* ---------- Header and footer ---------- */

.site-header { border-bottom: 1px solid var(--line-soft); background: rgba(17, 13, 24, 0.7); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--font-head); font-size: 0.95rem; line-height: 1.05; }
.brand:hover { color: var(--text); }
.brand-mark { width: 22px; height: 28px; flex: none; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: var(--radius); font-size: 0.95rem; }
.site-nav a:hover { color: var(--text); background: var(--card); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--card-2); }

.site-footer { border-top: 1px solid var(--line-soft); margin-top: 72px; padding: 28px 0 40px; color: var(--muted); font-size: 0.92rem; }
.footer-row p { margin: 0 0 8px; }
.footer-row nav { display: flex; gap: 18px; margin: 0 0 12px; flex-wrap: wrap; }
.fine { font-size: 0.82rem; opacity: 0.85; }

/* ---------- Hero ---------- */

.hero { padding: 40px 0 20px; }
.hero p.lead { font-size: 1.12rem; color: var(--muted); max-width: 680px; margin: 0; }
.hero .rule {
  display: inline-flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 18px;
  font-family: var(--font-mono); font-size: 0.95rem; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
}
.hero .rule > span { white-space: nowrap; }
.hero .rule b { color: var(--ow); font-weight: 600; }
.hero .rule i { color: var(--ne); font-style: normal; font-weight: 600; }

/* ---------- Tool ---------- */

.tool { display: grid; gap: 20px; margin: 16px 0 8px; }

.edition { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.edition-label { color: var(--muted); font-size: 0.9rem; margin-right: 4px; }
.edition label {
  position: relative; cursor: pointer; padding: 6px 16px; border: 1px solid var(--line);
  border-radius: 999px; font-family: var(--font-head); font-size: 0.95rem; background: var(--card);
}
.edition input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.edition label:has(input:checked) { background: var(--violet-deep); border-color: var(--violet); color: #fff; }
.edition label:has(input:focus-visible) { outline: 2px solid var(--violet); outline-offset: 2px; }

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}
.card-lead { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }

.dims { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.dim { margin: 0; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 14px; min-width: 0; }
.dim legend { font-family: var(--font-head); font-size: 1rem; padding: 0 6px; display: flex; align-items: center; gap: 8px; }
.dim legend::before { content: ""; width: 12px; height: 12px; border-radius: 2px; }
.dim-overworld { border-color: rgba(127, 214, 138, 0.45); background: rgba(127, 214, 138, 0.05); }
.dim-overworld legend::before { background: var(--ow); }
.dim-nether { border-color: rgba(255, 126, 82, 0.5); background: rgba(255, 126, 82, 0.06); }
.dim-nether legend::before { background: var(--ne); }

.xyz { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.xyz label { display: grid; gap: 4px; font-family: var(--font-head); font-size: 0.85rem; color: var(--muted); }

input[type="number"], input[type="text"], select {
  width: 100%; min-width: 0; font: 500 1rem var(--font-mono); color: var(--text);
  background: #0d0a13; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 10px; min-height: 42px;
}
input[type="text"] { font-family: var(--font-body); }
select { font-family: var(--font-body); appearance: none; padding-right: 26px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus { border-color: var(--violet); outline: none; box-shadow: 0 0 0 3px rgba(185, 140, 255, 0.25); }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }
.dim-overworld input:focus { border-color: var(--ow); box-shadow: 0 0 0 3px rgba(127, 214, 138, 0.2); }
.dim-nether input:focus { border-color: var(--ne); box-shadow: 0 0 0 3px rgba(255, 126, 82, 0.2); }

/* The portal between the two panels */
.gate { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.gate-frame {
  width: 64px; height: 80px; padding: 12px;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.35) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(rgba(0,0,0,0.35) 1px, transparent 1px) 0 0 / 16px 16px,
    #2a1f3d;
  border-radius: 2px;
  box-shadow: 0 0 28px rgba(139, 77, 255, 0.35);
}
.gate-glow {
  width: 100%; height: 100%;
  background: linear-gradient(160deg, #d6b4ff, #8b4dff 45%, #4a1fa0 75%, #b98cff);
  background-size: 100% 300%;
  animation: shimmer 4s ease-in-out infinite alternate;
}
@keyframes shimmer { from { background-position: 0 0; } to { background-position: 0 100%; } }
.gate-ops { display: grid; gap: 2px; text-align: center; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

.answer { margin: 18px 0 0; padding: 14px 16px; border-radius: 8px; background: #0d0a13; border: 1px dashed var(--line); }
.answer p { margin: 0; }
.answer .big { font-family: var(--font-head); font-size: clamp(1.15rem, 2.6vw, 1.45rem); line-height: 1.3; }
.answer .coords { font-family: var(--font-mono); white-space: nowrap; }
.answer .note { color: var(--muted); font-size: 0.93rem; margin-top: 6px; }
.answer .warn { color: var(--warn); font-size: 0.93rem; margin-top: 6px; }
.c-ow { color: var(--ow); }
.c-ne { color: var(--ne); }

.converter-tools { display: grid; gap: 12px; margin-top: 16px; }
.paste { display: grid; gap: 4px; font-size: 0.88rem; color: var(--muted); }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  font: 600 0.95rem var(--font-head); color: var(--text); cursor: pointer;
  background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 14px; min-height: 42px;
}
.btn:hover { border-color: var(--violet); background: #2e2240; }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--text); background: var(--card-2); }

/* Portal list */
.plist-head, .prow { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr) repeat(3, minmax(0, 0.8fr)) 42px; gap: 8px; align-items: center; }
.plist-head { font-family: var(--font-head); font-size: 0.82rem; color: var(--muted); padding: 0 0 6px 14px; }
.plist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.prow { position: relative; padding-left: 14px; }
.prow::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 5px; border-radius: 3px; background: var(--ow); }
.prow[data-dim="nether"]::before { background: var(--ne); }
.fld { display: grid; gap: 2px; min-width: 0; }
.fl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon-btn { width: 42px; height: 42px; border-radius: var(--radius); border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 1.2rem; line-height: 1; }
.icon-btn:hover { color: var(--text); border-color: var(--ne); }
.plist-empty { color: var(--muted); padding: 12px 14px; border: 1px dashed var(--line); border-radius: 8px; }

.summary { margin: 18px 0 0; }
.summary:empty { display: none; }
.summary p { margin: 0; font-family: var(--font-head); font-size: 1.1rem; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 0.85rem; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); }
.chip-ok { color: var(--violet); border-color: rgba(185, 140, 255, 0.5); }
.chip-one { color: var(--warn); border-color: rgba(255, 199, 97, 0.5); }
.chip-new { color: var(--info); border-color: rgba(147, 184, 255, 0.5); }

.results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; margin-top: 16px; align-items: start; }
.results[hidden] { display: none; }
.map { margin: 0; position: sticky; top: 12px; }
.map-box { background: #0b0810; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.map svg { display: block; width: 100%; height: auto; }
.map figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; align-items: center; }
.lg { display: inline-block; width: 14px; height: 10px; margin-right: 4px; vertical-align: middle; font-style: normal; }
.lg-ow { background: var(--ow); border-radius: 50%; width: 10px; }
.lg-ne { background: var(--ne); }
.lg-two { height: 0; border-top: 2px solid var(--violet); }
.lg-one { height: 0; border-top: 2px dashed var(--warn); }
.lg-new { height: 10px; width: 10px; border: 1.5px dashed var(--info); }

.reports { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.report { border: 1px solid var(--line); border-left: 4px solid var(--violet); border-radius: 8px; padding: 12px 14px; background: rgba(13, 10, 19, 0.6); }
.report.one-way { border-left-color: var(--warn); }
.report.new-portal { border-left-color: var(--info); }
.report h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 1.05rem; }
.report p { margin: 4px 0 0; font-size: 0.95rem; }
.report .mono { white-space: nowrap; }
.report .flag { color: var(--warn); }
.report .fix { color: var(--text); background: var(--card-2); border-radius: 6px; padding: 8px 10px; margin-top: 8px; }
.report .fix b { color: var(--violet); }
.badge { font: 600 0.75rem var(--font-body); text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 999px; }
.badge-ok { background: rgba(185, 140, 255, 0.16); color: var(--violet); }
.badge-one { background: rgba(255, 199, 97, 0.15); color: var(--warn); }
.badge-new { background: rgba(147, 184, 255, 0.15); color: var(--info); }
.dimtag { font: 500 0.8rem var(--font-body); color: var(--muted); }
.report.is-hot { box-shadow: 0 0 0 2px var(--violet); }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%) translateY(20px);
  background: var(--violet); color: #12091f; font-weight: 600; padding: 10px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; margin: 0; z-index: 20; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Content ---------- */

.content { margin-top: 56px; }
.content section { margin: 0 0 44px; }
.content p, .content li { color: #ddd5ea; }
.content ul, .content ol { padding-left: 1.3em; }
.content li { margin: 4px 0; }
.content .callout { border-left: 3px solid var(--violet); background: var(--card); padding: 12px 16px; border-radius: 0 8px 8px 0; }

.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-left: 44px; margin: 0 0 14px; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px;
  display: grid; place-items: center; font-family: var(--font-head); color: #12091f; background: var(--violet); border-radius: 4px;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { font-family: var(--font-head); font-weight: 600; background: var(--card); }
tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--font-mono); white-space: nowrap; }

.faq details { border: 1px solid var(--line); border-radius: 8px; background: var(--card); margin: 0 0 10px; }
.faq summary { cursor: pointer; padding: 14px 16px; font-family: var(--font-head); font-size: 1.05rem; list-style: none; position: relative; padding-right: 40px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 16px; top: 12px; font-size: 1.3rem; color: var(--violet); }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 16px 6px; }

.diagram { margin: 18px 0; }
.diagram svg { width: 100%; height: auto; display: block; background: #0b0810; border: 1px solid var(--line); border-radius: 8px; }
.diagram figcaption { color: var(--muted); font-size: 0.88rem; margin-top: 8px; }

.legal h2 { margin-top: 32px; font-size: 1.3rem; }
.legal .updated { color: var(--muted); }

.notfound { text-align: center; padding: 60px 0 20px; }
.notfound .gate-frame { margin: 0 auto 24px; width: 96px; height: 120px; padding: 18px; }
.notfound .gate-glow { background: linear-gradient(160deg, #3a3346, #1d1726); }

.cta-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.cta { display: inline-block; text-decoration: none; font: 600 1rem var(--font-head); color: #12091f; background: var(--violet); padding: 10px 18px; border-radius: var(--radius); }
.cta:hover { color: #12091f; background: #d0b0ff; }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .results { grid-template-columns: 1fr; }
  .map { position: static; }
}

@media (max-width: 720px) {
  .card { padding: 16px; }
  .dims { grid-template-columns: 1fr; gap: 10px; }
  .gate { flex-direction: row; gap: 14px; }
  .gate-frame { width: 40px; height: 50px; padding: 7px; background-size: 10px 10px, 10px 10px, auto; }
  .gate-ops { grid-auto-flow: column; gap: 14px; }
  .plist-head { display: none; }
  .prow { grid-template-columns: repeat(12, minmax(0, 1fr)); padding: 8px 10px 10px 18px; border: 1px solid var(--line-soft); border-radius: 8px; background: rgba(13,10,19,0.5); }
  .prow::before { top: 10px; bottom: 10px; left: 7px; }
  .prow .f-name { grid-column: span 6; }
  .prow .f-dim { grid-column: span 6; }
  .prow .f-x, .prow .f-y, .prow .f-z { grid-column: span 4; }
  .prow .icon-btn { position: absolute; top: 2px; right: 4px; width: 32px; height: 26px; border: 0; font-size: 1.1rem; }
  .prow .fl { position: static; width: auto; height: auto; clip: auto; font-family: var(--font-head); font-size: 0.78rem; color: var(--muted); }
  .header-row { padding: 10px 16px; }
  .hero .rule { border-radius: 10px; }
}


@media (prefers-reduced-motion: reduce) {
  .gate-glow { animation: none; }
  .toast { transition: none; }
}
