:root {
  color-scheme: dark;
  --bg: #070b16;
  --surface: rgba(18, 25, 47, .88);
  --surface-strong: #121a31;
  --line: rgba(151, 170, 230, .17);
  --text: #f7f8ff;
  --muted: #9ca9c9;
  --blue: #6f91ff;
  --violet: #9b6cff;
  --green: #47d7a1;
  --shadow: 0 28px 80px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -15%, rgba(76, 116, 225, .33), transparent 37%),
    linear-gradient(180deg, #0d1428 0%, var(--bg) 44%, #070a12 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
body.gated { overflow: hidden; }

.access-gate {
  position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 18px;
  background: rgba(4, 8, 18, .88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: opacity .25s ease, visibility .25s ease;
}
.access-gate.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.access-card {
  width: min(100%, 470px); border-radius: 30px; padding: 28px; text-align: center;
  background: linear-gradient(160deg, rgba(24,34,63,.98), rgba(11,16,31,.98));
  border: 1px solid rgba(151,170,230,.22); box-shadow: 0 30px 100px rgba(0,0,0,.58);
}
.access-logo {
  width: 70px; height: 70px; margin: 0 auto 18px; display: grid; place-items: center; position: relative;
  border-radius: 23px; color: white; font-size: 35px; font-weight: 800;
  background: linear-gradient(145deg, rgba(111,145,255,.3), rgba(155,108,255,.25)); border: 1px solid rgba(164,178,255,.25);
}
.access-logo span { position: absolute; right: 7px; bottom: 8px; color: #aab8ff; font-size: 13px; }
.access-card h2 { margin: 6px 0 10px; font-size: clamp(25px,7vw,34px); letter-spacing: -.04em; }
.access-copy { margin: 0 auto 22px; max-width: 370px; color: #9eabc9; font-size: 13px; line-height: 1.55; }
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; text-align: left; }
.name-grid label { color: #bdc7e1; font-size: 11px; font-weight: 750; }
.name-grid input {
  width: 100%; margin-top: 7px; border: 1px solid rgba(151,170,230,.2); border-radius: 14px; outline: 0;
  background: rgba(4,9,21,.55); color: white; padding: 14px 13px; font-size: 15px;
}
.name-grid input:focus { border-color: #7694ff; box-shadow: 0 0 0 3px rgba(111,145,255,.12); }
.form-error { min-height: 18px; margin: 8px 0 2px; color: #ff91a0; font-size: 11px; }
.access-submit { width: 100%; min-height: 54px; border: 0; border-radius: 16px; font-weight: 800; cursor: pointer; }
.access-submit:disabled { opacity: .6; cursor: wait; }
.privacy-note { display: block; margin: 14px auto 0; max-width: 360px; color: #697591; font-size: 9.5px; line-height: 1.5; }

.ambient { position: fixed; border-radius: 50%; filter: blur(90px); opacity: .18; pointer-events: none; }
.ambient-one { width: 260px; height: 260px; background: #306cff; top: 18%; left: -180px; }
.ambient-two { width: 280px; height: 280px; background: #9e50ff; bottom: 4%; right: -210px; }

.app-shell {
  width: min(100%, 540px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
  position: relative;
  z-index: 1;
}

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.user-strip {
  margin: -10px 0 15px; padding: 8px 10px; display: flex; align-items: center; gap: 8px; border-radius: 14px;
  color: #919fbe; background: rgba(18,25,47,.58); border: 1px solid rgba(151,170,230,.11); font-size: 10.5px;
}
.user-strip[hidden] { display: none; }
.user-strip b { color: #d7def2; }
.user-avatar { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: white; background: linear-gradient(135deg,#6387f5,#8c61e9); font-weight: 800; }
.user-strip button { margin-left: auto; border: 0; background: transparent; color: #9fb0ff; font-size: 10.5px; cursor: pointer; }
.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }
.brand-mark {
  width: 59px; height: 59px; flex: 0 0 59px; display: grid; place-items: center; position: relative;
  border-radius: 19px; background: linear-gradient(145deg, rgba(111,145,255,.23), rgba(155,108,255,.2));
  border: 1px solid rgba(164, 178, 255, .22); box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
.brand-mark span { font-size: 30px; font-weight: 800; transform: translate(-6px, -4px); }
.brand-mark b { position: absolute; right: 6px; bottom: 7px; color: #9fb1ff; font-size: 13px; }
.eyebrow { margin: 0 0 4px; color: #9ba9ce; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; }
h1 { margin: 0; font-size: clamp(21px, 6vw, 29px); line-height: 1.05; letter-spacing: -.04em; }
h1 span { color: #98aaff; }
.icon-button {
  width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border: 1px solid var(--line);
  border-radius: 16px; color: #dbe2ff; background: rgba(20, 27, 49, .82); cursor: pointer;
}
.icon-button svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.loading svg { animation: spin .8s linear infinite; }

.rate-card, .converter-card, .info-card {
  border: 1px solid var(--line); background: var(--surface); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}
.rate-card { border-radius: 24px; padding: 18px; margin-bottom: 14px; }
.rate-heading, .rate-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rate-heading { color: #aab5d4; font-size: 12px; font-weight: 650; }
.rate-heading > div { display: flex; align-items: center; gap: 8px; }
.rate-heading a { color: #aabaff; text-decoration: none; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(71,215,161,.1); }
.rate-card.stale .live-dot { background: #f7b84b; box-shadow: 0 0 0 5px rgba(247,184,75,.1); }
.rate-card.error .live-dot { background: #ff6b7a; box-shadow: 0 0 0 5px rgba(255,107,122,.1); }
.rate-value { display: flex; align-items: baseline; justify-content: center; gap: 9px; padding: 20px 0 15px; }
.rate-value span { color: #a9b4d0; font-weight: 700; font-size: 15px; }
.rate-value strong { font-size: clamp(32px, 10vw, 47px); letter-spacing: -.055em; }
.rate-meta { padding-top: 13px; border-top: 1px solid var(--line); color: #7f8cac; font-size: 10.5px; }

.converter-card { border-radius: 28px; padding: 9px 19px 19px; position: relative; }
.currency-row { display: grid; grid-template-columns: minmax(120px, .85fr) minmax(0, 1.25fr); gap: 12px; align-items: center; min-height: 112px; }
.currency-row + .currency-row { border-top: 1px solid var(--line); }
.currency-row label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.currency-row label > span:last-child { display: flex; flex-direction: column; gap: 3px; }
.currency-row label b { font-size: 15px; }
.currency-row label small { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.currency-symbol {
  width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 13px;
  color: #dce4ff; background: rgba(101, 133, 255, .14); border: 1px solid rgba(117, 148, 255, .18); font-size: 20px; font-weight: 800;
}
.bs-symbol { font-size: 13px; background: rgba(155,108,255,.13); border-color: rgba(155,108,255,.2); }
.amount-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 37px; align-items: center; gap: 3px; border-bottom: 2px solid rgba(115, 145, 255, .65); }
.amount-wrap input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: #fff; text-align: right; font-size: clamp(25px, 8vw, 35px); letter-spacing: -.04em; padding: 14px 2px 11px; }
.amount-wrap input:focus { color: #aebdff; }
.copy-button { height: 38px; border: 0; background: transparent; color: #7885a5; font-size: 22px; cursor: pointer; }
.swap-button {
  position: absolute; z-index: 2; left: 50%; top: 104px; transform: translate(-50%, -50%); width: 43px; height: 43px;
  display: grid; place-items: center; border-radius: 14px; border: 1px solid rgba(138,160,235,.26); color: #cdd7ff;
  background: #17203b; box-shadow: 0 8px 25px rgba(0,0,0,.32); cursor: pointer;
}
.swap-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.actions { display: grid; grid-template-columns: 1.25fr .85fr; gap: 10px; padding-top: 13px; }
.actions button { min-height: 52px; border-radius: 16px; border: 0; font-weight: 800; cursor: pointer; }
.primary-action { color: white; background: linear-gradient(135deg, #6284f4, #8a5ee8); box-shadow: 0 12px 28px rgba(94, 113, 233, .25); }
.secondary-action { color: #c2cbe5; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.06) !important; }
.log-status { min-height: 15px; margin: 10px 2px -5px; text-align: center; color: #70dcb3; font-size: 10.5px; }
.log-status.error { color: #ff91a0; }

.info-card { margin-top: 14px; border-radius: 20px; padding: 15px; display: flex; gap: 11px; align-items: flex-start; box-shadow: none; }
.info-icon { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; display: grid; place-items: center; color: #aebdff; background: rgba(109,140,255,.13); font: 700 13px Georgia, serif; }
.info-card p { margin: 1px 0 0; color: #8f9bb9; font-size: 11.5px; line-height: 1.55; }
.info-card b { color: #cbd4ed; }
.footer-note { margin: 18px 0 0; text-align: center; color: #59647f; font-size: 10.5px; }
.toast {
  position: fixed; z-index: 20; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translate(-50%, 24px);
  padding: 11px 17px; border-radius: 14px; background: #eef1ff; color: #10162a; font-size: 12px; font-weight: 800;
  box-shadow: 0 12px 36px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: .22s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 370px) {
  .app-shell { padding-left: 12px; padding-right: 12px; }
  .brand-mark { width: 52px; height: 52px; flex-basis: 52px; }
  .currency-row { grid-template-columns: 112px minmax(0, 1fr); }
  .currency-symbol { width: 36px; height: 36px; flex-basis: 36px; }
  .currency-row label { gap: 7px; }
}
@media (max-width: 430px) {
  .access-card { padding: 24px 18px; }
  .name-grid { grid-template-columns: 1fr; }
}
@media (min-width: 700px) {
  .app-shell { padding-top: 44px; }
  .converter-card { padding-left: 26px; padding-right: 26px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
