:root{
  --bg:#070a12;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.085);
  --stroke: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.62);
  --muted2: rgba(255,255,255,.45);
  --shadow: 0 20px 80px rgba(0,0,0,.55);
  --radius: 18px;

  --a: #7c3aed;
  --b: #22d3ee;
  --c: #10b981;
  --danger:#fb7185;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, -apple-system, system-ui, Segoe UI, Roboto, Inter, Arial;
  color:var(--text);
  background: radial-gradient(1200px 700px at 20% 0%, rgba(124,58,237,.18), transparent 55%),
              radial-gradient(900px 600px at 85% 15%, rgba(34,211,238,.14), transparent 55%),
              radial-gradient(900px 700px at 50% 100%, rgba(16,185,129,.10), transparent 55%),
              var(--bg);
  overflow-x:hidden;
}

.bg{ position:fixed; inset:0; pointer-events:none; }
.grid{
  position:absolute; inset:-2px;
  background:
    linear-gradient(to right, rgba(255,255,255,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity:.06;
  mask-image: radial-gradient(closest-side at 50% 15%, black 0%, transparent 70%);
}
.orb{
  position:absolute;
  width:520px; height:520px;
  filter: blur(40px);
  opacity:.22;
  transform: translate3d(0,0,0);
  animation: float 10s ease-in-out infinite;
}
.orb1{
  left:-160px; top:-120px;
  background: radial-gradient(circle at 30% 30%, var(--a), transparent 60%);
}
.orb2{
  right:-190px; top:-140px;
  background: radial-gradient(circle at 45% 45%, var(--b), transparent 60%);
  animation-duration: 12.5s;
}
.orb3{
  left:20%; bottom:-220px;
  background: radial-gradient(circle at 45% 45%, var(--c), transparent 60%);
  animation-duration: 14.5s;
}
@keyframes float{
  0%,100%{ transform: translateY(0) translateX(0) scale(1); }
  50%{ transform: translateY(22px) translateX(10px) scale(1.03); }
}

.header{
  position:sticky; top:0; z-index:10;
  padding: 16px calc(clamp(16px, 4vw, 36px) + env(safe-area-inset-right, 0px)) 16px calc(clamp(16px, 4vw, 36px) + env(safe-area-inset-left, 0px));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display:flex; gap:14px; align-items:center; justify-content:space-between;
  backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, rgba(7,10,18,.82), rgba(7,10,18,.40));
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand{ display:flex; align-items:center; gap:12px; min-width: 220px; }
.logoWrap{ position:relative; width:44px; height:44px; }
.logo{
  width:44px; height:44px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.14);
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
  display:block;
  object-fit:cover;
}
.logoRing{
  position:absolute; inset:-3px;
  border-radius: 16px;
  background: radial-gradient(90px 60px at 20% 0%, rgba(34,211,238,.25), transparent 60%),
              radial-gradient(90px 60px at 90% 10%, rgba(124,58,237,.22), transparent 60%);
  filter: blur(8px);
  opacity:.85;
  animation: shimmer 2.6s ease-in-out infinite;
  pointer-events:none;
}
@keyframes shimmer{ 0%,100%{opacity:.55} 50%{opacity:1} }

.brandName{
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
  font-size: 13px;
}
.brandTag{
  margin-top:2px;
  color: var(--muted2);
  font-size: 12px;
}

.pillRow{ display:flex; gap:10px; align-items:center; }
.pill, .pillBtn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0,0,0,.25);
  user-select:none;
}
.pillBtn{
  cursor:pointer;
  color:var(--text);
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.pillBtn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
.pillBtn:active{ transform: translateY(0px); }

.dot{
  width:9px; height:9px; border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 0 rgba(16,185,129,.55);
  animation: pulse 1.4s infinite;
}
@keyframes pulse{
  0%{ box-shadow: 0 0 0 0 rgba(16,185,129,.55); }
  70%{ box-shadow: 0 0 0 10px rgba(16,185,129,0); }
  100%{ box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

.container{
  padding: 28px clamp(16px, 4vw, 36px) 60px;
  max-width: 1100px;
  margin: 0 auto;
}

.hero{ padding: 18px 0 22px; }
.title{
  margin: 0;
  font-size: clamp(28px, 4.6vw, 48px);
  letter-spacing: -.02em;
}
.shine{
  display:inline-block;
  background: linear-gradient(90deg, rgba(124,58,237,.95), rgba(34,211,238,.95), rgba(16,185,129,.9));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 14px 40px rgba(34,211,238,.08));
}
.subtitle{
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 70ch;
  line-height: 1.55;
}

.cards{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 16px;
  margin-top: 18px;
}

.card{
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  box-shadow: var(--shadow);
  overflow:hidden;
  transform: translateZ(0);
  animation: popIn .5s ease both;
}
@keyframes popIn{ from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:translateY(0)} }
.glass{ backdrop-filter: blur(14px); }

.cardHead{
  padding: 16px 16px 12px;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent);
}
.cardHead h2{ margin:0; font-size: 16px; letter-spacing:.01em; }
.muted{ margin:6px 0 0; color:var(--muted2); font-size: 12px; }

.form{ padding: 16px; display:grid; gap: 14px; }
.field{ display:grid; gap: 8px; }
.field span{ color: var(--muted); font-size: 12px; }

