html,
body {
  padding: 0;
  margin: 0;
  min-height: 100%;
  font-family: Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.26), transparent 22%),
    linear-gradient(180deg, #87cff4 0%, #56acdd 100%);
}

body {
  color: #fff5df;
}

body.name-modal-open {
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

.page-shell {
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: 18px 16px 24px;
}

.play-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.back-link {
  color: #e3f7ff;
  text-decoration: none;
  font-weight: 700;
}

.back-link:hover {
  text-decoration: underline;
}

.play-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.play-badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 47, 66, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.play-title {
  font-weight: 700;
  color: #fff7e8;
}

.play-stage {
  display: flex;
  justify-content: center;
}

#unity-container {
  position: relative;
}

#unity-container.unity-desktop {
  width: min(1240px, calc(100vw - 32px));
}

#unity-container.unity-mobile {
  position: relative;
  width: min(calc(100vw - 28px), 960px);
  max-width: 100vw;
  margin: 0 auto 18px;
  aspect-ratio: 16 / 9;
}

#unity-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  background: #231f20;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 18px 40px rgba(7, 20, 31, 0.22);
}

.unity-fullscreen-fab {
  position: absolute;
  right: 14px;
  bottom: 64px;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(14, 45, 62, 0.9);
  box-shadow: 0 12px 28px rgba(7, 20, 31, 0.28);
  z-index: 4;
}

.unity-fullscreen-icon {
  position: relative;
  width: 22px;
  height: 22px;
}

.unity-fullscreen-icon::before,
.unity-fullscreen-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
}

.unity-fullscreen-icon::before {
  background:
    linear-gradient(#fff7e8, #fff7e8) left top / 8px 2px no-repeat,
    linear-gradient(#fff7e8, #fff7e8) left top / 2px 8px no-repeat,
    linear-gradient(#fff7e8, #fff7e8) right bottom / 8px 2px no-repeat,
    linear-gradient(#fff7e8, #fff7e8) right bottom / 2px 8px no-repeat;
}

.unity-fullscreen-icon::after {
  background:
    linear-gradient(#fff7e8, #fff7e8) right top / 8px 2px no-repeat,
    linear-gradient(#fff7e8, #fff7e8) right top / 2px 8px no-repeat,
    linear-gradient(#fff7e8, #fff7e8) left bottom / 8px 2px no-repeat,
    linear-gradient(#fff7e8, #fff7e8) left bottom / 2px 8px no-repeat;
}

.unity-mobile #unity-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 18px 18px 0 0;
}

#unity-container:fullscreen,
#unity-container:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  aspect-ratio: auto;
}

#unity-container:fullscreen #unity-canvas,
#unity-container:-webkit-full-screen #unity-canvas {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.unity-mobile .unity-fullscreen-fab {
  right: 14px;
  bottom: 14px;
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

#unity-loading-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
}

#unity-logo {
  width: 154px;
  height: 130px;
  background: url("unity-logo-dark.png") no-repeat center;
}

#unity-progress-bar-empty {
  width: 141px;
  height: 18px;
  margin-top: 10px;
  margin-left: 6.5px;
  background: url("progress-bar-empty-dark.png") no-repeat center;
}

#unity-progress-bar-full {
  width: 0%;
  height: 18px;
  margin-top: 10px;
  background: url("progress-bar-full-dark.png") no-repeat center;
}

#unity-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 50px;
  padding: 8px 14px 10px;
  border-radius: 0 0 22px 22px;
  background: rgba(14, 45, 62, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 0;
}

.unity-mobile #unity-footer {
  display: none;
}

#unity-footer-spacer {
  flex: 1;
}

#unity-build-title {
  color: #fff6e6;
  line-height: 38px;
  font-size: 16px;
}

#unity-fullscreen-button {
  cursor: pointer;
  width: 38px;
  height: 38px;
  background: url("fullscreen-button.png") no-repeat center;
}

