/* ==========================================================
   縮.tw — 介面樣式
   ========================================================== */

@property --ang { syntax: '<angle>'; initial-value: 0deg; inherits: false; }

:root {
  color-scheme: dark;
  --bg: #05050f;
  --panel: rgba(16, 16, 40, .58);
  --panel-solid: #101028;
  --panel-2: rgba(255, 255, 255, .045);
  --panel-3: rgba(255, 255, 255, .08);
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .15);
  --text: #f2f1ff;
  --text-2: #b8b6da;
  --muted: #8380ad;
  --ok: #34e3a0;
  --warn: #ffc163;
  --bad: #ff5c7a;
  --a1: #8b5cff; --a1-rgb: 139, 92, 255;
  --a2: #22d3ee; --a2-rgb: 34, 211, 238;
  --a3: #ff4fa3; --a3-rgb: 255, 79, 163;
  --grad: linear-gradient(120deg, var(--a1), var(--a2) 50%, var(--a3) 100%);
  --grad-loop: linear-gradient(90deg, var(--a1), var(--a2) 33%, var(--a3) 66%, var(--a1));
  --grad-soft: linear-gradient(120deg, rgba(var(--a1-rgb), .25), rgba(var(--a2-rgb), .18), rgba(var(--a3-rgb), .22));
  --r-xl: 30px;
  --r-lg: 22px;
  --r: 16px;
  --r-sm: 11px;
  --shadow: 0 30px 80px -24px rgba(0, 0, 0, .7);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Noto Sans TC", system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-display: "Space Grotesk", "Noto Sans TC", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --cx: 50vw;
  --cy: 30vh;
}
html[data-accent="sunset"] { --a1: #ff6a3d; --a1-rgb: 255, 106, 61; --a2: #ffc53d; --a2-rgb: 255, 197, 61; --a3: #ff3d7f; --a3-rgb: 255, 61, 127; }
html[data-accent="matrix"] { --a1: #00e676; --a1-rgb: 0, 230, 118; --a2: #00e5ff; --a2-rgb: 0, 229, 255; --a3: #c6ff00; --a3-rgb: 198, 255, 0; }
html[data-accent="sakura"] { --a1: #ff7ac6; --a1-rgb: 255, 122, 198; --a2: #c4a1ff; --a2-rgb: 196, 161, 255; --a3: #ffb3d9; --a3-rgb: 255, 179, 217; }
html[data-accent="ocean"]  { --a1: #3b82f6; --a1-rgb: 59, 130, 246; --a2: #22d3ee; --a2-rgb: 34, 211, 238; --a3: #a78bfa; --a3-rgb: 167, 139, 250; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code { font-family: var(--font-mono); font-size: .92em; background: var(--panel-3); padding: .1em .4em; border-radius: 6px; }
[hidden] { display: none !important; }
::selection { background: rgba(var(--a1-rgb), .55); color: #fff; }
:focus-visible { outline: 2px solid var(--a2); outline-offset: 2px; }

.i { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }

/* ---------- 背景 ---------- */
.bg { position: fixed; inset: 0; z-index: -3; overflow: hidden; pointer-events: none; background: radial-gradient(ellipse at 50% -20%, #14113a 0%, var(--bg) 60%); }
.aurora { position: absolute; width: 62vmax; height: 62vmax; border-radius: 50%; filter: blur(80px); opacity: .42; mix-blend-mode: screen; animation: drift 26s ease-in-out infinite alternate; will-change: transform; }
.a1 { background: radial-gradient(circle, rgba(var(--a1-rgb), .95), transparent 62%); top: -26vmax; left: -14vmax; }
.a2 { background: radial-gradient(circle, rgba(var(--a2-rgb), .7), transparent 62%); top: 6vmax; right: -28vmax; animation-duration: 32s; animation-delay: -9s; }
.a3 { background: radial-gradient(circle, rgba(var(--a3-rgb), .65), transparent 62%); bottom: -36vmax; left: 14vmax; animation-duration: 38s; animation-delay: -18s; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(9vmax, 6vmax) scale(1.18) rotate(40deg); }
  100% { transform: translate(-7vmax, 11vmax) scale(.92) rotate(-20deg); }
}
.grid-floor {
  position: absolute; left: -50%; right: -50%; bottom: -12vh; height: 62vh;
  background-image: linear-gradient(rgba(var(--a2-rgb), .22) 1px, transparent 1px), linear-gradient(90deg, rgba(var(--a2-rgb), .22) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(520px) rotateX(72deg);
  transform-origin: 50% 100%;
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 78%);
  mask-image: linear-gradient(to top, #000 0%, transparent 78%);
  animation: grid-move 3.2s linear infinite;
  opacity: .55;
}
@keyframes grid-move { to { background-position: 0 64px; } }
.noise { position: absolute; inset: -50%; opacity: .07; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
#fx-stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
#fx-confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 90; pointer-events: none; }
.cursor-glow { position: fixed; left: var(--cx); top: var(--cy); width: 640px; height: 640px; margin: -320px 0 0 -320px; border-radius: 50%; background: radial-gradient(circle, rgba(var(--a1-rgb), .13), rgba(var(--a2-rgb), .05) 40%, transparent 65%); pointer-events: none; z-index: -1; transition: opacity .4s; }
html[data-fx="0"] .aurora, html[data-fx="0"] .grid-floor { animation: none; }
html[data-fx="0"] #fx-stars, html[data-fx="0"] .cursor-glow { display: none; }
html[data-fx="1"] .grid-floor { animation-duration: 8s; }
html[data-fx="1"] .cursor-glow { display: none; }

/* ---------- 版面 ---------- */
.wrap { width: min(1120px, 100% - 32px); margin: 0 auto; padding-bottom: 60px; }
.topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px max(16px, calc((100% - 1120px) / 2)); background: linear-gradient(to bottom, rgba(5, 5, 15, .85), rgba(5, 5, 15, 0)); backdrop-filter: blur(6px); }
.brand { display: inline-flex; align-items: baseline; gap: 1px; text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -.02em; }
.brand-mark { font-family: var(--font); font-weight: 900; background: var(--grad-loop); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; }
.brand-tld { color: var(--text-2); }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; text-decoration: none; color: var(--text-2); font-size: 14px; transition: background .2s, color .2s; }
.topnav a:hover { background: var(--panel-3); color: var(--text); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); transition: all .2s var(--ease); }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); background: var(--panel-3); transform: translateY(-1px); }

@keyframes shine { to { background-position: 200% center; } }

/* ---------- 卡片 ---------- */
.glow-card { position: relative; border-radius: var(--r-xl); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); }
.glow-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: conic-gradient(from var(--ang), transparent 0deg, transparent 200deg, var(--a1) 260deg, var(--a2) 300deg, var(--a3) 340deg, transparent 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 7s linear infinite;
  opacity: .9;
}
@keyframes spin { to { --ang: 360deg; } }
html[data-fx="0"] .glow-card::before { animation: none; opacity: .4; }

.reveal { animation: rise .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
.reveal.pending { animation: none; opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.pending.in { opacity: 1; transform: none; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
html[data-fx="0"] .reveal { animation: none; }
html[data-fx="0"] .reveal.pending { opacity: 1; transform: none; transition: none; }

.grad-text { background: var(--grad-loop); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 5s linear infinite; text-decoration: none; }
.kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--a2); letter-spacing: .04em; font-weight: 500; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: clamp(28px, 7vh, 80px) 0 clamp(20px, 4vh, 40px); }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; border-radius: 999px; font-size: 13px; color: var(--text-2); background: var(--panel-2); border: 1px solid var(--line); backdrop-filter: blur(8px); }
.pulse-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(52, 227, 160, .7); animation: pulse 1.8s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(52, 227, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 227, 160, 0); } }
.hero-title { margin: 14px 0 6px; font-size: clamp(104px, 21vw, 230px); line-height: .92; font-weight: 900; letter-spacing: -.04em; display: flex; justify-content: center; align-items: flex-end; user-select: none; }
.hero-tld { font-family: var(--font-display); font-size: .34em; font-weight: 700; color: var(--text); opacity: .9; margin-left: .04em; padding-bottom: .12em; letter-spacing: -.02em; }
.glitch { position: relative; display: inline-block; background: var(--grad-loop); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s linear infinite; filter: drop-shadow(0 0 38px rgba(var(--a1-rgb), .5)) drop-shadow(0 0 80px rgba(var(--a2-rgb), .25)); }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; inset: 0; background: none; -webkit-text-fill-color: currentColor; opacity: 0; pointer-events: none; }
.glitch::before { color: var(--a2); animation: glitch-a 5s infinite steps(1); }
.glitch::after { color: var(--a3); animation: glitch-b 5s infinite steps(1); }
@keyframes glitch-a {
  0%, 88%, 100% { opacity: 0; transform: none; clip-path: none; }
  89% { opacity: .85; transform: translate(-6px, 2px); clip-path: inset(10% 0 60% 0); }
  91% { opacity: .85; transform: translate(5px, -3px); clip-path: inset(55% 0 20% 0); }
  93% { opacity: .85; transform: translate(-3px, 1px); clip-path: inset(30% 0 45% 0); }
  95% { opacity: 0; }
}
@keyframes glitch-b {
  0%, 89%, 100% { opacity: 0; transform: none; clip-path: none; }
  90% { opacity: .8; transform: translate(6px, -2px); clip-path: inset(65% 0 5% 0); }
  92% { opacity: .8; transform: translate(-5px, 3px); clip-path: inset(5% 0 75% 0); }
  94% { opacity: .8; transform: translate(4px, 0); clip-path: inset(40% 0 35% 0); }
  96% { opacity: 0; }
}
html[data-fx="0"] .glitch::before, html[data-fx="0"] .glitch::after { display: none; }
.hero-sub { margin: 4px auto 0; font-size: clamp(16px, 2.4vw, 21px); color: var(--text-2); min-height: 1.7em; }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; vertical-align: -.15em; background: var(--a2); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- 主輸入卡 ---------- */
.composer { padding: 22px; margin: 0 auto; max-width: 900px; box-shadow: var(--shadow), 0 0 120px -40px rgba(var(--a1-rgb), .6); }
.seg { display: inline-flex; gap: 4px; padding: 4px; border-radius: 14px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); position: relative; flex-wrap: wrap; }
.seg button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-2); padding: 7px 14px; border-radius: 10px; font-size: 14px; transition: all .25s var(--ease); white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.is-active { color: #fff; background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 6px 20px -8px rgba(var(--a1-rgb), .8); }
.mode-switch { margin-bottom: 16px; }

.url-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 18px; border-radius: 20px; background: rgba(0, 0, 0, .38); border: 1px solid var(--line-2); transition: border-color .3s, box-shadow .3s; overflow: hidden; }
.url-row:focus-within { border-color: rgba(var(--a2-rgb), .65); box-shadow: 0 0 0 4px rgba(var(--a2-rgb), .12), 0 0 46px -12px rgba(var(--a2-rgb), .7); }
.url-row.has-error { border-color: rgba(255, 92, 122, .7); animation: shake .45s; }
.url-icon { color: var(--a2); width: 22px; height: 22px; }
.url-row input[type="text"] { flex: 1; min-width: 0; height: 52px; padding: 0; border: 0; border-radius: 0; outline: 0; background: none; box-shadow: none; font-family: var(--font-mono); font-size: 17px; transform-origin: left center; }
.url-row input::placeholder { color: var(--muted); font-family: var(--font); }
.url-row.squeeze input { animation: squeeze .75s cubic-bezier(.7, 0, .3, 1) forwards; }
@keyframes squeeze {
  0% { letter-spacing: 0; filter: blur(0); }
  55% { letter-spacing: -.45em; filter: blur(1.5px); opacity: .75; color: var(--a2); text-shadow: 0 0 18px var(--a2); }
  100% { letter-spacing: -.9em; filter: blur(4px); opacity: 0; transform: scaleX(.05); }
}
.btn-shrink { position: relative; flex: none; height: 56px; min-width: 112px; padding: 0 26px; border: 0; border-radius: 15px; color: #fff; font-weight: 900; font-size: 21px; letter-spacing: .08em; background: var(--grad-loop); background-size: 200% auto; animation: shine 4s linear infinite; box-shadow: 0 12px 34px -10px rgba(var(--a1-rgb), .9), inset 0 1px 0 rgba(255, 255, 255, .35); overflow: hidden; transition: transform .2s var(--spring), box-shadow .2s; }
.btn-shrink::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%); transform: translateX(-120%); animation: sweep 3.2s ease-in-out infinite; }
@keyframes sweep { 60%, 100% { transform: translateX(120%); } }
.btn-shrink:hover { box-shadow: 0 16px 44px -10px rgba(var(--a1-rgb), 1), inset 0 1px 0 rgba(255, 255, 255, .35); }
.btn-shrink:active { transform: scale(.95); }
.btn-spinner { position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; opacity: 0; }
.is-loading .btn-label { opacity: 0; }
.is-loading .btn-spinner { opacity: 1; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.field-error { display: flex; align-items: center; gap: 6px; color: var(--bad); font-size: 13.5px; margin: 8px 4px 0; }

.slug-box { margin-top: 14px; }
.slug-row { display: flex; align-items: center; gap: 0; border-radius: 16px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); padding: 5px 5px 5px 14px; transition: border-color .25s, box-shadow .25s; cursor: text; }
.slug-row:focus-within { border-color: rgba(var(--a1-rgb), .6); box-shadow: 0 0 0 4px rgba(var(--a1-rgb), .12); }
.slug-prefix { font-family: var(--font-mono); color: var(--muted); white-space: nowrap; font-size: 15px; }
.slug-row input[type="text"] { flex: 1; min-width: 60px; height: 40px; border: 0; border-radius: 0; outline: 0; background: none; box-shadow: none; font-family: var(--font-mono); font-size: 16px; color: var(--text); padding: 0 4px; }
.slug-row.compact { padding: 3px 3px 3px 12px; }
.slug-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 0 8px; white-space: nowrap; }
.slug-status.ok { color: var(--ok); }
.slug-status.bad { color: var(--bad); }
.slug-status.wait { color: var(--muted); }
.dice-btn { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--panel-3); color: var(--text); transition: transform .3s var(--spring), background .2s; flex: none; }
.dice-btn:hover { background: rgba(var(--a1-rgb), .3); }
.dice-btn.roll .i { animation: roll .6s var(--spring); }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 50% { transform: rotate(200deg) scale(1.3); } 100% { transform: rotate(360deg) scale(1); } }
.gen-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.len-ctl { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.len-ctl output { display: inline-block; min-width: 1.6em; text-align: center; color: var(--text); font-weight: 700; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); border-radius: 999px; padding: 5px 12px; font-size: 13px; transition: all .2s var(--ease); white-space: nowrap; }
.chips button:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-1px); }
.chips button.is-active { color: #fff; border-color: transparent; background: linear-gradient(var(--panel-solid), var(--panel-solid)) padding-box, var(--grad) border-box; border: 1px solid transparent; box-shadow: 0 4px 18px -6px rgba(var(--a1-rgb), .8); }
.chips.mini button { padding: 3px 10px; font-size: 12px; }
.chips.mini { margin-top: 8px; }

.presets { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.presets-label { font-size: 12.5px; color: var(--muted); }

.adv-toggle { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 16px; padding: 12px 16px; border-radius: 14px; border: 1px dashed var(--line-2); background: none; color: var(--text-2); font-size: 14.5px; transition: all .25s; }
.adv-toggle:hover { color: var(--text); border-color: rgba(var(--a2-rgb), .5); background: rgba(var(--a2-rgb), .05); }
.adv-toggle .chev { margin-left: auto; transition: transform .35s var(--spring); }
.adv-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.adv-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--grad); color: #fff; font-size: 12px; font-weight: 700; }
.adv-wrap { margin-top: 14px; animation: drop-in .45s var(--ease); }
@keyframes drop-in { from { opacity: 0; transform: translateY(-8px); } }
.private-key { margin-top: 14px; }

/* ---------- 進階設定 ---------- */
.opt-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.opt-tabs::-webkit-scrollbar { display: none; }
.opt-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); white-space: nowrap; font-size: 14px; transition: all .25s var(--ease); }
.opt-tab:hover { color: var(--text); border-color: var(--line-2); }
.opt-tab.is-active { color: #fff; background: var(--grad-soft); border-color: rgba(255, 255, 255, .16); box-shadow: 0 8px 24px -12px rgba(var(--a1-rgb), .9); }
.opt-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--a2); box-shadow: 0 0 10px var(--a2); opacity: 0; transform: scale(0); transition: all .3s var(--spring); }
.opt-tab.has-value .opt-dot { opacity: 1; transform: scale(1); }
.opt-panels { padding: 18px; border-radius: var(--r-lg); background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }
.opt-panel { display: none; }
.opt-panel.is-active { display: grid; gap: 16px; animation: panel-in .4s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateX(10px); } }

