/* Amgis, the picked design (draft A). Look: the owner-picked Linear system (od:linear-app): near-black canvas, luminance steps instead of
   shadows, semi-transparent white hairlines, one indigo for the primary action only, green and red for one meaning each
   (green = the called side happened, red = it did not). Type: Public Sans (OFL) in Linear's 510 / 590 weights in place of
   Inter, Commit Mono (OFL) only for numbers, ids and hashes. */

@font-face { font-family: "Public Sans"; src: url("../fonts/public-sans-var.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Commit Mono"; src: url("../fonts/commit-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Commit Mono"; src: url("../fonts/commit-mono-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #08090a;
  --panel: #0f1011;
  --surface: #191a1b;
  --surface-2: #232427;
  --fg: #f7f8f8;
  --fg-2: #d0d6e0;
  --muted: #8a8f98;
  --meta: #7c818a;
  --line: rgba(255, 255, 255, 0.08);
  --line-soft: rgba(255, 255, 255, 0.05);
  --line-strong: rgba(255, 255, 255, 0.16);
  --water: rgba(255, 255, 255, 0.28);          /* the waterline hairline: one line that marks what the market priced */
  --accent: #5e6ad2;
  --accent-hover: #6f7be0;
  --accent-active: #4f5bc4;
  --hit: #4cc38a;
  --hit-bg: rgba(76, 195, 138, 0.12);
  --miss: #f0595e;
  --miss-bg: rgba(240, 89, 94, 0.12);
  --sans: "Public Sans", system-ui, sans-serif;
  --mono: "Commit Mono", ui-monospace, monospace;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-long: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-ui: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-move: cubic-bezier(0.65, 0, 0.35, 1);
  --gutter: 32px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg-2); font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-variant-numeric: tabular-nums;
}
a { color: inherit; }
img, svg, canvas { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: rgba(94, 106, 210, 0.45); color: var(--fg); }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent-hover), transparent 10%); outline-offset: 2px; border-radius: 4px; }

/* ---------- the mark: a waterline with one step rising out of it ---------- */
.mark { width: 22px; height: 22px; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); font-weight: 590; font-size: 16px; letter-spacing: -0.01em; min-height: 44px; }

/* ---------- buttons ---------- */
.btn {
  --h: 40px; display: inline-grid; place-items: center; min-height: var(--h); padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--fg); font-size: 15px; font-weight: 510;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 150ms var(--ease-ui), border-color 150ms var(--ease-ui), transform 150ms var(--ease-ui), color 150ms var(--ease-ui);
}
.btn > * { grid-area: 1 / 1; }
.btn:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-strong); }
.btn:active { transform: scale(0.97); background: rgba(255, 255, 255, 0.09); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: var(--accent-active); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* big round buttons (dice: 큰 원형 단추), drawn in Linear's language */
.round {
  width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; color: var(--fg);
  font-size: 15px; font-weight: 510; letter-spacing: -0.005em; border: 1px solid var(--line-strong); background: rgba(8, 9, 10, 0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: background-color 150ms var(--ease-ui), border-color 150ms var(--ease-ui), transform 150ms var(--ease-ui);
}
.round:hover { background: rgba(40, 41, 45, 0.8); border-color: rgba(255, 255, 255, 0.28); }
.round:active { transform: scale(0.97); }
.round.primary { background: var(--accent); border-color: transparent; color: #fff; }
.round.primary:hover { background: var(--accent-hover); }
.round.primary:active { background: var(--accent-active); }

.link { color: var(--fg); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.28); text-underline-offset: 3px; transition: text-decoration-color 150ms var(--ease-ui); }
.link:hover { text-decoration-color: var(--fg); }

/* segmented control: one indicator slides 250ms */
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: var(--r-md); background: rgba(8, 9, 10, 0.6); border: 1px solid var(--line); }
.seg button { position: relative; z-index: 1; min-height: 38px; padding: 0 14px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 510; white-space: nowrap; transition: color 150ms var(--ease-ui), transform 150ms var(--ease-ui); }
.seg button:hover { color: var(--fg-2); }
.seg button:active { transform: scale(0.97); }
.seg button[aria-pressed="true"] { color: var(--fg); }
.seg .ind { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; border-radius: 6px; background: var(--surface-2); box-shadow: 0 0 0 1px var(--line) inset; transition: transform 250ms var(--ease), width 0ms; }

.stamp { display: inline-block; font-size: 13px; font-weight: 590; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg); padding: 3px 8px; border-radius: 4px; border: 1px solid var(--line-strong); }