#unity-warning {
  position: absolute;
  left: 50%;
  top: 4%;
  transform: translate(-50%);
  background: white;
  padding: 10px;
  display: none;
  z-index: 3;
}

.orientation-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 20, 31, 0.82);
  z-index: 30;
}

.orientation-overlay.hidden {
  display: none;
}

.orientation-card {
  width: min(360px, 100%);
  padding: 26px 22px 22px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(22, 57, 78, 0.98), rgba(15, 43, 59, 1));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 50px rgba(7, 20, 31, 0.32);
}

.orientation-card h2 {
  margin: 0 0 10px;
  font-size: 2rem;
  color: #fff5df;
}

.orientation-card p {
  margin: 0;
  color: rgba(255, 245, 223, 0.92);
  line-height: 1.55;
}

.name-modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 20, 31, 0.78);
  z-index: 35;
  overflow-y: auto;
}

.name-modal-backdrop.hidden {
  display: none;
}

.name-modal-card {
  width: min(420px, 100%);
  padding: 24px 22px 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(22, 57, 78, 0.98), rgba(15, 43, 59, 1));
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 50px rgba(7, 20, 31, 0.32);
}

.name-modal-card h2 {
  margin: 0 0 14px;
  text-align: center;
  font-size: 1.8rem;
  color: #fff5df;
}

.name-modal-help {
  margin: 0 0 14px;
  text-align: center;
  color: rgba(255, 245, 223, 0.88);
  line-height: 1.5;
}

.name-modal-input {
  width: 100%;
  max-width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 26, 37, 0.9);
  color: #fff7e8;
  font-size: 1.05rem;
  line-height: 1.2;
  outline: none;
}

.name-modal-input:focus {
  border-color: rgba(255, 208, 94, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 208, 94, 0.18);
}

.name-modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.name-modal-button {
  min-width: 132px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
}

.name-modal-button-primary {
  color: #0d2130;
  background: linear-gradient(180deg, #ffd66e, #ffbe37);
}

.name-modal-button-secondary {
  color: #eef9ff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

@media (max-width: 720px) {
  .page-shell {
    padding: 0 0 12px;
  }

  .play-topbar {
    padding: 12px 14px 0;
  }

  #unity-container.unity-desktop {
    width: 100vw;
  }

  .name-modal-card {
    width: min(92vw, 520px);
    padding: 28px 22px 24px;
    border-radius: 26px;
  }

  .name-modal-card h2 {
    font-size: 2rem;
  }

  .name-modal-help {
    font-size: 1rem;
  }

  .name-modal-input {
    min-height: 60px;
    font-size: 1.15rem;
    padding: 16px 18px;
  }

  .name-modal-actions {
    gap: 14px;
    margin-top: 20px;
  }

  .name-modal-button {
    min-width: 140px;
    min-height: 52px;
    font-size: 1.05rem;
  }
}

@media (max-width: 980px) and (orientation: landscape) {
  .play-stage {
    min-height: 100vh;
    align-items: flex-end;
    padding-bottom: 5vh;
  }

  .name-modal-backdrop {
    align-items: flex-start;
    padding: max(12px, env(safe-area-inset-top)) 14px 14px;
  }

  .name-modal-card {
    width: min(94vw, 560px);
    padding: 16px 16px 14px;
    border-radius: 18px;
  }

  .name-modal-card h2 {
    margin-bottom: 8px;
    font-size: 1.45rem;
  }

  .name-modal-help {
    margin-bottom: 10px;
    font-size: 0.92rem;
    line-height: 1.35;
  }

  .name-modal-input {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 1rem;
  }

  .name-modal-actions {
    margin-top: 12px;
    gap: 10px;
  }

  .name-modal-button {
    min-width: 120px;
    min-height: 46px;
    padding: 10px 14px;
    font-size: 0.98rem;
  }

  #unity-container.unity-mobile {
    width: 78vw;
    max-width: 78vw;
    margin: 0 auto;
  }
}
