:root { color-scheme: dark; --loading-ink: #061e30; --loading-cyan: #03f3f4; --loading-cut: 28px; }
#unity-status {
  background: linear-gradient(0deg, #031c31db, transparent 40%), url("offline-loading-background.webp") center / cover no-repeat, var(--loading-ink);
  font-family: "Offline Sans", Arial, sans-serif;
  opacity: 1;
  transition: opacity 200ms ease;
}
@font-face { font-family: "Offline Sans"; src: url("offline-loading-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
#unity-status[data-dismissing="true"] { opacity: 0; }
.offline-logo, .loading-panel { position: relative; flex-shrink: 0; box-sizing: border-box; filter: drop-shadow(0 0 8px #00eafa65); }
.offline-logo {
  width: min(50vw, 900px); padding: .6vw 1.5vw 1.2vw; text-align: center; background: var(--loading-cyan);
  clip-path: polygon(4% 0, 97% 0, 100% 15%, 96% 86%, 93% 100%, 4% 100%, 0 82%);
}
.offline-logo::before { content: ""; position: absolute; inset: 2px; background: linear-gradient(135deg, #082e49, #031e32); clip-path: inherit; }
.offline-logo::after { content: ""; position: absolute; bottom: 8%; left: 29%; width: 42%; height: 5%; background: #ffda00; transform: skewX(-40deg); }
.offline-logo span { position: relative; display: block; font-family: "Arial Black", "Offline Sans", Arial, sans-serif; font-size: clamp(40px, 8.6vw, 160px); font-weight: 900; font-style: italic; letter-spacing: -.065em; line-height: 1.16; padding-right: .09em; }
.loading-panel { width: min(68vw, 1300px); padding: 2px; background: var(--loading-cyan); clip-path: polygon(var(--loading-cut) 0, calc(100% - var(--loading-cut)) 0, 100% var(--loading-cut), 100% calc(100% - var(--loading-cut)), calc(100% - var(--loading-cut)) 100%, var(--loading-cut) 100%, 0 calc(100% - var(--loading-cut)), 0 var(--loading-cut)); }
.loading-panel-inner { padding: clamp(12px, 1.1vw, 22px) clamp(22px, 5.5vw, 100px) clamp(14px, 1.2vw, 24px); background: linear-gradient(120deg, #061d2ff5, #082b3bf7); clip-path: inherit; }
#loading-title { display: flex; align-items: center; gap: 5%; margin: 0 0 clamp(12px, 1vw, 20px); white-space: nowrap; font-size: clamp(22px, 3vw, 56px); line-height: 1.2; text-align: center; }
#loading-title::before, #loading-title::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--loading-cyan)); }
#loading-title::after { transform: rotate(180deg); }
.loading-labels { display: flex; justify-content: space-between; align-items: center; min-height: 1.5em; margin-bottom: 10px; font-size: clamp(16px, 1.65vw, 30px); line-height: 1.3; }
#loading-percent { font-variant-numeric: tabular-nums; }
#loading-progress { height: clamp(18px, 2.2vw, 40px); padding: 2px; background: #49bbd8; clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px), calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px); }
.loading-fill { height: 100%; position: relative; overflow: hidden; background: #103448; clip-path: inherit; }
/* Width tracks only Unity's measured progress; animation conveys activity separately. */
.loading-fill::before { content: ""; position: absolute; inset: 0; width: var(--load-progress, 0%); background: linear-gradient(#43ffff, #00dce9); }
[data-state="preparing"] .loading-fill::before { width: 25%; animation: loading-sweep 1.6s ease-in-out infinite alternate; }
.loading-footer { display: flex; gap: 20px; justify-content: center; align-items: center; min-height: 1.5em; margin-top: 12px; font-size: clamp(14px, 1.6vw, 28px); line-height: 1.3; text-align: center; }
.loading-dots { display: flex; gap: 7px; }
.loading-dots i { width: clamp(7px, .9vw, 16px); height: clamp(7px, .9vw, 16px); border-radius: 50%; background: var(--loading-cyan); animation: loading-pulse 1.2s ease-in-out infinite; }
.loading-dots i:nth-child(2) { animation-delay: .18s; }
.loading-dots i:nth-child(3) { animation-delay: .36s; }
[data-state="error"] .loading-dots, [data-state="error"] .loading-footer { display: none; }
[data-state="error"] .loading-labels { justify-content: center; text-align: center; }
#loading-retry { display: block; margin: 16px auto 0; min-width: 160px; min-height: 48px; padding: 10px 32px; border: 2px solid var(--loading-cyan); background: #0b384b; color: white; font: inherit; cursor: pointer; }
#loading-retry:hover { background: #15536a; }
#loading-retry:focus-visible { outline: 3px solid #ffda00; outline-offset: 4px; }
#loading-retry:disabled { opacity: .6; cursor: wait; }
@keyframes loading-pulse { 0%,100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }
@keyframes loading-sweep { from { transform: translateX(0); } to { transform: translateX(300%); } }
@media (max-width: 700px) {
  #unity-status { padding: 8vh 4vw 6vh; }
  .offline-logo { width: 80vw; padding: 8px 12px 18px; }
  .offline-logo span { font-size: 14vw; }
  .loading-panel { width: 100%; --loading-cut: 18px; }
  .loading-panel-inner { padding: 18px 20px; }
  #loading-title { font-size: clamp(20px, 5.5vw, 32px); }
  .loading-footer { gap: 10px; }
}
@media (max-height: 600px) {
  #unity-status { padding-top: 4vh; padding-bottom: 4vh; }
  .offline-logo { width: min(44vw, 600px); padding: 4px 16px 12px; }
  .offline-logo span { font-size: min(7vw, 20vh); }
  .loading-panel-inner { padding-top: 12px; padding-bottom: 12px; }
  #loading-title { font-size: clamp(22px, 3vw, 36px); margin-bottom: 10px; }
  .loading-labels { font-size: 18px; margin-bottom: 8px; }
  .loading-footer { font-size: 16px; margin-top: 8px; }
}
@media (max-height: 360px) {
  #unity-status { padding: 8px 4vw; }
  .offline-logo { padding: 2px 12px 8px; }
  .offline-logo span { font-size: 14vh; }
  .loading-panel { width: min(90vw, 1000px); }
  .loading-panel-inner { padding: 8px 24px; }
  #loading-title { font-size: 20px; margin-bottom: 6px; }
  #loading-progress { height: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  #unity-status { transition: none; }
  .loading-dots i, [data-state="preparing"] .loading-fill::before { animation: none; }
}
