:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  --app-width: 100vw;
  --app-height: 100dvh;
  --app-left: 0px;
  --app-top: 0px;
  --game-width: 100vw;
  background: #030e18;
  color: #eefaff;
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

#app {
  position: absolute;
  left: var(--app-left);
  top: var(--app-top);
  width: var(--app-width);
  height: var(--app-height);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  display: flex;
  justify-content: center;
  background: #030e18;
}

#game-frame {
  position: relative;
  width: min(100%, var(--game-width));
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: #071927;
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #071927;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#unity-canvas:focus { outline: none; }

#startup {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 26px;
  background: radial-gradient(ellipse at 50% 23%, #12364a 0%, #071927 66%);
  text-align: center;
}

.startup-content { width: 100%; max-width: 320px; margin: auto 0; }
.game-icon {
  display: block;
  width: clamp(88px, 18vh, 136px);
  height: auto;
  margin: 0 auto 26px;
  border-radius: 27%;
  border: 1px solid #83def640;
  box-shadow: 0 14px 36px #0006;
}

.eyebrow { margin: 0 0 9px; font-size: 12px; font-weight: 600; letter-spacing: .08em; color: #83d7ec; }
h1 { margin: 0 0 28px; font-size: clamp(30px, 8vw, 42px); font-weight: 800; letter-spacing: .13em; text-indent: .13em; }
#load-status { min-height: 44px; margin: 0; color: #c1d9e5; font-size: 14px; line-height: 1.6; white-space: pre-line; }
.progress-row { display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; min-height: 18px; }
progress { appearance: none; -webkit-appearance: none; flex: 1; width: 0; height: 5px; overflow: hidden; border: 0; border-radius: 4px; background: #214151; }
progress::-webkit-progress-bar { border-radius: 4px; background: #214151; }
progress::-webkit-progress-value { border-radius: 4px; background: #87e5ef; transition: width .2s ease; }
progress::-moz-progress-bar { border-radius: 4px; background: #87e5ef; }
#load-percent { min-width: 36px; color: #83d7ec; font-size: 12px; font-variant-numeric: tabular-nums; }
.primary-action {
  width: 100%;
  min-height: 54px;
  margin-top: 18px;
  padding: 14px 24px;
  border: 1px solid #b7f4ff;
  border-radius: 14px;
  background: #8ee5ef;
  color: #092638;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.primary-action:active { background: #c1f7fb; transform: translateY(1px); }
.primary-action:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.home-hint { flex-shrink: 0; margin: 20px 0 0; color: #88a7b9; font-size: 11px; line-height: 1.8; }
.home-hint strong { color: #bad3df; font-weight: 500; }
noscript { margin-top: 14px; font-size: 12px; color: #ffd9a1; }

@media (max-height: 520px) {
  #startup { padding: 14px 18px; }
  .game-icon { width: 68px; margin-bottom: 10px; }
  .eyebrow { font-size: 10px; }
  h1 { margin-bottom: 10px; font-size: 28px; }
  #load-status { min-height: 22px; font-size: 12px; }
  .progress-row { margin-top: 8px; }
  .primary-action { min-height: 44px; margin-top: 8px; padding: 10px; font-size: 14px; }
  .home-hint { margin-top: 12px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  progress::-webkit-progress-value { transition: none; }
  .primary-action:active { transform: none; }
}
