:root {
  --bg: #050504;

  --text-main: rgba(246, 242, 226, 0.92);
  --text-soft: rgba(232, 224, 202, 0.76);
  --text-muted: rgba(232, 224, 202, 0.56);
  --text-bright: #fff8df;

  --panel-bg: rgba(0, 0, 0, 0.44);
  --panel-bg-strong: rgba(0, 0, 0, 0.76);

  --line: rgba(218, 194, 132, 0.22);
  --line-strong: rgba(218, 194, 132, 0.38);

  --button-bg: #d7c78f;
  --button-hover: #eadca9;
  --button-text: #080806;

  --accent: #d9c27a;
}

html,
body {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  background: var(--bg);
  color: var(--text-main);
  font-family: Georgia, serif;
  line-height: 25px !important;
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

/* Unity stage */

#unity-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  background: #000000;
  overflow: hidden;
}

#unity-canvas {
  width: 100%;
  height: 100%;
  background: #000000;
  display: block;
}

/* Loading bar wrapper */

#unity-loading-bar {
  width: min(72vw, 340px);
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1000;
  transform: translate(-50%, -50%);
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Optional Unity logo */

#unity-logo {
  width: 154px;
  height: 130px;
  margin: 0 auto 22px auto;
  background: url('unity-logo-dark.png') no-repeat center;
  background-size: contain;
  opacity: 0.82;
  filter: sepia(0.18) brightness(1.1) contrast(0.95);
}

/* Loading bar outer track */

#unity-progress-bar-empty {
  width: 100%;
  height: 12px;
  padding: 2px;

  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--line);
  border-radius: 999px;

  overflow: hidden;

  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.44),
    inset 0 1px 0 rgba(255, 244, 210, 0.08);
}

/* Loading bar fill */

#unity-progress-bar-full {
  height: 100%;
  width: 0%;

  background: linear-gradient(
    90deg,
    #a9914f 0%,
    #d9c27a 48%,
    #fff1b6 100%
  );

  border-radius: 999px;

  box-shadow:
    0 0 18px rgba(217, 194, 122, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

/* Loading percentage text */

#unity-progress-text {
  position: absolute;
  left: 50%;
  top: calc(50% + 18px);
  z-index: 1000;

  transform: translateX(-50%);
  pointer-events: none;

  color: var(--text-soft);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-align: center;

  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Visibility states */

#unity-loading-bar.visible,
#unity-progress-text.visible {
  opacity: 1;
}

#unity-loading-bar.fade-out,
#unity-progress-text.fade-out,
.fade-out {
  opacity: 0 !important;
}

/* Warning banner */

#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  z-index: 10000;

  transform: translateX(-50%);

  display: none;
  max-width: min(90vw, 680px);
  padding: 14px 18px;

  background: rgba(0, 0, 0, 0.78);
  color: var(--text-bright);

  border: 1px solid var(--line);
  border-radius: 14px;

  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.56),
    inset 0 1px 0 rgba(255, 244, 210, 0.08);

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

/* Full-screen rotate overlay */

#rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;

  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;

  padding: 32px;

  background: rgba(0, 0, 0, 0.88);
  color: var(--text-main);

  pointer-events: all;

  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

#rotate-overlay .box {
  max-width: 28rem;
  margin: 0 auto;
  padding: clamp(28px, 7vw, 52px);

  border: 1px solid var(--line);
  background: var(--panel-bg-strong);

  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 244, 210, 0.08);
}

#rotate-overlay .emoji {
  display: block;
  margin-bottom: 18px;

  font-size: 56px;
  line-height: 1;

  opacity: 0.92;
  filter: sepia(0.2);
}

#rotate-overlay h1 {
  margin: 0 0 10px 0;

  color: var(--text-bright);

  font-size: clamp(22px, 5vw, 34px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-transform: uppercase;

  background: linear-gradient(180deg, #fff8df 0%, #d8c47f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#rotate-overlay p {
  margin: 0;

  color: var(--text-soft);
  opacity: 1;

  font-size: 16px;
  line-height: 1.6;
}

/* Pure-CSS: show overlay on portrait for typical device widths */

@media screen and (orientation: portrait) and (max-width: 1200px) {
  #rotate-overlay {
    display: flex;
  }
}

/* Prevent background scroll when overlay is visible */

body.rotate-lock {
  overflow: hidden;
  touch-action: none;
}

/* Intro overlay */

#intro-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483646;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: clamp(18px, 4vw, 64px);

  background: #000000;
  color: var(--text-main);

  pointer-events: auto;
}

#intro-overlay[hidden] {
  display: none;
}

#intro-overlay .intro-box {
  width: min(90vw, 720px);
  max-width: 720px;

  padding: clamp(32px, 7vw, 62px) clamp(24px, 6vw, 54px);

  text-align: center;

  border: 1px solid var(--line);
  background: var(--panel-bg);

  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.48),
    0 2px 18px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 244, 210, 0.06);

  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

#intro-overlay h1 {
  margin: 0 0 28px 0;

  color: var(--text-bright);

  font-size: clamp(24px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0.03em;
  text-transform: uppercase;

  background: linear-gradient(180deg, #fff8df 0%, #d8c47f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#intro-overlay .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: min(100%, 300px);
  min-height: 52px;

  padding: 14px 24px;

  border: 1px solid rgba(255, 248, 223, 0.18);
  border-radius: 999px;

  background: linear-gradient(180deg, var(--button-hover), var(--button-bg));
  color: var(--button-text);

  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  cursor: pointer;

  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);

  transition:
    background 180ms ease,
    transform 120ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

#intro-overlay .btn-primary:hover,
#intro-overlay .btn-primary:focus-visible {
  background: #f1e4b6;
  transform: translateY(-1px);
  border-color: rgba(255, 248, 223, 0.38);

  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

#intro-overlay .btn-primary:active {
  transform: scale(0.98);
}

#intro-overlay .btn-link {
  display: block;

  margin: 12px auto 20px auto;
  padding: 0;

  background: none;
  border: none;

  color: var(--text-soft);

  font-family: inherit;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-decoration: underline;
  text-underline-offset: 4px;

  cursor: pointer;
}

#intro-overlay .btn-link:hover,
#intro-overlay .btn-link:focus-visible {
  color: var(--text-bright);
}

#intro-overlay .copyright {
  margin: 0;

  color: var(--text-muted);

  font-size: 12px;
  line-height: 1.5;
}

/* Prevent background scroll while intro is up */

body.intro-lock {
  overflow: hidden;
  touch-action: none;
}

/* Small screens */

@media screen and (max-width: 520px) {
  #unity-loading-bar {
    width: min(78vw, 300px);
  }

  #unity-progress-text {
    font-size: 11px;
  }

  #rotate-overlay {
    padding: 18px;
  }

  #rotate-overlay .box {
    padding: 30px 22px;
  }

  #intro-overlay {
    padding: 14px;
  }

  #intro-overlay .intro-box {
    width: 100%;
    padding: 34px 22px;
  }

  #intro-overlay .btn-primary {
    width: 100%;
  }
}