/* PiNet bar + Launchpad card (tím #6B3077, viền ngoài nhạt như mẫu) */
:root {
  --pinet-gold: #fbb713;
  --pinet-gold-dark: #e5a810;
  --pinet-gold-soft: rgba(251, 183, 19, 0.22);
  --pinet-header-gold: #f9c46b;
  --pinet-cta-orange: #ffb84d;
  --accent-deep: #1c1c1e;
  /* Tím chủ đạo (giá trị IRRA, viền trong, header, nút Search) */
  --launchpad-purple: #6b3077;
  --pinet-bar-purple: #6b3077;
  --launchpad-outer-border: #e4dde8;
  --white: #ffffff;
  --gray-bg: #ffffff;
  --pinet-border: #d1d1d6;
  --gray-muted: #4a4a4a;
  --banner-bg: #fff8e7;
  --banner-border: #f0d78c;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--gray-bg);
  font-family: var(--font);
  color: #1a1a24;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  justify-content: center;
  padding: 0;
}

.app {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  background: var(--white);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* Header — PiNet bar (purple + gold + Download CTA) */
.header {
  flex-shrink: 0;
  background: var(--pinet-bar-purple);
  padding: 14px 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 100%;
}

.header__back {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  margin: 0 2px 0 -4px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--pinet-header-gold);
  cursor: pointer;
}

.header__back:active {
  opacity: 0.85;
}

.app--search .header__back {
  display: none;
}

.app:not(.app--search) .header__back {
  display: flex;
}

.header__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  line-height: 0;
}

.header__brand-img {
  display: block;
  width: 100px;
  height: auto;
  max-height: 34px;
  object-fit: contain;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 1;
  min-width: 0;
  justify-content: flex-end;
}

.header__home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

@media (min-width: 380px) {
  .header__home {
    font-size: 1.125rem;
    gap: 8px;
  }
}

.header__home-pi {
  display: block;
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.header__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 999px;
  background: var(--pinet-cta-orange);
  color: #2d1f0f;
  font-size: 0.6875rem;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.header__cta:active {
  filter: brightness(0.96);
}

@media (min-width: 380px) {
  .header__cta {
    font-size: 0.75rem;
    padding: 10px 14px;
  }
}

/* Main scroll */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 100px;
  -webkit-overflow-scrolling: touch;
}

.main--search {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 8px;
  /* Chừa chỗ cho chân trang (tab bar) cố định */
  padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

.search-hero {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.search-form {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-form__label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-muted);
  text-align: center;
}

.search-form__input {
  width: 100%;
  padding: 14px 16px;
  font-size: 0.875rem;
  font-family: inherit;
  border: 1px solid var(--pinet-border);
  border-radius: 12px;
  background: var(--white);
  color: #1a1a24;
  outline: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.search-form__input::placeholder {
  color: #aeaeb2;
}

.search-form__input:focus {
  border-color: var(--launchpad-purple);
  box-shadow: 0 0 0 3px rgba(107, 48, 119, 0.18);
}

.search-form__btn {
  margin-top: 4px;
  padding: 14px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--pinet-bar-purple);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(122, 66, 148, 0.35);
}

.search-form__btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.search-form__hint {
  margin: 4px 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--gray-muted);
  text-align: center;
}

.search-form__hint a {
  color: var(--launchpad-purple);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.search-form__error {
  margin: 0;
  padding: 10px 12px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: #8b2942;
  background: #fdeef1;
  border: 1px solid #f0c4cd;
  border-radius: 10px;
  text-align: center;
}

.convert-cta-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 28px;
  padding: 0 4px;
}

.convert-cta-wrap--tight {
  margin-top: 20px;
  padding-top: 4px;
}

.convert-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  padding: 14px 22px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  text-decoration: none;
  text-align: center;
  background: var(--pinet-bar-purple);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(122, 66, 148, 0.35);
}

.convert-cta:active {
  opacity: 0.92;
}

