:root {
  --bg: #0e0f13;
  --bg-soft: #16181f;
  --card: #1b1e27;
  --border: #2a2e3a;
  --text: #e7e9ee;
  --muted: #8b90a0;
  --accent: #7c5cff;
  --accent-2: #00d4a0;
  --radius: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1b1633 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 8px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  flex-shrink: 0;
}
.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand-name {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -.3px;
  white-space: nowrap;
}
.lang-dropdown { position: relative; }
.lang-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: .2s;
  min-height: 40px;
}
.lang-btn:hover { border-color: var(--accent); background: rgba(124,92,255,.08); }
.lang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-btn-arrow { flex-shrink: 0; color: var(--muted); transition: transform .2s; }
.lang-btn[aria-expanded="true"] .lang-btn-arrow { transform: rotate(180deg); }
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  max-height: 320px;
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
  padding: 6px;
  z-index: 100;
}
.lang-menu[hidden] { display: none; }
.lang-option {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: .15s;
}
.lang-option:hover { background: var(--bg-soft); }
.lang-option.active { background: rgba(124,92,255,.15); color: var(--accent); font-weight: 600; }
.lang-option:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* WALLET BUTTON */
.wallet-btn-wrap { margin-left: auto; }
.wallet-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: .2s;
  min-height: 40px;
  white-space: nowrap;
}
.wallet-btn:hover { border-color: var(--accent); background: rgba(124,92,255,.08); }
.wallet-btn.connected { border-color: var(--accent-2); color: var(--accent-2); }
.wallet-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* HERO */
.hero { 
  text-align: center; 
  margin-bottom: 24px;
  position: relative;
}

/* Banner - responsive, with aspect ratio preservation */
.banner-wrap {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.banner-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 200px;
  object-fit: cover;
}

/* Avatar/Logo - responsive sizing */
.avatar-wrap {
  display: inline-flex;
  margin-bottom: 16px;
}
.avatar-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  box-shadow: 0 8px 30px rgba(124, 92, 255, .35);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.hero h1 { 
  margin: 0 0 8px; 
  font-size: clamp(22px, 5vw, 28px); 
  letter-spacing: -.5px; 
}
.subtitle { 
  margin: 0; 
  color: var(--muted); 
  font-size: clamp(14px, 3.5vw, 16px); 
  line-height: 1.5; 
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
}
.subtitle .yt-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  transition: .2s;
  vertical-align: middle;
}
.subtitle .yt-inline:hover {
  border-color: #ff0000;
  color: #ff0000;
  background: rgba(255, 0, 0, 0.08);
}
.subtitle .yt-inline:active { transform: scale(0.98); }
.subtitle .yt-icon { flex-shrink: 0; }

/* TABS */
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 20px;
  touch-action: manipulation;
}
.tab {
  padding: 14px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: .2s;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tab.active { 
  background: var(--card); 
  color: var(--text); 
  box-shadow: 0 2px 12px rgba(0,0,0,.25); 
}
.tab:active { transform: scale(0.98); }

/* PANELS */
.panel { display: none; }
.panel.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* COIN SELECT - vertical list */
.coin-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.coin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  cursor: pointer;
  transition: .2s;
  min-height: 64px;
  touch-action: manipulation;
}
.coin-item:hover { border-color: var(--accent); background: rgba(124,92,255,.08); }
.coin-item:active { transform: scale(0.98); }
.coin-item.active {
  border-color: var(--accent);
  background: rgba(124,92,255,.15);
}
.coin-item-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
}
.coin-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.coin-item-badge {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
}
.coin-item-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coin-item-network {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coin-item-check {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  transform: scale(0.5);
  transition: .2s;
}
.coin-item.active .coin-item-check {
  opacity: 1;
  transform: scale(1);
  background: var(--accent);
  color: #0e0f13;
}

/* Card coin logo */
.card-coin-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

/* CARD */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-head { 
  display: flex; 
  align-items: center; 
  gap: 12px; 
  margin-bottom: 18px; 
}
.coin-badge {
  width: 44px; 
  height: 44px;
  display: grid; 
  place-items: center;
  border-radius: 12px;
  font-weight: 700; 
  font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0e0f13;
  flex-shrink: 0;
}
.coin-name { font-weight: 700; font-size: 17px; }
.coin-network { color: var(--muted); font-size: 13px; }

/* FIELD */
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* Prevents zoom on iOS */
  min-height: 48px;
}
.field input:focus { 
  outline: 2px solid var(--accent); 
  border-color: transparent; 
}
.field input::placeholder { color: var(--muted); opacity: 0.6; }

/* QR */
.qr-wrap {
  display: flex; 
  flex-direction: column; 
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--bg-soft);
  border-radius: 12px;
  margin-bottom: 16px;
}
#qrCanvas { 
  width: 100%; 
  max-width: 240px; 
  height: auto; 
  aspect-ratio: 1;
  border-radius: 8px; 
  background: #fff; 
}
.qr-hint { color: var(--muted); font-size: 13px; text-align: center; }

/* ADDRESS */
.address-row { 
  display: flex; 
  gap: 10px; 
  flex-wrap: wrap;
}
.address-row input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  min-height: 48px;
}
.btn-copy {
  flex-shrink: 0;
  padding: 14px 20px;
  border-radius: 10px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: .2s;
  white-space: nowrap;
  min-height: 48px;
  min-width: 120px;
  touch-action: manipulation;
}
.btn-copy:hover { filter: brightness(1.1); }
.btn-copy:active { transform: scale(.97); }
.btn-copy:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.note { color: var(--muted); font-size: 13px; margin: 12px 0 0; line-height: 1.5; }

