/* 星原旅誌 — 基礎：色票、字體、外框、共用零件 */

:root {
  --f-sans: "Chiron GoRound TC", "Microsoft JhengHei UI", "Microsoft JhengHei", "PingFang TC", sans-serif;
  --f-serif: var(--f-sans);
  --f-hand: var(--f-sans);
  --f-num: "Barlow Condensed", "Chiron GoRound TC", "Microsoft JhengHei", sans-serif;

  --rail: 84px;
  --hud: 60px;
  --leaf: 14px;
  --leaf-s: 9px;

  --paper: #eaf2fa;
  --card: #ffffff;
  --card-2: #f3f7fc;
  --ink: #1c2743;
  --ink-2: #47557a;
  --ink-3: #8090ae;
  --line: #d2ddeb;
  --bar: #1c2743;
  --azure: #2a8fe8;
  --azure-deep: #1466c0;
  --teal: #12a99b;
  --sun: #ffcc33;
  --sun-deep: #b67600;
  --coral: #f2685f;
  --seal: #ee5566;
  --meadow: #3fa246;
  --marker: rgba(255, 204, 51, 0.4);
  --shade: 0 14px 30px -20px rgba(18, 44, 96, 0.55);
  --shade-up: 0 22px 40px -22px rgba(18, 44, 96, 0.6);

  --sky-img: url("../assets/sky/day.webp");
  --sky-pos: 50% 30%;
  --veil-a: rgba(234, 242, 250, 0.5);
  --veil-b: rgba(234, 242, 250, 0.93);
  --dots: rgba(28, 39, 67, 0.07);

  color-scheme: light;
}

[data-sky="dusk"] {
  --paper: #f7efe9;
  --card-2: #fbf5f0;
  --line: #e6d8cf;
  --ink: #2a2440;
  --ink-2: #5a4f70;
  --ink-3: #988aa6;
  --bar: #2a2440;
  --azure: #d9603f;
  --azure-deep: #b4411f;
  --sky-img: url("../assets/sky/dusk.webp");
  --sky-pos: 60% 40%;
  --veil-a: rgba(250, 238, 228, 0.42);
  --veil-b: rgba(247, 239, 233, 0.93);
  --shade: 0 14px 30px -20px rgba(90, 44, 40, 0.5);
}

[data-sky="night"] {
  --paper: #0b1230;
  --card: #151e40;
  --card-2: #1b264e;
  --ink: #edf2ff;
  --ink-2: #b4c0e0;
  --ink-3: #7c8ab2;
  --line: #2a3763;
  --bar: #080d24;
  --azure: #5fb6ff;
  --azure-deep: #9ad2ff;
  --teal: #45d3c3;
  --sun: #ffd65c;
  --sun-deep: #ffd65c;
  --coral: #ff8f85;
  --seal: #ff7689;
  --meadow: #7ed879;
  --marker: rgba(255, 214, 92, 0.22);
  --shade: 0 14px 30px -18px rgba(0, 0, 0, 0.8);
  --shade-up: 0 22px 40px -20px rgba(0, 0, 0, 0.9);
  --sky-img: url("../assets/sky/night.webp");
  --sky-pos: 50% 40%;
  --veil-a: rgba(11, 18, 48, 0.35);
  --veil-b: rgba(11, 18, 48, 0.92);
  --dots: rgba(255, 255, 255, 0.07);
  color-scheme: dark;
}

/* 分類代表色：夜間提亮 */
[style*="--t:"] {
  --tt: var(--t);
}

[data-sky="night"] [style*="--t:"] {
  --tt: color-mix(in srgb, var(--t) 62%, #fff);
}

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

html {
  background: var(--paper);
  scroll-padding-top: calc(var(--hud) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font: 400 15.5px/1.65 var(--f-sans);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5,
p,
dl,
dd,
ul,
ol,
figure {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg,
video {
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--azure);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--sun);
  color: #1c2743;
}

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font: 600 13px/1 var(--f-num);
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-width: 2.5px;
  border-radius: 6px;
}

.skip {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 99;
  padding: 10px 16px;
  font-weight: 700;
  color: #1c2743;
  background: var(--sun);
  border-radius: 8px;
}

.skip:focus {
  top: 12px;
}

/* ───── 天空：遊戲實景 ───── */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: var(--paper);
}

