:root {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e7edf4;
  background: #090b0f;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #090b0f;
  --panel: #11151c;
  --panel-2: #151b23;
  --text: #e7edf4;
  --muted: #8e99a8;
  --red: #ff5a5f;
  --cyan: #3ed6d0;
  --amber: #f2b94b;
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; margin: 0; }
body { min-width: 320px; min-height: 100vh; overflow-x: hidden; background: var(--bg); }
button { font: inherit; }

.app {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(62, 214, 208, .055), transparent 32rem),
    linear-gradient(180deg, #0b0e13 0%, #090b0f 60%, #07090c 100%);
  isolation: isolate;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(22px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
}

.noise {
  position: fixed;
  inset: 0;
  opacity: .035;
  pointer-events: none;
  z-index: -1;
  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='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.scanline {
  position: fixed;
  left: 0;
  right: 0;
  height: 1px;
  top: -2px;
  opacity: .22;
  pointer-events: none;
  z-index: 8;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  animation: scan 8s linear infinite;
}

@keyframes scan { to { transform: translateY(105dvh); } }

.screen {
  min-height: calc(100dvh - 72px);
  width: min(100%, 760px);
  margin: 0 auto;
  animation: enter .5s cubic-bezier(.2,.8,.2,1) both;
}

.screen--center {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 20px;
}

.screen--terminal { padding-top: clamp(50px, 10vh, 110px); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }

.eyebrow,
.build-mark,
.fragment-card__label,
.fragment-card__meta,
.breach-code,
.live-pill,
.terminal {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.brand {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(46px, 14vw, 96px);
  line-height: .9;
  letter-spacing: -.075em;
  font-weight: 850;
}

.lead {
  margin: 0;
  max-width: 480px;
  color: #b7c0cb;
  line-height: 1.55;
  font-size: clamp(16px, 4vw, 19px);
}
.lead--small { font-size: 14px; max-width: 430px; color: var(--muted); }

.warning-card {
  width: min(100%, 460px);
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 11px;
}
.warning-card__dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 18px rgba(242,185,75,.5); flex: 0 0 auto; }

.actions { display: flex; width: min(100%, 460px); gap: 10px; }
.button {
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 0 20px;
  color: var(--text);
  cursor: pointer;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
  flex: 1;
  font-weight: 700;
}
.button:active { transform: scale(.985); }
.button--ghost { background: rgba(255,255,255,.035); border-color: rgba(255,255,255,.08); color: #9ca6b3; }
.button--danger { background: rgba(255,90,95,.12); border-color: rgba(255,90,95,.28); color: #ffc6c8; }
.button--signal { width: min(100%, 420px); flex: 0 0 auto; background: rgba(62,214,208,.1); border-color: rgba(62,214,208,.28); color: #a7fffa; }
.button--disabled { width: min(100%, 440px); flex: 0 0 auto; opacity: .42; cursor: not-allowed; background: rgba(255,255,255,.04); border-color: rgba(255,255,255,.08); }
.microcopy { margin: 4px 0 0; color: #535c68; font-size: 11px; }

.forbidden-wrap { position: relative; width: min(78vw, 330px); aspect-ratio: 1; display: grid; place-items: center; }
.forbidden-button {
  position: relative;
  z-index: 3;
  width: 61%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255,90,95,.42);
  background: radial-gradient(circle at 45% 38%, #281315 0%, #180d10 52%, #100a0c 100%);
  box-shadow: 0 0 0 8px rgba(255,90,95,.02), inset 0 1px 0 rgba(255,255,255,.06), 0 22px 70px rgba(0,0,0,.55);
  color: #ffd6d7;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  letter-spacing: .1em;
  transition: transform .18s ease, box-shadow .18s ease;
}
.forbidden-button span { font-size: 11px; color: #bf777a; }
.forbidden-button strong { font-size: clamp(26px, 8vw, 40px); letter-spacing: -.035em; }
.forbidden-button:active { transform: scale(.96); box-shadow: 0 0 55px rgba(255,90,95,.2); }
.forbidden-ring { position: absolute; border: 1px solid rgba(255,90,95,.13); border-radius: 50%; animation: breathe 3.2s ease-in-out infinite; }
.forbidden-ring--one { inset: 10%; }
.forbidden-ring--two { inset: 1%; animation-delay: -1.6s; }
@keyframes breathe { 50% { transform: scale(1.025); opacity: .48; } }

.screen--breach { animation: breachIn .2s steps(2) both; }
@keyframes breachIn { 50% { transform: translateX(4px); filter: contrast(1.25); } }
.breach-code { margin: 0; color: var(--red); font-size: 11px; letter-spacing: .15em; }
.breach-title { margin: 0; max-width: 660px; font-size: clamp(34px, 10vw, 68px); line-height: .98; letter-spacing: -.05em; }
.breach-flash { margin-top: 12px; padding: 8px 10px; border: 1px solid rgba(255,90,95,.3); color: var(--red); font: 11px/1 "SFMono-Regular", Consolas, monospace; letter-spacing: .16em; animation: flicker .9s steps(2) infinite; }
@keyframes flicker { 50% { opacity: .3; } }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.live-pill { color: #77f3ed; border: 1px solid rgba(62,214,208,.2); background: rgba(62,214,208,.06); padding: 8px 9px; border-radius: 999px; font-size: 9px; letter-spacing: .08em; }
.terminal { overflow: hidden; border: 1px solid rgba(255,255,255,.075); border-radius: 18px; background: rgba(10,13,17,.86); box-shadow: 0 30px 90px rgba(0,0,0,.36); }
.terminal__bar { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 15px; border-bottom: 1px solid rgba(255,255,255,.06); color: #616b78; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.terminal__status { color: var(--cyan); }
.terminal__body { min-height: 320px; padding: 20px 18px; color: #a9b4c0; font-size: 12px; line-height: 1.72; }
.terminal__body p { margin: 0 0 7px; animation: lineIn .18s linear both; }
.terminal__alert { color: #e0a1a4; }
.terminal__cursor { color: var(--cyan); animation: blink 1s steps(1) infinite; }
@keyframes lineIn { from { opacity: 0; transform: translateX(-3px); } }
@keyframes blink { 50% { opacity: 0; } }

.chapter-title { margin: 0; max-width: 560px; font-size: clamp(34px, 9vw, 62px); line-height: 1; letter-spacing: -.05em; }
.fragment-card {
  width: min(100%, 430px);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid rgba(62,214,208,.18);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(62,214,208,.075), rgba(255,255,255,.018));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 28px 80px rgba(0,0,0,.28);
}
.fragment-card__label, .fragment-card__meta { color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.fragment-card strong { color: #b9fffb; font: 700 clamp(32px, 9vw, 48px)/1 "SFMono-Regular", Consolas, monospace; letter-spacing: -.04em; }
.lock-icon { width: 92px; height: 92px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.08); border-radius: 24px; color: var(--cyan); background: rgba(255,255,255,.025); font-size: 48px; transform: rotate(10deg); }
.text-button { border: 0; background: transparent; color: #66717d; cursor: pointer; padding: 9px; font-size: 12px; }
.build-mark { position: absolute; bottom: max(8px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: #313943; font-size: 8px; letter-spacing: .13em; white-space: nowrap; }

@media (max-width: 520px) {
  .actions { flex-direction: column-reverse; }
  .screen--terminal { padding-top: 36px; }
  .section-head { align-items: flex-end; }
  .terminal__body { min-height: 360px; }
}

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

/* Build 0.2 multiplayer additions */
.actions--wide { width: min(100%, 620px); }
.signal-orb { width: 92px; height: 92px; display: grid; place-items: center; border: 1px solid rgba(62,214,208,.18); border-radius: 50%; box-shadow: 0 0 60px rgba(62,214,208,.06); }
.signal-orb span { width: 13px; height: 13px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 24px rgba(62,214,208,.7); animation: signalPulse 1.7s ease-in-out infinite; }
@keyframes signalPulse { 50% { transform: scale(.55); opacity: .35; } }
.invite-card { width: min(100%, 620px); display: grid; gap: 11px; padding: 18px; border: 1px solid rgba(255,255,255,.07); border-radius: 16px; background: rgba(255,255,255,.025); text-align: left; }
.invite-card code { color: #95a2b1; font: 11px/1.55 "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.waiting-line { display: flex; align-items: center; gap: 9px; color: #66717d; font: 10px/1 "SFMono-Regular", Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; }
.waiting-line i { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 14px rgba(62,214,208,.6); animation: flicker 1.1s steps(2) infinite; }
.lock-icon--incoming { color: var(--amber); transform: rotate(-6deg); }
.fragment-card--puzzle strong { letter-spacing: .16em; }
.code-form { width: min(100%, 430px); display: grid; gap: 10px; }
.code-input { width: 100%; height: 62px; border: 1px solid rgba(255,255,255,.09); border-radius: 14px; outline: none; background: rgba(255,255,255,.03); color: var(--text); text-align: left; padding: 0 24px; font: 700 26px/1 "SFMono-Regular", Consolas, monospace; letter-spacing: .24em; transition: border-color .2s, box-shadow .2s; }
.code-input:focus { border-color: rgba(62,214,208,.35); box-shadow: 0 0 0 3px rgba(62,214,208,.05); }
.code-input--error { border-color: rgba(255,90,95,.55); animation: shake .35s ease; }
@keyframes shake { 30% { transform: translateX(-6px); } 65% { transform: translateX(6px); } }
.access-mark { width: 88px; height: 88px; display: grid; place-items: center; border: 1px solid rgba(62,214,208,.24); border-radius: 50%; color: var(--cyan); font-size: 38px; background: rgba(62,214,208,.055); box-shadow: 0 0 70px rgba(62,214,208,.07); }
.sealed-message { width: min(100%, 560px); padding: 22px; border: 1px solid rgba(255,255,255,.075); border-radius: 18px; background: rgba(255,255,255,.025); text-align: left; }
.sealed-message p { margin: 12px 0 0; color: #b6c0cc; line-height: 1.65; font-size: 15px; }
.boot-spinner { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); border-top-color: var(--cyan); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.button:disabled { cursor: not-allowed; opacity: .55; }
@media (max-width: 520px) { .actions--wide { flex-direction: column; } }

/* Four-slot OTP code entry */
.code-entry {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.code-entry .code-input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  opacity: .01;
  border: 0;
  padding: 0;
  margin: 0;
  font-size: 16px;
  caret-color: transparent;
  background: transparent;
  cursor: text;
}

.code-slot {
  height: 68px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.03);
  color: var(--text);
  font: 700 28px/1 "SFMono-Regular", Consolas, monospace;
  transition:
    border-color .16s ease,
    background .16s ease,
    box-shadow .16s ease,
    transform .16s ease;
}

.code-slot--active {
  border-color: rgba(62,214,208,.55);
  box-shadow: 0 0 0 3px rgba(62,214,208,.06);
}

.code-slot--filled {
  background: rgba(62,214,208,.035);
  border-color: rgba(62,214,208,.22);
}

.code-entry--error {
  animation: shake .35s ease;
}

.code-entry--error .code-slot {
  border-color: rgba(255,90,95,.55);
}
