:root {
  --bg0: #070a12;
  --bg1: #0b1022;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.08);
  --stroke: rgba(255, 255, 255, 0.10);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.62);
  --muted2: rgba(255, 255, 255, 0.46);

  --container: 1280px;
  --nav-max: 720px;
  --sheet-max: 720px;
  --pad: clamp(12px, 2.4vw, 22px);

  --green: #2ee59d;
  --green2: #1fbf81;
  --red: #ff4d6d;
  --red2: #e63d5d;
  --accent: #8a7dff;

  --shadow: 0 14px 38px rgba(0, 0, 0, 0.40);
  --radius: 18px;
  --radius2: 14px;
  --radius3: 12px;
  --gap: clamp(10px, 1.6vw, 14px);

  --tabbar-h: 72px;
  --header-h: 56px;

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* { 
  box-sizing: border-box;
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
}

html, body {
  height: 100%;
  overflow-x: hidden;
}

html {
  background: var(--bg0);
  /* Дополнительная защита от зума */
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: transparent;
  position: relative;
  isolation: isolate;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Дополнительная защита от зума */
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
  overscroll-behavior: contain;
}

body::before {
  content: "";
  position: fixed;
  inset: -30vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70vmax 48vmax at 16% -6%, rgba(138, 125, 255, 0.20), rgba(138, 125, 255, 0.08) 38%, transparent 72%),
    radial-gradient(60vmax 44vmax at 104% 18%, rgba(46, 229, 157, 0.12), rgba(46, 229, 157, 0.05) 40%, transparent 72%),
    radial-gradient(78vmax 52vmax at 8% 112%, rgba(255, 77, 109, 0.10), rgba(255, 77, 109, 0.04) 42%, transparent 74%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

a { color: inherit; }

.app {
  min-height: 100%;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

.shell {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--pad);
  background: rgba(11, 16, 34, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

html.glass:not([data-theme="light"]) .header {
  background: rgba(11, 16, 34, 0.86);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.logo {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  object-fit: contain;
}

/* Alert icons */
.alert-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  object-fit: contain;
}

.brand-title {
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.05;
}

.brand-sub {
  display: block;
  font-size: 12px;
  color: var(--muted2);
  font-weight: 500;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25);
  -webkit-tap-highlight-color: transparent;
}

.icon-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(138, 125, 255, 0.14), 0 10px 28px rgba(0, 0, 0, 0.25);
}

.icon-btn:active { transform: translateY(1px); }

.content {
  padding: var(--pad);
}

.card {
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04)),
    rgba(11, 16, 34, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

html.glass:not([data-theme="light"]) .card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04)),
    rgba(11, 16, 34, 0.78);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.card-inner { padding: 14px; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.row > * { min-width: 0; }

.section-title {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.chip[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(138, 125, 255, 0.35);
  background: rgba(138, 125, 255, 0.14);
}

.segmented {
  display: flex;
  gap: 8px;
}

.seg-btn {
  width: 38px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}

.seg-btn[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(46, 229, 157, 0.35);
  background: rgba(46, 229, 157, 0.12);
}

.chart {
  width: 100%;
  height: clamp(220px, 30vh, 420px);
  position: relative;
  border-radius: var(--radius2);
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: block;
}

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

.chart-caption {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.62);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 0.2px;
}

.chart-caption-pair,
.chart-caption-tf {
  font-family: var(--mono);
}

.chart-caption-dot {
  opacity: 0.65;
}

.token-badge.sm {
  width: 20px;
  height: 20px;
  border-radius: 8px;
}

.token-badge.sm .token-img {
  width: 14px;
  height: 14px;
}

.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius) var(--radius);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted2);
  font-weight: 700;
  padding: 10px 14px;
}

