:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #1a1d29;
  --text-dim: #5b6072;
  --border: #e4e6ee;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fd;
  --radius: 18px;
  --shadow: 0 1px 3px rgba(20, 22, 40, 0.06), 0 1px 2px rgba(20, 22, 40, 0.04);
  --shadow-lg: 0 16px 32px -14px rgba(20, 22, 40, 0.22);

  --cat-finance: #4f46e5;
  --cat-finance-soft: #e9e7fd;
  --cat-utility: #0d9488;
  --cat-utility-soft: #d9f5f1;
  --cat-social: #db2777;
  --cat-social-soft: #fbe0ee;
  --cat-fun: #9333ea;
  --cat-fun-soft: #f2e4fd;

  --pop: #f97316;
  --pop-soft: #ffe8d1;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131320;
    --surface: #1c1e2e;
    --text: #f1f2fc;
    --text-dim: #9a9db3;
    --border: #2c2e40;
    --accent: #918bff;
    --accent-hover: #a5b0fb;
    --accent-soft: #292a4a;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 36px -16px rgba(0, 0, 0, 0.55);

    --cat-finance: #918bff;
    --cat-finance-soft: #2b2a4d;
    --cat-utility: #2dd4bf;
    --cat-utility-soft: #133532;
    --cat-social: #f472b6;
    --cat-social-soft: #3d2233;
    --cat-fun: #c084fc;
    --cat-fun-soft: #3a2350;

    --pop: #fb923c;
    --pop-soft: #402812;
  }
}

/* Explicit theme override driven by theme.js (time-of-day switch). Wins over
   the prefers-color-scheme media query above because it's declared later
   and shares the same :root specificity. */
:root[data-theme="light"] {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --text: #1a1d29;
  --text-dim: #5b6072;
  --border: #e4e6ee;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fd;
  --shadow: 0 1px 3px rgba(20, 22, 40, 0.06), 0 1px 2px rgba(20, 22, 40, 0.04);
  --shadow-lg: 0 16px 32px -14px rgba(20, 22, 40, 0.22);

  --cat-finance: #4f46e5;
  --cat-finance-soft: #e9e7fd;
  --cat-utility: #0d9488;
  --cat-utility-soft: #d9f5f1;
  --cat-social: #db2777;
  --cat-social-soft: #fbe0ee;
  --cat-fun: #9333ea;
  --cat-fun-soft: #f2e4fd;

  --pop: #f97316;
  --pop-soft: #ffe8d1;
}

:root[data-theme="dark"] {
  --bg: #131320;
  --surface: #1c1e2e;
  --text: #f1f2fc;
  --text-dim: #9a9db3;
  --border: #2c2e40;
  --accent: #918bff;
  --accent-hover: #a5b0fb;
  --accent-soft: #292a4a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 36px -16px rgba(0, 0, 0, 0.55);

  --cat-finance: #918bff;
  --cat-finance-soft: #2b2a4d;
  --cat-utility: #2dd4bf;
  --cat-utility-soft: #133532;
  --cat-social: #f472b6;
  --cat-social-soft: #3d2233;
  --cat-fun: #c084fc;
  --cat-fun-soft: #3a2350;

  --pop: #fb923c;
  --pop-soft: #402812;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Noto Sans TC", -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  background:
    radial-gradient(680px circle at 92% 3%, var(--cat-social-soft) 0%, transparent 62%),
    radial-gradient(620px circle at 4% 12%, var(--cat-finance-soft) 0%, transparent 62%),
    radial-gradient(640px circle at 90% 38%, var(--cat-utility-soft) 0%, transparent 60%),
    radial-gradient(600px circle at 4% 55%, var(--pop-soft) 0%, transparent 60%),
    radial-gradient(650px circle at 88% 76%, var(--cat-social-soft) 0%, transparent 60%),
    radial-gradient(580px circle at 6% 92%, var(--cat-finance-soft) 0%, transparent 58%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
  position: relative;
}


.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 20px;
}

header.site {
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  position: relative;
  z-index: 2;
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  row-gap: 8px;
}

header.site a.brand {
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

header.site nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  margin-left: 18px;
  transition: color 0.15s ease;
}

header.site nav a:hover { color: var(--accent); }