.field { display: grid; gap: 6px; min-width: 0; }
.field.grow { flex: 1; }
.field-label { font-size: 13.5px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.field-label small, .field-help { color: var(--muted); font-weight: 400; font-size: 12px; }
.field-label output { color: var(--a2); font-weight: 700; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.field-group { display: grid; gap: 14px; padding: 14px; border-radius: var(--r); background: rgba(var(--a1-rgb), .06); border: 1px solid rgba(var(--a1-rgb), .2); animation: drop-in .35s var(--ease); }
input[type="text"], input[type="password"], input[type="number"], input[type="datetime-local"], input[type="time"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; min-width: 0; padding: 10px 13px; border-radius: var(--r-sm); border: 1px solid var(--line); background: rgba(0, 0, 0, .3); color: var(--text); outline: 0; transition: border-color .2s, box-shadow .2s, background .2s; font-size: 14.5px;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus { border-color: rgba(var(--a2-rgb), .6); box-shadow: 0 0 0 3px rgba(var(--a2-rgb), .12); background: rgba(0, 0, 0, .4); }
.is-invalid { border-color: rgba(255, 92, 122, .7) !important; box-shadow: 0 0 0 3px rgba(255, 92, 122, .14) !important; }
textarea { resize: vertical; line-height: 1.6; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8b6da' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 34px; }
select option { background: var(--panel-solid); }
input[type="datetime-local"]::-webkit-calendar-picker-indicator, input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.8); cursor: pointer; }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--a1), var(--a2)) 0 / var(--p, 50%) 100% no-repeat, var(--panel-3); outline: 0; padding: 0; border: 0; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(var(--a2-rgb), .3), 0 0 16px rgba(var(--a2-rgb), .8); cursor: grab; }
.range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(var(--a2-rgb), .3), 0 0 16px rgba(var(--a2-rgb), .8); cursor: grab; }
.len-ctl .range { width: 130px; }

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-body { display: grid; gap: 2px; height: 100%; padding: 11px 13px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); transition: all .25s var(--ease); }
.choice-body b { font-size: 14px; }
.choice-body small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.choice:hover .choice-body { border-color: var(--line-2); transform: translateY(-2px); }
.choice input:checked + .choice-body { border-color: transparent; background: linear-gradient(#17163a, #17163a) padding-box, var(--grad) border-box; border: 1px solid transparent; box-shadow: 0 10px 30px -14px rgba(var(--a1-rgb), 1); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--a2); outline-offset: 2px; }

.switch-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 4px 0; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; flex: none; width: 44px; height: 26px; border-radius: 99px; background: var(--panel-3); border: 1px solid var(--line-2); transition: background .3s; margin-top: 1px; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: transform .35s var(--spring); }
.switch-row input:checked + .switch { background: var(--grad); border-color: transparent; box-shadow: 0 0 18px -4px rgba(var(--a2-rgb), .9); }
.switch-row input:checked + .switch::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--a2); outline-offset: 2px; }
.switch-row b { display: block; font-size: 14px; font-weight: 500; }
.switch-row small { display: block; color: var(--muted); font-size: 12.5px; }

