:root {
  --bg-top: #050321;
  --bg-bottom: #020713;
  --accent: #7b5cff;
  --accent-2: #22e1ff;
  --accent-3: #ff4ecd;
  --text-main: #f5f5ff;
  --text-subtle: #a4a4c9;
  --glass: rgba(8, 8, 30, 0.8);
  --border-glass: rgba(124, 124, 255, 0.4);
}

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

html,
body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Inter", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at 0% -20%, #16192f, #05030f 45%, #000 80%);
  overflow: hidden;
}

.background {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #05060b;
}

.cockpit-bg {
  position: absolute;
  inset: 0;
  background-image: url("assets/bearableguy-cockpit-hd2.jpeg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  filter: drop-shadow(0 0 18px rgba(0, 0, 0, 0.8));
}

.hero {
  display: none;
}

.hero-content {
  display: none;
}

.logo {
  font-size: clamp(2.2rem, 3vw, 2.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.85rem;
  background: linear-gradient(120deg, var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  color: transparent;
}

.subtitle {
  font-size: 0.98rem;
  color: var(--text-subtle);
  margin-bottom: 2rem;
}

.primary-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 2.8rem;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #05030f;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-3));
  box-shadow:
    0 0 25px rgba(123, 92, 255, 0.8),
    0 0 60px rgba(34, 225, 255, 0.6);
  transition:
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out,
    filter 0.16s ease-out;
}

.primary-btn::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.45);
  opacity: 0.45;
  pointer-events: none;
}

.primary-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 0 35px rgba(123, 92, 255, 0.9),
    0 0 80px rgba(34, 225, 255, 0.7);
  filter: brightness(1.05);
}

.primary-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow:
    0 0 18px rgba(123, 92, 255, 0.7),
    0 0 40px rgba(34, 225, 255, 0.5);
}

.widget {
  display: none;
}

.widget-static {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  padding-bottom: calc(1.5rem + 2rem);
  z-index: 2;
}

.widget-open {
  opacity: 1;
  pointer-events: auto;
  backdrop-filter: blur(12px);
}

.widget-card {
  width: min(360px, 92vw);
  padding: 1.6rem 1.7rem 1.5rem;
  border-radius: 18px;
  background: radial-gradient(
      circle at top,
      rgba(123, 92, 255, 0.4),
      transparent 55%
    ),
    radial-gradient(
      circle at bottom,
      rgba(34, 225, 255, 0.1),
      transparent 60%
    ),
    rgba(5, 6, 32, 0.98);
  border: 1px solid var(--border-glass);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.9),
    0 0 40px rgba(123, 92, 255, 0.6);
}

.widget-open .widget-card {
  /* retained for compatibility if used again */
}

.widget-static .widget-card {
  opacity: 1;
  transform: none;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  gap: 0.5rem;
}

.widget-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.widget-title-logo {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
}

.widget-title-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  line-height: 1.2;
}

.widget-title-beta {
  font-weight: 600;
  font-size: 0.88em;
  opacity: 0.88;
}

.icon-btn {
  border: none;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  font-size: 1rem;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.15s ease-out,
    color 0.15s ease-out,
    transform 0.12s ease-out;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  transform: translateY(-1px);
}

.widget-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-subtle);
  margin-bottom: 1.1rem;
}

