/* 俐方體11號 (Cubic 11) by ACh-K, SIL OFL 1.1 (assets/fonts/Cubic_11-OFL.txt):
   a pixel font made for Traditional Chinese. Headings, labels, pixel UI. */
@font-face {
  font-family: "Cubic 11";
  src: url("../assets/fonts/Cubic_11.woff2") format("woff2");
  font-display: swap;
}

/* Palette pulled from hub_blank.png. Dark is the default; light follows the
   system setting unless the visitor picks a theme (html[data-theme]). */
:root {
  color-scheme: dark;
  --bg: #0e1716;
  --bg-2: #1c2b2a;
  --panel: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.14);
  --teal-900: #003a3a;
  --teal-500: #429696;
  --teal-300: #99d2d2;
  --teal-100: #c7ffff;
  --gold: #fdd23c;
  --text: #e6f2f0;
  --muted: #a9bfbc;
  --accent: #c7ffff;      /* links, headings, brand */
  --accent-soft: #99d2d2; /* small labels */
  --heading: #ffffff;
  --gold-text: #fdd23c;   /* gold used as text */
  --topbar: rgba(14, 23, 22, 0.75);
  --code-bg: rgba(0, 58, 58, 0.7);
  --shadow: rgba(0, 0, 0, 0.55);
  --s: 2; /* navigator pixel scale — integers keep the art crisp */
  /* Latin in Nunito (real bold), Chinese in 粉圓 Huninn */
  --font-body: "Nunito", "Huninn", "Microsoft JhengHei", sans-serif;
  /* Cubic 11 is drawn on a 12 px grid: 12/24/36/48 px stay crisp */
  --font-pixel: "Cubic 11", monospace;
  --font-mono: "VT323", "Cubic 11", monospace;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #eef6f4;
    --bg-2: #d5ebe6;
    --panel: rgba(255, 255, 255, 0.7);
    --line: rgba(0, 58, 58, 0.16);
    --text: #12302d;
    --muted: #4b6865;
    --accent: #1d6b6b;
    --accent-soft: #2f7f7f;
    --heading: #0b3b3a;
    --gold-text: #9a6a00;
    --topbar: rgba(238, 246, 244, 0.8);
    --code-bg: rgba(66, 150, 150, 0.14);
    --shadow: rgba(0, 40, 40, 0.3);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef6f4;
  --bg-2: #d5ebe6;
  --panel: rgba(255, 255, 255, 0.7);
  --line: rgba(0, 58, 58, 0.16);
  --text: #12302d;
  --muted: #4b6865;
  --accent: #1d6b6b;
  --accent-soft: #2f7f7f;
  --heading: #0b3b3a;
  --gold-text: #9a6a00;
  --topbar: rgba(238, 246, 244, 0.8);
  --code-bg: rgba(66, 150, 150, 0.14);
  --shadow: rgba(0, 40, 40, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-2), var(--bg)) fixed;
  background-color: var(--bg);
  font-family: var(--font-body);
  line-height: 1.6;
}
a { color: var(--accent); }
code {
  font-family: var(--font-mono);
  font-size: 1.15em;
  background: var(--code-bg);
  border: 1px solid var(--teal-500);
  padding: 0 6px;
  border-radius: 4px;
  color: var(--accent);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
  background: var(--topbar);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--font-pixel);
  font-size: 24px; text-decoration: none; color: var(--accent);
}
.brand .name span { color: var(--gold-text); }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { height: 40px; width: auto; }
.links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.links a { text-decoration: none; color: var(--muted); font-weight: 600; }
.links a:hover { color: var(--accent); }
.links .discord { color: var(--gold-text); }
.topnav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; }
.controls { display: flex; align-items: center; gap: 8px; }
.ctl {
  display: inline-flex; align-items: center; gap: 8px; height: 34px;
  padding: 0 10px; cursor: pointer;
  font: 600 14px var(--font-body); color: var(--text);
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.ctl:hover { border-color: var(--teal-500); }
.ctl:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ctl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-btn .moon { display: none; }
:root[data-theme-now="dark"] .theme-btn .sun { display: none; }
:root[data-theme-now="dark"] .theme-btn .moon { display: block; }
/* on/off switch */
.switch {
  position: relative; width: 30px; height: 18px; border-radius: 999px;
  background: var(--line); transition: background 0.15s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
[aria-checked="true"] .switch { background: var(--teal-500); }
[aria-checked="true"] .switch::after { transform: translateX(12px); }

/* ---------- layout ---------- */
main { max-width: 980px; margin: 0 auto; padding: 0 24px; }
/* Wide screens: dock the navigator on the right and keep content beside it */
@media (min-width: 1280px) {
  body:has(.hub.open:not(.moved)) { padding-right: calc(var(--s) * 240px + 48px); }
}

.hero { padding: 88px 0 56px; }
.tag {
  display: inline-block; margin: 0 0 12px;
  font-family: var(--font-pixel); font-size: 12px;
  color: var(--accent-soft);
}
h1 {
  font-family: var(--font-pixel); font-weight: 400;
  font-size: clamp(36px, 6vw, 60px); line-height: 1.25; margin: 0 0 16px;
  color: var(--heading);
  text-shadow: 3px 3px 0 var(--line);
}
.lead { font-size: 18px; color: var(--muted); max-width: 620px; }

.ip-box {
  display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 10px 10px 10px 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
.ip-box code { font-size: 26px; border: 0; background: none; padding: 0; }

.btn {
  display: inline-block; cursor: pointer;
  font: 600 15px var(--font-body); text-decoration: none;
  color: var(--teal-900); background: var(--gold);
  border: 0; border-radius: 10px; padding: 10px 18px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--teal-500); box-shadow: none; }

.status { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status.online .dot { background: #5fe08a; box-shadow: 0 0 10px #5fe08a; }
.status.offline .dot { background: #e0605f; }

.block { padding: 48px 0; border-top: 1px solid var(--line); }
h2 {
  font-family: var(--font-pixel); font-weight: 400;
  font-size: 36px; margin: 0 0 20px; color: var(--accent);
}
h3 { margin: 0 0 4px; font-size: 18px; }
p { margin: 0 0 8px; }
.note { color: var(--muted); margin-top: 16px; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.steps li { display: flex; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; }
.steps b {
  flex: none; width: 36px; height: 36px; display: grid; place-items: center;
  font-family: var(--font-pixel); color: var(--teal-900); background: var(--teal-300); border-radius: 8px;
}
.steps p { color: var(--muted); }

.cards, .grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card, .feat { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card p, .feat p { color: var(--muted); }
.chip {
  display: inline-block; margin-bottom: 8px; padding: 2px 10px; border-radius: 999px;
  font: 12px var(--font-pixel); color: var(--teal-900); background: var(--teal-300);
}
.chip.folia { background: var(--gold); }

.events { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.events li { display: flex; gap: 18px; flex-wrap: wrap; padding: 14px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.events time { font-family: var(--font-pixel); color: var(--gold-text); min-width: 150px; }

.rules { padding-left: 22px; }
.rules li { margin-bottom: 8px; }
.rules li::marker { color: var(--gold-text); font-family: var(--font-pixel); }

.cta { text-align: center; }
.cta .btn { margin: 12px 6px 0; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 40px 24px 120px; }

/* ---------- hub navigator ---------- */
.hub {
  position: fixed; right: 24px; bottom: 24px; z-index: 30;
  transform: translateY(20px) scale(0.96); opacity: 0; visibility: hidden;
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}
.hub.open { transform: none; opacity: 1; visibility: visible; }
.hub { touch-action: none; }
.hub-art, .hub-title { cursor: grab; }
.hub.dragging, .hub.dragging * { cursor: grabbing !important; user-select: none; }
.hub.dragging { transition: none; }
@media (min-width: 1280px) {
  .hub { top: 50%; bottom: auto; transform: translateY(-50%) scale(0.96); }
  .hub.open { transform: translateY(-50%); }
}

/* No frame around the panel: the pixel art stands on its own */
.hub-glass { padding: 0; }

/* PIXEL LAYER: hard edges, integer scale */
.hub-device { position: relative; width: calc(var(--s) * 240px); height: calc(var(--s) * 131px); }
.hub-art {
  display: block; width: 100%; height: 100%;
  image-rendering: pixelated; user-select: none; -webkit-user-drag: none;
  filter: drop-shadow(0 calc(var(--s) * 4px) calc(var(--s) * 6px) var(--shadow));
}

.hub-title {
  font: calc(var(--s) * 8px) / 1 var(--font-mono);
  margin: 0 0 calc(var(--s) * 4px) calc(var(--s) * 39px);
  padding: calc(var(--s) * 2px) calc(var(--s) * 4px);
  width: max-content; max-width: calc(var(--s) * 162px);
  background: #c6c6c6; /* vanilla container title bar */
  border-radius: calc(var(--s) * 2px);
  white-space: nowrap; overflow: hidden;
}

/* Inventory slot: 18×18 source px, icon 16×16 inset by 1 — like in-game */
.slot {
  position: absolute; padding: calc(var(--s) * 1px); margin: 0; border: 0;
  width: calc(var(--s) * 18px); height: calc(var(--s) * 18px);
  background: transparent; cursor: pointer;
}
.slot:disabled { pointer-events: none; } /* empty slots: drag through to the art */
.slot img, .slot-ph {
  display: block; width: calc(var(--s) * 16px); height: calc(var(--s) * 16px);
  image-rendering: pixelated; pointer-events: none;
}
/* Vanilla hover: white wash over the 16×16 area */
.slot::after {
  content: ""; position: absolute; inset: calc(var(--s) * 1px);
  background: rgba(255, 255, 255, 0.5); opacity: 0; pointer-events: none;
}
.slot:not(:disabled):hover::after, .slot.cursor::after { opacity: 1; }
.slot:active:not(:disabled) img { transform: translateY(calc(var(--s) * 1px)); }
.slot:focus-visible { outline: calc(var(--s) * 1px) solid var(--gold); outline-offset: calc(var(--s) * -1px); }
.slot.cursor { outline: calc(var(--s) * 1px) solid var(--gold); outline-offset: calc(var(--s) * -1px); }
.slot.active::before {
  content: ""; position: absolute; left: calc(var(--s) * 4px); right: calc(var(--s) * 4px); bottom: 0;
  height: calc(var(--s) * 1px); background: var(--gold);
}
.slot-ph {
  display: grid; place-items: center;
  font: calc(var(--s) * 10px) / 1 var(--font-pixel); color: #fff;
  background: hsl(var(--h) 45% 40%);
  box-shadow: inset calc(var(--s) * -1px) calc(var(--s) * -1px) 0 rgba(0, 0, 0, 0.35),
              inset calc(var(--s) * 1px) calc(var(--s) * 1px) 0 rgba(255, 255, 255, 0.3);
  text-shadow: calc(var(--s) * 1px) calc(var(--s) * 1px) 0 rgba(0, 0, 0, 0.5);
}
.slot-count {
  position: absolute; right: 0; bottom: calc(var(--s) * -1px);
  font: calc(var(--s) * 9px) / 1 var(--font-mono); color: #fff;
  text-shadow: calc(var(--s) * 1px) calc(var(--s) * 1px) 0 #3f3f3f;
  pointer-events: none;
}

/* Vanilla-style item tooltip */
.hub-tip {
  position: absolute; z-index: 2; pointer-events: none;
  display: none; width: max-content; max-width: calc(var(--s) * 140px);
  padding: calc(var(--s) * 3px) calc(var(--s) * 4px);
  font: calc(var(--s) * 8px) / 1.15 var(--font-mono); color: #aa00aa;
  background: rgba(16, 0, 16, 0.94);
  border: calc(var(--s) * 1px) solid #2a0060;
  box-shadow: inset 0 0 0 calc(var(--s) * 1px) #5000a0;
  border-radius: calc(var(--s) * 1px);
  text-shadow: calc(var(--s) * 0.75px) calc(var(--s) * 0.75px) 0 rgba(0, 0, 0, 0.6);
}
.hub-tip.show { display: block; }
.tip-name { margin-bottom: calc(var(--s) * 2px); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; transition: 0.2s;
  font: 20px var(--font-mono); color: var(--teal-900);
  background: var(--teal-100); padding: 6px 16px; border-radius: 10px;
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* Scale steps: 3× on big monitors, 2× default, smaller on phones */
@media (min-width: 1800px) { :root { --s: 3; } }
/* After a drag the panel keeps its own spot (set inline by navigator.js) */
.hub.moved, .hub.moved.open { right: auto; bottom: auto; transform: none; }

@media (max-width: 560px) {
  /* 1.4× isn't an integer, but 1× is unreadable on a phone */
  :root { --s: 1.4; }
  .hub { right: 50%; bottom: 12px; transform: translate(50%, 20px); }
  .hub.open { transform: translate(50%, 0); }
  .topbar { flex-direction: column; align-items: flex-start; padding: 10px 16px; }
  main { padding: 0 16px; }
}