.input-affix { position: relative; display: flex; }
.input-affix input { padding-right: 44px; }
.input-affix.big input { height: 52px; font-size: 16px; border-radius: 14px; }
.affix-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); border-radius: 9px; }
.affix-btn:hover { color: var(--text); background: var(--panel-3); }

.hint { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 10px 13px; border-radius: 12px; font-size: 13px; color: var(--text-2); background: rgba(var(--a2-rgb), .06); border: 1px solid rgba(var(--a2-rgb), .16); }
.hint .i { color: var(--a2); margin-top: 3px; }
.hint-inline { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }

details.sub { border-radius: var(--r); border: 1px solid var(--line); background: var(--panel-2); padding: 0 14px; transition: background .2s; }
details.sub[open] { background: rgba(255, 255, 255, .03); padding-bottom: 14px; }
details.sub > summary { list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; font-weight: 500; font-size: 14.5px; }
details.sub > summary::-webkit-details-marker { display: none; }
details.sub > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .3s; }
details.sub[open] > summary::after { transform: rotate(-135deg); }
details.sub > summary small { color: var(--muted); font-weight: 400; font-size: 12px; }
details.sub .field-row { margin-bottom: 10px; }
.rows { display: grid; gap: 8px; margin-bottom: 10px; }
.rows:empty { display: none; }
.rule-row { display: flex; gap: 8px; align-items: center; animation: drop-in .3s var(--ease); }
.rule-row .w-s { flex: 0 0 140px; }
.rule-row .w-xs { flex: 0 0 76px; }
.rule-row input[data-k="url"] { flex: 1; }
.time-row { flex-wrap: wrap; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, .2); }
.time-row input[type="time"] { width: 120px; }
.time-row .to { color: var(--muted); }
.days { display: flex; gap: 3px; width: 100%; }
.days label { cursor: pointer; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); font-size: 13px; color: var(--muted); transition: all .2s; }
.days input:checked + span { color: #fff; background: var(--grad-soft); border-color: rgba(255, 255, 255, .18); }

.og-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: start; }
.og-layout > div:first-child { display: grid; gap: 14px; }
.og-preview { border-radius: 16px; overflow: hidden; background: #18191c; border: 1px solid var(--line-2); box-shadow: 0 20px 50px -20px #000; position: sticky; top: 80px; }
.og-img { aspect-ratio: 1200 / 630; background: var(--grad-soft), repeating-linear-gradient(45deg, rgba(255, 255, 255, .03) 0 10px, transparent 10px 20px); background-size: cover; background-position: center; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-family: var(--font-mono); }
.og-img.has-img span { display: none; }
.og-body { padding: 12px 14px; display: grid; gap: 3px; border-left: 4px solid var(--a1); }
.og-body small { color: var(--muted); font-size: 11.5px; text-transform: lowercase; }
.og-body b { font-size: 15px; line-height: 1.35; word-break: break-word; }
.og-body p { margin: 0; color: var(--text-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.utm-preview { font-family: var(--font-mono); font-size: 12.5px; word-break: break-all; padding: 10px 13px; border-radius: 12px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); color: var(--text-2); }
.utm-preview mark { background: none; color: var(--a2); }

/* ---------- 按鈕 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; padding: 0 18px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-weight: 500; font-size: 14.5px; text-decoration: none; white-space: nowrap; transition: transform .25s var(--spring), background .2s, box-shadow .25s, border-color .2s; position: relative; overflow: hidden; }
.btn:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .25); background: var(--panel-3); }
.btn:active { transform: scale(.97); }
.btn.primary { border: 0; color: #fff; background: var(--grad-loop); background-size: 200% auto; animation: shine 5s linear infinite; box-shadow: 0 10px 30px -12px rgba(var(--a1-rgb), 1), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn.primary:hover { box-shadow: 0 14px 40px -12px rgba(var(--a1-rgb), 1), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn.danger { color: #ffd0d9; border-color: rgba(255, 92, 122, .4); background: rgba(255, 92, 122, .1); }
.btn.danger:hover { background: rgba(255, 92, 122, .22); }
.btn.ghost { background: transparent; }
.btn.sm { height: 36px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn.done { border-color: rgba(52, 227, 160, .6) !important; color: var(--ok) !important; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .45); transform: scale(0); animation: ripple .6s ease-out; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
.magnetic { will-change: transform; }

/* ---------- 結果 ---------- */
.result { display: grid; grid-template-columns: 1fr 340px; gap: 18px; max-width: 1060px; margin: 24px auto 0; animation: result-in .8s var(--spring); }
@keyframes result-in { from { opacity: 0; transform: translateY(30px) scale(.96); } }
.result-card { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 26px; transform-style: preserve-3d; transition: transform .2s ease-out; }
.result-main { display: grid; gap: 12px; align-content: start; min-width: 0; }
.result-kicker { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 700; font-size: 14px; }
.result-short { font-family: var(--font-display), var(--font); font-weight: 700; font-size: clamp(26px, 4.6vw, 46px); line-height: 1.12; letter-spacing: -.02em; word-break: break-all; text-decoration: none; background: var(--grad-loop); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 4s linear infinite; filter: drop-shadow(0 0 24px rgba(var(--a2-rgb), .35)); }
.result-dest { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: 13px; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-row { display: flex; flex-wrap: wrap; gap: 6px; }
.share-row a { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); text-decoration: none; font-size: 13px; color: var(--text-2); background: var(--panel-2); cursor: pointer; transition: all .2s; }
.share-row a:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-1px); }
.key-box { margin-top: 4px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 193, 99, .07); border: 1px solid rgba(255, 193, 99, .25); }
.key-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13.5px; color: var(--warn); }
.key-head span { color: var(--text-2); font-size: 12px; }
.key-val { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.key-val code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding: 8px 10px; background: rgba(0, 0, 0, .35); border-radius: 9px; font-size: 14px; letter-spacing: .04em; white-space: nowrap; }
.result-side { display: grid; justify-items: center; align-content: start; gap: 12px; }
.ratio { position: relative; width: 120px; height: 120px; }
.ratio svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ratio-track { fill: none; stroke: var(--panel-3); stroke-width: 9; }
.ratio-bar { fill: none; stroke: var(--a2); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset 1.4s var(--ease); filter: drop-shadow(0 0 6px rgba(var(--a2-rgb), .8)); }
.ratio-text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.ratio-text b { font-family: var(--font-display); font-size: 30px; }
.ratio-text small { color: var(--muted); font-size: 11.5px; }
.tag-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; max-width: 160px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; color: var(--text-2); background: var(--panel-3); border: 1px solid var(--line); white-space: nowrap; }

