/* ==========================================================================
   Roblox 小站 — 共用樣式
   設計語彙：Baseplate 網格底、積木紅、Studio 藍、等寬字當結構骨架
   ========================================================================== */

:root {
  --ground:   #EDEFEA;
  --surface:  #FDFDFC;
  --ink:      #1A2129;
  --muted:    #5E6A6E;
  --line:     #CFD5CC;
  --grid:     #E3E7E0;
  --brick:    #C93D24;
  --studio:   #1370AE;
  --ok:       #1F6B4C;
  --code-bg:  #1D2429;
  --code-ink: #DDE4E2;

  --f-sans: "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
  --f-mono: "Cascadia Mono", "Consolas", "SF Mono", Menlo, "Roboto Mono", monospace;

  --gut: 5.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground:   #14181B;
    --surface:  #1C2226;
    --ink:      #E4E9E4;
    --muted:    #96A09B;
    --line:     #2E363A;
    --grid:     #232A2E;
    --brick:    #FF7358;
    --studio:   #58B4F0;
    --ok:       #4FBF8B;
    --code-bg:  #0F1417;
    --code-ink: #DDE4E2;
  }
}

:root[data-theme="dark"] {
  --ground:   #14181B;
  --surface:  #1C2226;
  --ink:      #E4E9E4;
  --muted:    #96A09B;
  --line:     #2E363A;
  --grid:     #232A2E;
  --brick:    #FF7358;
  --studio:   #58B4F0;
  --ok:       #4FBF8B;
  --code-bg:  #0F1417;
  --code-ink: #DDE4E2;
}

:root[data-theme="light"] {
  --ground:   #EDEFEA;
  --surface:  #FDFDFC;
  --ink:      #1A2129;
  --muted:    #5E6A6E;
  --line:     #CFD5CC;
  --grid:     #E3E7E0;
  --brick:    #C93D24;
  --studio:   #1370AE;
  --ok:       #1F6B4C;
  --code-bg:  #1D2429;
  --code-ink: #DDE4E2;
}

/* ---------- reset ---------- */

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

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

body {
  background-color: var(--ground);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
ul, ol { list-style: none; }

a { color: var(--studio); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--studio);
  outline-offset: 2px;
}

/* ---------- 版面 ---------- */

.page {
  max-width: 46rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem 5rem;
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

/* ---------- 站台導覽列 ---------- */

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem 1.1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.9rem;
  margin-bottom: 0.5rem;
}

.site-nav .home {
  font-family: var(--f-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brick);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.site-nav .home svg { width: 1.35rem; height: 1.35rem; flex: none; }

.site-nav .links { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-left: auto; }
.site-nav .links a {
  font-size: 0.86rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.site-nav .links a:hover { color: var(--ink); border-bottom-color: var(--brick); }
.site-nav .links a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--brick); }

.theme-toggle {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.28rem 0.6rem;
  cursor: pointer;
  line-height: 1.6;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--muted); }

/* ---------- 頁首 ---------- */

.masthead { display: flex; flex-direction: column; gap: 1.25rem; }

.mark { width: 9rem; height: auto; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.mark .guy { animation: bob 3.4s ease-in-out infinite; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brick);
}

