:root {
  --bg-color: #000000;
  --card-bg: #09090b;
  --text-color: #ffffff;
  --text-muted: #a1a1aa;
  --border-color: #27272a;
  --border-hover: #3f3f46;
  --accent: #ffffff;
  --accent-text: #000000;
  --up: #34d399;
  --down: #f87171;
  --radius-lg: 16px;
  --radius-md: 12px;
}

[data-theme="light"] {
  --bg-color: #f4f4f5;
  --card-bg: #ffffff;
  --text-color: #09090b;
  --text-muted: #71717a;
  --border-color: #e4e4e7;
  --border-hover: #d4d4d8;
  --accent: #09090b;
  --accent-text: #ffffff;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  padding: 16px 16px 40px;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.5s ease, color 0.5s ease;
}

.noise-overlay { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0.03; mix-blend-mode: overlay; }

.splash { position: fixed; inset: 0; overflow: hidden; background: rgba(0,0,0,0.5); backdrop-filter: blur(26px) saturate(135%); -webkit-backdrop-filter: blur(26px) saturate(135%); z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity 0.7s ease, backdrop-filter 0.7s ease; }
.splash-aurora { position: absolute; inset: -10%; filter: blur(44px) saturate(150%); opacity: 0.5; pointer-events: none; }
.splash-aurora .blob { position: absolute; border-radius: 50%; mix-blend-mode: screen; }
.splash-aurora .b1 { width: 48vmin; height: 48vmin; background: radial-gradient(circle at 35% 35%, #34d399, transparent 70%); left: -6vmin; top: -4vmin; animation: drift1 15s ease-in-out infinite; }
.splash-aurora .b2 { width: 54vmin; height: 54vmin; background: radial-gradient(circle at 50% 50%, #6c8cff, transparent 70%); right: -12vmin; top: 18%; animation: drift2 19s ease-in-out infinite; }
.splash-aurora .b3 { width: 42vmin; height: 42vmin; background: radial-gradient(circle at 50% 50%, #b06cff, transparent 70%); left: 24%; bottom: -12vmin; animation: drift3 17s ease-in-out infinite; }
.splash-ticker-wrap { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 16vh 0; pointer-events: none; }
.splash-ticker { white-space: nowrap; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; letter-spacing: 1px; color: var(--text-muted); opacity: 0.13; will-change: transform; }
.splash-ticker.row-a { animation: tickA 24s linear infinite; }
.splash-ticker.row-b { animation: tickB 28s linear infinite; }
.splash-core { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; }
.splash-logo-chrome { font-size: 48px; font-weight: 800; letter-spacing: 4px; line-height: 1; background: linear-gradient(100deg, #9a9a9a 0%, #ffffff 22%, #8a8a8a 42%, #f2f2f2 58%, #6f6f6f 78%, #fafafa 100%); background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; animation: logoIn 0.9s cubic-bezier(.2,.7,.2,1) both, chromeSweep 3.5s linear 0.9s infinite, logoFloat 4.5s ease-in-out 0.9s infinite; }
.splash-sub { margin-top: 8px; font-size: 11px; letter-spacing: 4px; text-transform: uppercase; color: var(--text-muted); animation: fadeUp 0.6s ease 0.5s both; }
.splash-counter { margin: 20px 0 22px; font-size: 15px; font-weight: 600; color: var(--text-color); display: flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; animation: fadeUp 0.6s ease 0.7s both; }
.splash-counter .cur { font-size: 11px; font-weight: 700; color: var(--text-muted); }
.splash-counter .arrow { color: var(--accent); font-weight: 700; }
@keyframes drift1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(8vmin,6vmin) scale(1.15); } }
@keyframes drift2 { 0%,100% { transform: translate(0,0) scale(1.05); } 50% { transform: translate(-10vmin,4vmin) scale(0.9); } }
@keyframes drift3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(6vmin,-8vmin) scale(1.2); } }
@keyframes tickA { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes tickB { from { transform: translateX(-50%); } to { transform: translateX(0); } }
@keyframes chromeSweep { from { background-position: 0% 0; } to { background-position: 250% 0; } }
@keyframes logoFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes logoIn { from { opacity: 0; letter-spacing: 24px; filter: blur(14px); transform: scale(0.92); } to { opacity: 1; letter-spacing: 4px; filter: blur(0); transform: scale(1); } }
.alert-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.alert-row { display: flex; align-items: center; gap: 8px; }
.alert-row .select-wrapper { flex: 1; }
.alert-arrow { color: var(--accent); font-weight: 700; }
.alert-input { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 11px 12px; color: var(--text-color); font-size: 14px; font-weight: 600; outline: none; width: 100%; box-sizing: border-box; }
.alert-input:focus { border-color: var(--accent); }
.alert-dir { display: flex; gap: 4px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 3px; }
.alert-dir .dir-btn { flex: 1; border: none; background: transparent; color: var(--text-muted); font-size: 12px; font-weight: 600; padding: 8px 6px; border-radius: 9px; cursor: pointer; white-space: nowrap; transition: background 0.15s ease, color 0.15s ease; }
.alert-dir .dir-btn.active { background: var(--accent); color: var(--accent-text); }
.alert-note { font-size: 11px; color: var(--text-muted); line-height: 1.4; }
.alert-note.err { color: var(--down); }
[data-theme="light"] .splash { background: rgba(255,255,255,0.55); }
.splash.hidden { opacity: 0; pointer-events: none; backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
.splash-logo { width: 64px; height: 64px; border-radius: 16px; background: var(--accent); color: var(--accent-text); display: flex; align-items: center; justify-content: center; margin-bottom: 24px; animation: pulse 2s infinite ease-in-out; }
.splash-logo svg { stroke: var(--accent-text); width: 32px; height: 32px; }
.splash-title { font-size: 24px; font-weight: 700; color: var(--text-color); margin-bottom: 20px; letter-spacing: -0.5px;}
.loader { width: 48px; height: 4px; background: var(--border-color); border-radius: 4px; position: relative; overflow: hidden; }
.loader::after { content: ''; position: absolute; left: 0; top: 0; height: 100%; width: 50%; background: var(--accent); animation: loadLine 1s infinite ease-in-out alternate; border-radius: 4px;}
@keyframes loadLine { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

header { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-radius: var(--radius-lg); margin-bottom: 24px; }
.head-left h1 { display:flex; align-items:center; gap: 8px; font-size: 22px; font-weight: 700; margin: 0 0 4px; letter-spacing: -1px; color: var(--text-color);}
.head-left h1 svg { stroke: var(--text-color); flex: 0 0 auto; }
.updated { color: var(--text-muted); font-size: 12px; margin: 0; font-weight: 500; }
.head-right { display: flex; align-items: center; gap: 12px; }

.theme-btn {
  background: var(--card-bg); border: 1px solid var(--border-color); cursor: pointer; color: var(--text-color); width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s;
  position: relative; overflow: hidden;
}
.theme-btn:hover { border-color: var(--border-hover); }
.theme-btn svg { position: absolute; width: 20px; height: 20px; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease; }
.moon-icon { opacity: 1; transform: rotate(0) scale(1); }
.sun-icon { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="light"] .moon-icon { opacity: 0; transform: rotate(-90deg) scale(0.5); }
[data-theme="light"] .sun-icon { opacity: 1; transform: rotate(0) scale(1); }

.avatar {
  width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer; background: var(--accent); color: var(--accent-text); font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; background-size: cover; background-position: center; transition: transform 0.2s;
}
.avatar:active { transform: scale(0.95); }
.avatar.big { width: 64px; height: 64px; font-size: 24px; }

.tabs { display: flex; gap: 6px; margin-bottom: 24px; border-radius: var(--radius-lg); padding: 4px; background: var(--card-bg); border: 1px solid var(--border-color); }
.tab {
  flex: 1; padding: 10px 4px; border: none; border-radius: 14px; background: transparent; color: var(--text-muted); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.2s; white-space: nowrap; display:flex; align-items:center; justify-content:center; gap:6px;
}
.tab.active { background: var(--border-color); color: var(--text-color); font-weight: 600; }

.panel { display: none; }
.panel.active { display: block; animation: fadeUp 0.3s ease forwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card { border-radius: var(--radius-lg); padding: 20px; margin-bottom: 16px; background: var(--card-bg); border: 1px solid var(--border-color); transition: border-color 0.2s; }
.card:hover { border-color: var(--border-hover); }

label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin: 0 0 8px; letter-spacing: 0.5px; }
.hint { color: var(--text-muted); font-size: 12px; margin: 6px 0 0; }

.input-wrapper, .select-wrapper { position: relative; }
.search-wrap .search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--text-muted); pointer-events: none; }
.search-wrap input { padding-left: 44px; }

input {
  width: 100%; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-color); font-size: 18px; font-weight: 500; outline: none; transition: border-color 0.2s;
  -webkit-appearance: none; appearance: none;
}
input:focus { border-color: var(--text-color); }

/* CUSTOM SELECT UI */
.custom-select-ui { position: relative; width: 100%; user-select: none; }
.custom-select-display {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--border-color);
  background: var(--bg-color); color: var(--text-color); font-size: 16px; font-weight: 500; cursor: pointer;
  transition: border-color 0.2s;
}
.custom-select-display:hover, .custom-select-display.active { border-color: var(--border-hover); }
.custom-select-display.active { border-color: var(--text-color); }
.custom-select-display svg { transition: transform 0.2s; color: var(--text-muted); }
.custom-select-display.active svg { transform: rotate(180deg); color: var(--text-color); }

.custom-select-options {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0,0,0,0.5); z-index: 100; max-height: 280px; overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateY(-10px) scale(0.98); transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 8px;
}
[data-theme="light"] .custom-select-options { box-shadow: 0 10px 40px rgba(0,0,0,0.1); }
.custom-select-options.show { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.custom-select-search {
  width: 100%; padding: 11px 13px; margin-bottom: 8px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--border-color); border-radius: 8px;
  background: var(--bg-color); color: var(--text-color);
  position: sticky; top: 0; z-index: 2; -webkit-appearance: none; appearance: none;
}
.custom-select-search:focus { border-color: var(--text-color); outline: none; }
.custom-select-search::placeholder { color: var(--text-muted); }

.custom-option { padding: 12px 14px; color: var(--text-muted); cursor: pointer; transition: all 0.2s; font-size: 15px; border-radius: 8px; margin-bottom: 2px;}
.custom-option:last-child { margin-bottom: 0; }
.custom-option:hover { background: var(--bg-color); color: var(--text-color); }
.custom-option.selected { color: var(--text-color); font-weight: 600; background: var(--bg-color); }
/* Custom Scrollbar for options */
.custom-select-options::-webkit-scrollbar { width: 6px; }
.custom-select-options::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }


.row { display: flex; align-items: flex-end; gap: 12px; }
.col { flex: 1; min-width: 0; }
.swap {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: var(--radius-md); border: 1px solid var(--border-color); background: var(--bg-color); color: var(--text-color); font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.swap:active { transform: scale(0.9); }
.swap:hover { border-color: var(--border-hover); background: var(--card-bg); }

.result-row { display: flex; align-items: flex-start; justify-content: space-between; margin-top: 24px; }
.result { font-size: 36px; font-weight: 700; word-break: break-word; color: var(--text-color); letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.subrate { color: var(--text-muted); font-size: 14px; margin-top: 6px; font-weight: 500; }
.star {
  flex: 0 0 auto; background: none; border: none; color: var(--text-muted); font-size: 28px; cursor: pointer; padding: 0 0 0 12px; transition: transform 0.2s, color 0.2s;
}
.star.on { color: var(--text-color); }
.star.on svg { fill: var(--text-color); stroke: var(--text-color); }
.star:active { transform: scale(1.2); }

.chart-box { margin-top: 24px; border-top: 1px solid var(--border-color); padding-top: 16px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; }
.chart-title { display:flex; align-items:center; }
.chart-range { display: flex; gap: 6px; background: var(--bg-color); padding: 4px; border-radius: 12px; border: 1px solid var(--border-color);}
.chart-range button {
  background: none; border: none; color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer; padding: 6px 12px; border-radius: 8px; transition: all 0.2s;
}
.chart-range button.active { background: var(--card-bg); color: var(--text-color); border: 1px solid var(--border-color);}
#chart svg, #c-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-foot { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-top: 12px; }

.fav-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin: 8px 4px 12px; text-transform: uppercase; letter-spacing: 0.5px;}
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick button {
  border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-color); padding: 10px 16px; border-radius: 20px; font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.2s; 
}
.quick button:hover { border-color: var(--border-hover); }
.quick button:active { transform: scale(0.95); }

.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  display: flex; justify-content: space-between; align-items: center; background: var(--card-bg); border: 1px solid var(--border-color); padding: 16px; border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s;
}
.item:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.item .name { font-size: 16px; font-weight: 600; display: flex; align-items: center; }
.item .code { color: var(--text-muted); font-size: 13px; font-weight: 500; margin-top: 2px;}
.item .val { font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.item img { width: 28px; height: 28px; vertical-align: middle; margin-right: 12px; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.2); }
.up { color: var(--up); }
.down { color: var(--down); }
.err { color: var(--down); }

