/*
  styles.css — Global styles for GammaLab frontend.

  - Roboto font, loaded from Google Fonts in HTML.
  - Page content centered horizontally and vertically.
  - Light/dark theme via CSS variables, switched by a [data-theme] attribute on <html>.
*/

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --fg: rgba(0,0,0,0.8);
  --primary: rgba(77, 179, 162, 1);
  --muted: #555555;
  --border: #cccccc;
  --border-sh: var(--bg);
  --accent: #000000;
  --input-bg: rgba(0, 0, 0, 0.15);
  --input-fg: #000000;
  --menu-bg:  rgba(0, 0, 0, 0.1);
  --button-bg: rgba(0, 0, 0, 0.15);
  --button-fg: #000000;
  --button-ho: rgba(0, 0, 0, 0.2); /* hover */
  --error: #b00020;
  --success: #006400;
  --highlight: rgba(219, 73, 252, 1);
  --highlight2: rgba(160, 73, 252, 1);
  --highlight3: rgba(252, 73, 207, 1);
  --ticker-bg: rgba(0,0,0,0.05);
  --ticker-fg: rgba(0,0,0,0.5);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: rgba(12, 11, 13, 1);
  --fg: rgba(255,255,255,0.8);
  --primary: rgba(77, 179, 162, 1);
  --secondary: rgba(50, 48, 64, 1);
  --highlight: rgba(221, 204, 255, 0.12);
  --muted: #aaaaaa;
  --border: #333333;
  --border-sh: var(--bg);
  --accent: #ffffff;
  --input-bg: rgba(221, 204, 255, 0.08);
  --input-fg: rgba(255,255,255,0.8);
  --menu-bg:  rgba(221, 204, 255, 0.1);
  --button-bg: rgba(221, 204, 255, 0.08);
  --button-fg: rgba(255,255,255,0.8);
  --button-ho: rgba(221, 204, 255, 0.12); /* hover */
  --error: #ff6b6b;
  --success: #7CFC7C;
  --ticker-bg: rgba(255,255,255,0.05);
  --ticker-fg: rgba(255,255,255,0.5);
}

/* ── Chart colors ────────────────────────────────────────────────────── */

:root[data-theme="light"] {
  --chart-bar:        var(--primary);
  --chart-border:     var(--primary);
  --chart-neg-bar:    rgba(0, 0, 0, 0.75);
  --chart-neg-border: rgba(0, 0, 0, 1);
  --chart-grid:       rgba(0, 0, 0, 0.08);
  --chart-tick:       var(--muted);
  --chart-line:       rgba(0, 0, 0, 0.75);
  --chart-ref-line:   rgba(160, 160, 160, 0.45);
  --chart-sg-today:   var(--primary); /* spot vs gamma chart */
  --chart-sg-prior:   rgba(180, 180, 180, 1);
}

:root[data-theme="dark"] {
  --chart-bar: var(--primary);
  --chart-border: var(--primary);
  --chart-neg-bar: #B3577D; /* #B34D77 rgba(250, 250, 250, 0.75); */
  --chart-neg-border: #B34D77; /* rgba(250, 250, 250, 1); */
  --chart-grid: rgba(255, 255, 255, 0.08);
  --chart-tick:   var(--muted);
  --chart-legend: var(--primary);
  --chart-line: rgba(255, 255, 255, 0.75);
  --chart-line-secondary: rgba(255, 255, 255, 0.75);
  --chart-sg-today: var(--primary); /* spot vs gamma chart */
  --chart-sg-prior: rgba(255, 255, 255, 0.75);
}

* {
  box-sizing: border-box;
}

/* ── Splash screen ───────────────────────────────────────────────────── */

#splash {
  position: fixed;
  inset: 0;
  background: rgba(24, 23, 26, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: splash-out 0.2s ease 1.8s forwards;
}

#splash span {
  color: #fff;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  font-size: 6vw;
  line-height: 1;
  white-space: nowrap;
  animation: splash-scale 1s ease forwards, splash-fade 1s ease forwards, splash-fade-out 0.5s ease 1s forwards;
}

@keyframes splash-scale {
  from { transform: scale(0.333); }
  to   { transform: scale(1); }
}

@keyframes splash-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes splash-out {
  to { opacity: 0; pointer-events: none; }
}

@keyframes splash-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── Typography & base elements ─────────────────────────────────────── */

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: 0.02em;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.3rem; margin-top: 0;}
h3 { font-size: 1.1rem; }

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

ul, ol {
  text-align: left;
  display: inline-block;
  margin: 0.5em auto;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  width: 100%;
  margin: 1.2em 0;
}

/* ── html & body tags ─────────────────────────────────────── */

html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Roboto', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  touch-action: pan-y; /* Only allow vertical scrolling gestures */
}

/* Hide the scrollbar UI but keep the page scrollable. */
html { scrollbar-width: none; overflow: hidden; }   /* Firefox */
html::-webkit-scrollbar { display: none; }          /* Chromium, Safari */

body {
  /* Max-width of all site content lives here. Body itself is the
     centered content column; children stretch to fill it. */
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: center;
  overflow-y: auto;
  scrollbar-width: none;
}

body::-webkit-scrollbar { display: none; }

body:has(#login-form) {
  justify-content: center;
  align-items: center;
  padding: 20px;
  max-width: 100vw;
}

body:has(#login-form) #login-section,
body:has(#login-form) #change-password-section {
  max-width: 400px;
  width: 100%;
  padding: 0;
}

body:has(#login-form) #login-section h2,
body:has(#login-form) #change-password-section h2 {
  text-align: center;
}

/* ── Inputs, textareas, buttons, labels ─────────────────────────────── */

input:focus, textarea:focus {
  outline: none;
  box-shadow: none;
  -webkit-appearance: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  font-family: inherit;
  font-size: inherit;
  background: var(--input-bg);
  color: var(--input-fg);
  border: 0px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 10px;
  width: 100%;
}

textarea#post-bulletin-input,
textarea#post-news-input,
textarea#post-techlog-input,
textarea#support-message {
  height: 200px;
}

textarea#post-bulletin-input {
  height: 600px;
}

