:root {
  /* TicenpiPost light identity — cool pale blue ground, never dark */
  --bg: #eef3f9;
  --bg-2: #e4edf6;
  --surface: #ffffff;
  --inset: #f4f8fc;
  --ink: #16324d;
  --muted: #5c7085;
  --faint: #93a4b6;
  --line: #dbe6f1;
  --line-strong: #c6d5e5;
  --brand: #2f7fd4;
  --brand-deep: #1f5fa8;
  --ok: #1f9d6b;
  --new: #d98a2b;
  --danger: #d1495b;

  --font-display: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Segoe UI", system-ui, -apple-system, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --r: 12px;
  --r-sm: 8px;
  --ease: cubic-bezier(0.16, 0.84, 0.34, 1);
  --shadow: 0 14px 40px -20px rgba(15, 47, 82, 0.28);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
button { font: inherit; cursor: pointer; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 5px; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; } }

/* ============ topbar — everything secondary lives here ============ */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand-mark { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-weight: 600; font-size: 14.5px; letter-spacing: 0.01em; }
.brand-mark .g { width: 25px; height: 25px; border-radius: 7px; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 13px; }
.topbar .sp { flex: 1; }

.tnav { display: flex; align-items: center; gap: 4px; }
.tbtn {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border: 1px solid transparent; border-radius: 999px;
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
}
.tbtn:hover { background: var(--surface); color: var(--ink); border-color: var(--line); }
.tbtn[aria-expanded="true"] { background: var(--surface); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow); }
.tbtn svg { width: 14px; height: 14px; flex: none; }
.tbtn .badge {
  position: absolute; top: 2px; right: 4px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--new); box-shadow: 0 0 0 2px var(--bg);
}
.tbtn.logout { color: var(--faint); }
.tbtn.logout:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
@media (max-width: 720px) { .tbtn span.lbl { display: none; } .tbtn { padding: 7px; } }

