:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #201a17;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 223, 116, 0.24), transparent 38%),
    #201a17;
}

button {
  font: inherit;
}

.game-frame {
  position: relative;
  isolation: isolate;
  width: min(100vw, calc(100svh * 750 / 1334));
  height: min(100svh, calc(100vw * 1334 / 750));
  overflow: hidden;
  background: #fff8d6;
  box-shadow: 0 0 3rem rgba(0, 0, 0, 0.45);
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: #fff8d6;
  touch-action: none;
}

.loading-screen,
.error-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #5f2d20;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.88), transparent 20%),
    linear-gradient(180deg, #fff8cf, #f5bd54);
  text-align: center;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.loading-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-icon {
  width: clamp(5.5rem, 25vw, 8.5rem);
  height: auto;
  border: 0.35rem solid rgba(255, 255, 255, 0.72);
  border-radius: 26%;
  box-shadow: 0 0.7rem 1.6rem rgba(107, 56, 23, 0.24);
}

.loading-title {
  margin-top: 1.5rem;
  font-size: clamp(1.7rem, 8vw, 2.7rem);
  letter-spacing: 0.08em;
}

.loading-track {
  width: min(76%, 19rem);
  height: 0.85rem;
  margin-top: 1.5rem;
  overflow: hidden;
  border: 0.18rem solid #873f27;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
}

.loading-progress {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f35141, #ff9e32);
  transition: width 180ms ease;
}

.loading-status {
  min-height: 1.5em;
  margin-top: 0.9rem;
  font-size: clamp(0.82rem, 3.5vw, 1rem);
  font-weight: 700;
}

.error-panel[hidden] {
  display: none;
}

.error-panel {
  z-index: 30;
  gap: 0.85rem;
  background: rgba(255, 247, 222, 0.98);
}

.error-panel strong {
  color: #b42d29;
  font-size: 1.5rem;
}

.error-panel p {
  max-width: 25rem;
  margin: 0;
  color: #684139;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.error-panel button {
  padding: 0.72rem 1.45rem;
  border: 0.16rem solid #843f27;
  border-radius: 999px;
  color: #fff;
  background: #ef5145;
  box-shadow: 0 0.3rem 0 #843f27;
  font-weight: 800;
  cursor: pointer;
}

.game-controls {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.round-control {
  position: absolute;
  top: max(0.7rem, env(safe-area-inset-top));
  display: grid;
  width: clamp(2.55rem, 11vw, 3.25rem);
  aspect-ratio: 1;
  place-items: center;
  border: 0.16rem solid rgba(86, 49, 32, 0.86);
  border-radius: 50%;
  color: #5a3021;
  background: rgba(255, 244, 197, 0.9);
  box-shadow: 0 0.24rem 0.55rem rgba(73, 42, 21, 0.27);
  font-size: clamp(1.35rem, 5.5vw, 1.7rem);
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  backdrop-filter: blur(5px);
}

.round-control[hidden] {
  display: none;
}

.round-control:focus-visible {
  outline: 0.2rem solid #fff;
  outline-offset: 0.15rem;
}

.home-control {
  left: max(0.7rem, env(safe-area-inset-left));
}

.fullscreen-control {
  right: max(0.7rem, env(safe-area-inset-right));
}

@media (display-mode: fullscreen) {
  .game-frame {
    box-shadow: none;
  }
}