.table td {
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.pair-row {
  cursor: pointer;
}

.pair-row[aria-selected="true"] {
  background: rgba(138, 125, 255, 0.10);
}

.pair {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.pair-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.token-badge {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  flex: 0 0 auto;
}

.token-img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: block;
}

.token-fallback {
  display: none;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0.3px;
  color: rgba(255, 255, 255, 0.80);
  line-height: 1;
}

.secondary.block {
  width: 100%;
}

.price {
  font-family: var(--mono);
  font-size: 13px;
  color: rgba(255,255,255,0.88);
}

.price.updating {
  filter: blur(2.2px);
  opacity: 0.72;
  transition: filter 140ms ease, opacity 140ms ease;
}

.change {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 800;
}

.change.pos { color: var(--green); }
.change.neg { color: var(--red); }

.spark {
  width: clamp(72px, 16vw, 110px);
  height: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 8px;
}

.label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.label span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.helper {
  font-size: 12px;
  color: rgba(255, 120, 140, 0.95);
  display: none;
}

.helper.show { display: block; }

.input {
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0 14px;
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.input:focus {
  border-color: rgba(138, 125, 255, 0.55);
  box-shadow: 0 0 0 4px rgba(138, 125, 255, 0.12);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cta {
  height: 48px;
  border-radius: 12px;
  border: none;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 1px 0 rgba(255, 255, 255, 0.10) inset;
}

.cta.up {
  background: #12b76a;
  box-shadow:
    0 16px 32px rgba(18, 183, 106, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.10) inset,
    0 1px 0 rgba(255, 255, 255, 0.14) inset;
}

.cta.down {
  background: #d04f45;
  box-shadow:
    0 16px 32px rgba(208, 79, 69, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.10) inset,
    0 1px 0 rgba(255, 255, 255, 0.14) inset;
}

.cta:active { transform: translateY(1px); }

.secondary {
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 800;
}

.secondary:active { transform: translateY(1px); }

.trade-card {
  display: grid;
  gap: 10px;
}

.trade-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
}

.badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.up { background: var(--green); }
.dot.down { background: var(--red); }

.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kv .k {
  font-size: 11px;
  color: var(--muted2);
  font-weight: 800;
}

.kv .v {
  font-family: var(--mono);
  font-size: 13px;
  color: rgba(255,255,255,0.90);
  margin-top: 4px;
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
  background: rgba(7, 10, 18, 0.98);
  box-shadow:
    0 -18px 44px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

html.glass:not([data-theme="light"]) .tabbar {
  background: rgba(7, 10, 18, 0.86);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.tabbar::before {
  content: "";
  position: absolute;
  left: -20px;
  right: -20px;
  top: -22px;
  height: 22px;
  background: rgba(7, 10, 18, 0.86);
  filter: blur(14px);
  opacity: 0.85;
  pointer-events: none;
  display: none;
}

html.glass:not([data-theme="light"]) .tabbar::before {
  display: block;
}

.tabs {
  max-width: var(--nav-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.tab {
  height: 52px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.2px;
}

.tab[aria-current="page"] {
  color: var(--text);
  border-color: rgba(138, 125, 255, 0.45);
  background: rgba(138, 125, 255, 0.14);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  display: none;
  z-index: 50;
}

.overlay.show { display: block; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  transform: translateY(110%);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  padding: 12px;
}

.sheet.show {
  transform: translate3d(0, 0, 0);
  -webkit-transform: translate3d(0, 0, 0);
}

/* Centered alert variant */
.sheet.sheet--alert {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transform: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sheet.sheet--alert.show {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.sheet-card {
  width: 100%;
  max-width: var(--sheet-max);
  margin: 0 auto;
  border-radius: 22px;
  background:
    radial-gradient(420px 180px at 20% 0%, rgba(138, 125, 255, 0.14), transparent 58%),
    radial-gradient(420px 180px at 85% 10%, rgba(46, 229, 157, 0.10), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)),
    rgba(7, 10, 18, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow);
  overflow: hidden;
}

html.glass:not([data-theme="light"]) .sheet-card {
  background:
    radial-gradient(420px 180px at 20% 0%, rgba(138, 125, 255, 0.14), transparent 58%),
    radial-gradient(420px 180px at 85% 10%, rgba(46, 229, 157, 0.10), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)),
    rgba(7, 10, 18, 0.78);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}

/* Alert card styling */
.sheet--alert .sheet-card {
  max-width: 380px;
  border-radius: 24px;
  background:
    radial-gradient(300px 150px at 20% 0%, rgba(138, 125, 255, 0.18), transparent 60%),
    radial-gradient(300px 150px at 90% 20%, rgba(46, 229, 157, 0.12), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)),
    rgba(7, 10, 18, 0.98);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
}

html.glass:not([data-theme="light"]) .sheet--alert .sheet-card {
  background:
    radial-gradient(300px 150px at 20% 0%, rgba(138, 125, 255, 0.18), transparent 60%),
    radial-gradient(300px 150px at 90% 20%, rgba(46, 229, 157, 0.12), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)),
    rgba(7, 10, 18, 0.82);
  -webkit-backdrop-filter: blur(28px);
  backdrop-filter: blur(28px);
}

.sheet--alert.show .sheet-card {
  transform: scale(1);
}

.sheet-head {
  padding: 16px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.sheet-title {
  font-weight: 1000;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.sheet-body {
  padding: 20px 18px;
  display: grid;
  gap: 14px;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  line-height: 1.5;
}

.sheet-actions {
  padding: 6px 18px 18px;
  display: grid;
  gap: 10px;
}

.btn {
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-weight: 900;
}

.btn.primary {
  border-color: rgba(138, 125, 255, 0.45);
  background: rgba(138, 125, 255, 0.18);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.checkbox input { width: 18px; height: 18px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.92);
  font-weight: 800;
  font-size: 13px;
  transition: opacity 160ms ease, transform 160ms ease;
}

html.glass:not([data-theme="light"]) .toast {
  background: rgba(0, 0, 0, 0.66);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.note {
  position: fixed;
  left: 50%;
  top: calc(var(--header-h) + 10px + env(safe-area-inset-top));
  transform: translateX(-50%) translateY(-10px);
  opacity: 0;
  pointer-events: none;
  z-index: 90;
  width: min(520px, calc(100vw - (var(--pad) * 2)));
  padding: 12px 14px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)),
    rgba(7, 10, 18, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  transition: opacity 160ms ease, transform 160ms ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html.glass:not([data-theme="light"]) .note {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04)),
    rgba(7, 10, 18, 0.82);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.note.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.note.drag { transition: none; }

.note-title {
  font-weight: 1000;
  letter-spacing: 0.2px;
}

.note-body {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 800;
  font-size: 12px;
  line-height: 1.25;
}

.note.pos { border-color: rgba(46, 229, 157, 0.26); }
.note.neg { border-color: rgba(255, 77, 109, 0.26); }

html[data-theme="light"] {
  --bg0: #eef2f8;
  --bg1: #f7f9fd;
  --card: rgba(0, 0, 0, 0.06);
  --card2: rgba(0, 0, 0, 0.08);
  --stroke: rgba(0, 0, 0, 0.12);
  --text: rgba(15, 18, 26, 0.92);
  --muted: rgba(15, 18, 26, 0.62);
  --muted2: rgba(15, 18, 26, 0.50);
}

html[data-theme="light"] body::before {
  background:
    radial-gradient(70vmax 48vmax at 16% -6%, rgba(138, 125, 255, 0.18), rgba(138, 125, 255, 0.06) 38%, transparent 72%),
    radial-gradient(60vmax 44vmax at 104% 18%, rgba(46, 229, 157, 0.12), rgba(46, 229, 157, 0.05) 40%, transparent 72%),
    radial-gradient(78vmax 52vmax at 8% 112%, rgba(255, 77, 109, 0.12), rgba(255, 77, 109, 0.05) 42%, transparent 74%);
}

html[data-theme="light"] body::after { opacity: 0.035; }

html[data-theme="light"] .header {
  background: rgba(246, 248, 252, 0.82);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .tabbar {
  background: rgba(246, 248, 252, 0.82);
  box-shadow:
    0 -18px 44px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

html[data-theme="light"] .tabbar::before { background: rgba(246, 248, 252, 0.92); }

html[data-theme="light"] .card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.72)),
    rgba(246, 248, 252, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 44px rgba(18, 23, 35, 0.14);
}

html[data-theme="light"] .input,
html[data-theme="light"] .tab,
html[data-theme="light"] .secondary,
html[data-theme="light"] .icon-btn,
html[data-theme="light"] .eye-btn,
html[data-theme="light"] .seg-switch,
html[data-theme="light"] .sheet-card,
html[data-theme="light"] .badge {
  border-color: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .icon-btn,
html[data-theme="light"] .eye-btn {
  background: rgba(255, 255, 255, 0.72);
  color: rgba(15, 18, 26, 0.78);
  box-shadow: 0 12px 26px rgba(18, 23, 35, 0.14);
}

html[data-theme="light"] .tab,
html[data-theme="light"] .secondary,
html[data-theme="light"] .chip,
html[data-theme="light"] .seg-btn {
  background: rgba(255, 255, 255, 0.72);
  color: rgba(15, 18, 26, 0.62);
  border-color: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .tab[aria-current="page"],
html[data-theme="light"] .chip[aria-pressed="true"],
html[data-theme="light"] .seg[aria-selected="true"],
html[data-theme="light"] .seg-btn[aria-pressed="true"] {
  color: rgba(15, 18, 26, 0.92);
}

html[data-theme="light"] .seg-switch {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .seg {
  color: rgba(15, 18, 26, 0.62);
}

html[data-theme="light"] .input {
  background: rgba(255, 255, 255, 0.84);
  color: rgba(15, 18, 26, 0.92);
}

html[data-theme="light"] .table th { color: rgba(15, 18, 26, 0.55); }
html[data-theme="light"] .table td { border-top-color: rgba(0, 0, 0, 0.06); }
html[data-theme="light"] .pair-row[aria-selected="true"] { background: rgba(138, 125, 255, 0.10); }

html[data-theme="light"] .price,
html[data-theme="light"] .kv .v,
html[data-theme="light"] .trade-amt {
  color: rgba(15, 18, 26, 0.86);
}

html[data-theme="light"] .trade-amt-win {
  color: rgba(21, 168, 104, 1);
}

html[data-theme="light"] .trade-amt-loss {
  color: rgba(220, 61, 76, 1);
}

html[data-theme="light"] .trade-time { color: rgba(15, 18, 26, 0.45); }

html[data-theme="light"] .stat-k { color: rgba(15, 18, 26, 0.55); }
html[data-theme="light"] .stat-v { color: rgba(15, 18, 26, 0.90); }

html[data-theme="light"] .badge {
  background: rgba(255, 255, 255, 0.74);
}

html[data-theme="light"] .token-badge {
  background: rgba(255, 255, 255, 0.78);
}

html[data-theme="light"] .overlay {
  background: rgba(0, 0, 0, 0.40);
}

html[data-theme="light"] .sheet-card {
  background:
    radial-gradient(420px 180px at 20% 0%, rgba(138, 125, 255, 0.12), transparent 58%),
    radial-gradient(420px 180px at 85% 10%, rgba(21, 168, 104, 0.09), transparent 62%),
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.75));
  border-color: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .sheet--alert .sheet-card {
  background:
    radial-gradient(300px 150px at 20% 0%, rgba(138, 125, 255, 0.12), transparent 60%),
    radial-gradient(300px 150px at 90% 20%, rgba(21, 168, 104, 0.09), transparent 65%),
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.82));
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.03) inset;
}

html[data-theme="light"] .sheet-head {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .sheet-title {
  color: rgba(15, 18, 26, 0.92);
}

html[data-theme="light"] .sheet-body {
  color: rgba(15, 18, 26, 0.70);
}

html[data-theme="light"] .btn {
  background: rgba(255, 255, 255, 0.78);
  color: rgba(15, 18, 26, 0.86);
  border-color: rgba(0, 0, 0, 0.10);
}

html[data-theme="light"] .btn.primary {
  background: rgba(138, 125, 255, 0.16);
  border-color: rgba(138, 125, 255, 0.35);
}

html[data-theme="light"] .bal-plus {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
  color: rgba(15, 18, 26, 0.86);
}

html[data-theme="light"] .chart {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .spark {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.10);
  color: rgba(15, 18, 26, 0.92);
}

html[data-theme="light"] .note {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(255,255,255,0.70)),
    rgba(246, 248, 252, 0.78);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.18);
}

html[data-theme="light"] .note-body { color: rgba(15, 18, 26, 0.72); }

html[data-theme="light"] .chart-caption { color: rgba(15, 18, 26, 0.62); }
html[data-theme="light"] .chart-caption-dot { opacity: 0.55; }
html[data-theme="light"] .chart-caption-pair,
html[data-theme="light"] .chart-caption-tf { color: rgba(15, 18, 26, 0.86); }

html[data-theme="light"] .mode-note {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: rgba(15, 18, 26, 0.62);
}

html[data-theme="light"] .mode-note strong { color: rgba(15, 18, 26, 0.86); }
html[data-theme="light"] .verification-block.verified {
  background: rgba(31, 191, 129, 0.12);
  border-color: rgba(31, 191, 129, 0.30);
  color: #1a9e6d;
}
html[data-theme="light"] .verification-block.not-verified {
  background: rgba(230, 160, 0, 0.10);
  border-color: rgba(230, 160, 0, 0.30);
  color: #c28b00;
}
html[data-theme="light"] .verification-btn {
  border-color: rgba(200, 140, 0, 0.40);
  background: rgba(230, 160, 0, 0.12);
  color: #b38200;
}
html[data-theme="light"] .verification-btn:hover {
  background: rgba(230, 160, 0, 0.22);
}

.page {
  padding-top: 6px;
  display: grid;
  gap: var(--gap);
}

.news-page {
  display: grid;
  gap: var(--gap);
}

.news-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}

.news-title {
  font-weight: 1100;
  letter-spacing: 0.2px;
}

.news-item {
  display: block;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.news-item:active {
  transform: translateY(1px);
}

.news-item-inner {
  display: grid;
  gap: 10px;
}

.news-item-top {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
}

.news-item-title {
  font-weight: 1000;
  letter-spacing: 0.2px;
  line-height: 1.25;
}

.news-item-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
}

.news-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 900;
  font-size: 12px;
}

.news-article-title {
  font-weight: 1100;
  letter-spacing: 0.2px;
  line-height: 1.2;
}

.news-article-body {
  white-space: pre-wrap;
  line-height: 1.45;
  color: var(--text);
  font-weight: 780;
  opacity: 0.92;
}

.market-grid {
  display: grid;
  gap: var(--gap);
  align-items: start;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "chart"
    "form"
    "pairs"
    "active";
}

.ios-market-stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.ios-market-section {
  overflow: visible;
}

.ios-market-form .card-inner {
  padding-bottom: 20px;
}

.ios-pairs-list {
  display: grid;
  gap: 8px;
}

.ios-pair-row {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.ios-pair-row[aria-selected="true"] {
  background: rgba(138, 125, 255, 0.12);
  border-color: rgba(138, 125, 255, 0.28);
}

.ios-pair-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ios-pair-values {
  display: inline-grid;
  justify-items: end;
  gap: 2px;
  min-width: 90px;
}

.market-grid > * { min-width: 0; }

.market-chart,
.market-pairs,
.market-form,
.market-active {
  overflow: hidden;
}
.market-form .card-inner {
  padding-bottom: 20px;
}

.market-chart { grid-area: chart; }
.market-pairs { grid-area: pairs; }
.market-form { grid-area: form; }
.market-active { grid-area: active; }

@media (min-width: 860px) {
  .market-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr);
    grid-template-areas:
      "chart form"
      "pairs pairs"
      "active active";
  }
}

@media (min-width: 1160px) {
  .market-grid {
    grid-template-columns: minmax(0, 1.60fr) minmax(0, 0.90fr) minmax(0, 1.10fr);
    grid-template-areas:
      "chart form pairs"
      "chart active pairs";
  }

  .market-pairs .table-wrap {
    max-height: calc(100vh - var(--header-h) - var(--tabbar-h) - (var(--pad) * 4));
  }
}

.table {
  table-layout: fixed;
}

.table th,
.table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table th:nth-child(1),
.table td:nth-child(1) { width: 34%; }
.table th:nth-child(2),
.table td:nth-child(2) { width: 22%; }
.table th:nth-child(3),
.table td:nth-child(3) { width: 24%; }
.table th:nth-child(4),
.table td:nth-child(4) { width: 20%; }

@media (max-width: 380px) {
  .table th:nth-child(2),
  .table td:nth-child(2) {
    display: none;
  }
}

.empty {
  padding: 14px;
  color: var(--muted);
  font-weight: 700;
}

.profile {
  display: grid;
  gap: var(--gap);
}

.profile-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  font-weight: 1000;
  letter-spacing: 0.2px;
  margin-top: 6px;
  margin-bottom: 2px;
}
.profile-loading {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.5;
}
.verification-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}
.verification-block.verified {
  background: rgba(46, 229, 157, 0.12);
  border: 1px solid rgba(46, 229, 157, 0.25);
  color: #2ee59d;
}
.verification-block.not-verified {
  background: rgba(255, 193, 7, 0.10);
  border: 1px solid rgba(255, 193, 7, 0.25);
  color: #ffc107;
}
.verification-icon {
  flex-shrink: 0;
}
.verification-text {
  white-space: nowrap;
}
.verification-btn {
  margin-left: 4px;
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 193, 7, 0.35);
  background: rgba(255, 193, 7, 0.15);
  color: #ffc107;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.verification-btn:hover {
  background: rgba(255, 193, 7, 0.25);
}
.verification-btn:active {
  transform: scale(0.97);
}