textarea.article-edit-input {
  width: 100%;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  min-height: 2em;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

button {
  font-family: inherit;
  font-size: inherit;
  background: var(--button-bg);
  color: var(--button-fg);
  border: none;
  border-radius: 10px;
  width: 100%;
  margin: 10px 0 10px 0;
  padding: 10px;
  cursor: pointer;
}

button:hover { 
  background: var(--button-ho); 
  text-decoration: none;
}

button.tab {margin: 0px;}

.article-controls button {
  margin: 0px;
  padding: 0px;
}

label { color: var(--muted); }

/* ── Tab bar (main menu) ────────────────────────────────────────────── */

.tabs {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 1200px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 20px var(--border-sh);
}

.tabs .tab {
  flex: 1 1 0;
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 10px;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tabs .tab:hover {
  color: var(--fg);
  background: var(--button-bg);
}

.tabs .tab.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}

/* ── Admin ──────────────────────────────────── */

.admin-fold {
  width: 100%;
  /* max-width: 800px; */
  margin: 0 auto 20px auto;
  border-radius: 10px;
  background: var(--button-bg);
  text-align: left;
}

.admin-fold:hover {background: var(--button-ho);}

.admin-fold > summary {
  cursor: pointer;
  padding: 20px 20px;
  font-weight: 600;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.admin-fold > summary::-webkit-details-marker { display: none; }

.admin-only-label { font-weight: normal; }

.admin-fold > summary::after {
  content: "+";
  font-family: inherit;
  margin-left: auto;
  color: var(--muted);
}
.admin-fold[open] > summary::after { content: "−"; }

.admin-fold[open] {
  background: var(--bg);
  border: 1px solid var(--border);
}

.admin-fold > *:not(summary):not(textarea) {
  padding: 0 20px;
}
.admin-fold > *:last-child:not(summary) {
  padding-bottom: 20px;
}

.textarea-auto {
  resize: none;
  overflow: hidden;
  height: auto;
  width: calc(100% - 40px);
  margin-left: 20px;
  margin-right: 20px;
}

.admin-config-heading {
  font-size: inherit;
  margin-top: 5px;
  margin-bottom: 5px;
  background: color-mix(in srgb, var(--button-bg) 100%, transparent);
}

.admin-config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0 5px 0;
  gap: 5px;
}

.admin-config-label {
  flex: 1;
  min-width: 0;
  color: var(--fg);
}

input.admin-config-input {
  font-size: inherit;
  text-align: center;
  width: 200px;
  margin-bottom: 0;
  padding: 2px;
  border-radius: 0;
}

input.admin-config-input:focus {
  background: var(--highlight);
}

.agent-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0 5px 0;
  border-bottom: 1px solid var(--border);
}

.agent-row-right {
  display: flex;
  align-items: center;
  gap: 0.8em;
}

.agent-status {
  font-size: 0.85em;
}

.btn-credit {
  display: inline;
  width: auto;
  margin-left: 0.6em;
  padding: 2px 2px;
  font-size: 0.85em;
}
/* .agent-status.running  { color: var(--success, green); }
.agent-status.stopped  { color: var(--error, red); } */

/* Direct action buttons — pixel-identical to the fold summary bar. */
.admin-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  /* max-width: 800px; */
  margin: 0 auto 20px auto;
  padding: 20px;
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  line-height: 1.5;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}

.admin-btn:hover {
  background: var(--button-ho);
  text-decoration: none;
}

.admin-sub-btn {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 10px;
  background: transparent;
  color: var(--fg);
  border: none;
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.admin-sub-btn:hover { text-decoration: underline; }

/* ── Content general ──────────────────── */

.content {
  padding: 0;
  flex: 1;
}

.content:not(:has(#claude-form)) {
  padding: 40px 20px 100px 20px;
}

/* ── Prompt tab (centered input, fixed at bottom) ──────────────────── */

#claude-form {
  display: none;
  flex-direction: column;
  align-items: center;
  position: relative;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  background: var(--bg);
  padding: 20px 20px 12px 20px;
  margin: 0;
  z-index: 100;
  box-shadow: 0 -10px 20px var(--border-sh);
}

#claude-tokens a { color: inherit; }

#claude-tokens {
  margin: 4px 0 0 0;
  font-size: 0.75em;
  color: var(--muted);
  text-align: center;
}

#claude-chat {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  font-family: inherit;
  font-size: inherit;
  margin-bottom: 20px;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--input-bg);
  text-align: right;
  border-radius: 16px 0 16px 16px;
  margin-right: 20px;
}

.chat-bubble.claude {
  align-self: flex-start;
  background: var(--input-bg);
  text-align: left;
  border-radius: 0 16px 16px 16px;
  margin-left: 20px;
}

#claude-intro {
  opacity: 0;
  transition: opacity 1s ease;
  color: var(--fg);
  padding: 0 20px 0 20px;
}

#help-overlay p,
#claude-intro p {
  margin-bottom: 5px;
}

#claude-input {
  width: 75%;
  max-width: 800px;
  padding: 20px;
  text-align: left;
  font-family: monospace;
  transition: background 0.2s ease;
}

#claude-input:focus {
  background: var(--primary);
  color: black;
}
#claude-input:focus ~ #dte-hint {
  color: black;
}

#admin-change-password-form input[type="password"] {
  transition: background 0.2s ease;
}

#admin-change-password-form input[type="password"]:focus {
  background: var(--highlight);
}