.widget-main {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  background: radial-gradient(
      circle at top left,
      rgba(123, 92, 255, 0.4),
      transparent 55%
    ),
    linear-gradient(135deg, rgba(11, 7, 52, 0.9), rgba(7, 9, 40, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 1.1rem;
}

.exchange-widget {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.exchange-field {
  padding: 0.75rem 0.8rem 0.6rem;
  border-radius: 12px;
  background: radial-gradient(
      circle at top left,
      rgba(123, 92, 255, 0.28),
      transparent 60%
    ),
    rgba(6, 8, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.exchange-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.exchange-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.15);
}

.token-select {
  font-size: 0.78rem;
  padding: 0.25rem 0.8rem 0.25rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(124, 124, 255, 0.7);
  background: rgba(10, 13, 58, 0.96);
  color: var(--text-main);
  cursor: pointer;
  outline: none;
}

.token-select:focus-visible {
  box-shadow: 0 0 0 2px rgba(34, 225, 255, 0.7);
}

.token-select option:disabled {
  color: rgba(110, 115, 155, 0.55);
}

.exchange-amount-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
  border-radius: 8px;
  transition: box-shadow 0.15s ease-out;
}

.from-exchange-field.from-amount-out-of-range .exchange-amount-row {
  box-shadow: inset 0 0 0 1px rgba(255, 72, 88, 0.95);
}

.amount-input,
.amount-display {
  flex: 1;
  font-size: 1.2rem;
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  background: transparent;
  border: none;
  color: #ffffff;
}

.amount-input::placeholder {
  color: rgba(170, 172, 210, 0.5);
}

.amount-input:focus {
  outline: none;
}

.amount-display {
  text-align: left;
}

.unit-label {
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(191, 192, 230, 0.96);
}

.fiat-toggle {
  margin-top: 0.3rem;
  width: 100%;
  border-radius: 999px;
  border: none;
  background: rgba(10, 13, 62, 0.92);
  padding: 0.35rem 0.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(197, 198, 234, 0.96);
  font-size: 0.76rem;
  cursor: pointer;
}

.fiat-toggle:hover {
  background: rgba(14, 18, 72, 0.98);
}

.alt-value {
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.alt-caption {
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.exchange-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(210, 210, 255, 0.8);
  font-size: 0.95rem;
}

.exchange-divider span {
  display: inline-flex;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(124, 124, 255, 0.7);
  background: radial-gradient(
      circle at top,
      rgba(123, 92, 255, 0.6),
      transparent 55%
    ),
    rgba(9, 12, 52, 0.98);
}

.widget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 0.4rem 0;
}

.widget-row + .widget-row {
  border-top: 1px dashed rgba(164, 164, 201, 0.26);
}

.widget-key {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(180, 180, 217, 0.85);
}

.widget-value {
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  color: #ffffff;
}

.secondary-btn {
  width: 100%;
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(124, 124, 255, 0.7);
  background: radial-gradient(
      circle at top left,
      rgba(34, 225, 255, 0.18),
      transparent 55%
    ),
    rgba(5, 8, 36, 0.96);
  color: var(--text-main);
  font-size: 0.86rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.16s ease-out,
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out;
}

.exchange-btn {
  margin-top: 0.5rem;
}

.trade-range-caption {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  margin-bottom: 0.15rem;
  font-size: 0.74rem;
  line-height: 1.35;
  text-align: center;
  color: rgba(200, 205, 255, 0.95);
  transition: color 0.15s ease-out;
}

.trade-range-caption.trade-range-caption--warn {
  color: #ff5c6c;
}

/* Exchange flow overlay */
.exchange-flow-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: radial-gradient(
    circle at top,
    rgba(0, 0, 0, 0.55),
    rgba(0, 0, 0, 0.9)
  );
  z-index: 15;
}

.exchange-flow-overlay.open {
  display: flex;
}

.exchange-flow-card {
  width: min(360px, 92vw);
  padding: 1.4rem 1.5rem 1.1rem;
  border-radius: 18px;
  background: radial-gradient(
      circle at top,
      rgba(123, 92, 255, 0.4),
      transparent 55%
    ),
    rgba(5, 6, 32, 0.98);
  border: 1px solid var(--border-glass);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.9),
    0 0 40px rgba(123, 92, 255, 0.6);
  color: var(--text-main);
}

.exchange-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

.exchange-flow-title {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.exchange-flow-body {
  font-size: 0.86rem;
  color: rgba(198, 199, 233, 0.98);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.address-chip {
  margin-top: 0.4rem;
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  background: rgba(10, 13, 62, 0.9);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: "SF Mono", ui-monospace, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 0.74rem;
  position: relative;
}

.copy-btn {
  border: none;
  background: rgba(34, 225, 255, 0.15);
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  cursor: pointer;
}

.copy-tooltip {
  position: absolute;
  left: 50%;
  top: -1.7rem;
  transform: translateX(-50%);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(10, 13, 62, 0.98);
  color: var(--text-main);
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.copy-tooltip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-3px);
}

.exchange-flow-input-block {
  margin-bottom: 0.9rem;
}

.exchange-flow-input-block label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  color: rgba(191, 192, 230, 0.96);
}

