:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: #000;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #000;
}

body {
  position: fixed;
  inset: 0;
  color: #fff;
  -webkit-user-select: none;
  user-select: none;
}

#game-frame,
#godot-game-wrap {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
}

#canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  color: #fff;
  outline: none;
  background: #000;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

#canvas:focus { outline: none; }

#status {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(80px, calc(24px + env(safe-area-inset-bottom, 0px))) max(20px, env(safe-area-inset-left, 0px));
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 34%, rgba(191, 150, 64, 0.18), transparent 31%),
    linear-gradient(145deg, #0b1118 0%, #05070a 54%, #11100d 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}

#status::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 32px 32px;
}

#status.is-visible {
  opacity: 1;
  visibility: visible;
}

#loading-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(96px, 150px) minmax(230px, 430px);
  align-items: center;
  gap: clamp(18px, 4vw, 42px);
  width: min(720px, calc(100vw - 40px));
  box-sizing: border-box;
  padding: clamp(20px, 4vw, 38px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(8, 11, 15, 0.88);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
}

#status-splash {
  display: block;
  width: 100%;
  max-height: min(46vh, 280px);
  object-fit: contain;
  filter: drop-shadow(0 15px 18px rgba(0, 0, 0, 0.55));
}

#loading-copy {
  min-width: 0;
  text-align: left;
}

#loading-brand {
  margin-bottom: 9px;
  color: #d3a94b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

#loading-copy h1 {
  margin: 0 0 18px;
  color: #fff;
  font-size: clamp(24px, 4.2vw, 42px);
  font-weight: 750;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

#status-label {
  min-height: 1.35em;
  margin: 0 0 10px;
  color: #cbd1d8;
  font-size: 14px;
  line-height: 1.45;
}

#status-progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: #20252b;
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.5);
}

#status-progress-inner {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b98b32, #f2cc68);
  box-shadow: 0 0 14px rgba(242, 204, 104, 0.4);
  transition: width 0.16s linear;
}

#status-meta {
  margin-top: 8px;
  color: #f1d27f;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

#status-notice {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(230, 82, 82, 0.5);
  border-radius: 10px;
  background: rgba(93, 20, 24, 0.72);
  color: #fff;
  line-height: 1.4;
  text-align: left;
  pointer-events: auto;
}

#status-notice strong { font-size: 16px; }
#status-notice-text { color: #f0dfe0; font-size: 13px; }

#status-retry {
  justify-self: start;
  min-width: 92px;
  height: 38px;
  margin-top: 4px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: #301014;
  font: 700 14px Arial, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}

#noscript-message {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #080b10;
  color: #fff;
  font: 600 16px Arial, sans-serif;
  text-align: center;
}

[hidden] { display: none !important; }

@media (max-width: 620px), (max-height: 500px) {
  #status { padding: 18px 18px 74px; }
  #loading-card {
    grid-template-columns: minmax(70px, 112px) minmax(190px, 1fr);
    gap: 18px;
    width: min(620px, calc(100vw - 28px));
    padding: 18px;
  }
  #loading-copy h1 { margin-bottom: 12px; font-size: clamp(22px, 5vw, 32px); }
  #status-splash { max-height: 42vh; }
}

@media (orientation: portrait) and (max-width: 620px) {
  #loading-card {
    grid-template-columns: 1fr;
    justify-items: center;
    max-width: 390px;
    text-align: center;
  }
  #status-splash { width: min(120px, 34vw); max-height: 28vh; }
  #loading-copy { width: 100%; text-align: center; }
  #loading-copy h1 { font-size: clamp(25px, 8vw, 36px); }
}

@supports (height: 100dvh) {
  html,
  body,
  #game-frame,
  #godot-game-wrap,
  #status { height: 100dvh; }
}

@media (prefers-reduced-motion: reduce) {
  #status,
  #status-progress-inner { transition: none; }
}