/* ---------- QR 工作室 ---------- */
.qr-card { padding: 20px; }
.qr-studio { display: grid; gap: 14px; }
.qr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qr-head b { display: inline-flex; align-items: center; gap: 6px; }
.qr-stage { display: grid; place-items: center; padding: 14px; border-radius: 20px; background: repeating-conic-gradient(rgba(255, 255, 255, .04) 0 25%, transparent 0 50%) 0 0 / 16px 16px; border: 1px solid var(--line); min-height: 240px; }
.qr-stage canvas, .qr-stage svg { width: 100% !important; max-width: 260px; height: auto !important; border-radius: 12px; display: block; }
.qr-stage .qr-loading { color: var(--muted); font-size: 13px; }
.qr-controls { display: grid; gap: 10px; }
.qr-controls .field-label { font-size: 12.5px; }
.qr-colors { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qr-colors input[type="color"] { width: 38px; height: 34px; padding: 2px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .3); cursor: pointer; }
.qr-colors label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.qr-colors input[type="checkbox"] { accent-color: var(--a2); }
.qr-dl { display: flex; gap: 6px; }
.qr-dl .btn { flex: 1; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 26px; height: 26px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, .15); padding: 0; transition: transform .2s var(--spring); }
.swatches button:hover { transform: scale(1.15); }