.backdrop::before {
  content: "";
  position: absolute;
  inset: -4%;
  background: var(--sky-img) var(--sky-pos) / cover no-repeat;
  animation: sky-drift 70s ease-in-out infinite alternate;
}

.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--veil-a) 0, var(--veil-b) 62vh);
}

body[data-page="home"] .backdrop::after {
  background: none;
}

@keyframes sky-drift {
  from {
    transform: scale(1) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.07) translate3d(-1.5%, -1%, 0);
  }
}

#sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s;
}

[data-sky="night"] #sky {
  opacity: 0.85;
}

/* ───── 側欄 ───── */

.rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 30;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 14px;
  color: #dfe6f7;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.05) 1px, transparent 1.4px) 0 0 / 9px 9px,
    linear-gradient(180deg, #1d2848 0, #141b37 100%);
  box-shadow: 10px 0 30px -22px rgba(0, 0, 0, 0.9);
}

.rail::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #ffcc33 0 72px, rgba(255, 255, 255, 0.1) 72px);
}

.rail-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.rail-mark svg {
  width: 38px;
  height: 38px;
  fill: #ffcc33;
  filter: drop-shadow(0 0 10px rgba(255, 204, 51, 0.55));
}

.rail-mark:hover {
  transform: rotate(90deg) scale(1.1);
}

.tabs {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  scrollbar-width: none;
}

.tab {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 7px 0 6px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: #aab5d3;
  transition: color 0.15s;
}

.tab i {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font: 900 16px/1 var(--f-sans);
  font-style: normal;
  color: #e8edfa;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  overflow: hidden;
  transition:
    transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1),
    background 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}

