/* Server pages (<name>.mineworld.space): the page and its in-place editor. The theme comes in as
   custom properties on <body> (sp-core.js themeVars). Works down to 360px wide. */
@font-face { font-family: 'Silkscreen'; font-style: normal; font-weight: 700; font-display: swap; src: url(art/fonts/silkscreen-700-latin.woff2) format('woff2'); }
@font-face { font-family: 'Silkscreen'; font-style: normal; font-weight: 400; font-display: swap; src: url(art/fonts/silkscreen-400-latin.woff2) format('woff2'); }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(art/fonts/geist-latin.woff2) format('woff2'); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.sp {
  margin: 0; min-height: 100vh; background: var(--sp-bg); color: var(--sp-ink);
  font: 16px/1.55 'Geist', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background-image: radial-gradient(circle at 50% -10%, color-mix(in srgb, var(--sp-accent) 22%, transparent), transparent 55%);
  background-repeat: no-repeat;
}
.sp a { color: var(--sp-accent); }
.sp [hidden] { display: none !important; }
.sp a.sp-btn { color: var(--sp-ink); }
.sp a.sp-btn-pri, .sp .sp-btn-pri { color: var(--sp-on-accent); }
.sp :focus-visible { outline: 3px solid var(--sp-accent); outline-offset: 2px; }
.sp-skip { position: absolute; left: 8px; top: -60px; background: var(--sp-surface); color: var(--sp-ink); padding: 10px 14px; border-radius: 10px; z-index: 50; }
.sp-skip:focus { top: 8px; }
.sp-beta { margin: 0; padding: 8px 16px; text-align: center; font-size: 14px; line-height: 1.4; background: var(--sp-surface); color: var(--sp-ink); border-bottom: 1px solid color-mix(in srgb, var(--sp-ink) 18%, transparent); }
.sp-beta code { font-family: ui-monospace, Menlo, Consolas, monospace; }
.sp-ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sp-mono, .sp-addr-v { font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }
.sp-font-pixel .sp-name, .sp-font-pixel .sp-h { font-family: 'Silkscreen', 'Geist', system-ui, sans-serif; font-weight: 700; letter-spacing: .02em; }
main#sp-main { width: min(680px, 100%); margin: 0 auto; padding: 32px 16px 24px; outline: none; }

