/* Loan Meme app — same palette, type and button language as the landing page (css/style.css). */
* { margin: 0; box-sizing: border-box; }
:root {
  --bg: #000;
  --fg: #fff;
  --muted: #8a8f98;
  --line: rgba(255, 255, 255, 0.12);
  --card: rgba(8, 10, 14, 0.72);
  --green: #b7f516;
  --green-dark: #073b21;
  --red: #ff5d5d;
  --amber: #ffcc4d;
}
html, body { background: var(--bg); color: var(--fg); font-family: "Comfortaa", cursive; font-size: 15px; line-height: 1.6; }
body { min-height: 100vh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font-family: inherit; }
[hidden] { display: none !important; }
.mono { font-family: "Roboto", monospace; font-size: 12px; letter-spacing: 0.02em; word-break: break-all; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.fine { font-size: 11px; color: var(--muted); letter-spacing: 0.03em; line-height: 1.7; margin-top: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

/* ---- backgrounds: the landing page textures, slowly drifting ---- */
.bg-pattern {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background: url("../assets/textures/pattern.webp") repeat; background-size: 384px 64px;
  opacity: 0.045; animation: drift 90s linear infinite;
}
.bg-noise {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url("../assets/textures/noise.webp") repeat; background-size: 256px 256px;
  opacity: 0.06; mix-blend-mode: screen;
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% -10%, rgba(183, 245, 22, 0.10), transparent 55%),
    radial-gradient(ellipse at 50% 110%, rgba(53, 86, 107, 0.35), transparent 60%);
}
@keyframes drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-384px, -64px, 0); } }