/* ---------- 區塊 ---------- */
.section-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: clamp(22px, 3.4vw, 32px); font-weight: 900; letter-spacing: -.01em; }
.section-title small { font-size: 14px; color: var(--muted); font-weight: 400; }
.section-title.big { font-size: clamp(38px, 7vw, 64px); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 18px; }
.section-head h2 small { color: var(--muted); font-weight: 400; font-size: 13px; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.bulk-result { max-width: 1060px; margin: 24px auto 0; padding: 20px; }
.bulk-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); padding: 10px 12px; background: rgba(0, 0, 0, .25); white-space: nowrap; font-size: 12.5px; }
.table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tr { transition: background .2s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .ellipsis { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.table a { color: var(--a2); text-decoration: none; }
.table .err { color: var(--bad); }

.features { margin-top: 90px; }
.features .section-title { justify-content: center; text-align: center; margin-bottom: 28px; display: block; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { position: relative; padding: 22px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); overflow: hidden; transition: transform .4s var(--ease), border-color .3s; }
.feature::before { content: ""; position: absolute; inset: 0; background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(var(--a1-rgb), .18), transparent 45%); opacity: 0; transition: opacity .4s; pointer-events: none; }
.feature:hover { transform: translateY(-4px); border-color: rgba(var(--a2-rgb), .3); }
.feature:hover::before { opacity: 1; }
.f-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--grad-soft); border: 1px solid rgba(255, 255, 255, .12); margin-bottom: 14px; color: #fff; box-shadow: 0 10px 30px -12px rgba(var(--a1-rgb), .9); }
.f-icon .i { width: 22px; height: 22px; }
.feature h3 { margin: 0 0 6px; font-size: 17px; }
.feature p { margin: 0; color: var(--text-2); font-size: 14px; }