/* hero */
.sp-hero { text-align: center; display: grid; justify-items: center; gap: 10px; }
.sp-icon { width: 96px; height: 96px; image-rendering: pixelated; border-radius: 18px; background: var(--sp-surface); box-shadow: 0 0 0 1px var(--sp-line), 0 10px 30px rgba(0,0,0,.25); }
.sp-name { margin: 6px 0 0; font-size: clamp(1.6rem, 6vw, 2.4rem); line-height: 1.15; overflow-wrap: anywhere; }
.sp-motd { margin: 0; color: var(--sp-mute); max-width: 52ch; overflow-wrap: anywhere; background: #0d0d0d; padding: 6px 12px; border-radius: 8px; font-family: 'Geist Mono', ui-monospace, monospace; font-size: .92rem; color: #aaa; }
.sp-status { margin: 0; display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; font-weight: 600; color: var(--sp-mute); }
.sp-dot { width: 10px; height: 10px; border-radius: 50%; background: #9e9e9e; box-shadow: 0 0 0 3px color-mix(in srgb, #9e9e9e 30%, transparent); }
[data-sp-status="running"] .sp-dot { background: #4caf50; box-shadow: 0 0 0 3px rgba(76,175,80,.3); }
[data-sp-status="suspended"] .sp-dot { background: #e53935; }
.sp-sep { opacity: .5; }
.sp-join { width: 100%; margin-top: 10px; background: var(--sp-surface); border: 1px solid var(--sp-line); border-radius: 18px; padding: 16px; text-align: left; }
.sp-addr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; }
.sp-addr-l { grid-column: 1 / -1; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sp-mute); }
.sp-addr-v { font-size: clamp(1.05rem, 4.6vw, 1.5rem); font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.sp-tabs { display: flex; gap: 6px; margin: 14px 0 6px; border-bottom: 1px solid var(--sp-line); }
.sp-tabs button { appearance: none; background: none; border: 0; color: var(--sp-mute); font: inherit; font-weight: 600; padding: 8px 10px; border-bottom: 3px solid transparent; cursor: pointer; min-height: 44px; }
.sp-tabs button[aria-selected="true"] { color: var(--sp-ink); border-bottom-color: var(--sp-accent); }
.sp-steps { margin: 10px 0 0; padding-left: 1.4em; display: grid; gap: 6px; }
.sp-steps b { color: var(--sp-ink); }

/* buttons */
.sp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 10px 18px; border-radius: 14px; font: inherit; font-weight: 600;
  text-decoration: none; color: var(--sp-ink); background: var(--sp-surface); border: 1px solid var(--sp-line); cursor: pointer; transition: transform .12s ease, border-color .12s ease; }
.sp-btn:hover { border-color: var(--sp-accent); transform: translateY(-1px); }
.sp-btn-pri { background: var(--sp-accent); color: var(--sp-on-accent); border-color: transparent; }
.sp-btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.sp-link { appearance: none; background: none; border: 0; padding: 6px 4px; font: inherit; color: var(--sp-mute); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 32px; }
.sp-link:hover { color: var(--sp-ink); }

/* blocks */
.sp-blocks { display: grid; gap: 14px; margin-top: 22px; }
.spb { background: var(--sp-surface); border: 1px solid var(--sp-line); border-radius: 18px; padding: 18px; min-width: 0; overflow-wrap: anywhere; }
.sp-h { margin: 0 0 10px; font-size: 1.15rem; line-height: 1.3; }
.sp-prose p { margin: 0 0 .7em; } .sp-prose p:last-child { margin-bottom: 0; }
.spb-text .sp-prose, .spb-card .sp-prose, .sp-faq .sp-prose { color: color-mix(in srgb, var(--sp-ink) 88%, var(--sp-bg)); }
.sp-empty { margin: 0; color: var(--sp-mute); font-style: italic; }
.sp-card-in { display: flex; gap: 14px; align-items: flex-start; }
.sp-card-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--sp-accent) 20%, transparent); color: var(--sp-accent); flex: none; }
.sp-card-ic .sp-ic { width: 24px; height: 24px; }
.sp-card-img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; flex: none; }
.spb-links, .spb-vote { background: transparent; border: 0; padding: 0; }
.spb-links .sp-h, .spb-vote .sp-h { text-align: center; }
.sp-links { display: grid; gap: 10px; }
.sp-links .sp-btn { width: 100%; justify-content: flex-start; }
.sp-links .sp-btn span { flex: 1; text-align: center; }
.sp-vote .sp-n { flex: none !important; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: color-mix(in srgb, var(--sp-accent) 22%, transparent); font-size: .85rem; }
.sp-list { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.sp-list-checks { list-style: none; padding: 0; }
.sp-list-checks li { display: flex; gap: 8px; align-items: flex-start; }
.sp-check { color: var(--sp-accent); margin-top: 2px; }
.sp-figure { margin: -18px; }
.spb-image { overflow: hidden; }
.sp-figure img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: cover; }
.sp-figure figcaption { padding: 10px 18px 14px; color: var(--sp-mute); font-size: .92rem; }
.sp-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.sp-gallery a { display: block; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--sp-bg); }
.sp-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.sp-gallery a:hover img { transform: scale(1.04); }
.sp-discord { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.sp-discord > div { flex: 1 1 180px; }
.sp-discord p { margin: 0; color: var(--sp-mute); }
.sp-discord .sp-h { margin-bottom: 2px; }
.sp-discord-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: #5865f2; color: #fff; }
.sp-discord-ic .sp-ic { width: 28px; height: 28px; }
.sp-discord-widget { width: 100%; height: 340px; border: 0; border-radius: 12px; margin-top: 14px; background: var(--sp-bg); }
.sp-map { position: relative; border-radius: 14px; overflow: hidden; background: #000; }
.sp-map iframe { display: block; width: 100%; border: 0; }
.sp-map-s iframe { height: 260px; } .sp-map-m iframe { height: 380px; } .sp-map-l iframe { height: min(600px, 75vh); }
.sp-map-open { position: absolute; right: 10px; bottom: 10px; display: inline-flex; gap: 6px; align-items: center; padding: 8px 12px; border-radius: 10px; background: rgba(0,0,0,.7); color: #fff !important; text-decoration: none; font-weight: 600; font-size: .9rem; }
.sp-faq details { border-top: 1px solid var(--sp-line); }
.sp-faq details:first-child { border-top: 0; }
.sp-faq summary { cursor: pointer; padding: 12px 0; font-weight: 600; list-style-position: inside; min-height: 44px; }
.sp-faq .sp-prose { padding: 0 0 12px; }

/* just the map */
.sp-layout-map main#sp-main { width: 100%; max-width: none; padding: 0; }
.sp-maponly { position: relative; min-height: 100vh; }
.sp-maponly > iframe { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.sp-mapcard { position: relative; z-index: 2; width: min(420px, calc(100% - 24px)); margin: 12px; padding: 16px; border-radius: 20px; background: color-mix(in srgb, var(--sp-bg) 88%, transparent); backdrop-filter: blur(10px); box-shadow: 0 10px 40px rgba(0,0,0,.4); }
.sp-mapcard .sp-icon { width: 64px; height: 64px; }
.sp-mapcard .sp-join { padding: 12px; }
.sp-layout-map .sp-foot { position: relative; z-index: 2; width: min(420px, calc(100% - 24px)); margin: 0 12px 12px; border-radius: 14px; background: color-mix(in srgb, var(--sp-bg) 88%, transparent); }

.sp-note { text-align: center; color: var(--sp-mute); margin-top: 24px; }
.sp-missing { text-align: center; padding-top: 18vh !important; }
.sp-foot { width: min(680px, 100%); margin: 0 auto; padding: 18px 16px 40px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; color: var(--sp-mute); font-size: .92rem; }
.sp-brand { color: var(--sp-mute) !important; text-decoration: none; }
.sp-brand b { color: var(--sp-ink); }
.sp-foot-acts { display: inline-flex; flex-wrap: wrap; gap: 6px 12px; }
.sp-aiswitch[hidden] { display: none; }
/* "AI yes, AI no": with AI off, no AI control is shown (ai.js). */
[data-ai="off"] .ai-only { display: none !important; }

/* toasts and dialogs */
.sp-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; background: var(--sp-ink); color: var(--sp-bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.35); max-width: calc(100% - 32px); }
dialog.sp-dlg { width: min(520px, calc(100% - 24px)); max-height: calc(100vh - 32px); border: 1px solid var(--sp-line); border-radius: 18px; padding: 0; background: var(--sp-surface); color: var(--sp-ink); }
dialog.sp-dlg::backdrop { background: rgba(0,0,0,.6); }
.sp-dlg form, .sp-dlg .sp-dlg-in { padding: 20px; display: grid; gap: 12px; }
.sp-dlg h2 { margin: 0; font-size: 1.2rem; }
.sp-field { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
.sp-field small { font-weight: 400; color: var(--sp-mute); }
.sp-input { width: 100%; font: inherit; font-weight: 400; color: var(--sp-ink); background: var(--sp-bg); border: 1px solid var(--sp-line); border-radius: 10px; padding: 10px 12px; min-height: 44px; }
textarea.sp-input { min-height: 88px; resize: vertical; }
.sp-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.sp-radio { display: flex; gap: 8px; align-items: center; font-weight: 400; min-height: 32px; }

/* ---------- editor (sp-edit.js) ---------- */
.sp-editbtn { position: fixed; right: 16px; bottom: 16px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
body.sp-editing { padding-bottom: 96px; }
body.sp-editing .sp-editbtn { display: none; }
.sp-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #101410; color: #eef5ee; border-top: 1px solid rgba(255,255,255,.12); box-shadow: 0 -10px 30px rgba(0,0,0,.35); font: 15px/1.4 'Geist', system-ui, sans-serif; }
.sp-bar .sp-btn { min-height: 44px; padding: 8px 12px; background: #1d241d; color: #eef5ee; border-color: rgba(255,255,255,.14); }
.sp-bar .sp-btn-pri { background: #5cbf3a; color: #0b130a; }
.sp-btn-ai, .sp-bar .sp-btn-ai { background: linear-gradient(135deg, #6a4ff0, #1f9fb8); color: #fff; border-color: transparent; }
.sp-bar-state { flex: 1 1 140px; min-width: 0; color: #b5c6b5; font-size: .9rem; }
.sp-bar-state b { color: #fff; }
.sp-bar .sp-ic { width: 18px; height: 18px; }
@media (max-width: 520px) { .sp-bar { gap: 6px; } .sp-bar .sp-btn { flex: 1 1 0; min-width: 0; padding: 8px 0; } .sp-bar .sp-btn span.l { display: none; } .sp-bar-state { flex-basis: 100%; order: -1; } }
@media (min-width: 900px) { body.sp-sheet-open .sp-bar { right: 420px; } body.sp-sheet-open main#sp-main { margin-left: max(16px, calc((100% - 420px - 680px) / 2)); } }
body.sp-editing .sp-toast { bottom: 96px; }
@media (max-width: 520px) { body.sp-editing .sp-toast { bottom: 128px; } }
body.sp-editing .spb { position: relative; cursor: pointer; outline: 2px dashed transparent; outline-offset: 4px; transition: outline-color .12s ease; }
body.sp-editing .spb:hover, body.sp-editing .spb.sp-sel { outline-color: var(--sp-accent); }
body.sp-editing .spb.sp-dragging { opacity: .5; }
.sp-handle { position: absolute; top: -14px; right: 10px; display: flex; gap: 4px; z-index: 5; }
.sp-handle button { appearance: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); background: #101410; color: #fff; cursor: pointer; padding: 0; }
.sp-handle button:hover, .sp-handle button:focus-visible { background: #2a352a; }
.sp-handle .sp-grip { cursor: grab; touch-action: none; }
.sp-handle .sp-ic { width: 18px; height: 18px; }
.sp-drop { height: 6px; border-radius: 3px; background: var(--sp-accent); margin: -10px 0; }
.sp-sheet { position: fixed; z-index: 80; right: 0; top: 0; bottom: 0; width: min(420px, 100%); overflow-y: auto; background: #101410; color: #eef5ee; padding: 18px 18px 110px; box-shadow: -20px 0 40px rgba(0,0,0,.4);
  font: 15px/1.5 'Geist', system-ui, sans-serif; --sp-ink: #eef5ee; --sp-mute: #a9bba9; --sp-bg: #0b0f0b; --sp-surface: #172017; --sp-line: rgba(255,255,255,.14); }
.sp-sheet h2 { margin: 0 0 4px; font-size: 1.15rem; }
.sp-sheet .sp-sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.sp-sheet .sp-sheet-head h2 { flex: 1; }
.sp-sheet form { display: grid; gap: 14px; }
.sp-sheet fieldset { border: 1px solid rgba(255,255,255,.14); border-radius: 12px; padding: 10px 12px 12px; margin: 0; display: grid; gap: 8px; }
.sp-sheet legend { padding: 0 6px; font-weight: 600; }
.sp-item { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: start; padding-bottom: 8px; border-bottom: 1px dashed rgba(255,255,255,.12); }
.sp-item .sp-item-f { display: grid; gap: 6px; min-width: 0; }
.sp-icbtn { appearance: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(255,255,255,.16); background: #1d241d; color: #fff; cursor: pointer; padding: 0; }
.sp-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sp-swatch { appearance: none; border: 2px solid transparent; border-radius: 12px; padding: 8px; cursor: pointer; font: inherit; font-size: .85rem; display: grid; gap: 6px; text-align: left; min-height: 64px; }
.sp-swatch[aria-pressed="true"] { border-color: #fff; }
.sp-swatch i { display: block; height: 14px; border-radius: 4px; }
.sp-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sp-palette button { appearance: none; text-align: left; border: 1px solid rgba(255,255,255,.14); background: #1a221a; color: #eef5ee; border-radius: 12px; padding: 12px; cursor: pointer; font: inherit; display: grid; gap: 4px; min-height: 72px; }
.sp-palette button:hover, .sp-palette button:focus-visible { border-color: #5cbf3a; }
.sp-palette b { font-size: .98rem; } .sp-palette small { color: #a9bba9; line-height: 1.35; }
.sp-msg { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(92,191,58,.14); color: #cfeec4; }
.sp-msg.err { background: rgba(229,57,53,.16); color: #ffcdd2; }
.sp-enzica { border: 1px solid rgba(122,92,255,.5); background: linear-gradient(135deg, rgba(122,92,255,.18), rgba(60,200,224,.12)); border-radius: 14px; padding: 12px; display: grid; gap: 10px; }
@media (prefers-reduced-motion: reduce) { .sp *, .sp *::before, .sp *::after { transition: none !important; animation: none !important; } }

/* Minecraft colours (sp-core.js mcHTML) */
.mc-0{color:#000}.mc-1{color:#00a}.mc-2{color:#0a0}.mc-3{color:#0aa}.mc-4{color:#a00}.mc-5{color:#a0a}.mc-6{color:#fa0}.mc-7{color:#aaa}.mc-8{color:#555}.mc-9{color:#55f}.mc-a{color:#5f5}.mc-b{color:#5ff}.mc-c{color:#f55}.mc-d{color:#f5f}.mc-e{color:#ff5}.mc-f{color:#fff}
.mc-bo { font-weight: 700; } .mc-it { font-style: italic; } .mc-un { text-decoration: underline; } .mc-st { text-decoration: line-through; }