/* signed numbers sit on or hang from a waterline (the signature) */
.wl { display: inline-grid; align-items: end; position: relative; padding: 0 2px; }
.wl::after { content: ""; position: absolute; left: -4px; right: -4px; height: 1px; background: var(--water); }
.wl.up::after { bottom: -3px; }
.wl.down { align-items: start; }
.wl.down::after { top: -3px; }
.wl.up { color: var(--hit); }
.wl.down { color: var(--miss); }
.wl.zero { color: var(--fg-2); }

/* ---------- wallet picker ---------- */
.wp-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, 0.72); opacity: 0; transition: opacity 250ms var(--ease); }
.wp-backdrop.open { opacity: 1; }
.wp {
  position: fixed; z-index: 81; left: 50%; top: 50%; width: min(440px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto;
  transform: translate(-50%, -50%) scale(0.96); opacity: 0; transition: transform 250ms var(--ease), opacity 250ms var(--ease);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; color: var(--fg-2);
  box-shadow: 0 8px 2px rgba(0,0,0,0), 0 5px 2px rgba(0,0,0,0.01), 0 3px 2px rgba(0,0,0,0.04), 0 1px 1px rgba(0,0,0,0.07), 0 0 1px rgba(0,0,0,0.08);
}
.wp.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.wp.closing, .wp-backdrop.closing { transition-duration: 150ms; }
.wp h2 { margin: 0; font-size: 18px; font-weight: 590; color: var(--fg); letter-spacing: -0.01em; }
.wp .wp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.wp .x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,0.03); cursor: pointer; display: grid; place-items: center; transition: background-color 150ms var(--ease-ui), transform 150ms var(--ease-ui); }
.wp .x:hover { background: rgba(255,255,255,0.07); }
.wp .x:active { transform: scale(0.94); }
.wp h3 { margin: 16px 0 8px; font-size: 13px; font-weight: 510; color: var(--muted); }
.wp .rows { display: grid; gap: 6px; }
.wp .row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: rgba(255,255,255,0.03); cursor: pointer; text-align: left; font-size: 15px; font-weight: 510; color: var(--fg); transition: background-color 150ms var(--ease-ui), border-color 150ms var(--ease-ui), transform 150ms var(--ease-ui); }
.wp .row:hover { background: rgba(255,255,255,0.06); border-color: var(--line-strong); }
.wp .row:active { transform: scale(0.98); }
.wp .row img { width: 32px; height: 32px; border-radius: 8px; }
.wp .row .tag { margin-left: auto; font-size: 13px; color: var(--muted); font-weight: 400; }
.wp .row[aria-busy="true"] .tag { color: var(--fg-2); }
.wp .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wp .tile { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 10px; border-radius: var(--r-md); border: 1px solid var(--line-soft); text-decoration: none; color: var(--fg-2); font-size: 14px; font-weight: 510; transition: background-color 150ms var(--ease-ui), transform 150ms var(--ease-ui); }
.wp .tile:hover { background: rgba(255,255,255,0.05); color: var(--fg); }
.wp .tile:active { transform: scale(0.98); }
.wp .tile img { width: 24px; height: 24px; border-radius: 6px; }
.wp .msg { margin: 12px 0 0; min-height: 22px; font-size: 14px; color: var(--muted); }
.wp .msg.err { color: var(--miss); }
.wp .acct { display: grid; gap: 10px; }
.wp .acct .addr { font-family: var(--mono); color: var(--fg); font-size: 15px; }
.wp .acct .acts { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) { .wp .tiles { grid-template-columns: 1fr; } }

/* toast */
.toasts { position: fixed; z-index: 90; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; width: min(420px, calc(100vw - 32px)); }
.toast { pointer-events: auto; background: var(--surface-2); border: 1px solid var(--line); color: var(--fg); border-radius: var(--r-md); padding: 12px 14px; font-size: 14px; transform: translateY(100%); opacity: 0; transition: transform 400ms var(--ease), opacity 400ms var(--ease); }
.toast.in { transform: none; opacity: 1; }


/* ---------- empty states ---------- */
.emptyst { padding: 18px 16px 20px; display: grid; gap: 4px; justify-items: start; }
.emptyst b { color: var(--fg); font-weight: 590; font-size: 15px; }
.emptyst span { color: var(--muted); font-size: 14px; max-width: 40em; }
.emptyst .btn { margin-top: 10px; }

