/* Palette and type follow the server icon and banner (code/assets/branding). */
:root {
  --sky-top: #121113;
  --sky-mid: #26201e;
  --sky-low: #4a2618;
  --ground: #100e0e;
  --cream: #e4ddd0;
  --cream-dim: rgba(228, 221, 208, .62);
  --sun-light: #f29a55;
  --sun-dark: #cf5a2a;
  --stamp-line: #c0453b;
  --stamp-text: #d8574b;
  --discord: #5865f2;
  --scene-h: clamp(150px, 30svh, 340px);
  --font: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--sky-top);
  color: var(--cream);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
}

/* Sky, sunset glow and the red glow behind the survivor, as on the banner. */
.sky {
  position: absolute;
  inset: 0;
  z-index: -4;
  background:
    radial-gradient(60% 45% at 50% 100%, rgba(216, 106, 50, .55), rgba(155, 63, 30, .2) 45%, transparent 75%),
    radial-gradient(40% 60% at 92% 45%, rgba(122, 18, 16, .55), rgba(58, 8, 8, .3) 60%, transparent 100%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 92%, #2a1c17 100%);
}

/* Film grain over the whole scene. */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 .4'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Side vignette. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .5), transparent 22%, transparent 78%, rgba(0, 0, 0, .45));
}

.embers {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
}

.scene {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: -2;
  width: 100%;
  height: var(--scene-h);
}

