/* TX Gym — shared tokens, reset, app layout.
   Axiom tokens mirror axiom.trade's own names: most are "R G B" triplets used as
   rgb(var(--x)) / rgb(var(--x) / .5). --ax-bg is a hex like Axiom's --background.
   J7 tokens are plain colors (j7tracker's panel is a neutral-gray dark UI). */

:root {
  /* ---- Axiom (default dark preset) ---- */
  --ax-bg: #06070b;
  --background-secondary: 16 17 22;
  --background-tertiary: 24 25 32;
  --primary-stroke: 34 36 46;
  --secondary-stroke: 44 46 58;
  --border-subtle: 26 28 36;
  --text-primary: 252 252 252;
  --text-secondary: 119 122 140;
  --text-tertiary: 74 77 92;
  --primary-color: 82 111 255;          /* Axiom "primaryBlue" */
  --primary-color-hover: 106 131 255;
  --increase: 47 227 172;
  --increase-hover: 80 235 188;
  --decrease: 236 57 122;
  --decrease-hover: 240 88 143;
  --primary-green: 47 227 172;
  --primary-red: 236 57 122;
  --primary-yellow: 247 196 51;
  --primary-orange: 255 138 61;
  --primary-light-blue: 95 190 255;
  --chart-up: 47 227 172;
  --chart-down: 236 57 122;

  /* ---- J7 ---- */
  --j7-bg: #1b1b1b;
  --j7-bg-2: #222222;
  --j7-bg-3: #2a2a2a;
  --j7-input: #161616;
  --j7-border: #333333;
  --j7-border-2: #3d3d3d;
  --j7-text: #ededed;
  --j7-text-2: #a3a3a3;
  --j7-text-3: #6b6b6b;
  --j7-accent: #6d6af5;          /* purple-blue outline (Site Chat, highlighted tweets) */
  --j7-green: #4ade80;
  --j7-yellow: #eab308;
  --j7-pink: #ec4899;
  --j7-red: #ef4444;
  --j7-blue: #1d9bf0;            /* X blue */

  /* ---- app ---- */
  --j7-width: 430px;
  --font-ax: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --font-j7: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --emoji: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ax-bg);
  color: rgb(var(--text-primary));
  font-family: var(--font-ax);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.emoji { font-family: var(--emoji); }
.hidden { display: none !important; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }

/* thin scrollbars like Axiom */
* { scrollbar-width: thin; scrollbar-color: rgb(var(--secondary-stroke)) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: rgb(var(--secondary-stroke)); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- app layout: J7 column + Axiom main. j7-left / j7-right flips it. ---- */
#app {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--j7-width) 4px minmax(0, 1fr);
  grid-template-areas: "j7 rz ax";
}
#app.j7-right {
  grid-template-columns: minmax(0, 1fr) 4px var(--j7-width);
  grid-template-areas: "ax rz j7";
}
#app.j7-hidden { grid-template-columns: 0 0 minmax(0, 1fr); }
#app.j7-hidden #j7, #app.j7-hidden #j7-resizer { display: none; }
#j7 { grid-area: j7; min-width: 0; height: 100vh; overflow: hidden; background: var(--j7-bg); font-family: var(--font-j7); color: var(--j7-text); }
#j7-resizer { grid-area: rz; cursor: col-resize; background: #0d0d10; border-left: 1px solid #222; border-right: 1px solid #222; }
#j7-resizer:hover, #j7-resizer.dragging { background: rgb(var(--primary-color) / .5); }
#axiom { grid-area: ax; min-width: 0; height: 100vh; display: flex; flex-direction: column; background: var(--ax-bg); }
#ax-nav { flex: 0 0 auto; }
#ax-body { flex: 1 1 auto; min-height: 0; display: flex; }
#ax-trades { flex: 0 0 auto; min-height: 0; }
#ax-view { flex: 1 1 auto; min-width: 0; min-height: 0; position: relative; }
#ax-bottom { flex: 0 0 auto; }