/* ---------- launch state: the server writes data-launched (mint set and the app open) ---------- */
html[data-launched="0"] .post-only, html:not([data-launched]) .post-only { display: none !important; }
html[data-launched="1"] .pre-only { display: none !important; }
/* the token's words follow the mint alone, the app's links follow APP_OPEN alone (they can differ for a while) */
html[data-mint=""] .has-mint, html:not([data-mint]) .has-mint { display: none !important; }
html[data-mint]:not([data-mint=""]) .no-mint { display: none !important; }
html[data-app="0"] .app-on, html:not([data-app]) .app-on { display: none !important; }
html[data-app="1"] .app-off { display: none !important; }
.wnotice { position: fixed; z-index: 70; left: 50%; top: 16px; transform: translateX(-50%); margin: 0; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid rgba(240, 89, 94, 0.4); color: var(--fg); font-size: 14px; max-width: calc(100vw - 32px); }

/* ---------- the wallet menu under a connected button ---------- */
.wmenu { position: fixed; z-index: 85; width: 260px; display: grid; gap: 8px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 8px 24px rgba(0,0,0,0.45); animation: pop 200ms var(--ease) both; }
.wmenu .addr { margin: 0 0 4px; font-size: 13px; color: var(--fg-2); word-break: break-all; line-height: 1.5; }
.wmenu .btn { width: 100%; }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }

/* ---------- the site's wallet picker (wallet-ui.ts), drawn in this system ---------- */
:root { --wk-bg: var(--surface); --wk-fg: var(--fg-2); --wk-line: var(--line); --wk-radius: 12px; --wk-muted: var(--muted); --wk-accent: var(--fg-2); --wk-row: rgba(255,255,255,0.03); --wk-error: var(--miss); --wk-scrim: rgba(0,0,0,0.72); }
html body .wk-backdrop { animation: fadeIn 250ms var(--ease) both; z-index: 1000; }
html body .wk-panel { animation: pop 250ms var(--ease) both; box-shadow: 0 8px 2px rgba(0,0,0,0), 0 5px 2px rgba(0,0,0,0.01), 0 3px 2px rgba(0,0,0,0.04), 0 1px 1px rgba(0,0,0,0.07), 0 0 1px rgba(0,0,0,0.08); }
html body .wk-title { font-size: 18px; font-weight: 590; color: var(--fg); letter-spacing: -0.01em; }
html body .wk-x { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,0.03); color: var(--fg-2); font-size: 20px; padding: 0; transition: background-color 150ms var(--ease-ui), transform 150ms var(--ease-ui); }
html body .wk-x:hover { background: rgba(255,255,255,0.07); }
html body .wk-x:active { transform: scale(0.94); }
html body .wk-label { font-size: 13px; font-weight: 510; letter-spacing: 0; color: var(--muted); margin: 16px 0 8px; }
html body .wk-row { min-height: 56px; padding: 8px 12px; border-radius: var(--r-md); font-size: 15px; font-weight: 510; color: var(--fg); margin-bottom: 6px; transition: background-color 150ms var(--ease-ui), border-color 150ms var(--ease-ui), transform 150ms var(--ease-ui); }
html body .wk-row:hover { background: rgba(255,255,255,0.06); border-color: var(--line-strong); }
html body .wk-row:active { transform: scale(0.98); }
html body .wk-row[disabled] { opacity: 0.6; cursor: progress; }
html body .wk-row .wk-name { font-weight: 510; }
html body .wk-tag { font-size: 13px; color: var(--muted); font-weight: 400; }
html body .wk-grid { gap: 6px; }
html body .wk-tile { min-height: 48px; padding: 8px 10px; border-color: var(--line-soft); border-radius: var(--r-md); color: var(--fg-2); font-size: 14px; font-weight: 510; transition: background-color 150ms var(--ease-ui), transform 150ms var(--ease-ui); }
html body .wk-tile:hover { background: rgba(255,255,255,0.05); color: var(--fg); border-color: var(--line); }
html body .wk-tile:active { transform: scale(0.98); }
html body .wk-tile img { width: 24px; height: 24px; }
html body .wk-err { color: var(--miss); }
html body .wk-note { font-size: 13px; color: var(--muted); line-height: 1.5; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