header.site nav a.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
}
header.site nav a.lang-switch:hover {
  background: var(--accent);
  color: #fff;
}

.live-clock {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-right: 18px;
  font-variant-numeric: tabular-nums;
}

.hero-band {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft) 0%, var(--pop-soft) 100%);
  padding-bottom: 56px;
}

.hero-band::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--halftone-dot, rgba(20, 22, 40, 0.16)) 1.1px, transparent 1.1px);
  background-size: 5px 5px;
  mask-image: radial-gradient(ellipse 70% 90% at 70% 20%, black 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 70% 90% at 70% 20%, black 0%, transparent 72%);
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .hero-band::before {
    --halftone-dot: rgba(255, 255, 255, 0.14);
  }
}

.hero {
  text-align: center;
  padding: 60px 0 12px;
  position: relative;
}

.hero-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-decor .sticker {
  position: absolute;
  font-size: 2.3rem;
  opacity: 0.6;
  filter: drop-shadow(0 8px 12px rgba(20, 22, 40, 0.18));
}

.hero-decor .s1 { top: 8%;  left: 5%;  transform: rotate(-14deg); }
.hero-decor .s2 { top: 14%; right: 7%; transform: rotate(12deg); }
.hero-decor .s3 { bottom: 12%; left: 11%; transform: rotate(10deg); }
.hero-decor .s4 { bottom: 16%; right: 13%; transform: rotate(-10deg); }

@media (max-width: 700px) {
  .hero-decor { display: none; }
}

.hero-illustration {
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
  margin: 0 auto 20px;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  color: var(--pop);
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid var(--pop);
  font-size: 0.84rem;
  font-weight: 800;
  margin-bottom: 22px;
  box-shadow: 3px 3px 0 0 var(--pop);
  transform: rotate(-2deg);
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 900;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  line-height: 1.3;
  position: relative;
  z-index: 1;
}

.underline-highlight {
  position: relative;
  display: inline-block;
}

.underline-highlight .underline-svg {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -10px;
  width: 104%;
  height: 18px;
}

.underline-highlight .underline-svg path {
  stroke: var(--pop);
  opacity: 0.8;
}

.hero p {
  color: var(--text-dim);
  margin: 0 auto;
  font-size: 1.08rem;
  max-width: 34em;
  position: relative;
  z-index: 1;
}

.wave-divider {
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 50px;
  display: block;
}

.wave-divider path { fill: var(--bg); }

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 44px 0 18px;
}

.section-header .bar {
  width: 6px;
  height: 26px;
  border-radius: 3px;
  background: var(--section-accent, var(--accent));
}

.section-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 900;
}

.section-header p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.84rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  padding: 4px 0 8px;
}

.card {
  position: relative;
  background: var(--card-bg, var(--surface));
  border: 2.5px solid var(--card-accent, var(--accent));
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 5px 5px 0 0 var(--card-accent, var(--accent));
  transform: rotate(var(--card-rot, 0deg));
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1.3), box-shadow 0.2s ease;
  display: block;
}

.grid .card:nth-child(4n+1) { --card-rot: -1.6deg; }
.grid .card:nth-child(4n+2) { --card-rot: 1.1deg; }
.grid .card:nth-child(4n+3) { --card-rot: -0.9deg; }
.grid .card:nth-child(4n+4) { --card-rot: 1.5deg; }

.card .hot-badge {
  position: absolute;
  top: -12px;
  right: 14px;
  background:
    radial-gradient(rgba(255, 255, 255, 0.55) 0.9px, transparent 0.9px) 0 0 / 4px 4px,
    var(--pop);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--surface);
  box-shadow: 2px 2px 0 0 rgba(20, 22, 40, 0.35);
}

.card:hover {
  transform: translateY(-6px) rotate(0deg);
  box-shadow: 8px 8px 0 0 var(--card-accent, var(--accent));
}

.card .icon-badge {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 16px;
  background: var(--surface);
  box-shadow: 0 4px 10px -4px rgba(20, 22, 40, 0.3);
  transition: transform 0.2s ease;
}

.card:hover .icon-badge { transform: scale(1.1) rotate(6deg); }

