@font-face {
  font-family: 'SuperMario256';
  src: url('/SuperMario256.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --xp-navy: #000080;
  --xp-navy-deep: #000066;
  --xp-navy-bar: #000080;
  --xp-mid: #3d6ec4;
  --xp-sky: #5e8ad8;
  --xp-glow: #7aa0e0;
  --xp-center: #6b92d8;
  --xp-orange: #ff9c00;
  --xp-orange-line: #ff9c00;
  --xp-font: Tahoma, 'Segoe UI', Verdana, Geneva, sans-serif;
  --xp-title: 'Trebuchet MS', Tahoma, 'Segoe UI', sans-serif;
  --xp-bar-top: 52px;
  --xp-bar-bottom: 72px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  font-family: var(--xp-font);
  color: #fff;
  background: var(--xp-navy-bar);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
}

.welcome {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* XP Welcome chrome — solid navy rails */
.welcome-top {
  flex: 0 0 var(--xp-bar-top);
  height: var(--xp-bar-top);
  background: var(--xp-navy-bar);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

/* ---- stage: XP welcome blue gradient ---- */

.welcome-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vw, 32px);
  padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 48px) 24px;
  background:
    radial-gradient(ellipse 80% 50% at 50% 42%, rgba(120, 160, 220, 0.28) 0%, transparent 58%),
    linear-gradient(
      180deg,
      #2456b0 0%,
      var(--xp-mid) 24%,
      var(--xp-sky) 50%,
      var(--xp-mid) 76%,
      #1e4a9e 100%
    );
}

.welcome-split {
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1fr 1px 1.15fr;
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
}

.welcome-rule {
  width: 1px;
  align-self: stretch;
  min-height: 220px;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 18%,
    rgba(255, 255, 255, 0.75) 50%,
    rgba(255, 255, 255, 0.55) 82%,
    transparent 100%
  );
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

/* ---- left brand ---- */

.welcome-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding-right: 8px;
  animation: brand-in 0.7s ease-out both;
}

.brand-lockup {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.brand-face {
  width: clamp(72px, 12vw, 112px);
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 30, 80, 0.35));
}

.brand-word {
  margin: 0;
  font-family: 'SuperMario256', 'Comic Sans MS', cursive;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  font-weight: normal;
  display: flex;
}

.brand-word span {
  display: inline-block;
  -webkit-text-stroke: 2px #141414;
  text-shadow:
    3px 3px 0 #141414,
    -1px -1px 0 #141414,
    1px -1px 0 #141414,
    -1px 1px 0 #141414;
  color: #e8281e;
  animation: stonk-chroma 2s infinite;
  animation-timing-function: steps(1, end);
}

.brand-word span:nth-child(1) {
  animation-delay: 0s;
}
.brand-word span:nth-child(2) {
  animation-delay: -0.5s;
}
.brand-word span:nth-child(3) {
  animation-delay: -1s;
}
.brand-word span:nth-child(4) {
  animation-delay: -1.5s;
}
.brand-word span:nth-child(5) {
  animation-delay: -2s;
}
.brand-word span:nth-child(6) {
  animation-delay: -2.5s;
}
.brand-word span:nth-child(7) {
  animation-delay: -3s;
}

@keyframes stonk-chroma {
  0%,
  24.999% {
    color: #e8281e;
  }
  25%,
  49.999% {
    color: #2b55c8;
  }
  50%,
  74.999% {
    color: #ffc800;
  }
  75%,
  100% {
    color: #00b400;
  }
}

.brand-tag {
  margin: 4px 0 0;
  max-width: 28ch;
  font-size: 15px;
  line-height: 1.45;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 30, 80, 0.55);
}

.brand-hint {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 30, 80, 0.45);
}

/* ---- right nav ---- */

.welcome-accounts {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-left: 4px;
  animation: accounts-in 0.75s ease-out 0.12s both;
}

.account {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 420px;
  margin: 0;
  padding: 12px 18px 12px 12px;
  border: 0;
  border-radius: 10px;
  background: rgba(0, 40, 100, 0.18);
  color: #fff;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.12s ease;
}

.account:hover,
.account:focus-visible {
  outline: none;
  background: linear-gradient(
    90deg,
    rgba(200, 225, 255, 0.5) 0%,
    rgba(150, 190, 255, 0.28) 55%,
    transparent 100%
  );
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  transform: translateX(2px);
}

.account:active {
  background: linear-gradient(
    90deg,
    rgba(220, 235, 255, 0.58) 0%,
    rgba(170, 200, 255, 0.32) 55%,
    transparent 100%
  );
}

.account-icon {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 0 1px rgba(0, 50, 120, 0.45),
    0 3px 10px rgba(0, 30, 80, 0.4);
  background: #1a4a9a;
  display: grid;
  place-items: center;
}

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