.exchange-flow-input-block input {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: 9px;
  border: 1px solid rgba(124, 124, 255, 0.8);
  background: rgba(7, 9, 40, 0.96);
  color: var(--text-main);
  font-size: 0.82rem;
}

.exchange-flow-input-block input:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(34, 225, 255, 0.7);
}

.exchange-flow-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.exchange-flow-status {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
}

.exchange-flow-status.open {
  display: flex;
}

.loading-image {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.exchange-flow-success {
  min-height: 7.5rem;
  justify-content: center;
}

.exchange-flow-success-text {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.98);
}

.secondary-btn:hover {
  background: radial-gradient(
      circle at top left,
      rgba(34, 225, 255, 0.24),
      transparent 55%
    ),
    rgba(8, 10, 46, 0.98);
  transform: translateY(-1px);
  box-shadow: 0 0 28px rgba(34, 225, 255, 0.5);
}

.secondary-btn:active {
  transform: translateY(0);
  box-shadow: 0 0 18px rgba(34, 225, 255, 0.4);
}

/* Site credit — always visible, bottom center */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 8;
  text-align: center;
  padding: 0.3rem 1rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: rgba(155, 165, 210, 0.7);
  pointer-events: none;
}

.site-footer a {
  pointer-events: auto;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(155, 165, 210, 0.28);
  transition:
    color 0.15s ease,
    border-color 0.15s ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: rgba(210, 218, 255, 0.9);
  border-bottom-color: rgba(210, 218, 255, 0.45);
}

.site-footer-sep {
  user-select: none;
  cursor: default;
  opacity: 0.75;
}

/* Telegram support float – bottom right */
.telegram-float {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 2.35rem);
  right: max(1rem, env(safe-area-inset-right, 0px));
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0088cc 0%, #229ED9 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 136, 204, 0.4);
  transition:
    transform 0.2s ease,
    box-shadow 0.25s ease,
    filter 0.25s ease;
}

.telegram-float:hover {
  transform: scale(1.08);
  color: #fff;
  /* Bright yellow tracing / glow around logo */
  box-shadow:
    0 0 0 3px #FFE135,
    0 0 20px 4px rgba(255, 225, 53, 0.6),
    0 0 36px 8px rgba(255, 200, 0, 0.35),
    0 4px 20px rgba(0, 136, 204, 0.5);
  filter: brightness(1.05);
}

.telegram-float:active {
  transform: scale(1.02);
}

.telegram-float-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.telegram-float-tooltip {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  background: rgba(10, 10, 28, 0.95);
  color: #FFE135;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.telegram-float:hover .telegram-float-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 640px) {
  .hero-content {
    padding: 1.9rem 1.7rem 1.7rem;
    border-radius: 18px;
  }

  .subtitle {
    font-size: 0.9rem;
  }
}

/* Phones (typical Android width): widget fits width, room for Telegram + background */
@media (max-width: 480px) {
  .widget-static {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
    /* Site footer strip + Telegram FAB + margin */
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6.75rem);
    align-items: flex-start;
    justify-content: center;
  }

  .widget-card {
    width: min(100%, calc(100vw - 2rem));
    max-width: 100%;
    padding: 1.25rem 1.15rem 1.2rem;
    margin-left: auto;
    margin-right: auto;
    max-height: calc(100vh - 7rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: min(
      calc(
        100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) -
          7rem
      ),
      92dvh
    );
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .widget-label {
    font-size: 0.72rem;
    margin-bottom: 0.85rem;
    line-height: 1.35;
  }

  .amount-input,
  .amount-display {
    font-size: 1.1rem;
  }

  .token-select {
    font-size: 0.74rem;
    max-width: 52%;
  }

  .exchange-btn {
    min-height: 44px;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .secondary-btn {
    min-height: 44px;
  }

  .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .exchange-flow-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: max(0.75rem, env(safe-area-inset-top, 0px)) 1rem
      calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .exchange-flow-card {
    width: min(100%, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    max-height: min(
      88dvh,
      calc(
        100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) -
          1.5rem
      )
    );
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.15rem 1.05rem 1rem;
    margin-bottom: auto;
  }

  .telegram-float {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 2.35rem);
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    width: 48px;
    height: 48px;
    z-index: 10;
  }

  .telegram-float-icon svg {
    width: 24px;
    height: 24px;
  }
}