.tab i img {
  width: 84%;
  height: 84%;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.tab i img.face {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 12%;
  filter: none;
}

.tab:hover {
  color: #fff;
}

.tab:hover i {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.tab:hover i img {
  transform: scale(1.12) rotate(-4deg);
}

.tab[aria-current="page"] {
  color: #ffcc33;
  font-weight: 700;
}

.tab[aria-current="page"] i {
  background: #ffcc33;
  border-color: #ffcc33;
  box-shadow:
    0 0 0 2px #1c2743,
    0 0 0 4px #ffcc33;
}

.tab[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  background: #ffcc33;
  border-radius: 0 4px 4px 0;
}

.rail-foot {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding-top: 10px;
}

.traveler {
  position: relative;
  width: 52px;
  height: 52px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: #fff;
  border-radius: 50%;
  background:
    radial-gradient(circle closest-side, #1a2343 82%, transparent 84%),
    conic-gradient(#ffcc33 calc(var(--p, 0) * 1%), rgba(255, 255, 255, 0.16) 0);
  transition: transform 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.traveler:hover,
.traveler.on {
  transform: scale(1.1);
}

.traveler small {
  font: 600 10px/1 var(--f-num);
  letter-spacing: 0.12em;
  color: #ffcc33;
}

.traveler b {
  font: 700 21px/1 var(--f-num);
}

.sky-dial {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  transition:
    transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1),
    border-color 0.15s;
}

.sky-dial:hover {
  transform: rotate(40deg);
  border-color: #fff;
}

.dial-face {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffcc33;
  box-shadow: 0 0 0 4px rgba(255, 204, 51, 0.25);
  transition:
    background 0.3s,
    box-shadow 0.3s;
}

[data-sky="dusk"] .dial-face {
  background: linear-gradient(180deg, #ff9c4a 52%, transparent 52%);
  box-shadow: 0 0 0 4px rgba(255, 140, 90, 0.25);
}

[data-sky="night"] .dial-face {
  background: transparent;
  box-shadow: inset -6px -3px 0 0 #dfe8ff;
}

/* ───── 主舞台與頂欄 ───── */

.stage {
  margin-left: var(--rail);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hud {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--hud);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 clamp(16px, 3vw, 36px);
  background: color-mix(in srgb, var(--paper) 76%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.hud-brand {
  display: grid;
  flex: none;
  line-height: 1;
}

.hud-brand b {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.hud-brand small {
  margin-top: 4px;
  font: 600 10.5px/1 var(--f-num);
  letter-spacing: 0.3em;
  color: var(--azure-deep);
}

.crumbs {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
}

.crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.crumbs i {
  font-style: normal;
  font-size: 0;
}

.crumbs i::before {
  content: "›";
  font-size: 15px;
  color: var(--ink-3);
}

.crumbs b {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  color: var(--ink);
}

.crumbs b:only-child {
  display: none;
}

.hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.clock {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 14px 0 12px;
  color: #fff;
  background: var(--bar);
  border-radius: 999px;
  white-space: nowrap;
}

.clock b {
  display: flex;
  align-items: center;
  gap: 7px;
  font: 600 19px/1 var(--f-num);
  letter-spacing: 0.04em;
}

.clock b::before {
  content: "";
  width: 9px;
  height: 9px;
  background: #ffcc33;
  border-radius: 2px;
  transform: rotate(45deg);
}

.clock span {
  font-size: 12px;
  color: #aab5d3;
}

.clock em {
  font: 600 15px/1 var(--f-num);
  font-style: normal;
  color: #ffcc33;
  letter-spacing: 0.03em;
}

.finder {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 10px 0 13px;
  font-size: 13.5px;
  color: var(--ink-3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.finder:hover {
  border-color: var(--azure);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--azure) 20%, transparent);
  color: var(--ink);
}

.finder svg,
.field svg,
.fd-top svg,
.lobby-find svg {
  width: 17px;
  height: 17px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
}

main {
  flex: 1;
  outline: 0;
}

.wrap {
  width: min(1240px, 100% - clamp(28px, 6vw, 80px));
  margin-inline: auto;
}

.page {
  padding: 30px 0 70px;
  animation: page-in 0.32s both;
}

@keyframes page-in {
  from {
    opacity: 0.55;
    transform: translateY(8px);
  }
}

@keyframes drop-in {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

@keyframes stamp-down {
  0% {
    transform: scale(1.8);
    opacity: 0;
  }
  60% {
    transform: scale(0.92);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

.colophon {
  padding: 26px clamp(16px, 4vw, 48px) 34px;
  font-size: 12.5px;
  line-height: 1.9;
  color: var(--ink-3);
  text-align: center;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 80%, transparent);
}

.colophon-hand {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--ink-2);
}

.colophon-hand::before,
.colophon-hand::after {
  content: " ✦ ";
  color: var(--sun-deep);
}

.colophon a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ───── 共用零件 ───── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 22px;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 10px;
  white-space: nowrap;
  transition:
    transform 0.12s,
    box-shadow 0.12s,
    background 0.15s,
    color 0.15s;
}

.btn-ink {
  color: #1c2743;
  background: #ffcc33;
  box-shadow:
    0 4px 0 #c99400,
    0 10px 18px -8px rgba(201, 148, 0, 0.7);
}

.btn-ink:hover {
  background: #ffd95e;
  transform: translateY(-1px);
}

.btn-ink:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #c99400;
}

.btn-line {
  color: var(--ink);
  background: var(--card);
  box-shadow:
    inset 0 0 0 1.5px var(--ink),
    0 4px 0 color-mix(in srgb, var(--ink) 30%, transparent);
}

.btn-line:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-line:active {
  transform: translateY(4px);
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.btn-quiet {
  min-height: 36px;
  padding: 0 12px;
  font-weight: 500;
  color: var(--ink-2);
}

.btn-quiet:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
}

.mark-link {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--azure-deep);
  white-space: nowrap;
}

.mark-link::after {
  content: "›";
  display: inline-block;
  margin-left: 5px;
  transition: transform 0.2s;
}

.mark-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.mark-link:hover::after {
  transform: translateX(4px);
}

.push {
  margin-left: auto;
}

/* 字章：分類與屬性的小方塊 */
.seal {
  display: inline-grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  flex: none;
  font-weight: 900;
  font-style: normal;
  line-height: 1;
  color: var(--tt, var(--azure));
  background: color-mix(in srgb, var(--tt, var(--azure)) 14%, var(--card));
  border-radius: 28%;
}

.seal.fill {
  color: #fff;
  background: var(--tt, var(--azure));
}

/* 有對應圖示時：頭像或道具圖放在淡色底上 */
.seal.pic {
  background: color-mix(in srgb, var(--tt, var(--azure)) 18%, var(--card));
  overflow: hidden;
}

.seal.pic.fill {
  background: color-mix(in srgb, var(--tt, var(--azure)) 30%, var(--card));
}

.seal.pic img {
  width: 100%;
  height: 100%;
  padding: 7%;
  object-fit: contain;
}

.seal.pic img.face {
  padding: 0;
  object-fit: cover;
  object-position: 50% 12%;
}

.seal.round {
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--card);
}

.seal[data-el="火"] { --tt: #ef5a3c; }
.seal[data-el="水"] { --tt: #2f8fe8; }
.seal[data-el="風"] { --tt: #23b48a; }
.seal[data-el="雷"] { --tt: #9a5bea; }
.seal[data-el="冰"] { --tt: #3cbfd9; }
.seal[data-el="光"] { --tt: #e2a400; }
.seal[data-el="暗"] { --tt: #6957c9; }
.seal[data-el="地"],
.seal[data-el="土"],
.seal[data-el="岩"] { --tt: #b0793a; }
.seal[data-el="草"],
.seal[data-el="木"] { --tt: #57a83a; }
.seal[data-el="物"],
.seal[data-el="無"] { --tt: #7b869f; }

.stars {
  font-size: 13px;
  letter-spacing: 1px;
  color: var(--rc, var(--ink-3));
  white-space: nowrap;
}

[data-r="1"] { --rc: #8f9bb3; }
[data-r="2"] { --rc: #4fae5a; }
[data-r="3"] { --rc: #2f8fe8; }
[data-r="4"] { --rc: #9a5bea; }
[data-r="5"] { --rc: #eaa300; }
[data-r="6"],
[data-r="7"] { --rc: #f2685f; }

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  border-left: 3px solid var(--tt, var(--azure));
  border-radius: 3px;
}

.tag:empty {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 14px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  transition:
    transform 0.15s,
    border-color 0.15s,
    background 0.15s,
    color 0.15s;
}

.chip small {
  font: 600 12.5px/1 var(--f-num);
  color: var(--ink-3);
}

.chip:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: translateY(-1px);
}

.chip[aria-pressed="true"],
.chip[aria-current="page"] {
  color: #fff;
  background: var(--bar);
  border-color: var(--bar);
  font-weight: 700;
}

[data-sky="night"] .chip[aria-pressed="true"],
[data-sky="night"] .chip[aria-current="page"] {
  color: #1c2743;
  background: var(--sun);
  border-color: var(--sun);
}

.chip[aria-pressed="true"] small,
.chip[aria-current="page"] small {
  color: inherit;
  opacity: 0.7;
}

.sec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(var(--ink), var(--ink)) left bottom / 76px 3px no-repeat;
}

.sec-head .no {
  flex: none;
  width: 13px;
  height: 13px;
  margin: 0 5px 0 4px;
  font-size: 0;
  background: var(--sun);
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow:
    0 0 0 3px var(--paper),
    0 0 0 4.5px var(--ink);
}

.sec-head h2 {
  font-size: 24px;
}

.sec-head p {
  font-size: 13.5px;
  color: var(--ink-3);
}

.paper {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--leaf);
  box-shadow: var(--shade);
}

.hand {
  color: var(--ink-2);
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  color: var(--ink-3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.field:focus-within {
  border-color: var(--azure);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--azure) 20%, transparent);
}

.field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--ink);
}

input::placeholder {
  color: var(--ink-3);
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

select {
  height: 40px;
  padding: 0 34px 0 12px;
  background:
    linear-gradient(45deg, transparent 50%, var(--ink-2) 50%) right 17px center / 6px 6px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--ink-2) 50%) right 11px center / 6px 6px no-repeat,
    var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  appearance: none;
  cursor: pointer;
}

select:hover {
  border-color: var(--ink-3);
}

input[type="range"] {
  width: 100%;
  height: 24px;
  background: none;
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--line);
  border-radius: 6px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  appearance: none;
  background: var(--sun);
  border: 2.5px solid var(--bar);
  border-radius: 4px;
  transform: rotate(45deg);
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--line);
  border-radius: 6px;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--sun);
  border: 2.5px solid var(--bar);
  border-radius: 4px;
  transform: rotate(45deg);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--azure);
}

.bar {
  display: block;
  height: 6px;
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  border-radius: 6px;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--tt, var(--sun));
  border-radius: 6px;
  transition: width 0.5s;
}

.blank {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 54px 20px;
  text-align: center;
  color: var(--ink-3);
  border: 1.5px dashed var(--line);
  border-radius: var(--leaf);
}

.blank .seal.pic {
  width: 76px;
  height: 76px;
  background: none;
}

.blank .seal {
  font-size: 24px;
  margin-bottom: 6px;
}

.blank b {
  font-size: 17px;
  color: var(--ink);
}

.blank .btn {
  margin-top: 10px;
}

/* ───── 對話框：搜尋與說明 ───── */

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: none;
}

dialog::backdrop {
  background: rgba(10, 16, 40, 0.55);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.fd-box {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.finder-dialog {
  width: min(680px, calc(100vw - 24px));
  margin-top: 9vh;
}

.finder-dialog[open] .fd-box {
  animation: drop-in 0.22s cubic-bezier(0.2, 1.3, 0.4, 1);
}

.fd-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 20px;
  border-bottom: 2px solid var(--ink);
}

.fd-top input {
  flex: 1;
  min-width: 0;
  height: 54px;
  font-size: 19px;
  font-weight: 500;
  border: 0;
  outline: 0;
  background: none;
}

.icon-x {
  width: 36px;
  height: 36px;
  flex: none;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-3);
  border-radius: 50%;
}

.icon-x:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 9%, transparent);
}

.fd-scopes {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--card-2);
}

.fd-scopes .chip {
  min-height: 28px;
  padding: 0 11px;
  font-size: 12.5px;
}

.fd-list {
  max-height: min(52vh, 460px);
  overflow-y: auto;
  padding: 6px 8px 8px;
  scrollbar-width: thin;
}

.fd-label {
  padding: 8px 10px 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.fd-row {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 6px 8px;
  border-radius: 10px;
}

.fd-row .pic {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--card-2);
  border-radius: 10px;
  overflow: hidden;
}

.fd-row .pic .seal.pic {
  width: 100%;
  height: 100%;
  background: none;
  border-radius: 0;
}

.fd-row .pic img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.fd-row strong {
  display: block;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fd-row small {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fd-row mark {
  color: inherit;
  background: var(--marker);
  border-radius: 3px;
}

.fd-row em::before {
  content: "Enter ↵";
  font: 600 12px/1 var(--f-num);
  font-style: normal;
  color: var(--ink-3);
  opacity: 0;
}

.fd-row.on,
.fd-row:hover {
  background: color-mix(in srgb, var(--sun) 26%, var(--card));
}

.fd-row.on::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: var(--ink);
  border-radius: 4px;
}

.fd-row.on em::before {
  opacity: 1;
}

.fd-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  padding: 9px 18px;
  font-size: 12px;
  color: var(--ink-3);
  background: var(--card-2);
  border-top: 1px solid var(--line);
}

.fd-foot kbd {
  min-width: 20px;
  height: 20px;
  font-size: 12px;
}

.sheet-dialog {
  width: min(520px, calc(100vw - 24px));
}

.sheet-dialog .fd-box {
  padding: 28px 30px 26px;
}

.sheet-dialog h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.sheet-dialog p {
  margin-bottom: 10px;
  color: var(--ink-2);
}

.sheet-dialog .icon-x {
  position: absolute;
  right: 12px;
  top: 12px;
}

/* ───── 提示橫條與點擊星屑 ───── */

.toasts {
  position: fixed;
  right: 18px;
  top: calc(var(--hud) + 14px);
  z-index: 80;
  display: grid;
  justify-items: end;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 250px;
  max-width: min(400px, calc(100vw - 36px));
  padding: 7px 26px 7px 8px;
  color: #fff;
  background: linear-gradient(90deg, rgba(20, 27, 55, 0.96) 60%, rgba(20, 27, 55, 0.7));
  border-left: 4px solid #ffcc33;
  border-radius: 4px 26px 26px 4px;
  box-shadow: 0 14px 28px -14px rgba(0, 0, 0, 0.7);
  animation:
    toast-in 0.4s cubic-bezier(0.2, 1.2, 0.4, 1),
    toast-out 0.35s 2.75s forwards;
}

.toast .pic {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 900;
  color: #1c2743;
  background: #ffcc33;
  border-radius: 50%;
  overflow: hidden;
}

.toast .pic svg {
  width: 20px;
  height: 20px;
  fill: #1c2743;
}

.toast .pic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}

.toast small {
  display: block;
  font: 600 11.5px/1.3 var(--f-num);
  letter-spacing: 0.16em;
  color: #ffcc33;
}

.toast b {
  display: block;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.4;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

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

.spark {
  position: absolute;
  margin: -5px;
  background: var(--sun);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: spark 0.6s ease-out forwards;
}

@keyframes spark {
  to {
    transform: translate(var(--dx), var(--dy)) scale(0.1) rotate(120deg);
    opacity: 0;
  }
}

/* 晝夜切換：從按鈕位置擴散 */
::view-transition-old(root) {
  animation: none;
}

::view-transition-new(root) {
  animation: sky-reveal 0.7s ease-out;
}

@keyframes sky-reveal {
  from {
    clip-path: circle(0 at var(--vx, 40px) var(--vy, 90vh));
  }
  to {
    clip-path: circle(150vmax at var(--vx, 40px) var(--vy, 90vh));
  }
}

/* ───── 手機：底部導覽 ───── */

.dock {
  display: none;
}

@media (max-width: 860px) {
  :root {
    --hud: 54px;
  }

  .rail {
    display: none;
  }

  .stage {
    margin-left: 0;
    padding-bottom: 66px;
  }

  .hud {
    gap: 10px;
  }

  .crumbs,
  .clock span,
  .finder span,
  .finder kbd {
    display: none;
  }

  .finder {
    width: 36px;
    padding: 0;
    justify-content: center;
  }

  .clock {
    padding: 0 12px 0 10px;
  }

  .dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: #171f3d;
    border-top: 2px solid #ffcc33;
  }

  .dock a,
  .dock button {
    display: grid;
    justify-items: center;
    gap: 1px;
    font-size: 11.5px;
    color: #aab5d3;
  }

  .dock i {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    font: 900 15px/1 var(--f-sans);
    font-style: normal;
    color: #e8edfa;
    background: rgba(255, 255, 255, 0.1);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    overflow: hidden;
  }

  .dock i img {
    width: 86%;
    height: 86%;
    object-fit: contain;
  }

  .dock i img.face {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 12%;
  }

  .dock i svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.6;
    stroke-linecap: round;
  }

  .dock [aria-current="page"] {
    color: #ffcc33;
  }

  .dock [aria-current="page"] i {
    color: #1c2743;
    border-color: #ffcc33;
    background: #ffcc33;
  }

  .toasts {
    left: 12px;
    right: 12px;
    justify-items: stretch;
  }

  .toast {
    max-width: none;
  }

  .sec-head {
    flex-wrap: wrap;
  }

  .sec-head p {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .backdrop::before {
    animation: none;
  }
}