/* Limits block */
.limits-block {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(138, 125, 255, 0.10);
  border: 1px solid rgba(138, 125, 255, 0.25);
}
.limits-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(138, 125, 255, 0.15);
  color: var(--accent);
  flex-shrink: 0;
}
.limits-content {
  flex: 1;
  min-width: 0;
}
.limits-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 2px;
}
.limits-value {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 1000;
  color: var(--text);
}
.limits-currency {
  font-size: 12px;
  opacity: 0.6;
}
.limits-info-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(138, 125, 255, 0.25);
  background: rgba(138, 125, 255, 0.10);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.limits-info-btn:hover {
  background: rgba(138, 125, 255, 0.20);
}
.limits-info-btn:active {
  transform: scale(0.92);
}

html[data-theme="light"] .limits-block {
  background: rgba(138, 125, 255, 0.08);
  border-color: rgba(138, 125, 255, 0.20);
}
html[data-theme="light"] .limits-icon {
  background: rgba(138, 125, 255, 0.12);
}
html[data-theme="light"] .limits-info-btn {
  background: rgba(138, 125, 255, 0.08);
  border-color: rgba(138, 125, 255, 0.20);
}
html[data-theme="light"] .limits-info-btn:hover {
  background: rgba(138, 125, 255, 0.15);
}

