@font-face {
  font-family: "Outfit";
  src: url("/assets/fonts/Outfit-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("/assets/fonts/Outfit-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root,
[data-theme="dark"] {
  --bg-grad: linear-gradient(135deg, #080d14 0%, #1c2934 58%, #0c141e 100%);
  --glass-bg: linear-gradient(135deg, rgba(42, 54, 66, 0.72), rgba(32, 43, 53, 0.47));
  --glass-btn-bg: linear-gradient(135deg, rgba(42, 54, 66, 0.78), rgba(32, 43, 53, 0.56));
  --popup-bg: linear-gradient(135deg, rgba(37, 50, 61, 0.97), rgba(22, 32, 42, 0.96));
  --border: rgba(101, 123, 138, 0.25);
  --popup-border: rgba(127, 152, 168, 0.4);
  --text: #e6edf1;
  --muted: #9baeb8;
  --line: #344655;
  --grid: rgba(78, 100, 115, 0.24);
  --up: #36d79b;
  --down: #ff7589;
  --up-bg: rgba(54, 215, 155, 0.16);
  --down-bg: rgba(255, 117, 137, 0.16);
  --extended: #9dcdb4;
  --closed: #a8afb4;
  --accent: #3b6875;
  --accent-text: #f5f9fa;
  --focus-fill: rgba(144, 194, 212, 0.22);
  --focus-border: #e6f5fa;
  --danger-bg: rgba(255, 117, 137, 0.16);
  --danger-border: rgba(255, 117, 137, 0.45);
  --input-bg: rgba(12, 18, 26, 0.55);
  --shadow: 0 20px 56px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  --bg-grad: linear-gradient(135deg, #c7d8dc 0%, #e9ebe3 58%, #c9dcd9 100%);
  --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.64), rgba(236, 243, 242, 0.39));
  --glass-btn-bg: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(236, 243, 242, 0.48));
  --popup-bg: linear-gradient(135deg, rgba(246, 249, 249, 0.98), rgba(227, 236, 236, 0.96));
  --border: rgba(255, 255, 255, 0.75);
  --popup-border: rgba(255, 255, 255, 0.88);
  --text: #263e43;
  --muted: #526a70;
  --line: #adbdc0;
  --grid: rgba(97, 123, 126, 0.17);
  --up: #188455;
  --down: #c03e56;
  --up-bg: rgba(24, 132, 85, 0.12);
  --down-bg: rgba(192, 62, 86, 0.12);
  --extended: #5f9277;
  --closed: #737b7e;
  --accent: #2f5b64;
  --accent-text: #f5f9fa;
  --focus-fill: rgba(43, 94, 104, 0.14);
  --focus-border: #2b5e68;
  --danger-bg: rgba(192, 62, 86, 0.12);
  --danger-border: rgba(192, 62, 86, 0.38);
  --input-bg: rgba(255, 255, 255, 0.72);
  --shadow: 0 20px 56px rgba(28, 48, 54, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  font-weight: 500;
  color: var(--text);
  background: #0c1118;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-grad);
  z-index: 0;
}

[hidden] {
  display: none !important;
}

/* ================================================================
   SHARED GLASS CONTROLS
   ================================================================ */
.glass-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--glass-btn-bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
}

.glass-icon-btn.btn-sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 14px;
}

.glass-icon-btn:hover,
.glass-icon-btn:focus-visible {
  border-color: var(--focus-border);
  outline: none;
}

.glass-icon-btn:active {
  transform: scale(0.95);
}

.btn-primary,
.btn-glass,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-text);
}

.btn-glass {
  border: 1px solid var(--border);
  background: var(--glass-btn-bg);
  color: var(--text);
}

.btn-danger {
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--down);
}

.btn-lg {
  min-height: 50px;
  padding: 0 26px;
  font-size: 16px;
}

.btn-full {
  width: 100%;
}

.btn-primary:hover,
.btn-glass:hover,
.btn-danger:hover {
  opacity: 0.92;
}

.btn-primary:active,
.btn-glass:active,
.btn-danger:active {
  transform: scale(0.98);
}

.btn-primary:disabled,
.btn-glass:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ================================================================
   BENNY WALLET AUTH GATE (TESLA SCREEN OPTIMIZED)
   ================================================================ */
.auth-gate {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.auth-toolbar {
  position: fixed;
  top: 20px;
  right: 24px;
  display: flex;
  gap: 10px;
  z-index: 4;
}

.auth-card {
  width: min(940px, 100%);
  border-radius: 26px;
  border: 1px solid var(--popup-border);
  background: var(--popup-bg);
  box-shadow: var(--shadow);
  padding: 32px 36px;
}

.auth-checking {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 280px;
  text-align: center;
}

.auth-logo-lg {
  width: 72px;
  height: 72px;
  border-radius: 20px;
}

.auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  flex-shrink: 0;
}