.account-icon-badge,
.account-icon-doc {
  font-family: var(--xp-title);
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(160deg, #6eb0ff 0%, #1a5bb8 100%);
}

.account-icon-doc {
  background: linear-gradient(160deg, #f0f0e8 0%, #c8c8b8 100%);
  color: #1a4a9a;
}

.account-icon-token {
  background: #1a4a9a;
  padding: 0;
  overflow: hidden;
}

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

.account-ticker {
  font-size: 14px !important;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.account-token-addr {
  font-family: Consolas, 'Courier New', monospace;
  font-size: 11px;
  letter-spacing: 0.02em;
}

.account-token.copied {
  background: linear-gradient(
    90deg,
    rgba(160, 255, 180, 0.45) 0%,
    rgba(120, 220, 150, 0.22) 55%,
    transparent 100%
  );
}

.account-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 420px;
}

.account-compact {
  max-width: none;
  gap: 10px;
  padding: 10px 12px 10px 10px;
}

.account-compact .account-name {
  font-size: 15px;
}

.account-compact .account-sub {
  font-size: 11px;
}

.account-icon-sm {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-width: 2px;
  border-radius: 6px;
}

.account-icon-x {
  background: #141414;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.account-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.account-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 3px rgba(0, 30, 80, 0.55);
}

.account-sub {
  font-size: 13px;
  opacity: 0.88;
}

.account-launch {
  position: relative;
  padding-right: 14px;
}

.account-launch .account-meta {
  flex: 1;
  min-width: 0;
}

.account-launch .account-name {
  font-size: 26px;
}

.account-go {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  margin-left: auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 32% 28%, #b8f5b0 0%, transparent 42%),
    linear-gradient(180deg, #6fde5a 0%, #3cb82e 42%, #218c21 100%);
  border: 2px solid #ffffff;
  box-shadow:
    0 0 0 1px #0d5a14,
    0 2px 4px rgba(0, 40, 20, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.account-launch:hover .account-go,
.account-launch:focus-visible .account-go {
  background:
    radial-gradient(circle at 32% 28%, #d0ffc8 0%, transparent 42%),
    linear-gradient(180deg, #7aef64 0%, #44c834 42%, #28a028 100%);
  transform: scale(1.06);
}

.account-go svg {
  display: block;
  margin-left: 1px;
}

/* ---- Broker gallery (XP portrait tiles) ---- */

.welcome-gallery {
  width: min(1040px, 100%);
  animation: accounts-in 0.8s ease-out 0.2s both;
}

.welcome-gallery[hidden],
.welcome-gallery-empty[hidden],
.welcome-gallery-rail[hidden],
.welcome-gallery-loading[hidden] {
  display: none !important;
}

.welcome-gallery-label {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255, 255, 255, 0.78);
  text-shadow: 0 1px 2px rgba(0, 30, 80, 0.4);
}

.welcome-gallery-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 120px;
  padding: 8px 0 16px;
}

/* Classic XP Luna blue wait circle */
.xp-loader {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid rgba(180, 210, 255, 0.28);
  border-top-color: #ffffff;
  border-right-color: #9ec9ff;
  box-shadow:
    0 0 0 1px rgba(0, 50, 120, 0.25),
    0 2px 8px rgba(0, 30, 80, 0.35),
    inset 0 0 6px rgba(255, 255, 255, 0.15);
  animation: xp-spin 0.7s linear infinite;
}

.broker-tile-frame .xp-loader {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-width: 3px;
  z-index: 1;
}

@keyframes xp-spin {
  to {
    transform: rotate(360deg);
  }
}

.welcome-gallery-rail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 18px;
}

.broker-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 118px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: zoom-in;
  animation: brand-in 0.45s ease-out both;
}

.broker-tile-frame {
  position: relative;
  display: block;
  width: 108px;
  height: 108px;
  border-radius: 10px;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 0 1px rgba(0, 50, 120, 0.45),
    0 4px 12px rgba(0, 30, 80, 0.4);
  background: linear-gradient(160deg, #2a5eb8 0%, #163e78 100%);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.broker-tile:hover .broker-tile-frame,
.broker-tile:focus-visible .broker-tile-frame {
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.55),
    0 8px 18px rgba(0, 30, 80, 0.45);
}

.broker-tile:focus-visible {
  outline: none;
}

.broker-tile-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.broker-tile-frame.is-loaded img {
  opacity: 1;
}

.broker-tile-frame.is-loaded .xp-loader {
  display: none;
}

.broker-tile-name {
  max-width: 118px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 30, 80, 0.5);
}

.welcome-gallery-empty {
  margin: 0;
  max-width: 40ch;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.7;
}

/* ---- bottom bar ---- */

.welcome-bar {
  flex: 0 0 var(--xp-bar-bottom);
  height: var(--xp-bar-bottom);
  position: relative;
  background: var(--xp-navy-bar);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Gold/orange hairline — classic XP welcome separator */
.welcome-bar-edge {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(
    180deg,
    #ffc04a 0%,
    var(--xp-orange-line) 45%,
    #e07800 100%
  );
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
}

/* ---- info panels (XP window chrome, not OS login) ---- */

.panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 20, 60, 0.45);
  backdrop-filter: blur(2px);
  animation: fade-in 0.2s ease both;
}

.panel-backdrop[hidden] {
  display: none !important;
}

.info-panel {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 440px);
  max-height: min(78dvh, 560px);
  display: flex;
  flex-direction: column;
  background: #ece9d8;
  color: #000;
  border: 1px solid #0054e3;
  border-radius: 8px 8px 4px 4px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.35) inset,
    0 12px 40px rgba(0, 20, 60, 0.45);
  animation: panel-in 0.22s ease-out both;
  font-family: var(--xp-font);
}