.balance-card .card-inner {
  padding: 16px;
  text-align: center;
}

.balance-top {
  margin-bottom: 12px;
}

.balance-head {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
}

.balance-head .seg-switch {
  justify-self: center;
}

.eye-btn {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.78);
  display: grid;
  place-items: center;
}

.eye-btn:active { transform: translateY(1px); }

.balance-amount.blur {
  filter: blur(8px);
  user-select: none;
}

.mode-note {
  margin: 10px auto 0;
  max-width: min(420px, 100%);
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.68);
  font-weight: 800;
  font-size: 12px;
  line-height: 1.25;
  text-align: center;
}

.mode-note strong {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 1000;
}

.seg-switch {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: min(320px, 92%);
}

.seg {
  height: 36px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-weight: 900;
}

.seg[aria-selected="true"] {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(138, 125, 255, 0.20);
  border-color: rgba(138, 125, 255, 0.30);
}

.balance-amount {
  font-weight: 1100;
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.balance-unit {
  font-size: 0.65em;
  letter-spacing: 0.3px;
}

.bal-plus {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 1000;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bal-plus:active {
  transform: scale(0.96);
}



.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}

.stat .card-inner {
  padding: 14px;
  text-align: center;
}

.stat-k {
  color: rgba(255, 255, 255, 0.55);
  font-weight: 900;
  font-size: 12px;
}

.stat-v {
  margin-top: 6px;
  font-weight: 1100;
  font-size: 20px;
  letter-spacing: 0.2px;
}

.trade-history {
  overflow: hidden;
}

.trade-list {
  display: grid;
}

.trade-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.trade-item:first-child { border-top: none; }

.trade-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.trade-dir {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 1100;
  flex: 0 0 auto;
}

.trade-dir.up {
  background: rgba(46, 229, 157, 0.14);
  border: 1px solid rgba(46, 229, 157, 0.30);
  color: var(--green);
}

.trade-dir.down {
  background: rgba(255, 77, 109, 0.14);
  border: 1px solid rgba(255, 77, 109, 0.30);
  color: var(--red);
}

.trade-pair {
  font-weight: 1000;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trade-amt {
  font-family: var(--mono);
  color: rgba(255, 255, 255, 0.72);
  font-weight: 900;
}

.trade-amt-win {
  color: var(--green);
}

.trade-amt-loss {
  color: var(--red);
}

.trade-time {
  font-family: var(--mono);
  color: rgba(255, 255, 255, 0.45);
  font-weight: 900;
}

.ban-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg0);
}