/* ============ popover ============ */
.pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50;
  width: 268px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity 0.12s ease, transform 0.12s var(--ease);
}
.pop.open { opacity: 1; transform: none; pointer-events: auto; }
.pop h3 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.pop .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.pop .row:first-of-type { border-top: 0; }
.pop .row .k { color: var(--muted); }
.pop .row .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.pop .row .v.accent { color: var(--new); text-transform: uppercase; letter-spacing: 0.03em; }
.pop .act {
  margin-top: 11px; width: 100%; padding: 8px; border-radius: var(--r-sm);
  border: 1px solid var(--brand); background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  color: var(--brand-deep); font-weight: 600; font-size: 12.5px;
}
.pop .act:hover { background: color-mix(in srgb, var(--brand) 16%, var(--surface)); }
.pop .act.ghost { border-color: var(--line-strong); background: var(--inset); color: var(--ink); }
.pop .who { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pop .who .av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-deep); color: #fff; font-weight: 600; font-size: 14px; flex: none; }
.pop .who .mail { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop .who .org { font-size: 11.5px; color: var(--muted); }
.pop .conn { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.pop .conn:first-of-type { border-top: 0; }
.pop .conn .lg { width: 28px; height: 28px; border-radius: 7px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; font-family: var(--font-display); }
.pop .conn .lg.fb { background: #1877f2; }
.pop .conn .lg.n591 { background: #ff6a13; font-family: var(--font-mono); font-size: 11px; }
.pop .conn .m { flex: 1; min-width: 0; }
.pop .conn .m .nm { font-size: 12.5px; font-weight: 600; }
.pop .conn .m .st { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.dot.off { background: var(--faint); }
.dot.on { background: var(--ok); }
.pop .conn .lnk { font-size: 11.5px; font-weight: 600; color: var(--brand-deep); border: 0; background: none; padding: 4px; white-space: nowrap; }
.pop .conn .lnk[disabled] { color: var(--faint); cursor: not-allowed; }
.pop .note { margin: 11px 0 0; font-size: 11px; line-height: 1.6; color: var(--faint); }
.pop .feed { list-style: none; margin: 0; padding: 0; }
.pop .feed li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 12px; }
.pop .feed li:first-child { border-top: 0; }
.pop .feed .ago { color: var(--faint); font-size: 10.5px; font-family: var(--font-mono); }
.pop .big { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
.pop .big .n { font-family: var(--font-mono); font-size: 22px; font-weight: 500; color: var(--ink); }
.pop .big .u { font-size: 11px; color: var(--muted); }
.pop .empty { font-size: 12px; color: var(--faint); padding: 6px 0; }

/* ============ stage ============ */
.stage { max-width: 1180px; margin: 0 auto; padding: 26px 22px 40px; }
.stage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.stage-head h1 { font-size: 20px; font-weight: 600; letter-spacing: 0.005em; }
.stage-head .meta { font-family: var(--font-mono); font-size: 11px; color: var(--faint); letter-spacing: 0.04em; }

/* ============ horizontal image accordion (React Bits AccordionGallery, ported) ============ */
.gallery { display: flex; gap: 12px; height: 396px; }
.gpanel {
  position: relative; flex: 1 1 0%; min-width: 0;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(130% 80% at 14% 8%, hsl(var(--hue) 70% 88%) 0%, transparent 58%),
    radial-gradient(110% 120% at 92% 100%, hsl(var(--hue) 58% 78%) 0%, transparent 55%),
    linear-gradient(155deg, hsl(var(--hue) 46% 96%) 0%, hsl(var(--hue) 40% 90%) 100%);
  cursor: pointer; text-align: left; color: var(--ink);
  transition: flex-grow 0.55s var(--ease), filter 0.45s var(--ease), box-shadow 0.3s ease, border-color 0.3s ease;
  filter: saturate(0.62);
}
.gpanel .motif { position: absolute; inset: 0; z-index: 1; opacity: 0.5; color: hsl(var(--hue) 58% 52%); transition: opacity 0.45s var(--ease); }
.gpanel.active {
  flex-grow: 5.4;                 /* expandRatio ≈ 0.52 across 6 panels */
  filter: saturate(1);
  box-shadow: var(--shadow);
  border-color: hsl(var(--hue) 50% 70%);
}
.gpanel.active .motif { opacity: 0.9; }
.gpanel.soon { filter: saturate(0.1); }
.gpanel.soon.active { filter: saturate(0.32); }

.gp-label {
  position: absolute; left: 15px; bottom: 16px; right: 15px; z-index: 2;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--font-display); font-weight: 600; font-size: 13.5px;
  letter-spacing: 0.02em; color: var(--ink);
  transition: opacity 0.25s ease;
}
.gpanel.active .gp-label { opacity: 0; }

.gp-open {
  position: absolute; left: 24px; right: 24px; bottom: 24px; z-index: 3;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.3s ease 0.1s, transform 0.4s var(--ease) 0.1s;
  pointer-events: none;
}
.gpanel.active .gp-open { opacity: 1; transform: none; pointer-events: auto; }
.gp-open .kick { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.gp-open .name { font-family: var(--font-display); font-weight: 600; font-size: 23px; margin: 4px 0 5px; color: var(--ink); }
.gp-open .tag { font-size: 12.5px; color: var(--muted); max-width: 44ch; }
.gp-open .go {
  margin-top: 14px; display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--r-sm); border: 0;
  background: var(--brand); color: #fff;
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  box-shadow: 0 8px 20px -10px color-mix(in srgb, var(--brand) 70%, transparent);
}
.gp-open .go:hover { background: var(--brand-deep); }
.gp-open .go[disabled] { background: var(--surface); color: var(--faint); box-shadow: none; border: 1px solid var(--line-strong); cursor: not-allowed; }

.gp-chip {
  position: absolute; top: 15px; left: 15px; z-index: 3;
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(3px);
  display: inline-flex; align-items: center; gap: 5px;
  opacity: 0; transition: opacity 0.25s ease;
}
.gpanel.active .gp-chip { opacity: 1; }
.gp-chip .d { width: 5px; height: 5px; border-radius: 50%; }
.gp-chip.live { color: var(--ok); }
.gp-chip.live .d { background: var(--ok); }
.gp-chip.soon { color: var(--muted); }
.gp-chip.soon .d { background: var(--faint); }

.caption { margin-top: 14px; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 8px; }
.caption .k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; }

@media (max-width: 760px) {
  .gallery { flex-direction: column; height: auto; }
  .gpanel { min-height: 66px; }
  .gpanel.active { min-height: 300px; }
  .gp-label { writing-mode: horizontal-tb; transform: none; left: 18px; bottom: 14px; top: auto; }
  .pop { position: fixed; left: 12px; right: 12px; top: 60px; width: auto; }
}

/* ============ hard-lock overlay ============ */
.lock-overlay {
  position: fixed; inset: 0; z-index: 999; display: grid; place-items: center;
  background: color-mix(in srgb, var(--ink) 46%, transparent);
  backdrop-filter: blur(3px);
}
.lock-box {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 24px 26px; text-align: center; max-width: 320px; box-shadow: var(--shadow);
}
.lock-box .g { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; margin: 0 auto 10px; background: var(--brand); color: #fff; font-weight: 700; }
.lock-box h2 { font-size: 15px; margin-bottom: 6px; }
.lock-box p { margin: 0 0 15px; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.lock-box .retry { width: 100%; border: 1px solid var(--line-strong); background: var(--inset); color: var(--ink); padding: 9px; border-radius: var(--r-sm); font-weight: 600; font-size: 12.5px; }
.lock-box .retry:hover { background: var(--bg-2); }
