/* MEMO app v2. Dark, quiet, card-based (after the xDEX look). */
:root {
  --bg: #000;
  --panel: #111113;
  --field: #1a1a1d;
  --raised: #222226;
  --raised-2: #2c2c31;
  --edge: #1e1f22;
  --t1: #f4f4f5;
  --t2: #a1a1a6;
  --t3: #6b6b72;
  --t4: #3d3d43;
  --accent: #ffde59;      /* MEMO logo yellow */
  --accent-2: #ff9b9b;    /* MEMO logo pink */
  --negative: #ff3355;
  --warning: #f5b544;
  --r-panel: 16px;
  --r-card: 20px;
  --r-field: 12px;
  --r-control: 10px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--t1);
  font-family: Geist, Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--t1); }
button, select, textarea { font: inherit; color: inherit; }

/* Layout */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px;
  flex-shrink: 0;
  border-right: 1px solid var(--edge);
  padding: 20px 8px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 24px; font-size: 20px; font-weight: 600; letter-spacing: 0.02em; }
.brand img { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { margin-top: 3px; font-size: 11px; font-weight: 400; letter-spacing: 0.01em; color: var(--t3); white-space: nowrap; }
.brand-mobile { display: none; padding: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-control);
  color: var(--t2);
  text-decoration: none;
  font-size: 14px;
}
.nav-item.active, .nav-item:hover { background: var(--raised); color: var(--t1); }
.nav-icon { width: 16px; text-align: center; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--edge);
}
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 24px 48px; }

/* Controls */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-control);
  cursor: pointer;
}
.pill:hover { background: var(--raised); }
.network-select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, var(--t2) 50%), linear-gradient(135deg, var(--t2) 50%, transparent 50%); background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px; background-size: 5px 5px; background-repeat: no-repeat; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.btn-primary {
  border: 0;
  border-radius: var(--r-field);
  background: var(--t1);
  color: #000;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-primary:active:not(:disabled) { transform: scale(0.99); }
.btn-primary:disabled { background: var(--raised-2); color: var(--t3); cursor: not-allowed; }
.btn-small { height: 36px; padding: 0 14px; border-radius: var(--r-control); }
.btn-wide { width: 100%; height: 52px; font-size: 16px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-control);
  background: var(--raised);
  color: var(--t1);
  text-decoration: none;
  cursor: pointer;
}
.btn-secondary:hover { background: var(--raised-2); }

.icon-btn { border: 0; background: none; color: var(--t2); cursor: pointer; font-size: 16px; }

/* Hero */
.hero { margin-bottom: 28px; }
.hero-logo { width: 56px; height: 56px; margin-bottom: 14px; }
.hero h1 { margin: 0 0 8px; font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }
.motto span { white-space: nowrap; }
.motto b { color: var(--accent); font-weight: 700; }
.hero p { margin: 0; max-width: 640px; color: var(--t2); font-size: 15px; }

/* Panels */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 16px; align-items: start; }

.panel { background: var(--panel); border-radius: var(--r-panel); padding: 20px; }
.panel-label { color: var(--t2); font-size: 13px; margin-bottom: 6px; }
.panel-note { margin: 12px 0 0; color: var(--t3); font-size: 12px; }

