:root {
  color-scheme: dark;
  --black: #000713;
  --ink: #00102d;
  --blue: #075dcc;
  --cyan: #71d5ff;
  --gold: #ffc52f;
  --gold-soft: #ffe591;
  --white: #f8fbff;
  --muted: rgba(193, 225, 247, .58);
  --line: rgba(138, 213, 255, .25);
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; background: var(--black); }
body { overflow: hidden; color: var(--white); font-family: var(--ui); }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }

.market-scene {
  position: relative;
  isolation: isolate;
  width: 100vw;
  min-height: 100svh;
  overflow: hidden;
  background: #001139;
}

.scene-bg {
  --scene-x: 0px;
  --scene-y: 0px;
  position: absolute;
  z-index: 0;
  inset: -1.5%;
  width: 103%;
  height: 103%;
  object-fit: cover;
  object-position: center center;
  transform: translate(var(--scene-x), var(--scene-y)) scale(1.015);
  filter: saturate(1.05) contrast(1.04);
  transition: transform 700ms cubic-bezier(.2,.75,.2,1);
}

.scene-shade {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 5, 17, .92) 0%, rgba(0, 7, 26, .74) 26%, rgba(0, 13, 46, .3) 49%, transparent 69%),
    linear-gradient(180deg, rgba(0, 5, 18, .36), transparent 24%, transparent 72%, rgba(0, 5, 18, .55));
  box-shadow: inset 0 0 120px rgba(0,0,0,.42), inset 0 0 0 1px rgba(158, 222, 255, .12);
}

.market-grain {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.16'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.moving-signal {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.moving-signal path { fill: none; stroke: transparent; }
.moving-signal circle { fill: var(--gold-soft); filter: drop-shadow(0 0 10px var(--gold)) drop-shadow(0 0 22px rgba(255,197,47,.76)); }

.top-strip,
.bottom-strip {
  position: absolute;
  z-index: 5;
  left: 0;
  display: flex;
  width: 100%;
  justify-content: space-between;
  color: rgba(202, 233, 255, .48);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  pointer-events: none;
}
.top-strip { top: 0; padding: 17px clamp(22px, 3vw, 50px); border-bottom: 1px solid rgba(139, 210, 255, .16); background: rgba(0, 6, 24, .32); }
.top-strip b, .bottom-strip b { color: var(--gold); }
.bottom-strip { bottom: 0; padding: 14px clamp(22px, 3vw, 50px); border-top: 1px solid rgba(139, 210, 255, .16); background: rgba(0, 6, 24, .46); }

.interface {
  position: absolute;
  z-index: 6;
  top: 50%;
  left: clamp(30px, 5vw, 94px);
  width: min(39vw, 610px);
  transform: translateY(-50%);
}

.market-status { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 9px; letter-spacing: .17em; }
.market-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 18px var(--gold); }
.market-status span { color: var(--gold-soft); }
.market-status b { color: rgba(176, 218, 247, .5); font-size: 8px; }

h1 {
  margin: clamp(16px, 2.4vh, 26px) 0 10px;
  font-family: var(--display);
  font-size: clamp(72px, 7.8vw, 146px);
  font-weight: 700;
  line-height: .76;
  letter-spacing: -.055em;
  text-transform: uppercase;
  text-shadow: 0 7px 30px rgba(0,0,0,.48);
}
h1 span { display: block; }
h1 span:first-child { color: var(--gold); }
h1 span:last-child { color: var(--white); }

.identity-line { display: flex; align-items: center; gap: 16px; margin: 18px 0 25px; font-family: var(--mono); }
.identity-line strong { color: var(--gold); font-size: 18px; letter-spacing: .08em; }
.identity-line span { color: var(--muted); font-size: 8px; letter-spacing: .15em; }

.contract {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 70px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--white);
  background: rgba(0, 10, 36, .7);
  box-shadow: 0 20px 45px rgba(0,0,0,.22), inset 0 0 0 1px rgba(255,255,255,.03);
  font-family: var(--mono);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(15px);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.contract:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(255,197,47,.8); background: rgba(0, 18, 61, .86); }
.contract-copy, .contract-action { display: grid; gap: 6px; }
.contract-action { justify-items: end; }
.contract small { color: rgba(174, 218, 247, .52); font-size: 7px; letter-spacing: .13em; }
.contract code { min-width: 0; overflow: hidden; color: var(--white); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.contract b { color: var(--gold); font-size: 10px; letter-spacing: .1em; }
.contract:disabled { cursor: default; }

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(0, 9, 32, .67);
  backdrop-filter: blur(15px);
}
.action {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1px 10px;
  min-height: 68px;
  padding: 12px 14px;
  border-right: 1px solid rgba(139, 210, 255, .18);
  transition: color 180ms ease, background 180ms ease;
}
.action:last-child { border-right: 0; }
.action > span { grid-row: 1 / span 2; color: rgba(121, 202, 255, .45); font-family: var(--mono); font-size: 7px; }
.action strong { align-self: end; font-family: var(--ui); font-size: 13px; letter-spacing: .04em; }
.action small { align-self: start; color: rgba(183, 221, 246, .5); font-family: var(--mono); font-size: 7px; letter-spacing: .09em; }
.action b { grid-row: 1 / span 2; grid-column: 3; color: var(--gold); }
.action:hover:not(.is-disabled) { color: var(--ink); background: var(--gold); }
.action:hover small, .action:hover span, .action:hover b { color: var(--ink); }
.action.is-disabled { opacity: .34; pointer-events: none; }

button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  body { overflow-y: auto; }
  .market-scene { min-height: 100svh; }
  .scene-bg { inset: 0; width: 100%; height: 100%; object-position: 64% center; transform: translate(var(--scene-x), var(--scene-y)) scale(1.02); }
  .scene-shade { background: linear-gradient(180deg, rgba(0,5,18,.9) 0%, rgba(0,8,30,.58) 39%, rgba(0,8,30,.12) 63%, rgba(0,5,18,.82) 100%); }
  .top-strip span:nth-child(n+4) { display: none; }
  .interface { top: 70px; left: 22px; width: min(72vw, 600px); transform: none; }
  h1 { font-size: clamp(62px, 14vw, 104px); }
  .identity-line { margin: 12px 0 16px; }
  .contract { max-width: 580px; }
  .actions { position: fixed; z-index: 9; right: 12px; bottom: 48px; left: 12px; margin: 0; }
  .bottom-strip { z-index: 8; }
}

@media (max-width: 560px) {
  .top-strip { padding: 12px 14px; font-size: 7px; }
  .top-strip span:nth-child(n+3) { display: none; }
  .interface { top: 50px; left: 16px; width: calc(100vw - 32px); }
  .market-status { font-size: 8px; }
  h1 { margin-top: 12px; font-size: 17vw; line-height: .78; }
  .identity-line span { display: none; }
  .contract { min-height: 58px; padding: 10px 12px; }
  .contract code { font-size: 9px; }
  .contract-action small { display: none; }
  .actions { bottom: 40px; }
  .action { min-height: 57px; padding: 9px 8px; gap: 2px 6px; }
  .action > span { display: none; }
  .action strong { font-size: 11px; }
  .action small { font-size: 6px; }
  .bottom-strip { justify-content: center; padding: 12px; }
  .bottom-strip span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .moving-signal { display: none; }
}