.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(7px) saturate(112%); -webkit-backdrop-filter: blur(7px) saturate(112%); opacity: 0; visibility: hidden; transition: opacity 0.45s ease, visibility 0.45s ease, backdrop-filter 0.45s ease; z-index: 10;
}
.overlay.show { opacity: 1; visibility: visible; }

.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; top: auto;
  width: 100%; max-width: 480px; margin: 0 auto;
  max-height: 92vh; z-index: 20; padding: 14px 24px calc(28px + env(safe-area-inset-bottom)); overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -18px 60px rgba(0,0,0,0.32);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.4, 0, 1, 1), visibility 0s linear 0.32s;
}
.drawer::before {
  content: ""; flex-shrink: 0; align-self: center;
  width: 42px; height: 5px; border-radius: 99px;
  background: var(--border-hover); margin-bottom: 20px;
}
.drawer > * { flex-shrink: 0; }
.drawer.show {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s;
}
@media (prefers-reduced-motion: reduce) {
  .drawer { transition: opacity 0.2s ease; transform: none; }
}
.drawer-head { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--border-color); }
.uname { font-size: 18px; font-weight: 600; letter-spacing: -0.5px;}
.uhint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.drawer-title { font-size: 16px; font-weight: 600; margin: 30px 0 16px; display:flex; align-items:center; }