/* SERVICES */
.services-grid { display: grid; gap: 12px; }
.service-card {
  display: flex; 
  align-items: center; 
  gap: 14px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: .2s;
  min-height: 64px;
  touch-action: manipulation;
}
.service-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.service-card:active { transform: scale(0.99); }
.service-card.soon {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}
.service-card.soon:hover { border-color: var(--border); transform: none; }
.service-icon {
  width: 48px; 
  height: 48px; 
  flex: 0 0 auto;
  display: grid; 
  place-items: center;
  border-radius: 12px;
  font-size: 22px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}
.service-info { flex: 1; min-width: 0; }
.service-name { font-weight: 700; font-size: 16px; margin-bottom: 2px; }
.service-desc { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-arrow { color: var(--muted); font-size: 20px; flex-shrink: 0; }
.service-badge {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid var(--accent);
}

/* FOOTER */
.footer { text-align: center; margin-top: 40px; color: var(--muted); font-size: 13px; padding-bottom: 20px; }
.footer .muted { opacity: .6; }
.footer a { color: var(--text); text-decoration: none; transition: opacity .2s; }
.footer a:hover { opacity: .7; text-decoration: underline; }
.lang-switch { margin-top: 12px; font-size: 13px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; }
.lang-switch a { color: var(--accent); font-weight: 500; white-space: nowrap; padding: 2px 6px; border-radius: 4px; transition: .2s; }
.lang-switch a:hover { opacity: .8; text-decoration: underline; background: rgba(124, 92, 255, 0.1); }

/* TOAST */
.toast {
  position: fixed;
  left: 50%; 
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--accent-2);
  color: #04120d;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 1000;
  box-shadow: 0 8px 30px rgba(0, 212, 160, 0.3);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* MOBILE FIRST RESPONSIVE */
@media (max-width: 480px) {
  .container { padding: 16px 12px 40px; }
  .topbar { margin-bottom: 12px; }
  .brand-name { display: none; }
  .lang-btn { padding: 6px 8px; font-size: 13px; }
  .lang-btn-text { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wallet-btn-text { display: none; }
  .wallet-btn { padding: 8px 10px; }
  .hero { margin-bottom: 20px; }
  .banner-wrap { border-radius: 10px; margin-bottom: 12px; }
  .avatar-img { width: 64px; height: 64px; }
  .hero h1 { font-size: 22px; }
  .subtitle { font-size: 14px; }
  .tabs { gap: 4px; padding: 4px; }
  .tab { padding: 12px 8px; font-size: 14px; min-height: 44px; }
  .coin-item { padding: 10px 12px; gap: 10px; min-height: 56px; }
  .coin-item-logo { width: 36px; height: 36px; border-radius: 8px; }
  .coin-item-badge { font-size: 14px; }
  .coin-item-name { font-size: 13px; }
  .coin-item-network { font-size: 11px; }
  .card { padding: 16px; border-radius: 14px; }
  .coin-badge { width: 40px; height: 40px; font-size: 12px; }
  .card-coin-logo { width: 40px; height: 40px; border-radius: 10px; }
  .coin-name { font-size: 16px; }
  .field input { padding: 14px 14px; font-size: 16px; }
  .qr-wrap { padding: 16px; }
  #qrCanvas { max-width: 200px; }
  .address-row { flex-direction: column; }
  .address-row input { font-size: 13px; }
  .btn-copy { width: 100%; }
  .service-card { padding: 14px 16px; gap: 12px; }
  .service-icon { width: 44px; height: 44px; font-size: 20px; }
  .service-name { font-size: 15px; }
  .toast { 
    left: 16px; 
    right: 16px; 
    bottom: 16px; 
    transform: translateY(20px); 
    text-align: center;
    border-radius: 12px;
    padding: 14px 20px;
  }
  .toast.show { transform: translateY(0); }
}

@media (min-width: 481px) and (max-width: 768px) {
  .container { max-width: 100%; padding: 32px 20px 56px; }
  .banner-img { max-height: 240px; }
  .avatar-img { width: 80px; height: 80px; }
  .hero h1 { font-size: 30px; }
  .qr-wrap { padding: 24px; }
  #qrCanvas { max-width: 280px; }
}

@media (min-width: 769px) {
  .container { padding: 48px 24px 64px; }
  .banner-img { max-height: 280px; }
  .avatar-img { width: 88px; height: 88px; }
  .hero h1 { font-size: 32px; }
  .subtitle { font-size: 16px; }
  .qr-wrap { padding: 28px; }
  #qrCanvas { max-width: 300px; }
}

/* LANDSCAPE MOBILE */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { margin-bottom: 16px; }
  .banner-wrap { margin-bottom: 8px; }
  .banner-img { max-height: 120px; }
  .avatar-img { width: 56px; height: 56px; }
  .hero h1 { font-size: 20px; }
  .subtitle { font-size: 13px; }
  .container { padding: 12px 16px 32px; }
}

/* HIGH DPI DISPLAYS */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .avatar-img { image-rendering: -webkit-optimize-contrast; }
  .banner-img { image-rendering: -webkit-optimize-contrast; }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* FOCUS VISIBLE FOR ACCESSIBILITY */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* SELECTION COLORS */
::selection {
  background: rgba(124, 92, 255, 0.3);
  color: var(--text);
}