@font-face {
  font-family: 'Cubic 11';
  src: url('/static/fonts/Cubic_11.woff2') format('woff2');
  font-display: swap;
}

:root {
  --px: 3px;
  --gui: #c6c6c6;
  --gui-light: #ffffff;
  --gui-dark: #555555;
  --ink: #3f3f3f;
  --slot: #8b8b8b;
  --yellow: #ffff55;
  --green: #55ff55;
  --red: #ff5555;
  --aqua: #55ffff;
  --shadow: #1e1e1e;
  --hotbar-h: 84px;
  /* 像素角：把四個角各切掉一格 */
  --notch: polygon(
    var(--px) 0, calc(100% - var(--px)) 0, calc(100% - var(--px)) var(--px), 100% var(--px),
    100% calc(100% - var(--px)), calc(100% - var(--px)) calc(100% - var(--px)), calc(100% - var(--px)) 100%,
    var(--px) 100%, var(--px) calc(100% - var(--px)), 0 calc(100% - var(--px)), 0 var(--px), var(--px) var(--px)
  );
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: calc(var(--hotbar-h) + 24px);
  font: 18px/1.7 'Cubic 11', 'Microsoft JhengHei', sans-serif;
  color: #fff;
  background: #2b1d12;
  background-image: linear-gradient(rgba(0, 0, 0, .62), rgba(0, 0, 0, .62)), var(--tex-dirt, none);
  background-size: auto, 64px 64px;
  image-rendering: pixelated;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--aqua); }
img, canvas { image-rendering: pixelated; }

#fx { position: fixed; inset: 0; z-index: 90; pointer-events: none; }

.shadowed { text-shadow: 2px 2px 0 var(--shadow); }

