/* Opt-in Signal Studio. Existing themes keep their original layout and palette. */
.advanced-heading { display: none; }

html[data-theme="advanced"] {
  color-scheme: dark;
  --bg: #202126;
  --bg-elevated: #27282f;
  --bg-soft: #292a32;
  --bg-canvas: #141519;
  --bg-header: #18191e;
  --bg-float: #2b2c35;
  --bg-feature: #23242c;
  --border: #353640;
  --border-strong: #a89aff;
  --text: #f4f3fa;
  --text-2: #dbdae6;
  --text-3: #b7b6c8;
  --text-4: #a7a6b9;
  --invert-bg: #b2a4ff;
  --invert-text: #181524;
  --accent: #bcafff;
  --accent-deep: #d5cdff;
  --accent-ink: #191526;
  --yes: #83dfb1;
  --yes-shine: #d4ffe7;
  --yes-soft: #83dfb1;
  --yes-border: #83dfb1;
  --banked: #9dbbff;
  --banked-soft: #9dbbff18;
  --banked-border: #9dbbff;
  --no: #f0edff;
  --no-border: #b8aed8;
  --unknown: #bebacf;
  --unknown-border: #484352;
  --scheduled: #c8b9ff;
  --k-completed: #d2c9ff;
  --k-completed-soft: #39334d;
  --k-completed-fg: #e3dcff;
  --k-scheduled: #93e2bc;
  --k-scheduled-soft: #253b32;
  --k-fulfilled: #afc6ff;
  --k-fulfilled-soft: #2e374b;
  --k-banked: #afc6ff;
  --k-limit: #eeeaff;
  --k-uncertain: #bebacf;
  --tibo-work: #a9c5ff;
  --tibo-sleep: #f4d883;
  --muted: var(--text-3);
  --surface-subtle: var(--bg-soft);
  --radius: 1.5rem;
  --radius-sm: .8rem;
  --shadow: 0 12px 30px #00000013, inset 0 1px 0 #ffffff04;
  --max: 76rem;
  --topbar-h: 5rem;

  body { background: radial-gradient(ellipse 65% 28rem at 15% 0, #79709710, transparent 85%), var(--bg-canvas); }
  :focus-visible { outline: 2px solid #c5baff; outline-offset: 4px; }
  .topbar { background: #18191eef; border-bottom-color: #ffffff0b; box-shadow: none; }
  .topbar-inner, .shell { width: min(var(--max), calc(100% - 4rem)); }
  .shell { padding-top: 2.25rem; }
  .brand { gap: .85rem; }
  .brand-mark { width: 2.65rem; height: 2.65rem; padding: .38rem; border-radius: .9rem; background: #7560ed; box-shadow: inset 0 1px 0 #ffffff35, 0 5px 18px #7560ed22; }
  .brand-text strong { color: var(--text); background: none; animation: none; font-weight: 650; font-size: 1.08rem; letter-spacing: -.025em; }
  .controls { gap: .55rem; }
  .topbar .control-btn { padding: .5rem .7rem; min-height: 2.65rem; border-color: transparent; background: #24252c; font-size: .78rem; }
  #theme-btn { background: #332b4b; border-color: #9a85f633; color: #d4c9ff; }
  #theme-icon { color: #c4b4ff; }
  .control-dropdown { background: #292a33; border-color: #49434f; padding: .4rem; box-shadow: 0 18px 65px #0007; border-radius: 1rem; }
  .control-option { border-radius: .65rem; min-height: 2.65rem; }
  .control-option[aria-checked="true"] { background: #7560ed; color: #fff; }
  .control-option[aria-checked="true"] .control-option-icon { color: #fff; }
  .advanced-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.65rem; }
  .advanced-eyebrow { display: flex; align-items: center; gap: .5rem; margin: 0 0 .65rem; color: #a39ac4; font: 500 .64rem/1.2 var(--font-mono); letter-spacing: .19em; }
  .advanced-eyebrow::before { content: ''; width: .4rem; height: .4rem; background: #b3a0ff; border-radius: 50%; box-shadow: 0 0 0 4px #a18fff12; }
  .advanced-heading h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin: 0; letter-spacing: -.05em; font-weight: 600; line-height: 1.35; }
  .advanced-nav { display: flex; gap: .2rem; padding: .3rem; background: #202127; border: 1px solid #ffffff08; border-radius: .9rem; }
  .advanced-nav a { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: .45rem 1.05rem; color: var(--text-3); text-decoration: none; font-size: .8rem; border-radius: .65rem; white-space: nowrap; transition: background .2s, color .2s; }
  .advanced-nav a:hover { background: #2c2b37; color: #fff; }
  .advanced-nav a[aria-current="page"] { background: #7661ed; color: #fff; box-shadow: 0 4px 12px #7661ed26, inset 0 1px 0 #ffffff25; }
  &:not([data-page-kind="home"]) .advanced-heading-copy { display: none; }
  &:not([data-page-kind="home"]) .advanced-heading { margin-bottom: 1.5rem; }
  .notify-bar { padding: .9rem 1.15rem; border-radius: 1rem; background: #222329; border-color: #ffffff06; box-shadow: none; }
  .notify-bar-info { gap: .25rem; }
  .notify-bar-kicker { color: #d9d6e9; font-family: var(--font-sans); font-weight: 600; }
  .notify-bar-kicker i { color: #b2a4ff; }
  .notify-bar-detail { font-size: .72rem; color: #aaa9bd; }
  .notify-bar-actions { gap: .45rem; }
  .notify-bar-btn { background: #39314e; color: #e5dcff; border-color: #786a9b55; }
  .notify-bar-link { border-color: #ffffff09; background: #2c2d34; }
  .clock-bar { padding: .4rem .1rem; margin: .75rem 0 1rem; background: transparent; border-color: transparent; box-shadow: none; gap: .8rem; }
  .clock-bar-kicker { font-family: var(--font-sans); font-size: .75rem; color: var(--text-3); }
  .clock-bar-now { font-size: .75rem; color: #d3cddd; }
  .clock-bar-switch, .event-time-switch { background: #2b2934; border-color: #3d374b; }
  .clock-bar-switch::before, .event-time-switch::before { background: #b6a9ef; }
  .tz-btn[aria-pressed="true"], .event-time-btn[aria-pressed="true"] { color: #211d2e; }
  .dashboard { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(19rem, 1fr); gap: 1rem; background: transparent; border: 0; box-shadow: none; overflow: visible; margin-bottom: 1.4rem; }
  .verdict-board { position: relative; border: 1px solid #79629e40; border-radius: 1.5rem; background: #25212f; box-shadow: 0 20px 44px #0002; isolation: isolate; }
  .verdict-stage { padding: 2.2rem; border-radius: inherit; min-height: 23rem; background: radial-gradient(ellipse 70% 85% at 110% 30%, #9582ed2c, transparent 75%), linear-gradient(135deg, #2e283f, #25212f 70%); }
  .verdict-stage::before { content: ''; position: absolute; pointer-events: none; z-index: 0; right: 1.1rem; top: 2rem; width: 15rem; height: 15rem; border-radius: 50%; background: conic-gradient(from 45deg, #bca4fc20, #e6d9ff65, #67578610, #bda8f533, #ddc9ff70, #bca4fc20); -webkit-mask-image: radial-gradient(circle, transparent 54%, #000 55% 64%, transparent 65%); mask-image: radial-gradient(circle, transparent 54%, #000 55% 64%, transparent 65%); transform: rotate(-28deg) scaleX(.7); opacity: .5; }
  .verdict-stage > :not(.today-share-menu) { position: relative; z-index: 1; }
  .verdict-kicker { font: 500 .87rem/1.5 var(--font-sans); letter-spacing: .01em; color: #d0c4e7; margin-bottom: 1.6rem; }
  .verdict-kicker i { color: #cbbaff; }
  .verdict-row { gap: 1.35rem; margin-bottom: 1.4rem; align-items: center; }
  .verdict-word { font-size: clamp(3rem, 6.7vw, 5.7rem); font-weight: 600; letter-spacing: -.065em; line-height: 1.1; }
  .verdict-stage[data-state] .verdict-word { color: #e0d4ff; background: none; -webkit-text-fill-color: currentColor; animation: none; text-shadow: 0 4px 24px #af89ff16; }
  .verdict-stage[data-state="yes"] .verdict-word { color: #a1efc5; }
  .verdict-stage[data-state="yes"][data-reset-type="banked"] .verdict-word { color: #b4c9ff; }
  .verdict-stage[data-state="unknown"] .verdict-word { color: #ccc3dc; }
  .verdict-stage[data-confidence-band="warn"] .verdict-word { color: #f1d996; }
  .verdict-percent { font-variant-numeric: tabular-nums; }
  .reaction-btn { min-height: 2.8rem; padding: .7rem 1rem; background: #c4b0ff; color: #251c37; border: 1px solid #dfd0ff; box-shadow: 0 6px 22px #0002; font-size: .78rem; font-family: var(--font-sans); letter-spacing: 0; transition: background .2s, transform .2s; }
  .reaction-btn:hover:not(:disabled) { background: #dfd1ff; color: #20162d; box-shadow: 0 8px 24px #0003; transform: translateY(-2px); }
  .verdict-meta { color: #c7bfd6; font-size: .84rem; line-height: 1.85; max-width: 36rem; }
  .verdict-countdown { display: inline-flex; color: #e1d4ff; font-size: .78rem; margin-top: .75rem; padding: .3rem .65rem; background: #b395f216; border: 1px solid #b395f226; border-radius: .5rem; }
  .verdict-countdown[hidden] { display: none; }
  .verdict-excerpt { margin-top: 1.25rem; max-width: 100%; padding: .85rem 0 0; border-top: 1px solid #b5a5d31f; color: #b8accb; font-size: .74rem; }
  .today-share-menu { top: 1rem; right: 1rem; }
  .today-share-menu .share-btn { width: 2.4rem; height: 2.4rem; background: #b8a4ea13; border-color: #b8a4ea25; border-radius: .8rem; color: #d7caef; }
  .dashboard:has(.share-menu.is-open) .verdict-stage, .dashboard:has(.share-menu.is-open) .verdict-board { border-radius: 1.5rem; }
  .signal-rail { display: grid; grid-template-columns: 1fr; gap: .7rem; border: 0; background: none; overflow: visible; border-radius: 0; }
  .signal-item { padding: 1.1rem 1.3rem; justify-content: center; gap: .65rem; border: 0; border-radius: 1.15rem; color: #242332; background: #c1d1fc; box-shadow: inset 0 1px 0 #ffffff60; }
  .signal-item:nth-child(2) { background: #efe0aa; }
  .signal-item:nth-child(3) { background: #ccbef6; }
  .signal-label { color: #383744; font-family: var(--font-sans); letter-spacing: 0; font-size: .76rem; }
  .signal-label i { color: #343443; opacity: 1; }
  .signal-item .signal-value, #last-reset-chip .signal-value, #next-chip[data-has-next] .signal-value { color: #262432; font-size: clamp(1rem, 1.6vw, 1.25rem); font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
  .signal-relative-time { color: #494654; font-size: .72rem; font-weight: 400; margin-left: .3rem; }
  .signal-rail .signal-reset-type[data-reset-type] { background: #ffffff45; color: #3d354c; border-color: #33233f23; font: 500 .62rem/1.2 var(--font-sans); padding: .2rem .4rem; }
  .signal-link, .signal-link:first-of-type { margin: 0; border: 1px solid #383541; background: #27242f; border-radius: .7rem; padding: .5rem 1rem; font-family: var(--font-sans); font-size: .7rem; min-height: 2rem; color: #c8bcdf; }
  .signal-link:hover { background: #39314e; color: #fff; }
  .reset-heatmap, .home-news, .timeline, .macos-app, .history-hero, .history-day, .history-detail, .news-row, .news-article, .faq-hero, .faq-card, .api-section { border-color: #ffffff0c; background: #202126; box-shadow: var(--shadow); }
  .section-kicker { color: #dedce9; font-family: var(--font-sans); font-size: .88rem; font-weight: 600; letter-spacing: -.01em; text-transform: none; }
  .section-kicker i { color: #b7a7fa; opacity: 1; }
  .heatmap-head, .section-head, .home-news-head { padding: 1.15rem 1.5rem; border-color: #ffffff08; }
  .reset-heatmap { --hm-0: #2b2d35; --hm-1: #4f7168; --hm-2: #679c82; --hm-3: #9dd6ac; --hm-4: #c6ecc5; --hm-b-1: #7a94c8; --hm-b-2: #9bafe9; --hm-b-3: #b1c3f7; --hm-b-4: #d1dcff; }
  .heatmap-meta { font-size: .65rem; color: #aaa8bc; }
  .heatmap-body { padding: 1rem 1.5rem 1.25rem; }
  .heatmap-cell { border-radius: 3px; }
  .tibo-radar[data-activity] { --tibo-scene-fg: #ede7fa; --tibo-scene-muted: #b9afcb; --tibo-scene-accent: #c5b2ff; background: radial-gradient(ellipse at 90% 5%, #9a70be22, transparent 70%), #272330; border-color: #68527d55; }
  .tibo-radar[data-activity="working"] { --tibo-scene-accent: #afc7ff; background: #242a37; border-color: #53688466; }
  .tibo-radar[data-activity="sleeping"] { --tibo-scene-accent: #e9d499; background: #282638; border-color: #6e667f55; }
  .tibo-radar .section-kicker { color: #e3dbf1; }
  .tibo-radar .tibo-status { color: var(--tibo-scene-accent); }
  .events li { padding: 1.4rem 1.5rem; background: transparent; border-top-color: #ffffff09; }
  .events li[data-pending="true"] { background: #9680d507; }
  .events li:first-child { border-top: 0; }
  .event-quote, .history-tweet { color: #d5d3e0; line-height: 1.8; }
  .tibo-avatar { border: 2px solid #82709955; box-shadow: 0 3px 12px #0003; }
  .kind-badge, .reset-type-badge { border-radius: .45rem; }
  .events p.schedule { border-radius: .65rem; background: #af91ff0b; padding: .6rem .8rem; }
  .event-meta { gap: .6rem 1.5rem; }
  .translation-heading, .event-meta-item { color: #aaa6bb; }
  .translation-toggle { color: #c9b9ff; }
  .macos-app { background: #24232c; }
  .macos-download-btn--primary { color: #ede7ff; background: #6852ca; border-color: #9d89ed; }
  .macos-download-btn--primary .macos-download-text span { color: #d6cbf1; }
  .site-footer { margin-top: 1.5rem; padding: 1.5rem 0; border-color: #ffffff0d; color: #a9a5b9; }
  .site-footer a:hover { color: #d1c1ff; }
  .wechat-float { background: #2d2939; border-color: #615474; color: #e5def1; box-shadow: 0 8px 25px #0004; }
  .poster-dialog, .wechat-dialog, .email-card, .email-panel { background: #22232b; border-color: #45414f; }
  .poster-dialog-head, .poster-dialog > .modal-footer, .wechat-dialog-head { border-color: #3a3745; }
  .poster-dialog-theme-btn, .poster-dialog-close, .wechat-dialog-close { border-color: #484350; box-shadow: none; }
  .poster-dialog-theme-btn[aria-pressed="true"], .poster-dialog-save { background: #a593ee; color: #211a33; border-color: #a593ee; }
  .local-mail-note { color: var(--text-3); }
  .api-base, pre, .api-code { background: #191a20; }
}

@media (min-width: 68rem) {
  html[data-theme="advanced"][data-page-kind="home"] {
    main.shell { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; column-gap: 1.2rem; }
    main.shell > * { min-width: 0; grid-column: 1 / -1; }
    main.shell > .reset-heatmap { grid-column: 1; }
    main.shell > .tibo-radar { grid-column: 2; }
    .tibo-main { flex-direction: column; align-items: flex-start; }
    .tibo-date { font-size: .75rem; }
  }
}
@media (max-width: 67.99rem) {
  html[data-theme="advanced"] {
    .dashboard { grid-template-columns: minmax(0, 1fr); }
    .verdict-stage { min-height: 20rem; }
    .verdict-word { font-size: clamp(3.5rem, 9vw, 5.5rem); }
    .signal-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .signal-link { grid-column: 1 / -1; }
    .signal-item { padding: 1rem; }
    .signal-heading { align-items: flex-start; }
    .signal-relative-time { display: block; margin: .2rem 0 0; }
  }
}
@media (max-width: 48rem) {
  html[data-theme="advanced"] {
    --topbar-h: 4.3rem;
    --radius: 1.25rem;
    .topbar-inner, .shell { width: calc(100% - 2rem); }
    .shell { padding-top: 1.6rem; }
    .topbar-inner { gap: .5rem; }
    .brand { gap: .6rem; }
    .brand-mark { width: 2.2rem; height: 2.2rem; padding: .25rem; border-radius: .75rem; }
    .brand-text strong { font-size: .92rem; }
    .controls { gap: .3rem; }
    .topbar .control-btn { min-height: 2.55rem; min-width: 2.4rem; padding: .35rem; }
    .advanced-heading { align-items: flex-start; flex-direction: column; gap: 1.2rem; margin-bottom: 1.2rem; }
    .advanced-heading h2 { font-size: 1.65rem; }
    .advanced-eyebrow { font-size: .6rem; margin-bottom: .6rem; }
    .advanced-nav { width: 100%; }
    .advanced-nav a { flex: 1; padding: .5rem .6rem; min-height: 2.7rem; font-size: .78rem; }
    .notify-bar { padding: .9rem 1rem; gap: .9rem; }
    .notify-bar-detail { line-height: 1.7; font-size: .7rem; }
    .notify-bar-actions { gap: .3rem; }
    .notify-bar-link, .notify-bar-btn { min-height: 2.5rem; padding-inline: .55rem; }
    .clock-bar { margin: .9rem 0; padding: 0; }
    .clock-bar-kicker, .clock-bar-now { font-size: .7rem; }
    .dashboard { gap: .85rem; }
    .verdict-stage { padding: 1.65rem 1.35rem; min-height: 0; border-radius: 1.3rem; }
    .verdict-board { border-radius: 1.3rem; }
    .verdict-stage::before { opacity: .15; width: 12rem; height: 12rem; right: 0; top: 2rem; }
    .verdict-kicker { font-size: .77rem; margin-bottom: 1.3rem; }
    .verdict-row { gap: .95rem; align-items: flex-start; margin-bottom: 1.2rem; }
    .verdict-word { font-size: clamp(2.8rem, 12vw, 4.5rem); letter-spacing: -.055em; }
    .reaction-btn { min-height: 2.65rem; padding: .55rem .85rem; margin-top: .25rem; }
    .verdict-meta { font-size: .78rem; line-height: 1.9; }
    .verdict-countdown { font-size: .72rem; }
    .verdict-excerpt { margin-top: 1.05rem; font-size: .7rem; }
    .signal-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
    .signal-item { padding: 1rem; gap: .7rem; border-radius: 1rem; }
    .signal-label { font-size: .68rem; line-height: 1.5; }
    .signal-heading { gap: .45rem; }
    .signal-item .signal-value, #last-reset-chip .signal-value, #next-chip[data-has-next] .signal-value { font-size: .98rem; line-height: 1.5; }
    .signal-item:nth-child(3) { grid-column: 1 / -1; display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: .7rem; }
    .signal-item:nth-child(3) .signal-value { white-space: nowrap; }
    .signal-item:nth-child(3) .signal-heading { flex-direction: column; }
    .signal-link { min-height: 2.75rem; }
    .heatmap-head, .section-head, .home-news-head { padding: 1.1rem; }
    .section-kicker { font-size: .8rem; }
    .heatmap-body { padding: .8rem 1.1rem 1.1rem; }
    .heatmap-meta { font-size: .6rem; line-height: 1.5; }
    .events li { padding: 1.25rem 1rem; gap: .7rem; }
    .event-meta { gap: .5rem 1rem; }
    .tibo-avatar { width: 2rem; height: 2rem; }
    .events p.schedule { padding: .5rem .65rem; }
    .site-footer { margin-top: .5rem; }
  }
}
@media (max-width: 23rem) {
  html[data-theme="advanced"] {
    .topbar-inner, .shell { width: calc(100% - 1.5rem); }
    .brand-text strong { font-size: .78rem; }
    .brand-mark { width: 1.8rem; height: 1.8rem; }
    .brand { gap: .4rem; }
    .controls { gap: .15rem; }
    .topbar .control-btn { min-width: 2.2rem; }
    .advanced-heading h2 { font-size: 1.45rem; }
    .verdict-stage { padding: 1.4rem 1rem; }
    .verdict-word { font-size: 2.8rem; }
    .signal-item { padding: .85rem; }
    .signal-item:nth-child(3) { flex-direction: column; align-items: flex-start; }
    .signal-item:nth-child(3) .signal-heading { flex-direction: row; }
  }
}
@media (prefers-reduced-motion: reduce) {
  html[data-theme="advanced"] *, html[data-theme="advanced"] *::before, html[data-theme="advanced"] *::after { animation: none !important; transition: none !important; }
}