.history { margin-top: 80px; }
.history > .hint { margin-bottom: 14px; }
.search-mini { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 11px; border: 1px solid var(--line); background: rgba(0, 0, 0, .25); color: var(--muted); }
.search-mini input[type="search"] { border: 0; background: none; padding: 0; height: 100%; width: 120px; box-shadow: none; border-radius: 0; }
#bulk-form { margin-bottom: 14px; }
.search-mini.wide { flex: 1; min-width: 200px; }
.search-mini.wide input { width: 100%; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.h-card { position: relative; display: grid; gap: 8px; padding: 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); transition: transform .3s var(--ease), border-color .3s; animation: drop-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 40ms); }
.h-card:hover { transform: translateY(-3px); border-color: rgba(var(--a1-rgb), .4); }
.h-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.h-short { flex: 1; min-width: 0; font-family: var(--font-display), var(--font); font-weight: 700; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.h-clicks { display: inline-flex; align-items: baseline; gap: 3px; font-family: var(--font-display); font-size: 20px; font-weight: 700; }
.h-clicks small { font-size: 11px; color: var(--muted); font-family: var(--font); font-weight: 400; }
.h-dest { font-size: 12.5px; color: var(--muted); font-family: var(--font-mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-title { font-size: 13px; color: var(--text-2); }
.h-foot { display: flex; align-items: center; gap: 6px; }
.h-foot .h-date { margin-right: auto; font-size: 12px; color: var(--muted); }
.h-foot .icon-btn { width: 32px; height: 32px; border-radius: 10px; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.status-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.s-active { color: var(--ok); background: rgba(52, 227, 160, .1); }
.s-disabled { color: var(--bad); background: rgba(255, 92, 122, .1); }
.s-expired, .s-exhausted, .s-gone { color: var(--muted); background: var(--panel-3); }
.s-scheduled { color: var(--warn); background: rgba(255, 193, 99, .1); }
.empty { display: grid; justify-items: center; gap: 12px; padding: 40px 0; color: var(--muted); text-align: center; }
.empty-orb { width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, rgba(var(--a2-rgb), .8) 18%, rgba(var(--a1-rgb), .6) 50%, transparent 70%); filter: blur(1px); animation: float 4s ease-in-out infinite; box-shadow: 0 0 60px rgba(var(--a1-rgb), .5); }
@keyframes float { 50% { transform: translateY(-12px) scale(1.05); } }

.site-footer { margin-top: 90px; padding: 40px 16px 50px; text-align: center; border-top: 1px solid var(--line); background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, .35)); }
.footer-stats { display: flex; justify-content: center; gap: 48px; margin-bottom: 18px; }
.footer-stats div { display: grid; }
.footer-stats b { font-family: var(--font-display); font-size: 34px; line-height: 1.1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.footer-stats span { color: var(--muted); font-size: 13px; }
.footer-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--text-2); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--text); }
.footer-note { color: var(--muted); font-size: 12.5px; margin: 16px auto 0; max-width: 560px; }