#slash-menu {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 75%;
  max-width: 800px;
  background: var(--menu-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
}

#slash-menu.visible { display: block; }

#dte-hint {
  display: none;
  position: fixed;
  font-family: monospace;
  font-size: 0.78em;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  z-index: 101;
  opacity: 0;
  transition: opacity 0.6s ease;
}
#dte-hint.visible { display: block; opacity: 1; }

.dte-filter-overlay {
  display: none;
  margin-right: auto;
}
.dte-filter-overlay.visible { display: inline-flex; align-items: center; }
input.dte-filter-input {
  font-family: monospace;
  font-size: 0.85em;
  padding: 2px 5px;
  background-color: var(--primary);
  border: none !important;
  color: var(--input-fg);
  width: 150px;
  border-radius: 10px;
  outline: none;
  opacity: 1;
  transition: opacity 0.15s;
  margin-top: 8px;
}
input.dte-filter-input:focus,
input.dte-filter-input:hover { opacity: 1; border: none; outline: none; }
input.dte-filter-input::placeholder { color: var(--input-fg); }
input.dte-filter-input:focus::placeholder { color: transparent; }
.dte-filter-label {
  font-size: 0.8em;
  color: var(--input-fg);
  margin-right: 6px;
  white-space: nowrap;
}
.slash-back-btn {
  display: block;
  width: 100%;
  padding: 5px 10px;
  text-align: left;
  font-size: 1em;
  color: var(--muted);
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0px;
  cursor: pointer;
  margin: 0;
}
.slash-back-btn:hover { background: var(--button-bg); color: var(--fg); }

.slash-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 5px 10px;
  cursor: pointer;
}

.slash-item:hover,
.slash-item.selected { background: var(--button-bg); }

.slash-item-cmd {
  font-family: monospace;
  font-size: 1em;
  white-space: nowrap;
}

.slash-item-desc {
  font-size: 1em;
  color: var(--muted);
  white-space: nowrap;
}

.hidden {
  display: none;
}

.content:has(#claude-form):not([hidden]) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-bottom: 120px;
}

.content:has(#claude-form):not([hidden]) #claude-form {
  display: flex;
}

/* ── Feed tab (top-aligned) ─────────────────────────────────────────── */

.content:has(#market-ticks):not([hidden]) {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  padding: 20px;
}

/* ── News feed articles ──────────────────────────────────────────────── */

#news-feed {
  margin-top: -40px;
}

@keyframes article-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.news-article {
  display: block;
  padding: 40px 0 40px 0;
  border-bottom: 1px solid var(--border);
  width: 100%;
  text-align: left;
}
.news-article:last-child {
  border-bottom: none;
}

.article-content {
  display: block;
  /* margin-bottom: 10px; */
}

.article-time {
  color: var(--muted);
  font-size: 0.85em;
}

.article-controls {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding-top: 10px;
  font-size: 0.85em;
}

.article-controls .article-time {
  margin: 0;
}

.article-edit-btn,
.article-delete-btn,
.article-send-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  width: auto;
  padding: 0;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.article-edit-btn:hover,
.article-delete-btn:hover,
.article-send-btn:hover {
  color: var(--fg);
}

.article-send-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.article-send-status {
  color: var(--muted);
  font-style: italic;
}
.article-send-status:empty { display: none; }

.send-confirm-link {
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-style: normal;
}

.send-confirm-link:hover {
  color: var(--fg);
}

/* ── Blog section overrides ────────────────────────────────────────── */

#bulletins-feed .news-article {
  padding-top: 40px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
}

#bulletins-feed .news-article > .article-controls,
#bulletins-feed .news-article > .article-time {
  order: -1;
  margin-top: 0;
  margin-bottom: 0.5em;
}

/* ── Post News bar (feed, admin only) ──────────────────────────────── */

#post-news-fold > details {
  width: 100%;
  max-width: 1200px;
}

#post-news-fold > details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 20px 20px 20px;
  padding: 10px;
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--input-fg);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-family: inherit;
  font-size: inherit;
}
#post-news-fold > details > summary::-webkit-details-marker { display: none; }
#post-news-fold > details > summary::after {
  content: "+";
  color: var(--muted);
  margin-left: 0.5em;
}
#post-news-fold > details[open] > summary::after { content: "−"; }

#post-news-fold > details > form {
  padding: 0px 20px;
  margin-bottom: 10px;
}
#post-news-fold > details > form > button[type="submit"] {
  margin-top: 0px;
}

.content:has(#post-news-fold:not([hidden])):not([hidden]) {
  padding-bottom: 100px;
}

.content:has(#post-news-fold:not([hidden])):not([hidden]) #post-news-fold {
  position: fixed;
  bottom: 25px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  /* padding: 20px 20px 12px 20px; */
  z-index: 100;
  box-shadow: 0 -10px 20px var(--border-sh);
}

#bulletins-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -20px 0 40px 0;
}
#bulletins-filter-bar .bulletin-filter-btn {
  display: inline-block;
  width: auto;
  padding: 3px 10px;
  white-space: nowrap;
}

#bulletins-feed {
  margin-top: -60px;
}

#bulletins-load-more-row {
  display: flex;
  justify-content: center;
}
#bulletins-load-more-btn {
  width: auto;
  padding-left: 25px;
  padding-right: 25px;
}

/* ── Post Bulletin fold (mirrors Post News fold) ─────────────────────── */

#post-bulletin-fold > details { /* post bog */
  width: 100%;
  max-width: 1200px;
}

#post-bulletin-fold > details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 20px 20px 20px;
  padding: 10px;
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--input-fg);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-family: inherit;
  font-size: inherit;
}
#post-bulletin-fold > details > summary::-webkit-details-marker { display: none; }
#post-bulletin-fold > details > summary::after {
  content: "+";
  color: var(--muted);
  margin-left: 0.5em;
}
#post-bulletin-fold > details[open] > summary::after { content: "−"; }