.info-panel[hidden] {
  display: none !important;
}

.info-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: 7px 7px 0 0;
  background: linear-gradient(180deg, #0a246a 0%, #3a6ea5 8%, #1665ca 45%, #0f4ca8 100%);
  color: #fff;
  font-family: var(--xp-title);
  font-size: 13px;
  font-weight: 700;
}

.info-panel-close {
  width: 22px;
  height: 22px;
  margin: 0;
  padding: 0;
  border: 1px solid #fff;
  border-radius: 3px;
  background: linear-gradient(180deg, #e81123 0%, #c40f1c 100%);
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.info-panel-close:hover {
  filter: brightness(1.08);
}

.info-panel-body {
  padding: 14px 16px 16px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
}

.info-panel-body h3 {
  margin: 14px 0 6px;
  font-size: 13px;
  color: #0d3a7a;
}

.info-panel-body h3:first-child {
  margin-top: 0;
}

.info-panel-body p {
  margin: 0 0 10px;
}

.info-panel-body ul,
.info-panel-body ol {
  margin: 0 0 12px;
  padding-left: 1.25em;
}

.info-panel-body li {
  margin-bottom: 4px;
}

.info-panel-foot {
  margin-top: 8px !important;
  padding-top: 10px;
  border-top: 1px solid #c8c4b8;
  font-size: 12px;
  color: #444;
}

/* ---- lightbox for vault tile ---- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 20, 60, 0.72);
  cursor: zoom-out;
  animation: fade-in 0.18s ease both;
}

.lightbox img {
  max-width: min(90vw, 420px);
  max-height: 80dvh;
  border-radius: 8px;
  border: 3px solid #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ---- motion ---- */

@keyframes brand-in {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes accounts-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translate(-50%, -48%) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ---- mobile ---- */

@media (max-width: 720px) {
  .welcome-stage {
    padding: 20px 16px 20px;
    align-items: flex-start;
  }

  .welcome-split {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .welcome-rule {
    width: 100%;
    height: 1px;
    min-height: 0;
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.55) 20%,
      rgba(255, 255, 255, 0.75) 50%,
      rgba(255, 255, 255, 0.55) 80%,
      transparent 100%
    );
  }

  .welcome-brand {
    align-items: center;
    text-align: center;
    padding-right: 0;
  }

  .brand-lockup {
    align-items: center;
  }

  .brand-tag,
  .brand-hint {
    max-width: 36ch;
  }

  .welcome-accounts {
    align-items: stretch;
    padding-left: 0;
  }

  .account {
    max-width: none;
  }

  .account-row {
    max-width: none;
  }

  .broker-tile {
    width: 96px;
  }

  .broker-tile-frame {
    width: 88px;
    height: 88px;
  }

  .broker-tile-name {
    max-width: 96px;
  }

  .account-icon {
    flex-basis: 64px;
    width: 64px;
    height: 64px;
  }

  .account-name {
    font-size: 20px;
  }

  .account-launch .account-name {
    font-size: 22px;
  }

  .account-row {
    max-width: none;
  }

  .welcome-top {
    height: calc(40px + env(safe-area-inset-top, 0px));
    flex-basis: calc(40px + env(safe-area-inset-top, 0px));
  }

  .welcome-bar {
    height: calc(56px + env(safe-area-inset-bottom, 0px));
    flex-basis: calc(56px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 420px) {
  .account-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .welcome-brand,
  .welcome-accounts,
  .panel-backdrop,
  .info-panel,
  .lightbox {
    animation: none !important;
  }

  .brand-word span {
    animation: none !important;
  }

  .brand-word span:nth-child(4n + 1) {
    color: #e8281e;
  }
  .brand-word span:nth-child(4n + 2) {
    color: #2b55c8;
  }
  .brand-word span:nth-child(4n + 3) {
    color: #ffc800;
  }
  .brand-word span:nth-child(4n + 4) {
    color: #00b400;
  }

  .broker-tile,
  .broker-tile-frame {
    transition: none;
    animation: none !important;
  }

  .xp-loader {
    animation: none !important;
    border-top-color: #fff;
    opacity: 0.85;
  }
}