input{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  color: var(--text);
  padding: 14px 14px;
  outline:none;
  transition: border-color .2s ease, transform .12s ease, background .2s ease;
}
input:focus{
  border-color: rgba(34,211,238,.45);
  background: rgba(0,0,0,.30);
  transform: translateY(-1px);
}

.actions{ display:flex; gap:10px; flex-wrap:wrap; }

.btn{
  position:relative;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 12px 14px;
  cursor:pointer;
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
  font-weight: 700;
}
.btn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.btn:active{ transform: translateY(0px); }

.primary{
  border-color: rgba(34,211,238,.30);
  background: linear-gradient(135deg, rgba(124,58,237,.24), rgba(34,211,238,.18));
  overflow:hidden;
}
.btnGlow{
  position:absolute; inset:-2px;
  background: radial-gradient(500px 220px at 20% 0%, rgba(34,211,238,.30), transparent 65%),
              radial-gradient(500px 220px at 90% 10%, rgba(124,58,237,.26), transparent 65%);
  opacity:.9;
  filter: blur(10px);
  transform: translateZ(0);
  animation: shimmer 2.6s ease-in-out infinite;
}
.ghost{ background: rgba(0,0,0,.18); }
.tiny{ padding: 10px 12px; border-radius: 12px; font-size: 12px; }

.result{
  margin-top: 4px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.resultGrid{
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 12px;
  align-items:start;
}
.resultLabel{ color: var(--muted); font-size: 12px; }
.resultValue{
  margin-top: 6px;
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 900;
  letter-spacing: -.02em;
}
.resultMeta{ margin-top: 6px; color: var(--muted2); font-size: 12px; }

.profitBox{
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}
.profitLabel{ color: var(--muted); font-size: 12px; }
.profitValue{ margin-top: 6px; font-weight: 900; font-size: 20px; letter-spacing: -.01em; }
.profitMeta{ margin-top: 6px; color: var(--muted2); font-size: 12px; }

.history{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
  overflow:hidden;
}
.historyHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.historyTitle{ font-weight: 900; }
.historySub{ color: var(--muted2); font-size: 12px; margin-top:2px; }
.historyList{ display:grid; }
.histItem{
  padding: 10px 12px;
  display:flex;
  justify-content:space-between;
  gap: 10px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.histItem:first-child{ border-top: none; }
.histLeft{ display:grid; gap: 2px; }
.histTop{ font-weight: 800; }
.histSub{ color: var(--muted2); font-size: 12px; }
.histRight{ text-align:right; }
.histProfit{ font-weight: 900; }
.histUah{ color: var(--muted2); font-size: 12px; }

.segmented{
  display:inline-flex;
  gap:6px;
  padding: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.14);
}
.segBtn{
  width:40px; height:34px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor:pointer;
  font-weight: 900;
  transition: background .2s ease, transform .12s ease, border-color .2s ease;
}
.segBtn:hover{ transform: translateY(-1px); }
.segBtn.active{
  background: rgba(255,255,255,.10);
  border-color: rgba(255,255,255,.14);
}

.iconBtn{
  width:40px; height:40px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor:pointer;
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.iconBtn:hover{ transform: translateY(-1px); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }

.rates{ padding: 14px 16px 16px; display:grid; gap: 12px; }
.rateRow{ display:flex; align-items:center; justify-content:space-between; gap: 12px; }
.rateLeft{ display:flex; align-items:center; gap: 12px; min-width: 0; }
.currencyEmoji{
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 22px;
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.12);
}
.rateTitle{ font-weight: 800; }
.rateSub{ margin-top:2px; color: var(--muted2); font-size: 12px; }
.rateValue{ font-weight: 900; font-size: 20px; letter-spacing: -.01em; }
.divider{ height:1px; background: rgba(255,255,255,.10); }
.note{ margin-top: 4px; color: var(--muted2); font-size: 12px; }
.note2{ color: var(--muted2); font-size: 12px; }

.tip{
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
}
.tipTitle{ font-weight: 900; margin-bottom: 10px; }
.tipList{ margin: 0 0 12px 18px; color: var(--muted); line-height:1.55; }

.controlPhrase{
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.16);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.cpTitle{ color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing:.08em; text-transform: uppercase; }
.cpPhrase{ font-weight: 900; }

.footer{
  padding: 18px clamp(16px, 4vw, 36px) 26px;
  color: var(--muted2);
}
.footerInner{
  max-width: 1100px;
  margin: 0 auto;
  display:flex; gap:10px; align-items:center; justify-content:center;
}
.sep{ opacity:.5; }
.mutedSmall{ font-size: 12px; }

/* Responsive */
@media (max-width: 980px){
  .cards{ grid-template-columns: 1fr; }
}
@media (max-width: 520px){
  .pillBtn{ display:none; }
  .brandTag{ display:none; }
  .resultGrid{ grid-template-columns: 1fr; }
  .currencyEmoji{ width:40px; height:40px; }
}


/* Header: prevent overlap on small iPhones */
.brand{ min-width: 0; }
.brandText{ min-width: 0; }
.brandName{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}
.pillRow{ flex-shrink: 0; }

@media (max-width: 420px){
  .brandName{ max-width: 44vw; }
  .pill{ padding: 9px 10px; }
}