/* ---- loading overlay, identical to the landing page ---- */
.loading { position: fixed; inset: 0; background: #000; z-index: 100; display: flex; justify-content: center; align-items: center; transition: opacity 0.5s; }
.loading[data-visible="false"] { opacity: 0; pointer-events: none; }
.loading-logo { width: 30%; max-width: 200px; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 6%; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: "Jura", sans-serif; letter-spacing: 0.35em; font-size: 12px; }
.brand img { width: 40px; height: auto; }
.nav { display: flex; gap: 26px; font-family: "Jura", sans-serif; font-size: 12px; letter-spacing: 0.25em; text-transform: uppercase; }
.nav a { text-decoration: none; opacity: 0.75; transition: opacity 0.3s; }
.nav a:hover { opacity: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.chain-pill { font-family: "Jura", sans-serif; font-size: 10px; letter-spacing: 0.2em; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.chain-pill::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #555; margin-right: 8px; vertical-align: 1px; }
.chain-pill[data-state="ok"] { color: var(--fg); }
.chain-pill[data-state="ok"]::before { background: var(--green); box-shadow: 0 0 10px var(--green); }
.chain-pill[data-state="wrong"] { color: var(--amber); border-color: var(--amber); }
.chain-pill[data-state="wrong"]::before { background: var(--amber); }

/* ---- the landing page's green 3D button ---- */
.btn-green {
  display: inline-flex; align-items: center; justify-content: center; min-width: 130px; height: 46px; padding: 0 28px; border: 0; border-radius: 12px;
  background: var(--green); color: var(--green-dark); font-family: "Comfortaa", cursive; font-size: 14px; font-weight: 700; letter-spacing: 0.05em; text-decoration: none; white-space: nowrap; cursor: pointer;
  box-shadow: inset 0 0 0 2px #dbff77, inset 0 -4px 0 #79ca1c, 0 5px 0 #168d52, 0 9px 0 #064d2b;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.3s;
}
.btn-green:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 2px #dbff77, inset 0 -4px 0 #79ca1c, 0 7px 0 #168d52, 0 11px 0 #064d2b; }
.btn-green:active { transform: translateY(4px); box-shadow: inset 0 0 0 2px #dbff77, inset 0 -3px 0 #79ca1c, 0 1px 0 #168d52, 0 4px 0 #064d2b; }
.btn-green:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-green:focus-visible { outline: 2px solid #fff; outline-offset: 6px; }
.btn-green.wide { width: 100%; margin-top: 18px; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; height: 46px; padding: 0 24px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent; color: var(--fg); font-family: "Jura", sans-serif; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none; cursor: pointer; transition: border-color 0.3s, transform 0.15s;
}
.btn-ghost:hover { border-color: #fff; transform: translateY(-2px); }
.btn-ghost.sm { height: 34px; padding: 0 14px; font-size: 10px; }
.link { background: none; border: 0; color: var(--green); font-family: "Jura", sans-serif; font-size: 11px; letter-spacing: 0.2em; cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }

/* ---- layout ---- */
.app { position: relative; z-index: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 6% 80px; overflow-x: clip; }
/* Grid and flex children must be allowed to shrink below their content width, or long addresses push the page wider than the phone. */
.hero > *, .hero-text > *, .stats > *, .trade-grid > *, .account-grid > *, .kv > *, .market > *, .panel-head > *, .topbar > * { min-width: 0; }
.mono, .kv > span:last-child { overflow-wrap: anywhere; }
.hero { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 30px; align-items: center; padding: 70px 0 40px; min-height: 52vh; }
.eyebrow { font-family: "Jura", sans-serif; font-size: 11px; letter-spacing: 0.45em; color: var(--green); margin-bottom: 18px; }
.hero-head { font-family: "Roboto Serif", serif; font-weight: 200; font-size: clamp(30px, 4.2vw, 56px); line-height: 1.15; margin-bottom: 20px; }
.hero-sub { max-width: 560px; color: rgba(255, 255, 255, 0.72); font-size: 14px; line-height: 1.9; margin-bottom: 28px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-side { position: relative; display: flex; align-items: center; justify-content: center; gap: 24px; min-height: 260px; }
/* Melo, cropped straight out of the landing page's texture atlas (assets/textures/display.webp). */
.mascot { position: relative; width: 210px; height: 240px; overflow: hidden; border-radius: 50% 50% 45% 45%; background: #fff; box-shadow: 0 0 60px rgba(183, 245, 22, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.4); animation: float 5s ease-in-out infinite; }
.mascot img { position: absolute; width: 1024px; height: 1024px; left: -162px; top: -775px; max-width: none; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.vertical-accent { writing-mode: vertical-rl; font-family: "Noto Sans JP", "Noto Sans", sans-serif; font-size: 15px; letter-spacing: 0.35em; color: rgba(255, 255, 255, 0.55); }
.vertical-accent span { padding: 10px 0; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 10px 0 30px; }
.stat { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 18px 20px; backdrop-filter: blur(8px); animation: rise 0.7s ease both; }
.stat:nth-child(2) { animation-delay: 0.08s; } .stat:nth-child(3) { animation-delay: 0.16s; } .stat:nth-child(4) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.stat-label { font-family: "Jura", sans-serif; font-size: 10px; letter-spacing: 0.35em; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-family: "Roboto Serif", serif; font-weight: 200; font-size: 28px; line-height: 1.1; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 6px; }

.notice { border: 1px solid var(--amber); color: var(--amber); border-radius: 12px; padding: 12px 16px; font-size: 12px; margin-bottom: 20px; }

.panel { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 26px 28px; margin-bottom: 22px; backdrop-filter: blur(8px); scroll-margin-top: 90px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.panel h2 { font-family: "Roboto Serif", serif; font-weight: 200; font-size: 26px; }
.tabs { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.tab { background: transparent; border: 0; color: var(--muted); padding: 6px 18px; border-radius: 999px; font-family: "Jura", sans-serif; letter-spacing: 0.2em; font-size: 11px; text-transform: uppercase; cursor: pointer; }
.tab[aria-selected="true"] { background: #fff; color: #000; }

.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.field { display: block; margin-bottom: 8px; }
.field-label { display: flex; justify-content: space-between; align-items: center; font-family: "Jura", sans-serif; font-size: 11px; letter-spacing: 0.25em; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; }
.field input { width: 100%; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 12px; color: #fff; font-family: "Roboto Serif", serif; font-weight: 200; font-size: 26px; padding: 12px 14px; outline: none; transition: border-color 0.3s; }
.field input:focus { border-color: rgba(183, 245, 22, 0.6); }
.field input[readonly] { color: rgba(255, 255, 255, 0.7); }
.field-hint { display: block; font-size: 11px; color: var(--muted); margin-top: 6px; min-height: 16px; }
.arrow-down { text-align: center; color: var(--muted); font-size: 18px; margin: 2px 0 8px; }
.inline-input { width: 44px; background: transparent; border: 0; border-bottom: 1px solid var(--line); color: #fff; text-align: right; font-family: inherit; font-size: 12px; outline: none; }
.trade-info { border-left: 1px solid var(--line); padding-left: 30px; }
.kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.08); font-size: 12px; }
.kv > span:first-child { font-family: "Jura", sans-serif; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); font-size: 10px; padding-top: 3px; white-space: nowrap; }
.kv > span:last-child { text-align: right; }
.kv.big { flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kv.big > span:last-child { text-align: left; font-family: "Roboto Serif", serif; font-weight: 200; font-size: 24px; }

.market-list { display: grid; gap: 14px; }
.market { display: grid; grid-template-columns: 1.1fr repeat(4, 1fr) auto; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; background: rgba(255, 255, 255, 0.02); animation: rise 0.6s ease both; }
.market-name { display: flex; align-items: center; gap: 12px; }
.market-icon { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: "Jura", sans-serif; font-size: 11px; letter-spacing: 0.05em; border: 1px solid var(--line); background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.02)); }
.market-icon.loan { background: url("../assets/lm_logo2.webp") center / 80% no-repeat, #000; }
.market-symbol { font-family: "Jura", sans-serif; letter-spacing: 0.2em; font-size: 13px; }
.market-flags { font-size: 10px; color: var(--muted); letter-spacing: 0.1em; }
.cell-label { font-family: "Jura", sans-serif; font-size: 9px; letter-spacing: 0.3em; color: var(--muted); text-transform: uppercase; }
.cell-value { font-family: "Roboto Serif", serif; font-weight: 200; font-size: 20px; line-height: 1.2; }
.cell-sub { font-size: 11px; color: var(--muted); }
.apr-supply { color: var(--green); }
.market-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.account-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.health-bar { height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.health-fill { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--red), var(--amber), var(--green)); transition: width 0.8s ease; }

.app-footer { display: flex; justify-content: space-between; margin-top: 40px; font-family: "Roboto", sans-serif; font-size: 9px; letter-spacing: 0.2em; color: #777; }
.app-footer a { color: #999; text-decoration: none; margin-left: 14px; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: 100%; max-width: 440px; border: 1px solid var(--line); border-radius: 20px; background: #05070a; padding: 24px; animation: rise 0.35s ease both; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h3 { font-family: "Roboto Serif", serif; font-weight: 200; font-size: 24px; }
.modal-info { font-size: 12px; color: var(--muted); line-height: 1.8; }

/* ---- toasts, with the landing page's rotating ring as the spinner ---- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 7, 10, 0.95); padding: 12px 14px; font-size: 12px; animation: rise 0.3s ease both; }
.toast a { color: var(--green); }
.toast[data-kind="error"] { border-color: var(--red); }
.toast[data-kind="success"] { border-color: var(--green); }
.ring { position: relative; width: 26px; height: 26px; flex: none; }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: scrollRotate 2s infinite linear; }
@keyframes scrollRotate { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* ---- responsive ---- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 40px; min-height: 0; }
  .hero-side { min-height: 0; justify-content: flex-start; }
  .mascot { transform: scale(0.7); transform-origin: left center; margin-right: -60px; animation: none; }
  .stats, .account-grid { grid-template-columns: repeat(2, 1fr); }
  .trade-grid { grid-template-columns: 1fr; }
  .trade-info { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 20px; }
  .market { grid-template-columns: 1fr 1fr; }
  .market-name { grid-column: 1 / -1; }
  .market-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .nav { display: none; }
}
@media (max-width: 520px) {
  .app { padding: 0 16px 60px; }
  .topbar { padding: 12px 16px; }
  .brand span { display: none; }
  .chain-pill { font-size: 0; padding: 6px 4px 6px 12px; }
  .chain-pill::before { margin-right: 0; }
  .btn-green { min-width: 0; padding: 0 18px; }
  .hero-side { gap: 14px; }
  .vertical-accent { font-size: 13px; }
  .stats, .account-grid { grid-template-columns: 1fr; }
  .panel { padding: 20px 16px; }
  .stat-value { font-size: 24px; }
}