#post-bulletin-fold > details > form {
  padding: 0px 20px;
  margin-bottom: 10px;
}
#post-bulletin-fold > details > form > button[type="submit"] {
  margin-top: 0px;
}

#bulletins-feed img,
#news-feed img,
#techlog-feed img {
  display: block;
  max-width: 75% !important;
  margin: 40px auto;
}

#post-bulletin-img-bar,
#post-news-img-bar,
#post-techlog-img-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  flex-wrap: wrap;
}
#post-bulletin-file,
#post-news-file,
#post-techlog-file {
  display: none;
}
#post-bulletin-file-label,
#post-news-file-label,
#post-techlog-file-label {
  cursor: pointer;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--text);
  background: var(--bg);
  white-space: nowrap;
  overflow: hidden;
  max-width: 180px;
  text-overflow: ellipsis;
}
#post-bulletin-file-label:hover,
#post-news-file-label:hover,
#post-techlog-file-label:hover {
  background: var(--hover);
}
#post-bulletin-upload-status,
#post-news-upload-status,
#post-techlog-upload-status {
  font-size: 0.8em;
  color: var(--muted);
}

.content:has(#post-bulletin-fold:not([hidden])):not([hidden]) {
  padding-bottom: 100px;
}

.content:has(#post-bulletin-fold:not([hidden])):not([hidden]) #post-bulletin-fold {
  position: fixed;
  bottom: 25px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  z-index: 100;
  box-shadow: 0 -10px 20px var(--border-sh);
}

/* ── Post Blog — center the image picker row ────────────────────────── */

#post-bulletin-img-bar {
  justify-content: center;
}

/* ── Post Blog — email checkbox row (under submit, centered) ────────── */

#post-bulletin-email-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin: 8px 0 4px 0;
}

#post-bulletin-email-label,
#post-bulletin-public-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85em;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.bulletin-public-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: inherit;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

/* ── Format toolbar (sits above content textareas) ──────────────────── */

.format-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 4px 0 4px 0;
  flex-wrap: wrap;
}

.format-toolbar button {
  padding: 2px 8px;
  font-size: 0.8em;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  width: auto;
  margin: 0;
}

.format-toolbar button:hover {
  background: var(--hover);
}

.format-toolbar button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.format-toolbar .format-italic-btn {
  font-style: italic;
}

.format-toolbar .format-strong-btn {
  font-weight: 700;
}

.format-toolbar .polish-status {
  font-size: 0.8em;
  color: var(--muted);
  font-style: italic;
  margin-left: 4px;
}

/* ── Blog Read more link ────────────────────────────────────────────── */

.read-more-link {
  display: inline-block;
  margin-top: 0.4em;
  color: var(--muted);
  font-size: 0.9em;
  text-decoration: underline;
  cursor: pointer;
}

.read-more-link:hover {
  color: var(--fg);
}

/* ── BLanding Page Blog ────────────────────────────────────────────── */

body:has(#blog-wrap) {
  padding-top: 0;
  max-width: 100%;
}
#blog-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px 40px;
}
#blog-header {
  width: 100%;
  background: var(--primary);
}
#blog-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
#blog-brand {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #ffffff;
  text-decoration: none;
  pointer-events: none;
  margin: 0;
}
#blog-brand:hover { opacity: 1; }
#blog-header-sub {
  color: #ffffff;
  margin: 0;
  text-align: left;
}
#blog-login-link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}
#blog-login-link:hover { color: var(--fg); }
#blog-feed {
  margin-top: -20px;
}
#blog-feed img {
  display: block;
  max-width: 75%;
  margin: 40px auto;
}
#blog-load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}
#blog-load-more-btn {
  width: auto;
  padding-left: 25px;
  padding-right: 25px;
}
#blog-empty {
  color: var(--muted);
  font-style: italic;
  margin-top: 64px;
  text-align: center;
}
#blog-cta {
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border, #333);
  font-size: 0.9rem;
  color: var(--muted);
}
#blog-cta a {
  color: var(--fg);
  text-decoration: underline;
}

/* ── Post Tech Log (nested inside Tech Log fold) ────────────────────── */

#techlog-feed {margin-top: -20px;}

#techlog-feed .news-article {
  padding: 20px 0 20px 0;
  display: flex;
  flex-direction: column;
}

#techlog-feed .news-article > .article-controls,
#techlog-feed .news-article > .article-time {
  order: -1;
  margin-top: 0;
  margin-bottom: 0.5em;
}

#post-techlog-fold {
  padding: 0;
}

#post-techlog-fold > details {
  width: 100%;
}

#post-techlog-fold > details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 20px 20px 20px;
  padding: 10px;
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--input-fg);
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  font-family: inherit;
  font-size: inherit;
}
#post-techlog-fold > details > summary::-webkit-details-marker { display: none; }
#post-techlog-fold > details > summary::after {
  content: "+";
  color: var(--muted);
  margin-left: 0.5em;
}
#post-techlog-fold > details[open] > summary::after { content: "−"; }

#post-techlog-fold > details > form {
  padding: 0px 20px;
  margin-bottom: 10px;
}
#post-techlog-fold > details > form > button[type="submit"] {
  margin-top: 0px;
}

/* ── Chart container ─────────────────────────────────────────────────── */

#chart-container {
  width: 100%;
  position: sticky;
  top: 0px;
  z-index: 40;
  background: var(--bg);
  padding: 0 20px 20px 20px;
  box-shadow: 0 6px 18px var(--border-sh);
}

#chart-header {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  height: 22px;
  padding: 20px 0 15px 0;
}

#chart-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
  font-size: 0.8em;
  color: var(--muted);
  font-weight: 400;
  text-align: left;
}