.sun {
  transform-box: fill-box;
  transform-origin: center;
  animation: sunrise 2.4s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes sunrise {
  from { transform: translateY(45%); opacity: .4; }
  to { transform: none; opacity: 1; }
}

.survivor {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: -1;
  height: min(88%, 960px);
  width: auto;
  max-width: none;
  user-select: none;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%), linear-gradient(0deg, transparent 0%, #000 18%, #000 72%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0%, #000 45%), linear-gradient(0deg, transparent 0%, #000 18%, #000 72%, transparent 100%);
  mask-composite: intersect;
  animation: fade-in 1.6s .3s ease both;
}

.content {
  position: relative;
  z-index: 1;
  margin: auto;
  width: 100%;
  max-width: 1200px;
  padding: max(9vh, 48px) 16px calc(var(--scene-h) * .45);
  text-align: center;
  animation: rise 1.1s .15s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes rise {
  from { transform: translateY(18px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.logo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .14em .32em;
  margin: 0;
  font-size: clamp(2.75rem, 8.4vw, 7.25rem);
  font-weight: 700;
  line-height: .95;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-shadow: 0 4px 14px rgba(0, 0, 0, .7);
}

.logo-name { white-space: nowrap; }

.logo-stamp {
  display: inline-block;
  padding: .2em .32em .16em .5em;
  border: .055em solid var(--stamp-line);
  color: var(--stamp-text);
  font-size: .37em;
  letter-spacing: .2em;
  line-height: 1;
  text-shadow: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .45);
  transform: translateY(.18em);
}

.tagline {
  max-width: 34em;
  margin: clamp(18px, 3vh, 30px) auto 0;
  color: var(--cream-dim);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  line-height: 1.5;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: clamp(26px, 4.5vh, 44px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  min-width: 190px;
  padding: 1em 1.7em;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-decoration: none;
  text-transform: uppercase;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease;
}

.btn svg { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; }

.btn:hover { transform: translateY(-2px); }
.btn:active { transform: none; }

.btn:focus-visible,
.connect-copy:focus-visible,
.note a:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 3px;
}

.btn-play {
  background: linear-gradient(180deg, var(--sun-light), var(--sun-dark));
  color: #1c0e07;
  box-shadow: 0 6px 26px rgba(207, 90, 42, .45), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.btn-play:hover { box-shadow: 0 8px 34px rgba(242, 154, 85, .6), inset 0 1px 0 rgba(255, 255, 255, .25); }

.btn-discord {
  background: rgba(16, 14, 14, .55);
  border-color: rgba(228, 221, 208, .32);
  color: var(--cream);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.btn-discord:hover {
  background: rgba(88, 101, 242, .22);
  border-color: var(--discord);
  box-shadow: 0 6px 26px rgba(88, 101, 242, .3);
}

.connect {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: clamp(22px, 3.5vh, 34px);
}

.connect-label {
  color: var(--cream-dim);
  font-size: .95rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
}

kbd {
  display: inline-block;
  padding: .05em .45em;
  border: 1px solid rgba(228, 221, 208, .4);
  border-bottom-width: 2px;
  border-radius: 3px;
  font-family: var(--mono);
  font-size: .9em;
  color: var(--cream);
}

.connect-copy {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  max-width: 100%;
  padding: 12px 18px;
  border: 1px dashed rgba(228, 221, 208, .28);
  border-radius: 3px;
  background: rgba(10, 9, 9, .6);
  color: var(--cream);
  font: inherit;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}

.connect-copy:hover { border-color: rgba(242, 154, 85, .7); background: rgba(10, 9, 9, .75); }

.connect-copy code {
  font-family: var(--mono);
  font-size: clamp(.9rem, 3.6vw, 1.05rem);
  overflow-wrap: anywhere;
}

.connect-hint {
  color: var(--sun-light);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.connect-copy.is-done { border-color: rgba(242, 154, 85, .9); }
.connect-copy.is-done .connect-hint { color: var(--cream); }

.note {
  margin: 18px 0 0;
  color: rgba(228, 221, 208, .48);
  font-size: .85rem;
}

.note a { color: var(--cream-dim); text-underline-offset: 3px; }
.note a:hover { color: var(--cream); }

/* Player count from /api/status, hidden until the first answer. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: clamp(16px, 2.6vh, 24px) 0 0;
  padding: 6px 14px;
  border: 1px solid rgba(228, 221, 208, .2);
  border-radius: 999px;
  background: rgba(10, 9, 9, .5);
  color: var(--cream);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.status[hidden] { display: none; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6fcf6a;
  box-shadow: 0 0 0 0 rgba(111, 207, 106, .6);
  animation: pulse 2s infinite;
}

.status.is-offline .status-dot { background: #8a8580; box-shadow: none; animation: none; }
.status.is-offline { color: var(--cream-dim); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(111, 207, 106, .6); }
  70% { box-shadow: 0 0 0 8px rgba(111, 207, 106, 0); }
  100% { box-shadow: 0 0 0 0 rgba(111, 207, 106, 0); }
}

.scroll-cue {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
  padding: 8px 16px max(14px, env(safe-area-inset-bottom));
  color: rgba(228, 221, 208, .55);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color .2s ease;
}

.scroll-cue svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  animation: nudge 2.4s ease-in-out infinite;
}

.scroll-cue:hover { color: var(--cream); }
.scroll-cue:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }

@keyframes nudge {
  0%, 100% { transform: none; }
  50% { transform: translateY(4px); }
}

/* About the server: below the skyline, on the dark ground colour. */
.about {
  padding: clamp(48px, 9vh, 96px) 16px clamp(32px, 6vh, 64px);
  background: var(--ground);
}

.about-title {
  margin: 0 0 clamp(28px, 5vh, 48px);
  text-align: center;
  font-size: clamp(1.4rem, 3.6vw, 2.1rem);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 16px;
  max-width: 1160px;
  margin: 0 auto;
}

.card {
  position: relative;
  padding: 26px 22px 24px;
  border: 1px solid rgba(228, 221, 208, .1);
  border-top: 2px solid var(--sun-dark);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(74, 38, 24, .35), rgba(26, 22, 21, .6) 60%);
}

.card-num {
  display: inline-block;
  padding: 3px 7px 2px;
  border: 2px solid var(--stamp-line);
  color: var(--stamp-text);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .16em;
}

.card h3 {
  margin: 16px 0 10px;
  font-size: 1.15rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.card p {
  margin: 0;
  color: var(--cream-dim);
  font-size: .95rem;
  line-height: 1.6;
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(228, 221, 208, .06);
  background: var(--ground);
  color: rgba(228, 221, 208, .4);
  font-size: .75rem;
  text-align: center;
}

/* Below wide desktop the survivor would cover the text: keep her as a faint backdrop. */
@media (max-width: 1365px) {
  .survivor {
    height: min(80%, 760px);
    opacity: .3;
    right: -10%;
  }
}

/* Narrow screens: stacked logo like the server icon, full-width buttons. */

@media (max-width: 560px) {
  .logo { flex-direction: column; font-size: clamp(3rem, 18vw, 5rem); gap: .2em; }
  .content { padding-top: max(6vh, 32px); }
  .logo-name { white-space: normal; }
  .logo-name span { display: block; }
  .logo-stamp { font-size: .34em; transform: none; }
  .actions { flex-direction: column; align-items: stretch; max-width: 340px; margin-inline: auto; }
  .btn { width: 100%; }
  .connect-copy { width: 100%; max-width: 340px; }
}

/* Short landscape phones: keep everything above the skyline. */
@media (max-height: 520px) and (orientation: landscape) {
  :root { --scene-h: 120px; }
  .content { padding-top: 28px; }
  .logo { font-size: clamp(2.2rem, 8vw, 4rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