.ban-card {
  text-align: center;
  display: grid;
  gap: 16px;
  justify-items: center;
  max-width: 360px;
  width: 100%;
}

.ban-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.ban-title {
  font-weight: 1100;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.ban-text {
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.45;
}

.ban-btn {
  width: 100%;
  max-width: 280px;
}

.maintenance-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg0);
}

.maintenance-card {
  text-align: center;
  display: grid;
  gap: 16px;
  justify-items: center;
  max-width: 360px;
  width: 100%;
}

.maintenance-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.maintenance-title {
  font-weight: 1100;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.maintenance-text {
  color: var(--muted);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.45;
}

.maintenance-btn {
  width: 100%;
  max-width: 280px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px 14px;
  flex-wrap: wrap;
}

.pagination-btn {
  min-width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
  padding: 0 4px;
}

.pagination-btn:hover:not(:disabled) {
  background: rgba(138, 125, 255, 0.10);
  border-color: rgba(138, 125, 255, 0.25);
  color: var(--text);
}

.pagination-btn:active:not(:disabled) {
  transform: scale(0.92);
}

.pagination-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.pagination-btn.active {
  color: var(--text);
  border-color: rgba(138, 125, 255, 0.45);
  background: rgba(138, 125, 255, 0.18);
  font-weight: 1000;
}

html[data-theme="light"] .pagination-btn {
  border-color: rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(15, 18, 26, 0.55);
}

html[data-theme="light"] .pagination-btn:hover:not(:disabled) {
  background: rgba(138, 125, 255, 0.10);
  border-color: rgba(138, 125, 255, 0.25);
  color: rgba(15, 18, 26, 0.92);
}

html[data-theme="light"] .pagination-btn.active {
  color: rgba(15, 18, 26, 0.92);
  border-color: rgba(138, 125, 255, 0.45);
  background: rgba(138, 125, 255, 0.16);
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  .trade-item { grid-template-columns: 1fr auto; }
  .trade-time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sheet { transition: none; }
  .toast { transition: none; }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}



@keyframes priceFlash {
  0% { background: transparent; }
  30% { background: rgba(138, 125, 255, 0.15); }
  100% { background: transparent; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Page transitions - only on route change */
.page-enter {
  animation: fadeIn 0.25s ease-out;
}

/* Card cascade animation - only on route change */
.page-enter .card {
  animation: fadeInUp 0.35s ease-out backwards;
}

.page-enter .market-grid .card:nth-child(1) { animation-delay: 0ms; }
.page-enter .market-grid .card:nth-child(2) { animation-delay: 50ms; }
.page-enter .market-grid .card:nth-child(3) { animation-delay: 100ms; }
.page-enter .market-grid .card:nth-child(4) { animation-delay: 150ms; }

.page-enter .profile .card:nth-child(1) { animation-delay: 0ms; }
.page-enter .profile .card:nth-child(2) { animation-delay: 50ms; }
.page-enter .profile .card:nth-child(3) { animation-delay: 100ms; }

.page-enter .stats-grid .card:nth-child(1) { animation-delay: 80ms; }
.page-enter .stats-grid .card:nth-child(2) { animation-delay: 120ms; }
.page-enter .stats-grid .card:nth-child(3) { animation-delay: 160ms; }

.page-enter .news-page .card {
  animation: fadeInUp 0.3s ease-out backwards;
}
.page-enter .news-page .card:nth-child(2) { animation-delay: 30ms; }
.page-enter .news-page .card:nth-child(3) { animation-delay: 60ms; }
.page-enter .news-page .card:nth-child(4) { animation-delay: 90ms; }
.page-enter .news-page .card:nth-child(5) { animation-delay: 120ms; }

/* Verification block - only on route change */
.page-enter .verification-block {
  animation: fadeInScale 0.3s ease-out 100ms backwards;
}

/* Button interactions */
.cta, .btn, .secondary, .chip, .seg, .seg-btn, .icon-btn, .eye-btn, .bal-plus, .verification-btn {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.cta:active, .btn:active, .secondary:active, .chip:active, .seg:active, .seg-btn:active {
  transform: scale(0.96);
}

.icon-btn:active, .eye-btn:active, .bal-plus:active, .verification-btn:active {
  transform: scale(0.92);
}

/* CTA buttons special hover */
.cta.up:hover {
  box-shadow: 0 8px 24px rgba(46, 229, 157, 0.25);
}
.cta.down:hover {
  box-shadow: 0 8px 24px rgba(255, 77, 109, 0.25);
}

/* Tab transitions */
.tab {
  transition: color 0.15s ease, border-color 0.2s ease, background 0.15s ease;
}

/* Pair row interactions */
.pair-row {
  transition: background 0.15s ease;
  cursor: pointer;
}

.pair-row:hover {
  background: rgba(138, 125, 255, 0.08);
}

.pair-row:active {
  background: rgba(138, 125, 255, 0.12);
}

.pair-row[aria-selected="true"] {
  animation: fadeInScale 0.2s ease-out;
}

/* Price update flash */
.price.updating {
  animation: pulse 0.8s ease-in-out infinite;
}

.price {
  transition: color 0.2s ease;
}

/* Chart container - only on route change */
.page-enter .chart {
  animation: fadeIn 0.4s ease-out;
}



/* Spark chart fade in - only on route change */
.page-enter .spark {
  animation: fadeIn 0.5s ease-out;
}

/* Token badge pop */
.token-badge {
  transition: transform 0.15s ease;
}
.pair-row:hover .token-badge {
  transform: scale(1.08);
}

/* Input focus animation */
.input {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input:focus {
  box-shadow: 0 0 0 3px rgba(138, 125, 255, 0.15);
}

/* Segmented control */
.seg-switch {
  transition: background 0.15s ease;
}

/* Balance blur transition */
.balance-amount {
  transition: filter 0.25s ease;
}

/* Mode note - only on route change */
.page-enter .mode-note {
  animation: fadeIn 0.3s ease-out 150ms backwards;
}

/* Trade history items - only on route change */
.page-enter .trade-item {
  animation: slideInRight 0.25s ease-out backwards;
}
.page-enter .trade-item:nth-child(1) { animation-delay: 50ms; }
.page-enter .trade-item:nth-child(2) { animation-delay: 80ms; }
.page-enter .trade-item:nth-child(3) { animation-delay: 110ms; }
.page-enter .trade-item:nth-child(4) { animation-delay: 140ms; }
.page-enter .trade-item:nth-child(5) { animation-delay: 170ms; }

/* Skeleton loading placeholder */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 25%,
    rgba(255, 255, 255, 0.12) 50%,
    rgba(255, 255, 255, 0.06) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: 8px;
}

html[data-theme="light"] .skeleton {
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.06) 25%,
    rgba(0, 0, 0, 0.10) 50%,
    rgba(0, 0, 0, 0.06) 75%
  );
  background-size: 200% 100%;
}

/* Sheet animation - handled in main .sheet styles */

/* Toast slide in */
.toast {
  transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease;
}

/* Note notification */
.note {
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.25s ease;
}

/* Header subtle shadow on scroll - can be toggled via JS */
.header {
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

/* Chip pressed state */
.chip[aria-pressed="true"] {
  animation: fadeInScale 0.15s ease-out;
}

/* Chart type button */
.seg-btn[aria-pressed="true"] {
  animation: fadeInScale 0.15s ease-out;
}

/* News item hover */
.news-item {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.news-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.22);
}
.news-item:active {
  transform: translateY(0) scale(0.99);
}

/* Settings rows - only on route change */
.page-enter .card-inner > div {
  animation: fadeIn 0.25s ease-out backwards;
}
.page-enter .card-inner > div:nth-child(2) { animation-delay: 50ms; }
.page-enter .card-inner > div:nth-child(3) { animation-delay: 100ms; }

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

/* ============================================================================
   iOS SAFARI FIXES
   iOS Safari 18+ имеет критические баги с:
   - backdrop-filter (элементы исчезают)
   - CSS animations с backwards fill-mode (элементы не появляются)
   - overflow: hidden на grid items (rendering issues)
   ============================================================================ */

/* 1. Полностью отключаем backdrop-filter */
html.ios *,
html.ios *::before,
html.ios *::after {
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}

/* 2. Отключаем ВСЕ анимации - они ломают рендеринг */
html.ios *,
html.ios *::before,
html.ios *::after {
  animation: none !important;
  animation-delay: 0s !important;
  animation-duration: 0s !important;
  transition: none !important;
}

/* 3. Принудительно делаем все элементы видимыми */
html.ios .card,
html.ios .card-inner,
html.ios .ios-market-stack,
html.ios .ios-market-stack > *,
html.ios .ios-market-section,
html.ios .market-grid,
html.ios .market-grid > *,
html.ios .market-chart,
html.ios .market-form,
html.ios .market-pairs,
html.ios .market-active,
html.ios .news-page,
html.ios .news-page > *,
html.ios .profile,
html.ios .profile > *,
html.ios .stats-grid,
html.ios .stats-grid > *,
html.ios .page,
html.ios .page > *,
html.ios #route,
html.ios #route > * {
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
}

/* 3.1 Дополнительная стабилизация перерисовки в Telegram iOS WebView */
html.ios #route,
html.ios .page {
  -webkit-transform: translateZ(0) !important;
  transform: translateZ(0) !important;
  -webkit-backface-visibility: hidden !important;
  backface-visibility: hidden !important;
}

html.ios #route.page-enter {
  animation: none !important;
}