#help-overlay {
  position: fixed;
  top: 40px;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1200px;
  z-index: 45;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 20px;
  padding-bottom: 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
}
#help-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.help-item {
  padding: 5px;
  border-radius: 6px;
  transition: background 0.12s;
}

.help-item-text {
  font-size: 0.88em;
}

.help-item-desc-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.help-item:hover .help-item-desc-wrap {
  grid-template-rows: 1fr;
}

.help-item-desc {
  overflow: hidden;
  font-size: 0.8em;
  color: var(--muted);
  opacity: 0;
  padding-top: 0;
  transition: opacity 0.2s ease, padding-top 0.25s ease;
}

.help-item:hover .help-item-desc {
  opacity: 1;
  padding-top: 4px;
}

#chart-label {
  white-space: pre-line;
}

#chart-hints {
  letter-spacing: 0.02em;
}

#chart-close,
#chart-download,
#chart-popout,
#chart-maxwidth {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: auto;
  line-height: 1;
  margin: 0;
}

#chart-close { font-size: 1.1em; }
#chart-download,
#chart-popout,
#chart-maxwidth { font-size: 0.75em; }
#chart-hints { font-size: 0.75em; color: var(--muted); }
#chart-hints:not(:empty)::after { content: '\00a0\00a0|\00a0\00a0'; }
.chart-sep { font-size: 0.75em; color: var(--muted); padding: 0 6px; user-select: none; }
@media (max-width: 768px) { #chart-hints { display: none; } #chart-popout { display: none; } #chart-sep-popout { display: none; } #chart-maxwidth { display: none; } #chart-sep-maxwidth { display: none; } }

body.chart-maxwidth                  { max-width: 100vw; }
body.chart-maxwidth #chart-container { width: 100%; margin-left: 0; }
body.chart-maxwidth .content         { max-width: 1200px; margin-left: auto; margin-right: auto; }

#chart-close:hover,
#chart-download:hover,
#chart-popout:hover,
#chart-maxwidth:hover {
  color: var(--fg);
  background: transparent;
}

/* ── Chart popup page ─────────────────────────────────────────────────── */
body.chart-popup {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
  padding: 12px;
  box-sizing: border-box;
  overflow: hidden;
  max-width: unset;
  align-items: unset;
  justify-content: unset;
}
#popup-header {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  height: 22px;
  margin-bottom: 4px;
  flex-shrink: 0;
}
body.chart-popup #popup-header,
body.dashboard #popup-header { position: relative; z-index: 501; }
#popup-wrapper {
  flex: 1;
  position: relative;
  min-height: 0;
}
#popup-footer {
  margin-top: 8px;
  font-size: 0.8em;
  color: var(--muted);
  font-weight: 400;
  white-space: pre-line;
  text-align: left;
  flex-shrink: 0;
}
#split-container {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
}
#split-container.split-v { display: flex; flex-direction: row; }
#split-container.split-h { display: flex; flex-direction: column; }
.split-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.split-pane.split-node.split-v { flex-direction: row; }
.split-resizer {
  flex-shrink: 0;
  background: var(--border);
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}
.split-resizer-v {
  width: 5px;
  cursor: col-resize;
}
.split-resizer-h {
  height: 5px;
  cursor: row-resize;
}
.split-resizer:hover,
.split-resizer.dragging {
  background: var(--accent, #4a9eff);
}
.split-pane-hints {
  font-size: 0.7em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.split-pane-wrapper {
  flex: 1;
  position: relative;
  min-height: 0;
}
.split-pane.split-leaf { transition: box-shadow 0.6s ease; }
.split-pane.split-leaf.active { box-shadow: inset 0 0 0 2px var(--accent, #4a9eff); }
.split-pane-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 4px 8px 0;
  flex-shrink: 0;
  min-height: 1.4em;
}
.split-pane-label {
  padding: 2px 8px 4px;
  font-size: 0.75em;
  color: var(--muted);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.split-pane-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.split-pane-sep {
  font-size: 0.7em;
  color: var(--muted);
}
.split-pane-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.7em;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.split-pane-btn:hover { color: var(--fg, #fff); }
.split-pane-close { font-weight: bold; }
#popup-split-close, #popup-split-close-sep { display: none; }
#popup-split-close {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: auto;
  font-size: 0.75em;
  line-height: 1;
  margin: 0;
}
#popup-split-close:hover { color: var(--fg); }
#popup-download {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  width: auto;
  font-size: 0.75em;
  line-height: 1;
  margin: 0;
}
#popup-download:hover { color: var(--fg); background: transparent; }

#popup-hint {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 190;
  opacity: 0;
  transition: opacity 0.5s ease;
}
#popup-hint.visible { opacity: 1; }
#popup-hint-card {
  pointer-events: auto;
  background: var(--menu-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 0.9em;
  color: var(--fg);
}
#popup-hint kbd {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  font-family: monospace;
  font-size: 0.95em;
}
#popup-hint-never {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 0.78em;
  color: var(--muted);
  text-decoration: underline;
  width: auto;
  margin-bottom: 0;
}
#popup-hint-never:hover { color: var(--fg); }

#popup-prompt-overlay {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 20px 16px;
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 -10px 20px var(--border-sh);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 600;
}
[data-theme="dark"] #popup-prompt-overlay {
  background: rgba(12, 11, 13, 0.5);
}
#popup-prompt-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}
#popup-input-wrapper {
  position: relative;
  width: 75%;
  max-width: 800px;
}
#popup-slash-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--menu-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
  max-height: 220px;
  overflow-y: auto;
}
#popup-slash-menu.visible { display: block; }
#popup-chart-input {
  width: 100%;
  max-width: 100%;
  padding: 20px;
  text-align: left;
  font-family: monospace;
  transition: background 0.2s ease;
  box-sizing: border-box;
  margin-bottom: 0;
}
#popup-chart-input:focus {
  background: var(--primary);
  color: black;
}