.auth-logo-sm {
  width: 30px;
  height: 30px;
  border-radius: 9px;
}

.auth-brand-title {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.01em;
}

.auth-muted {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1.25fr 1px 0.85fr;
  gap: 32px;
  align-items: center;
}

.auth-divider {
  width: 1px;
  align-self: stretch;
  background: var(--line);
  opacity: 0.65;
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.auth-exclusive-tag {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--up);
  background: var(--up-bg);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.auth-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.auth-desc {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.qr-flow-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.qr-frame {
  width: 242px;
  height: 242px;
  padding: 12px;
  border-radius: 20px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.qr-frame svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-frame-md {
  width: 216px;
  height: 216px;
  padding: 10px;
  border-radius: 18px;
}

.qr-frame-sm {
  width: 156px;
  height: 156px;
  padding: 8px;
  border-radius: 16px;
}

.qr-loading {
  color: #33464c;
  font-size: 13.5px;
  text-align: center;
  padding: 12px;
}

.qr-done-check {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(24, 132, 85, 0.15);
  color: #188455;
  font-size: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-status-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--up);
  flex-shrink: 0;
}

.status-dot.waiting {
  animation: softPulse 1.8s ease-in-out infinite;
}

.status-dot.error {
  background: var(--down);
  animation: none;
}

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

.auth-status {
  font-size: 14px;
  color: var(--muted);
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.benny-browser-box {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-top: 12px;
}

.auth-pane-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.side-badge {
  font-size: 12px;
  color: var(--down);
  background: var(--down-bg);
  border: 1px solid var(--danger-border);
  padding: 4px 12px;
  border-radius: 999px;
}

.side-title {
  margin: 0;
  font-size: 19px;
}

.side-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}

.platform-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.platform-pill {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
}

/* Rejected non-Benny Wallet View */
.auth-rejected {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.rejected-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
}

.rejected-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--down);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rejected-title {
  margin: 0 0 4px;
  font-size: 20px;
  color: var(--text);
}

.rejected-detail {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.rejected-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 30px;
  align-items: center;
}

.rejected-qr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.rejected-qr-caption {
  margin: 0;
  font-size: 13.5px;
  color: var(--text);
  text-align: center;
}

.rejected-info-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rejected-brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rejected-brand-name {
  font-size: 21px;
}

.rejected-brand-sub {
  font-size: 13.5px;
  color: var(--muted);
}

.rejected-points {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.75;
}

.rejected-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

/* ================================================================
   MAIN TESLA MARKET BOARD (Quiet TV MarketBoardView Parity)
   ================================================================ */
.market-app {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 2vh, 22px) clamp(16px, 2.6vw, 38px) clamp(8px, 1.2vh, 14px);
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  height: clamp(42px, 5.8vh, 52px);
  flex-shrink: 0;
}

.market-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: var(--text);
  flex-shrink: 0;
}

.ticker-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
}

.ticker-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 12px 0 7px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--glass-btn-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.account-pill:hover {
  border-color: var(--focus-border);
}

.account-pill:active {
  transform: scale(0.96);
}

.account-pill-logo {
  width: 24px;
  height: 24px;
  border-radius: 7px;
}

.account-pill-addr {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

/* Section headers */
.board-heads {
  display: flex;
  align-items: center;
  height: clamp(32px, 4.4vh, 42px);
  flex-shrink: 0;
  margin-top: 2px;
}

.head-col {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  padding-left: 14px;
  min-width: 0;
}

.head-gap {
  width: clamp(18px, 2.4vw, 34px);
  flex-shrink: 0;
}

.section-label {
  font-size: clamp(13px, 1.85vh, 17px);
  letter-spacing: 0.08em;
  color: var(--muted);
}

.session-status {
  margin-left: 16px;
  font-size: clamp(13px, 1.85vh, 17px);
  color: var(--closed);
}

.session-status[data-tone="regular"] {
  color: var(--up);
}

.session-status[data-tone="extended"] {
  color: var(--extended);
}

.session-status[data-tone="muted"] {
  color: var(--closed);
}

.period-btn {
  margin-left: 14px;
  min-width: 44px;
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--glass-btn-bg);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.period-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}

.period-btn:active {
  transform: scale(0.95);
}

/* Main two-column glass board */
.board-columns {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

.glass-column {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--glass-bg);
  overflow: hidden;
}