/* ---------- 設定面板 / Toast / Modal / Drawer ---------- */
.settings-panel { position: fixed; top: 70px; right: 16px; z-index: 60; width: min(320px, calc(100vw - 32px)); padding: 16px; border-radius: var(--r-lg); background: rgba(16, 16, 40, .92); border: 1px solid var(--line-2); box-shadow: var(--shadow); backdrop-filter: blur(20px); display: grid; gap: 16px; animation: pop-in .35s var(--spring); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-8px) scale(.96); } }
.settings-head { display: flex; justify-content: space-between; align-items: center; }
.settings-group { display: grid; gap: 8px; }
.settings-label { font-size: 12.5px; color: var(--muted); }
.accent-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.accent-list button { display: grid; justify-items: center; gap: 4px; padding: 6px 0; border: 1px solid transparent; background: none; border-radius: 12px; font-size: 11.5px; color: var(--text-2); }
.accent-list button i { width: 30px; height: 30px; border-radius: 50%; }
.accent-list button.is-active { border-color: var(--line-2); background: var(--panel-3); color: var(--text); }
.accent-list [data-accent="aurora"] i { background: linear-gradient(135deg, #8b5cff, #22d3ee, #ff4fa3); }
.accent-list [data-accent="sunset"] i { background: linear-gradient(135deg, #ff6a3d, #ffc53d, #ff3d7f); }
.accent-list [data-accent="matrix"] i { background: linear-gradient(135deg, #00e676, #00e5ff, #c6ff00); }
.accent-list [data-accent="sakura"] i { background: linear-gradient(135deg, #ff7ac6, #c4a1ff, #ffb3d9); }
.accent-list [data-accent="ocean"] i { background: linear-gradient(135deg, #3b82f6, #22d3ee, #a78bfa); }
.settings-panel .seg { width: 100%; }
.settings-panel .seg button { flex: 1; justify-content: center; }

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 100; display: grid; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 14px; background: rgba(20, 20, 46, .95); border: 1px solid var(--line-2); box-shadow: 0 16px 40px -10px #000; font-size: 14px; animation: toast-in .45s var(--spring); pointer-events: auto; }
.toast.ok .i { color: var(--ok); }
.toast.err { border-color: rgba(255, 92, 122, .5); }
.toast.err .i { color: var(--bad); }
.toast.out { animation: toast-out .3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.9); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.95); } }

.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; }
.modal-backdrop, .drawer-backdrop { position: absolute; inset: 0; background: rgba(3, 3, 12, .7); backdrop-filter: blur(6px); animation: fade-in .3s; }
@keyframes fade-in { from { opacity: 0; } }
.modal-panel { position: relative; width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 24px; animation: pop-in .4s var(--spring); background: rgba(16, 16, 40, .95); }
.modal-panel.wide { width: min(560px, 100%); }
.modal-panel h3 { margin: 0 0 8px; font-size: 19px; }
.modal-panel p { margin: 0 0 18px; color: var(--text-2); }
.modal-x { position: absolute; top: 14px; right: 14px; z-index: 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.drawer { position: fixed; inset: 0; z-index: 70; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(720px, 100%); display: flex; flex-direction: column; background: rgba(12, 12, 32, .97); border-left: 1px solid var(--line-2); box-shadow: -30px 0 80px -20px #000; animation: slide-in .45s var(--ease); }
@keyframes slide-in { from { transform: translateX(100%); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: grid; gap: 16px; align-content: start; }
.drawer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.drawer-foot .field-error { margin: 0 auto 0 0; }

/* ---------- Gate 頁 ---------- */
.gate-wrap { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 24px; padding: 40px 16px; }
.gate-card { width: min(520px, 100%); padding: 36px 30px; text-align: center; display: grid; gap: 14px; justify-items: center; }
.gate-icon { display: grid; place-items: center; width: 78px; height: 78px; border-radius: 24px; background: var(--grad-soft); border: 1px solid rgba(255, 255, 255, .14); color: #fff; box-shadow: 0 16px 50px -14px rgba(var(--a1-rgb), 1); }
.gate-icon .i { width: 36px; height: 36px; }
.gate-icon.bad { background: rgba(255, 92, 122, .15); box-shadow: 0 16px 50px -14px rgba(255, 92, 122, .8); color: var(--bad); }
.gate-icon.dissolve .i { animation: tip 2.4s ease-in-out infinite; }
@keyframes tip { 0%, 40% { transform: rotate(0); } 50%, 90% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
.lock-anim .i { animation: wiggle 2.6s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes wiggle { 0%, 70%, 100% { transform: rotate(0); } 75% { transform: rotate(-12deg); } 80% { transform: rotate(10deg); } 85% { transform: rotate(-6deg); } 90% { transform: rotate(3deg); } }
.gate-title { margin: 0; font-size: 24px; line-height: 1.35; }
.gate-title code { font-size: .8em; }
.gate-text { margin: 0; color: var(--text-2); }
.gate-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.gate-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.gate-brand { display: inline-flex; align-items: baseline; gap: 1px; text-decoration: none; font-family: var(--font-display); font-weight: 700; color: var(--text-2); opacity: .7; }
.gate-brand:hover { opacity: 1; }
.big-404 { font-family: var(--font-display); font-weight: 700; font-size: clamp(90px, 22vw, 150px); line-height: 1; letter-spacing: -.04em; }
.shake { animation: shake .5s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pw-form { display: grid; gap: 12px; width: 100%; margin-top: 6px; }
.dest-box { width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); display: grid; gap: 4px; }
.dest-host { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 16px; }
.dest-url { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); word-break: break-all; }
.dest-note { display: flex; align-items: center; gap: 6px; color: var(--warn); font-size: 12.5px; margin-top: 4px; }
.splash-msg { width: 100%; text-align: left; padding: 16px; border-radius: 16px; background: var(--grad-soft); border: 1px solid rgba(255, 255, 255, .12); font-size: 16px; }
.ring-count { position: relative; width: 110px; height: 110px; }
.ring-count svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-count b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 38px; }
.ring-count .ratio-bar { stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
.flip-countdown { display: flex; gap: 10px; margin-top: 8px; }
.flip-countdown div { display: grid; justify-items: center; gap: 4px; }
.flip-countdown b { display: grid; place-items: center; width: 70px; height: 78px; border-radius: 16px; background: linear-gradient(to bottom, rgba(255, 255, 255, .09) 50%, rgba(255, 255, 255, .04) 50%); border: 1px solid var(--line-2); font-family: var(--font-display); font-size: 38px; box-shadow: 0 14px 30px -12px #000; }
.flip-countdown b.tick { animation: flip .5s var(--ease); }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.flip-countdown small { color: var(--muted); font-size: 12px; }
.info-short { margin: 0; font-family: var(--font-display), var(--font); font-size: clamp(28px, 7vw, 40px); word-break: break-all; line-height: 1.15; }
.info-meta { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.info-meta div { display: grid; gap: 2px; }
.info-meta small { color: var(--muted); font-size: 12px; }
.info-qr { width: 100%; }

/* ---------- 統計 ---------- */
.stats-wrap { display: grid; gap: 16px; padding-top: 8px; }
.stats-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 24px; flex-wrap: wrap; }
.sh-main { display: grid; gap: 6px; min-width: 0; flex: 1 1 380px; }
.sh-short { margin: 0; font-family: var(--font-display), var(--font); font-size: clamp(26px, 4.4vw, 42px); line-height: 1.15; word-break: break-all; }
.sh-dest { margin: 0; color: var(--muted); font-family: var(--font-mono); font-size: 13px; word-break: break-all; }
.sh-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sh-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; flex: 0 1 380px; }
.lock-panel { padding: 36px; text-align: center; display: grid; justify-items: center; gap: 10px; }
.lock-panel h2 { margin: 6px 0 0; }
.lock-panel p { margin: 0; color: var(--text-2); }
.key-form { display: flex; gap: 8px; width: min(460px, 100%); margin-top: 8px; }
.key-form .input-affix { flex: 1; }
.key-form .btn { height: 52px; }
.stats-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.8s infinite; }
.live.paused i { background: var(--muted); animation: none; }
.kpis { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 12px; }
.kpi { padding: 18px; border-radius: var(--r-lg); display: grid; gap: 4px; align-content: start; min-width: 0; }
.kpi-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1.15; }
.kpi-hero .kpi-value { font-size: 52px; background: var(--grad-loop); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 5s linear infinite; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-sub .up { color: var(--ok); }
.kpi-sub .down { color: var(--bad); }
.chart-card { padding: 18px; border-radius: var(--r-lg); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-note { font-size: 12.5px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.area-chart { position: relative; height: 260px; }
.area-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ax-grid { stroke: rgba(255, 255, 255, .06); stroke-width: 1; }
.ax-base { stroke: rgba(255, 255, 255, .16); stroke-width: 1; }
.ax-label { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.area-line { fill: none; stroke: var(--a2); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(var(--a2-rgb), .6)); }
.area-line.draw { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.4s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.area-fill { opacity: 0; animation: fade-in-op .9s .4s var(--ease) forwards; }
@keyframes fade-in-op { to { opacity: 1; } }
.cross { stroke: rgba(255, 255, 255, .25); stroke-width: 1; }
.cross-dot { fill: var(--a2); stroke: var(--panel-solid); stroke-width: 2; }
.chart-tip { position: absolute; pointer-events: none; padding: 8px 11px; border-radius: 11px; background: rgba(12, 12, 32, .96); border: 1px solid var(--line-2); box-shadow: 0 10px 30px -10px #000; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, -110%); z-index: 5; transition: opacity .15s; }
.chart-tip b { font-family: var(--font-display); font-size: 16px; display: block; }
.chart-tip small { color: var(--muted); }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 14px; text-align: center; }

.heatmap { display: grid; grid-template-columns: 22px repeat(24, 1fr); gap: 3px; position: relative; }
.heatmap .hm-cell { aspect-ratio: 1; border-radius: 4px; background: rgba(255, 255, 255, .04); transition: transform .2s var(--spring); }
.heatmap .hm-cell:hover { transform: scale(1.35); outline: 2px solid var(--panel-solid); z-index: 2; position: relative; }
.heatmap .hm-row { font-size: 11px; color: var(--muted); display: grid; place-items: center start; }
.heatmap .hm-col { font-size: 10px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.heat-legend { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.heat-legend i { width: 14px; height: 14px; border-radius: 3px; }

.bars { display: grid; gap: 9px; }
.bar-row { display: grid; gap: 4px; position: relative; }
.bar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); display: flex; align-items: center; gap: 6px; }
.bar-val { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar-val small { color: var(--muted); margin-left: 4px; }
.bar-track { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 0 99px 99px 0; background: linear-gradient(90deg, rgba(var(--a1-rgb), .85), var(--a2)); transition: width 1s var(--ease); }
.bars-empty { color: var(--muted); font-size: 13px; padding: 16px 0; text-align: center; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 420px; overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 11px; font-size: 13px; }
.feed li:nth-child(odd) { background: rgba(255, 255, 255, .02); }
.feed li.new { animation: feed-new 1.6s var(--ease); }
@keyframes feed-new { 0% { background: rgba(var(--a2-rgb), .25); transform: translateX(-10px); } 100% { transform: none; } }
.feed .f-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.feed .f-who { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.feed .f-ref { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; text-align: right; }
.feed-empty { color: var(--muted); text-align: center; padding: 24px; font-size: 13px; }

/* ---------- 後台 / 文件 ---------- */
.admin-wrap { display: grid; gap: 16px; padding-top: 10px; }
.admin-wrap .kpis { grid-template-columns: 1.4fr repeat(3, 1fr); }
.admin-filters { justify-content: flex-start; }
.admin-filters select { width: auto; }
.env-note { font-size: 12px; color: var(--muted); }
.pager { display: flex; justify-content: center; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager button { min-width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text-2); }
.pager button.is-active { background: var(--grad-soft); color: #fff; border-color: var(--line-2); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .icon-btn { width: 32px; height: 32px; border-radius: 9px; }

.docs-wrap { display: grid; gap: 18px; padding-top: 10px; }
.docs-hero { padding: 30px 0 6px; }
.docs-hero .lead { color: var(--text-2); font-size: 17px; max-width: 640px; margin: 10px 0 18px; }
.endpoint-base { display: inline-flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.endpoint-base span { color: var(--muted); font-size: 13px; }
.docs-toc { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; position: sticky; top: 64px; z-index: 10; }
.docs-toc a { padding: 6px 12px; border-radius: 10px; color: var(--text-2); text-decoration: none; font-size: 13.5px; }
.docs-toc a:hover { background: var(--panel-3); color: var(--text); }
.doc-block { padding: 24px; display: grid; gap: 12px; scroll-margin-top: 130px; }
.doc-block h2 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 20px; flex-wrap: wrap; }
.doc-block h3 { margin: 8px 0 0; font-size: 15px; color: var(--text-2); }
.doc-block p { margin: 0; color: var(--text-2); }
.method { display: inline-block; padding: 3px 9px; border-radius: 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.method.post { background: rgba(var(--a3-rgb), .16); color: var(--a3); }
.method.get { background: rgba(var(--a2-rgb), .16); color: var(--a2); }
.code { position: relative; border-radius: 16px; background: rgba(0, 0, 0, .45); border: 1px solid var(--line); }
.code pre { margin: 0; padding: 16px 18px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.7; color: #d7d5ff; }
.code-copy { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: var(--panel-solid); color: var(--text-2); opacity: .7; }
.code-copy:hover { opacity: 1; color: var(--text); }
.endpoint-list { display: grid; gap: 6px; }
.endpoint-list > div { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 12px; border-radius: 12px; background: rgba(0, 0, 0, .22); }
.endpoint-list span:last-child { color: var(--text-2); font-size: 13.5px; }
.params td:first-child { white-space: nowrap; }
.type { font-family: var(--font-mono); font-size: 12px; color: var(--a2); white-space: nowrap; }
.bookmarklet { justify-self: start; cursor: grab; }

/* ---------- 響應式 ---------- */
@media (max-width: 980px) {
  .result { grid-template-columns: 1fr; }
  .kpis, .admin-wrap .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi-hero { grid-column: 1 / -1; }
  .grid-2, .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .og-layout { grid-template-columns: 1fr; }
  .og-preview { position: static; }
}
@media (max-width: 680px) {
  body { font-size: 14.5px; }
  .topnav a span { display: none; }
  .composer { padding: 14px; border-radius: 24px; }
  .url-row { flex-wrap: wrap; padding: 6px 6px 6px 14px; }
  .url-row input { height: 48px; flex: 1 1 calc(100% - 40px); }
  .btn-shrink { width: 100%; height: 52px; }
  .choice-grid { grid-template-columns: 1fr 1fr; }
  .field-row, .field-row.three { grid-template-columns: 1fr; }
  .opt-panels { padding: 12px; }
  .gen-row { flex-direction: column; align-items: stretch; }
  .gen-row > * { min-width: 0; max-width: 100%; }
  .gen-row .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .len-ctl .range { width: 100%; }
  .len-ctl { justify-content: space-between; }
  .result-card { grid-template-columns: 1fr; padding: 20px; }
  .result-side { grid-auto-flow: column; justify-content: start; align-items: center; }
  .ratio { width: 92px; height: 92px; }
  .ratio-text b { font-size: 24px; }
  .feature-grid, .grid-3 { grid-template-columns: 1fr; }
  .history-grid { grid-template-columns: 1fr; }
  .stats-head { padding: 18px; }
  .sh-actions { justify-content: flex-start; }
  .kpi-hero .kpi-value { font-size: 42px; }
  .kpi-value { font-size: 26px; }
  .area-chart { height: 210px; }
  .heatmap { grid-template-columns: 18px repeat(24, 1fr); gap: 2px; }
  .heatmap .hm-cell { border-radius: 2px; }
  .feed li { grid-template-columns: 70px 1fr; }
  .feed .f-ref { grid-column: 2; text-align: left; max-width: none; }
  .flip-countdown b { width: 56px; height: 64px; font-size: 30px; }
  .gate-card { padding: 28px 20px; }
  .key-form { flex-direction: column; }
  .rule-row { flex-wrap: wrap; }
  .rule-row .w-s { flex: 1 1 100%; }
  .footer-stats { gap: 28px; }
  .drawer-body { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