#chart-wrapper {
  position: relative;
  height: calc(50vh - 80px);
}

#chart-canvas {
  display: block;
}

#chart-resize-handle {
  height: 50px;
  margin-top: -25px;
  position: relative;
  z-index: 41;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
}

#chart-resize-grip {
  font-size: 1.5em;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.2s;
  user-select: none;
}

#chart-resize-handle:hover #chart-resize-grip,
#chart-resize-handle.dragging #chart-resize-grip {
  opacity: 1;
}

/* ── Landing page (index.html only) ─────────────────────────────────────
   All selectors below are scoped to elements that only exist on index.html.
   body overrides use body.landing to avoid touching other pages.
   ──────────────────────────────────────────────────────────────────────── */

body.landing {
  max-width: 100vw !important;
  margin: 0 !important;
  background: transparent;
  padding: 0 !important;
  justify-content: flex-start !important;
  align-items: stretch !important;
}

body.landing #brand {
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  height: 100vh;
  height: var(--full-height, 100vh);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
    -webkit-mask-image: linear-gradient(to bottom, black 75%, transparent);
  mask-image: linear-gradient(to bottom, black 75%, transparent);
}
body.landing #brand::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0px; /* 300px original value - controls the fading height */
  background: linear-gradient(to bottom, transparent, var(--bg));
  z-index: 2;
  pointer-events: none;
}

#logo-group {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(-10vh);
  animation: logoFadeIn 2s ease both;
}

@keyframes logoFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#bg-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: color-mix(in srgb, var(--bg) 50%, transparent);
  z-index: 10000;
  box-shadow: 0 0 100px 0 color-mix(in srgb, var(--bg) 50%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 1s ease;
}
#site-header.header-hidden {
  opacity: 0;
  pointer-events: none;
}

#header-login-btn,
#header-blog-btn {
  color: var(--fg);
  font-size: 0.9em;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  padding: 6px 18px;
  border-radius: 8px;
  background: var(--button-bg);
  transition: background 0.15s;
}

#header-login-btn:hover,
#header-blog-btn:hover {
  background: var(--button-ho);
  text-decoration: none;
}

#site-header:has(#header-blog-btn) {
  gap: 10px;
}


#logo {
  display: block;
  font-family: monospace;
  font-weight: 700;
  font-size: min(calc((100vw - 80px) / 2.5), 250px); /* 320px original value */
  line-height: 1;
  white-space: nowrap;
  margin-bottom: 20px;
}

#logo-text {
  font-weight: 700;
  font-size: min(calc((100vw - 80px) / 5), 160px);
}

#logo-rule {
  width: 100%;
  border: none;
  border-top: 2px solid var(--fg);
  margin: -10px 0 40px 0;
  opacity: 0.4;
}

#logo-slogan {
  font-size: clamp(1rem, 2vw, 2em);
  font-weight: 400;
  letter-spacing: 0.08em;
  opacity: 0.7;
  text-align: center;
}

#scroll-hint {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  z-index: 100;
  transition: opacity 0.5s ease;
}
#scroll-hint.scrolled-away {
  opacity: 0;
  pointer-events: none;
}

.scroll-chevron {
  width: 0;
  height: 0;
  border-left: min(25px, 3vh) solid transparent;
  border-right: min(25px, 3vh) solid transparent;
  border-top: min(25px, 3vh) solid white;
  opacity: 0;
  animation: chevronFade 2.5s ease-in-out infinite;
}

.scroll-chevron:nth-child(2) { animation-delay: 0.5s; }
.scroll-chevron:nth-child(3) { animation-delay: 1s; }

@keyframes chevronFade {
  0%, 100% { opacity: 0; }
  40%      { opacity: 1; }
  50%      { opacity: 1; }
}

#intro p {
  opacity: 1;
  transform: none;
  transition: none;
}

#pricing {
  position: relative;
  z-index: 2;
  width: 100%;
  box-sizing: border-box;
  padding: 80px max(32px, calc(50% - 480px));
  margin-bottom: 0;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
  /* box-shadow: 0 0 100px 100px var(--bg); */
  /* box-shadow: 0 -100px 100px -100px var(--bg); */
}


#pricing #intro {
  font-size: 1.5em;
  margin-bottom: 40px;
}
#pricing #intro strong {
  font-size: 1.15em;
}
#pricing #intro p,
#pricing #intro .value-stack {
  margin-top: 40px;
}
#pricing #intro p {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  margin-bottom: 0;
}
#pricing #intro p:first-child {
  margin-top: 0;
}
#pricing #intro .value-stack {
  background: var(--primary);
  color: #ffffff;
  padding: 40px;
  border-radius: 6px;
}
#pricing #intro .value-stack h2 {
  margin: 0 0 0.6em 0;
  color: #ffffff;
  font-size: 1em;
}
#pricing #intro .value-stack ul {
  margin: 0;
  padding-left: 1.4em;
}
#pricing #intro p.intro-visible {
  opacity: 1;
  transform: translateY(0);
}

.pricing-card {
  position: relative;
  overflow: hidden;
  flex: 1;
  min-width: 400px;
  /* max-width: 460px; */
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-sizing: border-box;
}

.pricing-card > * {
  position: relative;
  z-index: 1;
}

.demo-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  filter: blur(0px);
  display: none;
}

.pricing-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  text-align: center;
  list-style: none;
}
.pricing-title::-webkit-details-marker { display: none; }

.pricing-fold {
  display: flex;
  flex-direction: column;
  gap: 24px;
  flex: 1;
}
.pricing-fold > summary {
  cursor: default;
  pointer-events: none;
}