.card.cat-finance { --card-accent: var(--cat-finance); --card-bg: var(--cat-finance-soft); }
.card.cat-utility { --card-accent: var(--cat-utility); --card-bg: var(--cat-utility-soft); }
.card.cat-social { --card-accent: var(--cat-social); --card-bg: var(--cat-social-soft); }
.card.cat-fun { --card-accent: var(--cat-fun); --card-bg: var(--cat-fun-soft); }

.card .icon { font-size: 1.8rem; margin-bottom: 10px; display: block; }
.card h3 { margin: 0 0 6px; font-size: 1.08rem; font-weight: 800; }
.card p { margin: 0; color: var(--text-dim); font-size: 0.88rem; }

@media (min-width: 640px) {
  .card-lg {
    grid-column: span 2;
    display: flex;
    align-items: center;
    gap: 20px;
  }
  .card-lg .icon-badge {
    margin-bottom: 0;
    flex-shrink: 0;
    width: 66px;
    height: 66px;
    font-size: 2rem;
    border-radius: 18px;
  }
  .card-lg h3 { font-size: 1.2rem; }
}

.tool-page { padding: 36px 0 60px; }

.tool-page h1 {
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.tool-page .desc {
  color: var(--text-dim);
  margin: 0 0 24px;
  font-size: 0.92rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 140px; }

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 30px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: 0 6px 16px -6px var(--accent);
}

button.primary:hover { background: var(--accent-hover); transform: translateY(-2px); }
button.primary:active { transform: translateY(0); }

.result {
  margin-top: 20px;
  padding: 18px;
  background: var(--accent-soft);
  border-radius: 14px;
  font-size: 0.95rem;
}

.result .big {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}

.result table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.result td { padding: 6px 0; border-top: 1px solid var(--border); font-size: 0.9rem; }
.result td:last-child { text-align: right; font-weight: 600; }

.howto {
  margin-top: 24px;
  padding: 24px 26px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.howto h2 {
  font-size: 1.05rem;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.howto ol {
  margin: 0;
  padding-left: 1.3em;
}
.howto ol li {
  margin-bottom: 10px;
  line-height: 1.65;
  color: var(--text-dim);
}
.howto ol li:last-child { margin-bottom: 0; }
.howto ol li strong { color: var(--text); }
.howto .tips {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-dim);
}
.howto .tips strong { color: var(--text); }

.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
  margin: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ad-slot .ad-label {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.7;
}

.ad-slot--leaderboard { min-height: 90px; }
.ad-slot--rectangle { min-height: 280px; }
.ad-slot--infeed { min-height: 160px; }
.ad-slot--skyscraper { min-height: 600px; margin: 0; }
.ad-slot--anchor { min-height: 50px; width: 320px; max-width: 100%; margin: 0; border: none; padding: 4px; }

/* Desktop side-rail ads — only shown when the viewport has real spare
   margin outside the 980px content column, so normal/laptop widths are
   never touched. Positioned absolutely (scrolls with the page, `top` set
   per-instance by ad-rails.js) rather than fixed, so a long page gets
   several distinct ad slots passing by instead of one static unit. */
.ad-rail {
  display: none;
  position: absolute;
  width: 160px;
  z-index: 5;
}
/* Anchored to the content column's edge (not the viewport edge), with a
   fixed 30px safety gap, so the rail can never overlap real content no
   matter how the viewport width changes (browser zoom, resize, etc). */
.ad-rail--left { left: calc(50% - 680px); }
.ad-rail--right { left: calc(50% + 520px); }

@media (min-width: 1400px) {
  .ad-rail { display: block; }
}

/* Mobile sticky anchor ad — small, dismissible, bottom-pinned. Only on
   narrow viewports; desktop already gets the side rails instead. */
.ad-anchor {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 4px 40px 4px 4px;
  box-shadow: 0 -4px 12px rgba(20, 22, 40, 0.08);
}
.ad-anchor-close {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

@media (max-width: 900px) {
  .ad-anchor { display: flex; }
}

.copy-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.copy-row input {
  flex: 1;
}

button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

button.ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

footer.site {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.82rem;
}

footer.site a { color: var(--text-dim); }

#qr-output img {
  display: block;
  margin: 16px auto 0;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.checks { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.checks label { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--text); }
