/*
  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);
}

: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;
}

/* ── 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:       #666666;
  --chart-line:       rgba(0, 0, 0, 0.75);
  --chart-ref-line:   rgba(160, 160, 160, 0.45);
  --chart-sg-today:   var(--primary);
  --chart-sg-prior:   rgba(180, 180, 180, 1);
}

:root[data-theme="dark"] {
  --chart-bar: var(--primary);
  --chart-border: var(--primary);
  --chart-neg-bar: rgba(250, 250, 250, 0.75);
  --chart-neg-border: rgba(250, 250, 250, 1);
  --chart-grid: rgba(255, 255, 255, 0.08);
  --chart-tick: #888888;
  --chart-line: rgba(255, 255, 255, 0.75);
  --chart-line-secondary: rgba(255, 255, 255, 0.75);
  --chart-sg-today: var(--primary);
  --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: 18px;
  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: 48px;
  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;
}

#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; }

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

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

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

.slash-item-desc {
  font-size: 0.8em;
  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: -20px;
}

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

.news-article {
  display: block;
  padding: 20px 0 20px 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;
  margin-top: 0.3em;
  font-size: 0.85em;
}

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

.article-edit-btn,
.article-delete-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 {
  color: var(--fg);
}

/* ── 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: 0;
  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-feed {
  margin-top: -20px;
}

/* ── 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;
  margin: 20px 0;
  max-width: 100%;
}

#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: 0;
  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 — email checkbox row ─────────────────────────────────── */

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

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

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

#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: 2px 0 0 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 {
  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 { 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-close:hover,
#chart-download:hover,
#chart-popout: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;
}
#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;
}
#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; }

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

#chart-canvas {
  display: block;
}

/* ── 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;
}
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 {
  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 {
  background: var(--button-ho);
  text-decoration: none;
}


#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: 50px;
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
  box-shadow: 0 0 200px 200px var(--bg);
}

#pricing #intro {
  font-size: 1.5em;
  margin-bottom: 100px;
}
#pricing #intro strong {
  font-size: 1.15em;
}
#pricing #intro p {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  padding: 1.6em 0 0 0;
  margin: 0;
}
#pricing #intro p:first-child {
  padding-top: 0;
}
#pricing #intro p:nth-child(odd):not(:last-child)::after {
  content: '';
  display: block;
  width: 50%;
  margin: 1.6em auto 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}
#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;
}

#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: var(--muted);
  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;
  right: 0;
  height: 50px;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  z-index: 10000;
  box-shadow: 0 0 200px 200px color-mix(in srgb, var(--bg) 75%, transparent);
}

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

  /* 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%;
  }

  /* 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;
  }

  /* Landing — pricing */
  body.landing #intro {
    margin-top: 0px;
  }
  #pricing #intro p {
    opacity: 1;
    transform: none;
    transition: none;
  }
  #pricing #intro {
    font-size: 1em;
    margin-bottom: 50px;
  }
  #pricing {
    padding: 0 10px;
    padding: 0 20px;
    margin-bottom: 100px;
  }
  #landing-footer {
    padding-left: 10px;
    padding-right: 10px;
  }
  .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;
  }
}
