:root {
  --bg: #0a0e13;
  --panel: #121922;
  --ink: #e8eef5;
  --dim: #8696a8;
  --accent: #ffb020;
  --accent2: #3bd1ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none;
}
#stage { position: fixed; inset: 0; background: #000; }
#unity-canvas { display: block; width: 100%; height: 100%; background: #05080c; outline: none; touch-action: none; }

#loader {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 24px 16px;
  background: radial-gradient(120% 90% at 50% 20%, #17202c 0%, #0a0e13 70%);
  transition: opacity .45s ease;
}
#loader.done { opacity: 0; pointer-events: none; }
.brand { text-align: center; }
.brand h1 {
  margin: 8px 0 4px; font-size: clamp(34px, 7vw, 72px); letter-spacing: .32em; padding-left: .32em;
  font-weight: 800; color: var(--ink);
  text-shadow: 0 0 28px rgba(255, 176, 32, .28);
}
.brand .tag { margin: 0; color: var(--dim); font-size: clamp(11px, 1.7vw, 15px); letter-spacing: .08em; }
.mark { display: inline-flex; gap: 6px; align-items: flex-end; height: 44px; }
.mark span { width: 10px; background: var(--accent); border-radius: 2px; animation: pulse 1.2s ease-in-out infinite; }
.mark span:nth-child(1) { height: 24px; }
.mark span:nth-child(2) { height: 44px; animation-delay: .15s; background: var(--accent2); }
.mark span:nth-child(3) { height: 32px; animation-delay: .3s; }
@keyframes pulse { 0%, 100% { transform: scaleY(.6); opacity: .6; } 50% { transform: scaleY(1); opacity: 1; } }

.bar { width: min(420px, 82vw); height: 6px; border-radius: 3px; background: #1d2733; overflow: hidden; }
#bar-fill { width: 0%; height: 100%; background: linear-gradient(90deg, var(--accent), #ffd36b); transition: width .15s linear; }
#load-text { margin: 0; color: var(--dim); font-size: 14px; letter-spacing: .06em; min-height: 1.2em; }
.hint { margin: 10px 0 0; max-width: 640px; text-align: center; color: #5d6c7d; font-size: 12px; line-height: 1.6; }

#fail {
  position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(10, 14, 19, .96); padding: 24px; text-align: center;
}
#fail[hidden] { display: none; }
#fail h2 { margin: 0; font-size: 22px; color: #ff6b5e; }
#fail p { margin: 0; max-width: 560px; color: var(--dim); line-height: 1.5; font-size: 14px; word-break: break-word; }
#fail button {
  margin-top: 8px; padding: 12px 26px; border: 0; border-radius: 8px; cursor: pointer;
  background: var(--accent); color: #1b1200; font-weight: 700; font-size: 15px;
}

#rotate {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(10, 14, 19, .97); color: var(--ink); font-size: 16px;
}
#rotate[hidden] { display: none; }
#rotate .phone {
  width: 54px; height: 90px; border: 3px solid var(--accent); border-radius: 10px; position: relative;
  animation: turn 2.2s ease-in-out infinite;
}
#rotate .phone::after { content: ""; position: absolute; left: 50%; bottom: 6px; width: 14px; height: 3px; margin-left: -7px; border-radius: 2px; background: var(--accent); }
@keyframes turn { 0%, 25% { transform: rotate(0); } 65%, 100% { transform: rotate(-90deg); } }

#toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 25;
  max-width: min(560px, 92vw); padding: 10px 16px; border-radius: 8px;
  background: rgba(18, 25, 34, .94); border: 1px solid #2b3a4b; color: var(--ink); font-size: 13px; text-align: center;
}
#toast[hidden] { display: none; }