.wbtn {
  width: 100%; padding: 16px; border: 1px solid var(--border-color); border-radius: var(--radius-md); background: var(--bg-color); color: var(--text-color); font-size: 16px; font-weight: 500; cursor: pointer; transition: all 0.2s;
}
.wbtn:hover { border-color: var(--border-hover); }
.wbtn:active { transform: scale(0.98); }
.wbtn.primary { background: var(--accent); color: var(--accent-text); margin-top: auto; border: none; font-weight: 600; }
.wbtn.primary:hover { opacity: 0.9; }

.fav-manage { display: flex; flex-direction: column; gap: 8px; }
.fav-manage .frow {
  display: flex; justify-content: space-between; align-items: center; background: var(--bg-color); padding: 14px 16px; border-radius: var(--radius-md); font-size: 15px; font-weight: 500; border: 1px solid var(--border-color);
}
.fav-manage .frow button { background: none; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; transition: color 0.2s; }
.fav-manage .frow button:hover { color: var(--down); }
.fav-manage .empty { color: var(--text-muted); font-size: 14px; text-align: center; padding: 20px; border: 1px dashed var(--border-color); border-radius: var(--radius-md);}

.modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -45%) scale(0.95); width: 90%; max-width: 440px; border-radius: var(--radius-lg); padding: 24px; z-index: 20; opacity: 0; visibility: hidden; transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--card-bg); border: 1px solid var(--border-color); box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}
.modal.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.modal-head { display: flex; justify-content: space-between; align-items: center; font-size: 18px; font-weight: 600; margin-bottom: 16px; letter-spacing: -0.5px;}
.modal-head button { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; transition: color 0.2s; }
.modal-head button:hover { color: var(--text-color); }