.column-divider {
  width: 1px;
  margin: 0 clamp(9px, 1.2vw, 17px);
  background: var(--line);
  flex-shrink: 0;
}

/* Row inside glass column */
.market-row {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: clamp(28px, 3.6vh, 36px) minmax(56px, 78px) minmax(92px, 120px) minmax(60px, 1fr) minmax(68px, 82px);
  align-items: center;
  gap: clamp(6px, 0.9vw, 12px);
  padding: 0 10px;
  border-radius: 10px;
  overflow: hidden;
}

.row-sep {
  height: 1px;
  margin: 0 10px;
  background: var(--grid);
  flex-shrink: 0;
}

.row-pulse {
  position: absolute;
  inset: 1px 0;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
}

.row-icon-wrap {
  position: relative;
  z-index: 1;
  width: clamp(28px, 3.6vh, 36px);
  height: clamp(28px, 3.6vh, 36px);
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f4f7;
  flex-shrink: 0;
}

.row-icon-wrap[data-bg="sol"] { background: #080a10; }
.row-icon-wrap[data-bg="hype"] { background: #062b26; }
.row-icon-wrap[data-bg="doge"] { background: #191e22; }
.row-icon-wrap[data-bg="fallback"] { background: #35545b; color: #f0f6f5; font-size: 12px; }

.row-icon-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.row-symbol {
  position: relative;
  z-index: 1;
  font-size: clamp(14px, 2.05vh, 19px);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-price {
  position: relative;
  z-index: 1;
  text-align: right;
  font-size: clamp(15px, 2.25vh, 21px);
  color: var(--muted);
  white-space: nowrap;
}

.row-price.up { color: var(--up); }
.row-price.down { color: var(--down); }

.row-chart-wrap {
  position: relative;
  z-index: 1;
  width: 100%;
  height: clamp(32px, 5.4vh, 52px);
  min-width: 0;
}

.row-chart {
  width: 100%;
  height: 100%;
  display: block;
}

.row-change {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: clamp(24px, 3.4vh, 32px);
  padding: 0 7px;
  border-radius: 7px;
  font-size: clamp(12px, 1.7vh, 15.5px);
  color: var(--muted);
  white-space: nowrap;
}

.row-change.up {
  color: var(--up);
  background: var(--up-bg);
}

.row-change.down {
  color: var(--down);
  background: var(--down-bg);
}

/* Footer */
.board-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: clamp(24px, 3.2vh, 30px);
  margin-top: 6px;
  padding: 0 4px;
  font-size: clamp(11.5px, 1.55vh, 14px);
  color: var(--muted);
  flex-shrink: 0;
}

.clock-line {
  display: flex;
  align-items: center;
  gap: 22px;
  white-space: nowrap;
}

.feed-meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.stream-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.stream-dot.live { background: var(--up); }
.stream-dot.warn { background: #f2b84b; }

/* ================================================================
   MODALS
   ================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  width: 100%;
  border-radius: 22px;
  border: 1px solid var(--popup-border);
  background: var(--popup-bg);
  box-shadow: var(--shadow);
  padding: 24px 26px;
}

.modal-card-sm { max-width: 440px; }
.modal-card-lg { max-width: 580px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-head h2 {
  margin: 0;
  font-size: 20px;
}

.modal-sub {
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
}

.account-full-box {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  margin-bottom: 20px;
}

.account-full-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.account-full-addr {
  font-size: 13.5px;
  word-break: break-all;
  user-select: text;
}

.config-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  color: var(--muted);
}

.config-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  outline: none;
}

.config-field input:focus {
  border-color: var(--focus-border);
}

.config-error {
  font-size: 13.5px;
  color: var(--down);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

.modal-actions-right {
  display: flex;
  gap: 10px;
}

/* ================================================================
   RESPONSIVE FALLBACK FOR SMALLER / PORTRAIT SCREENS
   ================================================================ */
@media (max-width: 960px) {
  html, body {
    overflow: auto;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .auth-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .auth-divider {
    width: 100%;
    height: 1px;
  }

  .rejected-body {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .rejected-points {
    text-align: left;
  }

  .rejected-actions {
    justify-content: center;
  }

  .market-app {
    height: auto;
    min-height: 100dvh;
  }

  .board-heads {
    display: none;
  }

  .board-columns {
    flex-direction: column;
    gap: 14px;
    margin-top: 10px;
  }

  .column-divider {
    display: none;
  }

  .glass-column {
    flex: none;
  }

  .market-row {
    min-height: 54px;
  }
}