.demo-box {
  position: relative;
  border-radius: 10px;
  padding: 10px 20px;
  font-family: monospace;
  background-color: var(--secondary);
  font-size: 0.95rem;
  height: 200px;
  display: flex;
  align-items: center;
  border-radius: 10px;
}

.demo-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  font-size: 1.5em;
}

.demo-ghost {
  opacity: 0;
  pointer-events: none;
  user-select: none;
}

.demo-live {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  /* text-shadow: 0 0 80px rgba(255,255,255,1); */
}

.demo-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--fg);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: cursorBlink 0.8s step-start infinite;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.feature-list li {
  font-size: 0.95rem;
  padding-left: 1.4em;
  position: relative;
}

.feature-list li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--muted);
}

.subscribe-btn {
  display: block;
  text-align: center;
  padding: 12px 24px;
  background: var(--button-bg);
  color: var(--button-fg);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.15s;
  margin-bottom: 20px;
}

.subscribe-btn:hover {
  background: var(--primary);
  text-decoration: none;
}

.subscribe-fine-print {
  font-size: 1em;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
}

#landing-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 40px max(32px, calc(50% - 340px)) 140px;
  text-align: left;
  flex-shrink: 0;
  box-sizing: border-box;
  line-height: 1.7;
  background: var(--bg);
}

#landing-content p {
  margin: 0 0 1.2em;
}

#landing-content .intro {
  margin-bottom: 2em;
}

#landing-content .market-close {
  margin-top: 2em;
  opacity: 0.7;
  font-size: 0.9em;
}

#subscribe-section {
  width: 100%;
  /* padding: 28px max(32px, calc(50% - 480px)) 60px; */
  margin-bottom: 80px;
  box-sizing: border-box;
  text-align: center;
}
#subscribe-label {
  margin: 0 0 16px 0;
}
#subscribe-form {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
#subscribe-email {
  width: auto;
  flex: 0 1 320px;
  margin: 0;
}
#subscribe-btn {
  width: auto;
  margin: 0;
  padding: 10px 24px;
  background: var(--primary);
  color: #ffffff;
}
#subscribe-btn:hover {
  background: var(--primary);
  opacity: 0.85;
}
#subscribe-msg {
  margin: 12px 0 0;
  font-size: 0.95rem;
}

#landing-footer {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 40px max(32px, calc(50% - 480px)) calc(60px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  background: color-mix(in srgb, var(--secondary) 25%, transparent);
  /* border-top: 1px solid rgba(255, 255, 255, 0.25); */
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.25);
  text-align: left;
  line-height: 1.6;
}
#landing-footer p {
  margin: 0 0 0.75em;
}
#landing-footer p:last-child {
  margin-bottom: 0;
}

#site-footer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 25px;
  overflow: hidden;
  background: var(--ticker-bg);
  z-index: 10000;
}

#site-footer.ticker-active {
  display: flex;
  align-items: center;
}

#ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-scroll linear infinite;
  animation-duration: var(--ticker-duration, 240s);
  gap: 0;
}

#ticker-track:hover {
  animation-play-state: paused;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 14px;
  font-size: 12px;
  font-family: monospace;
  font-weight: 500;
  color: var(--ticker-fg);
  line-height: 25px;
}

.ticker-sep {
  padding: 0 2px;
  font-size: 11px;
  font-family: monospace;
  font-weight: 500;
  color: var(--ticker-fg);
  line-height: 25px;
  user-select: none;
}

body.has-ticker { height: calc(100vh - 25px); }
body.has-ticker .content:not(:has(#claude-form)) { padding-bottom: 125px; }
body.has-ticker #claude-form { bottom: 25px; }

/* ── Mobile (max-width: 800px) ───────────────────────────────────────── */
@media (max-width: 800px) {

  #subscribe-section {
    margin-bottom: 40px;
  }
  /* Blog header */
  #blog-header {
    margin-bottom: 20px;
  }
  #blog-wrap {
    padding-bottom: 100px;
  }
  #blog-load-more-row {
    margin-top: 0px;
  }

  /* Login */
  body:has(#login-form) #login-section,
  body:has(#login-form) #change-password-section {
    max-width: 100%;
  }

  /* Admin */
  .admin-btn, .admin-fold {
    width: 100%;
  }
  input.admin-config-input {
    width: 125px;
  }

  textarea#post-bulletin-input,
  textarea#post-news-input,
  textarea#post-techlog-input,
  textarea#support-message {
    height: 200px;
  }

  textarea#post-bulletin-input {
    height: 200px;
  }

  /* Input / slash menu */
  #claude-input {
    width: 100%;
    max-width: 100%;
  }
  #slash-menu {
    width: 100%;
    max-width: 100%;
  }

  /* News / Bulletins */
  #post-news-fold > details,
  #post-bulletin-fold > details {
    width: 100%;
    max-width: 100%;
  }
  .news-article {
  padding: 20px 0 20px 0;
}

  /* Landing — chevrons */
  #scroll-hint { display: none; }
  .scroll-chevron {
    border-left-width: 12px;
    border-right-width: 12px;
    border-top-width: 12px;
  }

  /* Landing — logo group */
  #logo-group {
    width: 100%;
    box-sizing: border-box;
    padding: 0 40px;
    transform: translateY(-5vh);
  }
  #logo {
    margin-bottom: 20px;
  }
  #logo-rule {
    margin: -5px 0 20px 0;
  }

  /* Blog images */
  #bulletins-feed img,
  #news-feed img,
  #techlog-feed img,
  #blog-feed img {
    max-width: 100% !important;
    margin: 20px auto;
  }

  /* Landing — pricing */
  body.landing #intro {
    margin-top: 0px;
  }


  #pricing #intro p {
    opacity: 1;
    transform: none;
    transition: none;
  }
  #pricing #intro {
    font-size: 1em;
    margin-bottom: 20px;
  }
  #pricing {
    padding: 0 20px;
    margin-bottom: 40px;
    box-shadow: 0 0 50px 50px var(--bg);
  }
  #subscribe-section {
    padding: 0 20px 20px;
  }
  #landing-footer {
    color: rgba(255, 255, 255, 0.25);
    padding: 20px;
  }
  .pricing-card {
    padding: 20px;
    min-width: 100%;
  }

  /* Pricing card fold */
  .pricing-fold {
    display: block;
  }
  .pricing-fold > summary {
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    user-select: none;
    padding: 5px 0;
  }
  .pricing-fold > summary::after {
    content: "+";
    margin-left: auto;
    color: var(--muted);
    font-size: 1.2em;
    font-weight: 400;
  }
  .pricing-fold[open] > summary::after {
    content: "−";
  }
  .pricing-fold[open] {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
}