/* Interactive chart tooltip */
#chart, #c-chart { position: relative; touch-action: pan-y; }
.ch-cross, .ch-dot { transition: opacity 0.15s ease; pointer-events: none; }
.ch-tip {
  position: absolute; top: -6px; pointer-events: none; z-index: 5;
  background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 10px;
  padding: 7px 11px; font-size: 13px; font-weight: 700; color: var(--text-color);
  white-space: nowrap; transition: opacity 0.15s ease; box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  font-variant-numeric: tabular-nums; letter-spacing: -0.2px;
}
[data-theme="light"] .ch-tip { box-shadow: 0 6px 20px rgba(0,0,0,0.12); }
.ch-tip-d { display: block; color: var(--text-muted); font-size: 11px; font-weight: 500; margin-bottom: 2px; letter-spacing: 0.2px; }


/* --- BOOT SPLASH (liquid dots) --- */
#splash.boot-splash {
  background: #000 !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
  align-items: center; justify-content: center;
}
.boot-body { display: flex; flex-direction: column; align-items: center; }
.boot-title {
  font-size: clamp(32px, 9vw, 46px); font-weight: 800; letter-spacing: 5px; margin: 0 0 8px;
  background: linear-gradient(90deg, #ffffff 0%, #52525b 50%, #ffffff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  animation: bootShimmer 2.2s ease-in-out infinite;
}
@keyframes bootShimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.boot-sub {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; letter-spacing: 3px; color: #55555d; margin: 0 0 30px;
}
.boot-sub .hl { color: #ffffff; font-weight: 700; }
.boot-dots { display: flex; gap: 14px; }
.boot-dots span {
  position: relative; width: 15px; height: 15px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%; overflow: hidden;
  box-shadow: inset 0 0 5px rgba(0,0,0,0.5);
}
.boot-dots span::after {
  content: ''; position: absolute; width: 200%; height: 200%;
  background: #34d399; left: -50%; top: 100%; border-radius: 40%;
  animation: bootWave 2s infinite linear;
  transition: top 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.boot-dots span.filled { border-color: rgba(52,211,153,0.6); box-shadow: 0 0 8px rgba(52,211,153,0.5); }
.boot-dots span.filled::after { top: -20%; }
@keyframes bootWave { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }


/* --- alert current rate --- */
.alert-rate { font-size: 12.5px; color: var(--text-muted); text-align: center; margin: 2px 0 0; line-height: 1.4; }
.alert-rate b { color: var(--accent); font-weight: 700; }
.alert-rate.tap { cursor: pointer; }
.alert-rate.tap:active { opacity: .6; }

/* --- app reveal animation --- */
body.booting header, body.booting nav.tabs, body.booting main { opacity: 0; }
body.revealed header { animation: appReveal .55s cubic-bezier(.2,.8,.2,1) both; }
body.revealed nav.tabs { animation: appReveal .55s cubic-bezier(.2,.8,.2,1) .08s both; }
body.revealed main { animation: appReveal .62s cubic-bezier(.2,.8,.2,1) .16s both; }
@keyframes appReveal { from { opacity: 0; transform: translateY(16px); filter: blur(7px); } to { opacity: 1; transform: translateY(0); filter: blur(0); } }
@media (prefers-reduced-motion: reduce) {
  body.revealed header, body.revealed nav.tabs, body.revealed main { animation: none; }
  body.booting header, body.booting nav.tabs, body.booting main { opacity: 1; }
}


/* --- compact favorite rows with live rate --- */
.fav-manage { gap: 6px; }
.fav-manage .frow { padding: 9px 12px; font-size: 14px; cursor: pointer; }
.fav-manage .frow:active { background: var(--card-bg); }
.frow-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.frow-pair { font-size: 14px; font-weight: 600; }
.frow-rate { font-size: 11.5px; font-weight: 500; color: var(--text-muted); }
.fav-manage .frow .frow-del { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; display: inline-flex; flex-shrink: 0; }
.fav-manage .frow .frow-del:active { color: var(--down); }

/* --- spinner (replaces hourglass emoji) --- */
.loading { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 14px; justify-content: center; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--border-color); border-top-color: var(--accent); display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chart-foot.loading { justify-content: center; }


/* --- liquid-glass header island --- */
header {
  position: sticky; top: 8px; z-index: 30;
  background: rgba(20,20,22,0.55);
  backdrop-filter: blur(22px) saturate(170%);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 34px rgba(0,0,0,0.40), inset 0 1px 0 rgba(255,255,255,0.07);
  padding: 12px 18px; border-radius: 22px; margin: 8px 0 22px;
}
[data-theme="light"] header {
  background: rgba(255,255,255,0.6);
  border-color: rgba(0,0,0,0.06);
  box-shadow: 0 10px 34px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.6);
}

/* --- splash bottom caption --- */
.boot-foot { position: absolute; bottom: calc(26px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 11px; letter-spacing: 1px; color: #45454d; font-family: ui-monospace, "SF Mono", Menlo, monospace; }

/* --- settings version --- */
.drawer-version { text-align: center; font-size: 11px; color: var(--text-muted); opacity: 0.45; margin-top: 14px; letter-spacing: 0.5px; }

/* --- quick favorites with numbers --- */
.quick { display: flex; flex-wrap: wrap; gap: 8px; }
.quick .qbtn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 12px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-md); cursor: pointer; transition: all 0.2s; }
.quick .qbtn:hover { border-color: var(--border-hover); }
.quick .qbtn:active { transform: scale(0.96); }
.q-pair { font-size: 13px; font-weight: 600; color: var(--text-color); }
.q-rate { font-size: 11px; font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* --- favorites two-column grid + round pager --- */
.fav-manage { position: relative; }
.fav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.fav-manage.has-next .fav-grid { padding-right: 30px; }
.fav-grid .frow { padding: 8px 10px; }
.fav-grid .frow-pair { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-grid .frow-rate { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-grid .frow-del { padding: 2px; }
.fav-next { position: absolute; right: -2px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-text); border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.35); transition: transform 0.15s ease; z-index: 2; }
.fav-next:active { transform: translateY(-50%) scale(0.88); }

/* --- drawer drag / lock background scroll --- */
body.noscroll { overflow: hidden; }
.drawer { touch-action: pan-y; }