h1 {
  font-size: clamp(2.2rem, 6.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 .sub {
  display: block;
  font-family: var(--f-mono);
  font-weight: 400;
  font-size: 0.34em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.9rem;
}

.lede { font-size: 1.06rem; color: var(--muted); max-width: 34rem; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-top: 0.5rem;
}
.facts > div { background: var(--surface); padding: 0.85rem 1rem; }
.facts dt {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd { font-size: 0.95rem; font-weight: 600; line-height: 1.5; }

/* ---------- 首頁卡片 ---------- */

.deck {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.deck a {
  background: var(--surface);
  padding: 1.4rem 1.35rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
}
.deck a:hover { background: var(--ground); }
.deck a:hover h2 { color: var(--brick); }

.deck .card-ico { width: 2.6rem; height: 2.6rem; }
.deck .card-key {
  font-family: var(--f-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.deck h2 { font-size: 1.16rem; font-weight: 700; line-height: 1.45; }
.deck p { font-size: 0.9rem; color: var(--muted); line-height: 1.75; }
.deck .go {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--studio);
  margin-top: auto;
  padding-top: 0.6rem;
}

/* ---------- 步驟 ---------- */

.step { border-top: 2px solid var(--ink); padding-top: 1.1rem; }

.step-head {
  display: grid;
  grid-template-columns: var(--gut) 1fr;
  align-items: start;
  gap: 0 1.25rem;
  margin-bottom: 1.1rem;
}

.gutter { display: flex; flex-direction: column; align-items: flex-start; gap: 0.3rem; }

.stepicon { width: 2.75rem; height: 2.75rem; display: block; }

.num {
  font-family: var(--f-mono);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  color: var(--brick);
  font-variant-numeric: tabular-nums;
}

.step-head h2 {
  font-size: 1.42rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.mins {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.step-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-left: calc(var(--gut) + 1.25rem);
}

@media (max-width: 34rem) {
  :root { --gut: 3.1rem; }
  .step-body { padding-left: 0; }
  .stepicon { width: 2rem; height: 2rem; }
  .num { font-size: 1.5rem; }
  .mins { font-size: 0.6rem; }
}

/* ---------- 圖 ---------- */

.fig {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1rem 1rem 0.85rem;
  overflow-x: auto;
}
.fig svg { display: block; width: 100%; min-width: 26rem; height: auto; }
.fig figcaption {
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 0.5rem;
}
.fig text { font-family: var(--f-sans); }
.fig .t   { fill: var(--ink);    font-size: 13px; }
.fig .tb  { fill: var(--ink);    font-size: 13px; font-weight: 700; }
.fig .tm  { fill: var(--muted);  font-size: 11.5px; }
.fig .tk  { fill: var(--ink);    font-size: 17px; font-weight: 700; font-family: var(--f-mono); }
.fig .tv  { fill: var(--muted);  font-size: 12px; font-family: var(--f-mono); }
.fig .ta  { fill: var(--brick);  font-size: 12.5px; font-weight: 700; }
.fig .ts  { fill: var(--studio); font-size: 12.5px; font-weight: 700; }
.fig .tg  { fill: var(--ok);     font-size: 12.5px; font-weight: 700; }

/* ---------- 內文元件 ---------- */

ol.do, ul.plain { display: flex; flex-direction: column; gap: 0.55rem; }
ol.do { counter-reset: d; }
ol.do > li { position: relative; padding-left: 1.7rem; }
ol.do > li::before {
  counter-increment: d;
  content: counter(d) ".";
  position: absolute;
  left: 0;
  top: 0.15rem;
  font-family: var(--f-mono);
  font-size: 0.85rem;
  color: var(--muted);
}
ul.plain > li { position: relative; padding-left: 1.7rem; }
ul.plain > li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.82em;
  width: 0.55rem;
  height: 0.55rem;
  background: var(--line);
  border: 1px solid var(--muted);
}

strong { font-weight: 700; }
em { font-style: normal; color: var(--brick); font-weight: 700; }

kbd {
  font-family: var(--f-mono);
  font-size: 0.82em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  padding: 0.1em 0.42em;
  white-space: nowrap;
}

.ui {
  font-family: var(--f-mono);
  font-size: 0.86em;
  color: var(--studio);
  font-weight: 600;
}

pre {
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
}
pre code {
  font-family: var(--f-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  tab-size: 2;
  white-space: pre;
}

.note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--studio);
  padding: 0.85rem 1rem;
  font-size: 0.94rem;
}
.note .tag {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--studio);
  margin-bottom: 0.2rem;
}
.note .tag svg { width: 1.5em; height: 1.5em; flex: none; }
.note.warn { border-left-color: var(--brick); }
.note.warn .tag { color: var(--brick); }
.note.win { border-left-color: var(--ok); }
.note.win .tag { color: var(--ok); }

.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  cursor: pointer;
  margin-top: 0.2rem;
  user-select: none;
}
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--brick); cursor: pointer; }

/* ---------- 表格 ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; min-width: 30rem; background: var(--surface); }
th, td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.6;
  vertical-align: top;
}
th {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 400;
}
tbody tr:last-child td { border-bottom: 0; }

/* ---------- 段落區塊 ---------- */

.closer { border-top: 2px solid var(--ink); padding-top: 1.1rem; display: flex; flex-direction: column; gap: 1rem; }
.closer h2 { font-size: 1.24rem; font-weight: 700; display: flex; align-items: center; gap: 0.55rem; }
.closer h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.hico { width: 1.6em; height: 1.6em; flex: none; }

.tips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.tips > div {
  background: var(--surface);
  padding: 0.9rem 1.05rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.tips .tip-key {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--f-mono);
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ok);
}
.tips .tip-key svg { width: 1.6em; height: 1.6em; flex: none; }
.tips h3 { font-size: 0.97rem; font-weight: 700; line-height: 1.55; margin-top: 0; display: block; }
.tips p { font-size: 0.88rem; color: var(--muted); line-height: 1.75; }

/* ---------- 頁尾 ---------- */

.colophon {
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  line-height: 1.7;
}
.colophon a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 列印 ---------- */

@media print {
  :root, :root[data-theme="dark"], :root[data-theme="light"] {
    --ground: #FFFFFF; --surface: #FFFFFF; --ink: #000000; --muted: #555555;
    --line: #999999; --grid: #EEEEEE; --brick: #A8331C; --studio: #0E5A8A;
    --ok: #1B6042; --code-bg: #F4F4F4; --code-ink: #000000;
  }
  body { background-image: none; font-size: 11.5pt; line-height: 1.7; }
  .page { max-width: none; padding: 0; gap: 1.6rem; }
  .site-nav, .theme-toggle { display: none; }
  .step, .fig, .tips > div, .deck a { break-inside: avoid; page-break-inside: avoid; }
  pre { border: 1px solid #999; }
  .check input { -webkit-appearance: none; appearance: none; border: 1.5px solid #000; }
}