/* ---- toasts (Axiom style: bottom-right, tertiary bg, secondary stroke) ---- */
#toast-root {
  position: fixed; right: 16px; bottom: 44px; z-index: 900;
  display: flex; flex-direction: column-reverse; gap: 8px; pointer-events: none;
}
/* toasts stay over the Axiom pane: with J7 on the right they must not cover its Deploy row */
#app.j7-right:not(.j7-hidden) ~ #toast-root { right: calc(var(--j7-width) + 4px + 16px); }
.toast {
  pointer-events: none; min-width: 260px; max-width: 380px; /* informational only: never eat a click */
  display: flex; align-items: center; gap: 10px;
  background: rgb(var(--background-tertiary)); border: 1px solid rgb(var(--secondary-stroke));
  border-radius: 4px; padding: 12px 14px; box-shadow: 0 8px 24px rgb(0 0 0 / .45);
  font-size: 13px; animation: toast-in .16s ease-out;
}
.toast .t-icon { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #000; }
.toast.ok .t-icon { background: rgb(var(--increase)); }
.toast.err .t-icon { background: rgb(var(--decrease)); }
.toast.info .t-icon { background: rgb(var(--primary-color)); color: #fff; }
.toast .t-msg { flex: 1; min-width: 0; }
.toast .t-ms { font-family: var(--font-mono); font-size: 12px; color: rgb(var(--primary-color)); }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---- generic popover/menu shared by modules ---- */
.tx-pop {
  position: fixed; z-index: 800; min-width: 180px;
  background: rgb(var(--background-tertiary)); border: 1px solid rgb(var(--secondary-stroke));
  border-radius: 6px; box-shadow: 0 12px 32px rgb(0 0 0 / .5); padding: 6px;
}

/* small screens: stack (practice is meant for desktop, but never break) */
@media (max-width: 900px) {
  #app, #app.j7-right { grid-template-columns: 1fr; grid-template-rows: 46vh 0 54vh; grid-template-areas: "j7" "rz" "ax"; }
  #j7, #axiom { height: auto; }
  #j7-resizer { display: none; }
  #app.j7-right:not(.j7-hidden) ~ #toast-root { right: 16px; }
}

/* ---- donate (TX.donate) ---- */
.dn-btn { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 4px; border: 1px solid rgb(var(--decrease) / .45); color: rgb(var(--decrease)); font-size: 12px; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.dn-btn:hover { background: rgb(var(--decrease) / .1); }
.dn-btn.lg { height: 34px; padding: 0 14px; border-radius: 6px; font-size: 13px; }
.dn-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgb(0 0 0 / .6); display: grid; place-items: center; padding: 16px; animation: toast-in .14s ease-out; }
.dn-card { position: relative; width: min(440px, 100%); background: rgb(var(--background-tertiary)); border: 1px solid rgb(var(--secondary-stroke)); border-radius: 10px; padding: 26px 24px 20px; text-align: center; box-shadow: 0 24px 60px rgb(0 0 0 / .6); }
.dn-card h3 { margin: 10px 0 6px; font-size: 18px; }
.dn-card p { margin: 0 0 18px; color: rgb(var(--text-secondary)); font-size: 13px; }
.dn-icon { width: 44px; height: 44px; margin: 0 auto; border-radius: 12px; display: grid; place-items: center; font-size: 22px; color: rgb(var(--decrease)); background: rgb(var(--decrease) / .12); }
.dn-x { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 6px; color: rgb(var(--text-secondary)); font-size: 18px; }
.dn-x:hover { background: rgb(var(--secondary-stroke)); color: rgb(var(--text-primary)); }
.dn-label { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: rgb(var(--text-tertiary)); margin-bottom: 6px; }
.dn-row { display: flex; gap: 8px; align-items: stretch; }
.dn-addr { flex: 1; min-width: 0; padding: 10px 10px; border-radius: 6px; background: var(--ax-bg); border: 1px solid rgb(var(--primary-stroke)); font-size: 12px; word-break: break-all; text-align: left; user-select: all; }
.dn-copy { display: inline-flex; align-items: center; gap: 5px; padding: 0 12px; border-radius: 6px; background: rgb(var(--primary-color)); color: #fff; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.dn-copy:hover { background: rgb(var(--primary-color-hover)); }
.dn-open { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; color: rgb(var(--primary-color)); font-weight: 600; font-size: 13px; }
.dn-open:hover { text-decoration: underline; }
.dn-note { margin-top: 12px; font-size: 11px; color: rgb(var(--text-tertiary)); }