/* ── Dashboard menu ─────────────────────────────────────────────────── */
#dash-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 48px;
  z-index: 700;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 10px 20px var(--border-sh);
  display: flex;
  align-items: stretch;
}
.dmenu-back {
  display: flex;
  align-items: center;
  padding: 0 14px;
  line-height: 0;
  color: var(--muted);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s ease, background 0.15s ease;
}
.dmenu-back:hover { color: var(--fg); background: var(--button-bg); }
.dmenu-bar {
  display: flex;
  align-items: stretch;
  flex: 1;
}
.dmenu-cat {
  position: relative;
  display: flex;
  align-items: stretch;
}
.dmenu-cat-btn {
  width: auto;
  margin: 0;
  padding: 10px 14px;
  line-height: 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-transform: capitalize;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.dmenu-cat:hover > .dmenu-cat-btn {
  color: var(--fg);
  border-bottom-color: var(--accent);
  background: var(--button-bg);
}
.dmenu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 170px;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 0 8px 20px var(--border-sh);
  z-index: 200;
}
.dmenu-cat:hover > .dmenu-dropdown {
  display: block;
}
.dmenu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.85em;
  font-weight: 600;
  position: relative;
  user-select: none;
  text-transform: capitalize;
}
.dmenu-item:hover {
  color: var(--fg);
  background: var(--button-bg);
}
.dmenu-arrow {
  font-size: 0.65em;
  margin-left: 10px;
  opacity: 0.4;
  flex-shrink: 0;
}
.dmenu-ticker-pane {
  display: none;
  position: absolute;
  left: 100%;
  top: -1px;
  min-width: 80px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 8px 8px 20px var(--border-sh);
  z-index: 201;
  scrollbar-width: none;
}
.dmenu-ticker-pane::-webkit-scrollbar { display: none; }
.dmenu-item.has-sub:hover > .dmenu-ticker-pane {
  display: block;
}
.dmenu-ticker {
  display: block;
  width: 100%;
  padding: 7px 14px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.dmenu-ticker:hover {
  color: var(--fg);
  background: var(--button-bg);
}

/* ── Dashboard page ──────────────────────────────────────────────────── */
body.dashboard {
  max-width: 100%;
  margin: 0;
  padding-top: 48px;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  align-items: unset;
  justify-content: unset;
}
.dash-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}
.dash-news {
  width: 35%;
  min-width: 0;
  overflow-y: auto;
  padding: 12px;
  box-sizing: border-box;
  scrollbar-width: none;
  margin-top: -20px;
}
.dash-news::-webkit-scrollbar {
  display: none;
}
.dash-resizer {
  width: 1px;
  cursor: col-resize;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.15s;
  position: relative;
}
.dash-resizer::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  right: -4px;
  cursor: col-resize;
}
.dash-resizer:hover,
.dash-resizer.dragging {
  background: var(--accent, #4a9eff);
}
.dash-chart {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 150px;
  padding: 12px;
  box-sizing: border-box;
  position: relative;
}
body.dashboard #split-container {
  position: absolute;
}
#feed-restore {
  display: none;
  align-self: center;
  width: 25px;
  height: 200px;
  margin: 0;
  padding: 0;
  line-height: 200px;
  background: var(--button-bg);
  border: 1px solid var(--border);
  border-radius: 0 4px 4px 0;
  color: var(--muted);
  font-size: 0.75em;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
#feed-restore:hover { color: var(--fg); }
#feed-restore.visible { display: block; }

/* ── Dashboard: anchor input overlay to chart panel ── */
body.dashboard #popup-prompt-overlay { left: var(--dash-chart-left, 0); }

/* ── Chart right-click context menu ── */
#chart-ctx-menu {
  position: fixed;
  z-index: 9000;
  display: none;
  flex-direction: column;
  min-width: 180px;
  padding: 4px 0;
  background: var(--menu-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  overflow: hidden;
}
#chart-ctx-menu.visible { display: flex; }
#chart-ctx-menu button {
  width: 100%;
  margin: 0;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
#chart-ctx-menu button:hover:not(:disabled) { background: var(--button-bg); color: var(--fg); }
#chart-ctx-menu button:disabled { opacity: 0.35; cursor: default; }

/* ── Cross-document slide transition (Chrome 126+) ── */
@view-transition { navigation: auto; }

::view-transition-old(root) { animation: vt-out-left  0.3s ease both; }
::view-transition-new(root) { animation: vt-in-right  0.3s ease both; }
html.nav-back::view-transition-old(root) { animation: vt-out-right 0.3s ease both; }
html.nav-back::view-transition-new(root) { animation: vt-in-left  0.3s ease both; }

@keyframes vt-out-left  { to   { transform: translateX(-20%); opacity: 0; } }
@keyframes vt-in-right  { from { transform: translateX(20%);  opacity: 0; } }
@keyframes vt-out-right { to   { transform: translateX(20%);  opacity: 0; } }
@keyframes vt-in-left   { from { transform: translateX(-20%); opacity: 0; } }