.big-number { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.unit { color: var(--t2); margin-left: 6px; font-size: 14px; }
.accent { color: var(--accent); }

/* Supply panel */
.supply-loading { color: var(--t3); padding: 120px 0; text-align: center; }
.supply-sub { color: var(--t2); font-size: 13px; margin: 2px 0 18px; }

.curve-chart svg { display: block; width: 100%; height: auto; color: var(--accent); }
.curve-svg .c-grid { stroke: var(--edge); stroke-width: 1; }
.curve-svg .c-area { fill: var(--t1); opacity: 0.03; }
.curve-svg .c-line { fill: none; stroke: var(--t4); stroke-width: 2; stroke-linejoin: round; }
.curve-svg .c-line-mined { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.curve-svg .c-marker { stroke: var(--t1); stroke-width: 1; stroke-dasharray: 3 4; opacity: 0.5; }
.curve-svg .c-dot { fill: var(--accent); stroke: var(--panel); stroke-width: 3; }

.stage-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 8px; }
.stage { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 8px; text-align: center; min-width: 0; }
.stage-range { color: var(--t2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.stage-reward { display: flex; flex-direction: column; align-items: center; color: var(--t3); font-size: 11px; line-height: 1.35; font-family: "Geist Mono", ui-monospace, monospace; white-space: nowrap; }
.stage.current { background: var(--raised); }
.stage.current .stage-range { color: var(--t1); }
.stage.current .stage-reward { color: var(--accent); }

/* Emission table */
.mono { font-family: "Geist Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.emission { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--edge); }
.emission-title { margin: 0 0 8px; font-size: 15px; font-weight: 500; }
.emission-rules { margin: 0 0 16px; padding-left: 18px; color: var(--t2); font-size: 13px; }
.emission-rules li { margin: 4px 0; }

.emission-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.emission-table th { text-align: left; color: var(--t3); font-weight: 400; font-size: 12px; padding: 0 10px 8px; }
.emission-table td { padding: 10px; border-top: 1px solid var(--edge); }
.stage-tr { cursor: pointer; transition: background 0.15s var(--ease); }
.stage-tr:hover { background: var(--field); }
.stage-tr.past { color: var(--t3); }
.stage-tr.now { background: var(--raised); }
.stage-tr.now .mono { color: var(--accent); }
.stage-tr.open:not(.now) { background: var(--field); }
.col-stage { color: var(--t3); width: 48px; }
.col-step { color: var(--t2); }
.col-toggle { width: 24px; color: var(--t3); text-align: right; }
.now-badge { margin-left: 8px; padding: 1px 6px; border-radius: 6px; background: var(--accent); color: #000; font-size: 11px; font-weight: 500; }

.steps-tr td { padding: 0 10px 12px; border-top: 0; background: var(--field); }
.steps-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-top: 10px; }
.step-cell { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 8px; background: var(--panel); font-size: 12px; }
.step-range { color: var(--t2); white-space: nowrap; }
.step-cell.past { opacity: 0.45; }
.step-cell.now { outline: 1px solid var(--accent); }
.step-cell.now .step-reward { color: var(--accent); }

/* Right column: mint card, then TPM */
.side-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* TPM */
.tpm-empty { color: var(--t3); padding: 40px 0; text-align: center; }
.tpm-chart svg { display: block; width: 100%; height: auto; }
.tpm-svg .t-bar { fill: var(--accent); }
.tpm-svg .t-bar:hover { fill: var(--accent-2); }
.tpm-svg .t-bar.partial { opacity: 0.35; }
.tpm-svg .t-grid { stroke: var(--edge); stroke-width: 1; }
.tpm-axis { display: flex; justify-content: space-between; margin-top: 6px; color: var(--t3); font-size: 11px; font-family: "Geist Mono", ui-monospace, monospace; }

/* Mint card */
.mint-card { border-radius: var(--r-card); padding: 12px; }
.card-tabs { display: flex; gap: 4px; padding: 4px; background: var(--field); border-radius: var(--r-field); width: max-content; }
.tab { padding: 6px 12px; border-radius: var(--r-control); color: var(--t2); font-weight: 500; }
.tab.active { background: var(--raised); color: var(--t1); }
.card-caption { margin: 10px 4px 12px; color: var(--t3); font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 8px; background: var(--field); border-radius: var(--r-field); padding: 16px; margin-bottom: 6px; }
.field-label { color: var(--t2); font-size: 13px; }
.field-foot { color: var(--t3); font-size: 12px; }
.field-foot.bad { color: var(--negative); }

.memo-input {
  width: 100%;
  resize: vertical;
  min-height: 64px;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--t1);
  font-family: "Geist Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.receive { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.token-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 6px; background: var(--raised); border-radius: 999px; font-weight: 500; }
.token-chip img { width: 24px; height: 24px; }

.mint-card .btn-wide { margin-top: 6px; }

.msg { margin: 10px 4px 0; font-size: 13px; overflow-wrap: anywhere; }
.msg-ok { color: var(--accent); }
.msg-ok a { color: var(--t1); }
.msg-error { color: var(--negative); }
.msg-warn { color: var(--warning); margin: 8px 4px; }

.miner-panel { border-radius: var(--r-card); }
.miner-head { display: flex; align-items: center; gap: 12px; }
.miner-icon { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--r-control); background: var(--accent); color: #000; font-family: "Geist Mono", ui-monospace, monospace; font-weight: 700; font-size: 15px; }
.miner-title { font-size: 17px; font-weight: 600; }
.miner-sub { color: var(--t2); font-size: 13px; }
.miner-points { margin: 14px 0 16px; padding: 0; list-style: none; color: var(--t2); font-size: 13px; }
.miner-points li { position: relative; padding-left: 16px; margin: 6px 0; }
.miner-points li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.miner-panel .btn-wide { background: var(--accent); }
.btn-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.miner-foot { margin: 10px 0 0; color: var(--t3); font-size: 12px; text-align: center; }
.miner-foot a { color: var(--t2); text-decoration: none; }
.miner-foot a:hover { color: var(--t1); }

/* Wallet menu and modal */
.wallet-menu-anchor { position: relative; }
.wallet-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--r-field);
  padding: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wallet-menu-row { display: flex; justify-content: space-between; color: var(--t2); font-size: 13px; }
.wallet-menu-row span:last-child { color: var(--t1); font-variant-numeric: tabular-nums; }
.wallet-menu .btn-secondary { margin-top: 4px; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-card); padding: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.wallet-option { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--field); border-radius: var(--r-field); margin-bottom: 8px; }
.modal-note { margin: 12px 0 0; color: var(--t3); font-size: 12px; }

/* Narrow screens */
@media (max-width: 960px) {
  .home-grid { grid-template-columns: 1fr; }
  .side-col { order: -1; }
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .brand-mobile { display: flex; font-size: 18px; }
  .topbar { padding: 12px 16px; }
  .page { padding: 20px 16px 40px; }
  .hero h1 { font-size: 24px; }
  .hero p { font-size: 14px; }
  .big-number { font-size: 26px; }
  .stage-reward { display: none; }
  .stage-range { font-size: 10px; line-height: 1.3; }
  .stage-range span { display: block; }
  .emission-table .col-step { display: none; }
  .emission-table td, .emission-table th { padding-left: 6px; padding-right: 6px; }
  .col-stage { width: 32px; }
  .steps-grid { grid-template-columns: 1fr; }
}