html.ios .table,
html.ios .table tbody,
html.ios .table tr,
html.ios .table th,
html.ios .table td {
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

html.ios .table-wrap {
  -webkit-overflow-scrolling: auto !important;
}

/* 4. Убираем overflow:hidden который ломает рендеринг */
html.ios .market-chart,
html.ios .market-pairs,
html.ios .market-form,
html.ios .market-active,
html.ios .ios-market-section,
html.ios .card,
html.ios .table-wrap {
  overflow: visible !important;
}

/* 5. Непрозрачные фоны */
html.ios .header {
  background: rgba(11, 16, 34, 0.98) !important;
}

html.ios .tabbar {
  background: rgba(7, 10, 18, 0.98) !important;
}

html.ios .tabbar::before {
  display: none !important;
}

html.ios .card {
  background: linear-gradient(180deg, rgba(20, 26, 45, 1), rgba(15, 20, 38, 1)) !important;
}

html.ios .toast {
  background: rgba(0, 0, 0, 0.95) !important;
}

html.ios .note {
  background: rgba(12, 17, 30, 0.98) !important;
}

html.ios .sheet-card {
  background:
    radial-gradient(420px 180px at 20% 0%, rgba(138, 125, 255, 0.14), transparent 58%),
    radial-gradient(420px 180px at 85% 10%, rgba(46, 229, 157, 0.10), transparent 62%),
    rgba(12, 17, 30, 1) !important;
}

html.ios .overlay {
  background: rgba(0, 0, 0, 0.8) !important;
}

/* 6. Market-only fallback layout for iOS WKWebView:
   nested CSS Grid + overflow/filter can cause cards below the chart to not paint.
   Use a simple vertical flow to ensure all Market blocks render.
*/
html.ios .market-grid {
  display: flex !important;
  flex-direction: column !important;
}

html.ios .ios-market-stack {
  display: flex !important;
  flex-direction: column !important;
}

html.ios .market-chart,
html.ios .market-form,
html.ios .market-pairs,
html.ios .market-active {
  grid-area: auto !important;
}

html.ios .market-grid > * {
  width: 100%;
}

html.ios .ios-market-stack > * {
  width: 100%;
}

html.ios .market-grid .price.updating {
  filter: none !important;
  opacity: 1 !important;
}

/* iOS Light Theme */
html.ios[data-theme="light"] .header {
  background: rgba(246, 248, 252, 0.98) !important;
}

html.ios[data-theme="light"] .tabbar {
  background: rgba(246, 248, 252, 0.98) !important;
}

html.ios[data-theme="light"] .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(250, 252, 255, 1)) !important;
}

html.ios[data-theme="light"] .toast {
  background: rgba(255, 255, 255, 0.98) !important;
}

html.ios[data-theme="light"] .note {
  background: rgba(246, 248, 252, 0.98) !important;
}

html.ios[data-theme="light"] .sheet-card {
  background:
    radial-gradient(420px 180px at 20% 0%, rgba(138, 125, 255, 0.10), transparent 58%),
    radial-gradient(420px 180px at 85% 10%, rgba(21, 168, 104, 0.08), transparent 62%),
    rgba(255, 255, 255, 1) !important;
}