.token-block--compact {
  margin-bottom: 0;
}

.token-block--compact .token-block__logo-wrap {
  margin-bottom: 0;
}

.token-block__explorer {
  margin: 10px 0 0;
  min-height: 1.25rem;
}

.token-block__explorer-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--launchpad-purple);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.banner {
  background: var(--banner-bg);
  border: 1px solid var(--banner-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #5c4a1a;
  margin-bottom: 24px;
}

/* Khối launchpad: viền ngoài nhạt + thẻ trong viền tím */
.launchpad-shell {
  background: var(--white);
  border: 1px solid var(--launchpad-outer-border);
  border-radius: 18px;
  padding: 18px 14px 20px;
  box-shadow: 0 1px 6px rgba(107, 48, 119, 0.06);
}

.launchpad-shell .token-block {
  margin-bottom: 16px;
}

/* Token */
.token-block {
  text-align: center;
  margin-bottom: 22px;
}

.token-block__logo-wrap {
  width: 120px;
  height: 120px;
  margin: 0 auto 14px;
  line-height: 0;
}

.token-block__logo-img {
  display: block;
  width: 120px;
  height: auto;
  aspect-ratio: 353 / 358;
  object-fit: contain;
  image-rendering: auto;
}

.token-block--compact .token-block__logo-img {
  width: 100px;
  height: 100px;
}

.token-block--compact .token-block__logo-wrap {
  width: 100px;
  height: 100px;
}

.token-block__name {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  padding: 0 8px;
  color: #000;
}

/* Card — viền trong tím đậm */
.card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px 16px 18px;
}

.card--main {
  border: 1px solid var(--launchpad-purple);
  border-radius: 12px;
  box-shadow: none;
  padding: 18px 12px 16px;
}

.card__label {
  margin: 0 0 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: #000;
  text-align: center;
}

.card__amount {
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.2em;
  margin: 0 0 20px;
  font-size: 2rem;
  font-weight: 700;
  color: var(--launchpad-purple);
  text-align: center;
  line-height: 1.15;
}

.card__amount-value {
  font-size: 1em;
  font-weight: 700;
  color: inherit;
}

.card__amount-unit {
  font-size: 0.48em;
  font-weight: 700;
  color: inherit;
  letter-spacing: 0.02em;
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
}

.metrics__item {
  background: var(--white);
  border: 1px solid #e8e8e8;
  border-radius: 8px;
  padding: 10px 6px;
  text-align: center;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.metrics__label {
  font-size: 0.65rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.25;
}

.metrics__value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #000;
  word-break: break-word;
}

.metrics__value--small {
  font-size: 0.7rem;
  line-height: 1.3;
}

.card__section-title {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  font-weight: 700;
  color: #000;
}

.allocation-placeholder {
  border-radius: 8px;
  background: #fafafa;
  border: 1px dashed #d8d0df;
  padding: 16px;
  min-height: 56px;
}

.allocation-placeholder__text {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--gray-muted);
  line-height: 1.45;
}

/* Tab bar */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 8px 24px calc(10px + var(--safe-bottom));
  background: var(--white);
  border-top: 1px solid #e5e5ea;
  z-index: 10;
}

.tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  text-decoration: none;
  color: var(--gray-muted);
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 10px;
  max-width: 120px;
}

.tabbar__item:active {
  opacity: 0.85;
}

.tabbar__item--active {
  color: var(--launchpad-purple);
}

.tabbar__item--active .tabbar__icon {
  color: var(--launchpad-purple);
}

.tabbar__icon {
  display: flex;
  color: var(--gray-muted);
}

.tabbar__label {
  line-height: 1;
}

@media (min-width: 431px) {
  body {
    padding: 24px 16px;
  }

  .app {
    min-height: calc(100dvh - 48px);
    border-radius: 16px;
    overflow: hidden;
  }

  .tabbar {
    border-radius: 0 0 16px 16px;
  }
}