/* ───── 介面視窗（物品欄那種灰色面板）───── */
.panel {
  position: relative;
  padding: 22px 24px;
  color: var(--ink);
  background: var(--gui);
  border: var(--px) solid #000;
  box-shadow: inset var(--px) var(--px) 0 var(--gui-light), inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 var(--gui-dark);
  clip-path: var(--notch);
}
.panel h2, .panel h3 { font-size: 24px; line-height: 1.4; font-weight: normal; margin-bottom: 8px; }
.panel a { color: #1a4fb8; }
.panel .muted { color: #6a6a6a; font-size: 14px; }

/* ───── 按鈕 ───── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 22px;
  font: inherit;
  font-size: 18px;
  color: #fff;
  text-decoration: none;
  text-shadow: 2px 2px 0 #3a3a3a;
  cursor: pointer;
  border: var(--px) solid #000;
  background: linear-gradient(rgba(120, 120, 120, .15), rgba(120, 120, 120, .15)), var(--tex-stone, #7f7f7f);
  background-size: auto, 48px 48px;
  box-shadow: inset var(--px) var(--px) 0 rgba(255, 255, 255, .45), inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 rgba(0, 0, 0, .45);
  overflow: hidden;
  transition: transform .06s;
}
.panel a.btn { color: #fff; }
.btn:hover, .btn:focus-visible {
  outline: none;
  border-color: #fff;
  color: #ffffa0;
  background-image: linear-gradient(rgba(90, 110, 220, .45), rgba(90, 110, 220, .45)), var(--tex-stone, none);
}
.btn:active { transform: translateY(3px); box-shadow: inset var(--px) var(--px) 0 rgba(0, 0, 0, .45); }
.btn-go { background-image: linear-gradient(rgba(60, 170, 60, .72), rgba(40, 140, 40, .72)), var(--tex-stone, none); }
.btn-go:hover, .btn-go:focus-visible { background-image: linear-gradient(rgba(90, 210, 90, .8), rgba(60, 170, 60, .8)), var(--tex-stone, none); }
.btn-warn { background-image: linear-gradient(rgba(200, 150, 40, .72), rgba(200, 150, 40, .72)), var(--tex-stone, none); }
.btn-no { background-image: linear-gradient(rgba(190, 50, 50, .72), rgba(190, 50, 50, .72)), var(--tex-stone, none); }
.btn-lg { min-height: 60px; padding: 8px 34px; font-size: 24px; }

/* 附魔光澤 */
.glint::after {
  content: '';
  position: absolute;
  inset: -50%;
  background: repeating-linear-gradient(115deg, transparent 0 22px, rgba(190, 120, 255, .38) 26px 34px, transparent 40px 64px);
  mix-blend-mode: screen;
  animation: glint 2.6s linear infinite;
  pointer-events: none;
}
@keyframes glint { to { transform: translateX(128px); } }

/* ───── 輸入框 ───── */
label { display: block; margin: 16px 0 6px; }
.field {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: #e0e0e0;
  background: #000;
  border: var(--px) solid #a0a0a0;
  caret-color: #fff;
}
.field:focus { outline: none; border-color: #fff; }
textarea.field { min-height: 120px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; }
.check input { width: 22px; height: 22px; margin-top: 4px; accent-color: #3c9a3c; }

.notice { margin: 0 0 16px; padding: 10px 14px; border: var(--px) solid #000; color: #fff; text-shadow: 2px 2px 0 rgba(0, 0, 0, .5); }
.notice.err { background: #a83232; }
.notice.warn { background: #b07a1e; }

/* ───── 物品欄格子與圖示 ───── */
.blk { display: inline-block; width: 40px; height: 40px; background: center / contain no-repeat; flex: none; }
.slot-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 0; max-width: 648px; margin: 0 auto; }
.inv-slot {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0;
  font: inherit;
  background: var(--slot);
  border: 0;
  box-shadow: inset var(--px) var(--px) 0 #373737, inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 #fff;
  cursor: help;
}
.inv-slot .blk { width: 68%; height: 68%; transition: transform .12s; }
.inv-slot:hover, .inv-slot:focus { outline: none; background: #b9b9c8; z-index: 5; }
.inv-slot:hover .blk, .inv-slot:focus .blk { transform: scale(1.2) translateY(-2px); }

/* 物品提示框 */
.tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  z-index: 20;
  width: max-content;
  max-width: min(280px, 80vw);
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
  color: #aaa;
  background: rgba(16, 0, 16, .95);
  border: 2px solid #2d0a63;
  outline: 2px solid rgba(16, 0, 16, .95);
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.tip b { display: block; font-weight: normal; font-size: 16px; color: #fff; }
.tip i { display: block; font-style: italic; color: #5b6bff; }
.inv-slot:hover .tip, .inv-slot:focus .tip { opacity: 1; visibility: visible; }
.inv-slot:nth-child(9n + 1) .tip, .inv-slot:nth-child(9n + 2) .tip { left: 0; transform: none; }
.inv-slot:nth-child(9n) .tip, .inv-slot:nth-child(9n + 8) .tip { left: auto; right: 0; transform: none; }

/* ───── 快捷欄（主選單）───── */
.hotbar {
  position: fixed;
  left: 50%;
  bottom: 10px;
  z-index: 80;
  display: flex;
  padding: var(--px);
  background: rgba(0, 0, 0, .72);
  border: var(--px) solid #1a1a1a;
  box-shadow: 0 0 0 var(--px) rgba(255, 255, 255, .16);
  transform: translateX(-50%);
}
.hotbar form { display: contents; }
.slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 72px;
  height: 66px;
  padding: 2px;
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
  color: #ddd;
  text-decoration: none;
  text-shadow: 1px 1px 0 #000;
  cursor: pointer;
  background: rgba(139, 139, 139, .35);
  border: var(--px) solid #5a5a5a;
  margin-left: calc(-1 * var(--px));
}
.slot:first-child { margin-left: 0; }
.slot .blk { width: 34px; height: 34px; transition: transform .12s; }
.slot:hover, .slot:focus-visible { outline: none; color: #fff; z-index: 2; border-color: #cfcfcf; }
.slot:hover .blk { transform: translateY(-3px) scale(1.12); }
.p-home .slot[data-k='home'], .p-apply .slot[data-k='apply'], .p-admin .slot[data-k='admin'] {
  z-index: 3;
  color: #fff;
  border-color: #fff;
  background: rgba(200, 200, 200, .4);
  box-shadow: 0 0 0 var(--px) #000, inset 0 0 0 1px #000;
}

.nameplate {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-size: 14px;
  background: rgba(0, 0, 0, .55);
}
.nameplate img, .nameplate .blk { width: 28px; height: 28px; }

/* ───── 進度提示 ───── */
.toast {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
  max-width: calc(100vw - 28px);
  padding: 10px 16px 10px 12px;
  font-size: 14px;
  line-height: 1.5;
  background: #212121;
  border: var(--px) solid #555;
  box-shadow: inset 0 0 0 var(--px) #000;
  animation: toast-in .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
.toast b { display: block; font-weight: normal; color: var(--yellow); }
.toast.out { animation: toast-out .5s ease-in both; }
@keyframes toast-in { from { transform: translateX(120%); } }
@keyframes toast-out { to { transform: translateX(120%); } }

/* ───── 首頁主視覺 ───── */
#hero {
  position: relative;
  height: 100vh;
  min-height: 620px;
  overflow: hidden;
  background: linear-gradient(#5aa0f0, #a8d0ff 70%, #d8ecff);
}
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; image-rendering: auto; }
#hero::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 22%;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
  pointer-events: none;
}
.hero-ui {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 9vh 16px 0;
  text-align: center;
  pointer-events: none;
}
.hero-ui > * { pointer-events: auto; }

.logo-wrap { position: relative; animation: drop-in .9s cubic-bezier(.2, 1.3, .4, 1) both; }
.logo {
  font-size: clamp(44px, 11vw, 108px);
  line-height: 1.05;
  font-weight: normal;
  letter-spacing: .04em;
  color: #e9e9e9;
  background: linear-gradient(rgba(255, 255, 255, .5), rgba(255, 255, 255, .1) 55%, rgba(0, 0, 0, .3)), var(--tex-stone, #bbb);
  background-size: auto, 48px 48px;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #5a5a5a) drop-shadow(0 3px 0 #3d3d3d) drop-shadow(0 3px 0 #222) drop-shadow(0 6px 0 rgba(0, 0, 0, .45));
}
.logo small {
  display: block;
  font-size: .42em;
  letter-spacing: .5em;
  margin: .25em -.5em 0 0;
}
.splash {
  position: absolute;
  right: -6%;
  bottom: 4%;
  font-size: clamp(16px, 2.6vw, 26px);
  color: #ffff00;
  text-shadow: 2px 2px 0 #3f3f00;
  white-space: nowrap;
  transform: rotate(-16deg);
  animation: splash .45s ease-in-out infinite alternate;
}
@keyframes splash { from { scale: 1; } to { scale: 1.09; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-60px) scale(1.15); } }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; animation: rise .7s .35s both; }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }

/* 玩家列表（像按 Tab 看到的那個）*/
.tab {
  min-width: 240px;
  padding: 8px 14px;
  font-size: 16px;
  background: rgba(0, 0, 0, .5);
  animation: rise .7s .55s both;
}
.tab .head { display: flex; align-items: center; justify-content: center; gap: 10px; }
.tab .dot { width: 12px; height: 12px; background: #888; box-shadow: 2px 2px 0 rgba(0, 0, 0, .6); }
.tab[data-state='on'] .dot { background: var(--green); animation: blink 1.4s steps(2) infinite; }
.tab[data-state='off'] .dot { background: var(--red); }
.tab[data-state='on'] .state { color: var(--green); }
.tab[data-state='off'] .state { color: var(--red); }
.tab .state { font-weight: normal; }
.tab .names { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 6px; max-width: 420px; margin: 0; padding: 0; list-style: none; }
.tab .names li { padding: 0 8px; background: rgba(255, 255, 255, .13); }
.tab .names:not(:empty) { margin-top: 6px; }
@keyframes blink { 50% { opacity: .45; } }

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--hotbar-h) + 26px);
  z-index: 2;
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  text-shadow: 2px 2px 0 #000;
  transform: translateX(-50%);
  animation: bob 1.2s ease-in-out infinite alternate;
}
.scroll-hint::after { content: '▼'; display: block; text-align: center; }
@keyframes bob { to { translate: 0 8px; } }

/* 載入畫面 */
.loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: #2b1d12;
  background-image: linear-gradient(rgba(0, 0, 0, .7), rgba(0, 0, 0, .7)), var(--tex-dirt, none);
  background-size: auto, 64px 64px;
  transition: opacity .8s, visibility .8s;
}
.loading.done { opacity: 0; visibility: hidden; }
.loading .bar { width: min(320px, 70vw); height: 14px; padding: 2px; border: 2px solid #fff; }
.loading .bar i { display: block; height: 100%; background: var(--green); animation: load 1.6s ease-out both; }
@keyframes load { from { width: 0; } to { width: 92%; } }

/* ───── 內容區 ───── */
.wrap { width: min(1080px, 100% - 32px); margin: 0 auto; padding: 72px 0 8px; }
.narrow { width: min(680px, 100% - 32px); }
.title { margin-bottom: 28px; font-size: clamp(26px, 5vw, 36px); font-weight: normal; text-align: center; text-shadow: 3px 3px 0 var(--shadow); }
.title::before, .title::after { content: '◆'; margin: 0 .6em; font-size: .5em; vertical-align: middle; color: var(--aqua); }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.step { display: flex; flex-direction: column; gap: 6px; }
.step .num { display: flex; align-items: center; gap: 12px; }
.step .num b { font-weight: normal; font-size: 36px; line-height: 1; color: #2f8f2f; text-shadow: 2px 2px 0 rgba(0, 0, 0, .18); }
.step .blk { width: 48px; height: 48px; animation: float 3s ease-in-out infinite alternate; }
.step:nth-child(2) .blk { animation-delay: -1s; }
.step:nth-child(3) .blk { animation-delay: -2s; }
.step p { flex: 1; }
.step .btn { align-self: flex-start; margin-top: 10px; }
@keyframes float { to { translate: 0 -6px; } }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px; text-align: center; }
.stat b { display: block; font-weight: normal; font-size: clamp(30px, 6vw, 48px); line-height: 1.2; color: #80ff20; text-shadow: 3px 3px 0 #1a3a00; }
.stat span { font-size: 14px; text-shadow: 2px 2px 0 #000; }

.reveal { transition: opacity .6s, transform .6s cubic-bezier(.2, 1.2, .4, 1); }
.js .reveal:not(.in) { opacity: 0; transform: translateY(36px) scale(.97); }
.reveal:nth-child(2) { transition-delay: .1s; }
.reveal:nth-child(3) { transition-delay: .2s; }

footer { margin-top: 64px; padding: 0 16px; font-size: 12px; text-align: center; color: #a9a9a9; text-shadow: 1px 1px 0 #000; }

/* ───── 申請進度 ───── */
.track { display: flex; margin: 18px 0 8px; padding: 0; list-style: none; }
.track li { position: relative; flex: 1; padding-top: 58px; font-size: 14px; text-align: center; color: #777; }
.track li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  background: var(--slot);
  box-shadow: inset var(--px) var(--px) 0 #373737, inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 #fff;
}
.track li::after { content: ''; position: absolute; top: 20px; left: calc(-50% + 26px); width: calc(100% - 52px); height: 6px; background: #8b8b8b; }
.track li:first-child::after { display: none; }
.track li.ok { color: #1f7a1f; }
.track li.ok::before { background: #4caf50 center / 60% no-repeat; box-shadow: inset var(--px) var(--px) 0 #a5e8a8, inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 #1f6a22; }
.track li.ok::after { background: #4caf50; }
.track li.now { color: var(--ink); }
.track li.now::before { background: #f0c020; box-shadow: inset var(--px) var(--px) 0 #fff3a8, inset calc(-1 * var(--px)) calc(-1 * var(--px)) 0 #946c00; animation: blink 1.2s steps(2) infinite; }
.big-name { font-size: 28px; color: #000; }

/* ───── 審核後台 ───── */
.cards { display: grid; gap: 18px; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.intro { margin: 10px 0; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; color: #e0e0e0; background: #000; border: var(--px) solid #a0a0a0; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 6px 10px; text-align: left; vertical-align: top; border-bottom: 2px solid #a8a8a8; }
th { font-weight: normal; color: #6a6a6a; white-space: nowrap; }
td { overflow-wrap: anywhere; }
.tag { display: inline-block; padding: 0 8px; color: #fff; white-space: nowrap; text-shadow: 1px 1px 0 rgba(0, 0, 0, .5); background: #777; }
.tag.done { background: #2f8f2f; }
.tag.approved { background: #2a7ab0; }
.tag.need_info { background: #b07a1e; }
.tag.rejected { background: #a83232; }
.log { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.log li { padding: 3px 0; border-bottom: 2px solid #b4b4b4; }
.log time { color: #6a6a6a; margin-right: 8px; }

.stack { display: grid; gap: 22px; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .slot { width: 66px; height: 60px; font-size: 11px; }
  .slot .blk { width: 30px; height: 30px; }
  .panel { padding: 18px 16px; }
  .splash { right: 0; bottom: -18%; }
  .nameplate span { display: none; }
  .tip { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
