/* ============================================================================
   Antonyo's Pizza — Design System Styles (see DESIGN.md)
   Palette:
     outline:        #1A1A1F
     bg-main:        #F7E7C6
     surface-base:   #FFF4DA
     surface-raised: #F2C66D
     surface-dark:   #293D57
     accent-primary: #F08A24
     accent-second:  #E84E3C
     accent-pos:     #73C759
     accent-sun:     #FCD159
   ============================================================================ */

@font-face {
  font-family: 'Baloo 2';
  src: url('../assets/fonts/Baloo2.ttf') format('truetype');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Nunito Sans';
  src: url('../assets/fonts/NunitoSans.ttf') format('truetype');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --outline: #1A1A1F;
  --bg-main: #F7E7C6;
  --surface-base: #FFF4DA;
  --surface-raised: #F2C66D;
  --surface-dark: #293D57;
  --accent-primary: #F08A24;
  --accent-secondary: #E84E3C;
  --accent-positive: #73C759;
  --accent-sun: #FCD159;
  --text-primary: #1A1A1F;
  --text-inverse: #FFF4DA;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-main);
  background-image:
    radial-gradient(circle at 18% 20%, rgba(255, 244, 218, 0.7) 0%, transparent 45%),
    radial-gradient(circle at 82% 80%, rgba(242, 198, 109, 0.35) 0%, transparent 50%);
  font-family: 'Nunito Sans', system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  touch-action: none;
  overscroll-behavior: none;
}

#app-shell {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  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);
}

#stage-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#game-canvas {
  display: block;
  background: var(--surface-base);
  border: 4px solid var(--outline);
  border-radius: 16px;
  box-shadow:
    0 14px 36px rgba(26, 26, 31, 0.22),
    0 4px 0 var(--outline);
  touch-action: none;
  cursor: pointer;
}

@media (max-width: 1024px), (pointer: coarse) {
  #game-canvas {
    border-radius: 0;
    border-width: 0;
    box-shadow: none;
  }
}

/* Loading Overlay */
#loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(247, 231, 198, 0.94);
  z-index: 50;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  background: var(--surface-base);
  border: 5px solid var(--outline);
  border-radius: 16px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 10px 12px 0 rgba(26, 26, 31, 0.16);
  max-width: 460px;
  width: 90%;
}

.loading-pizza-spinner {
  font-size: 68px;
  display: inline-block;
  animation: pizzaBounce 1.1s infinite ease-in-out;
}

@keyframes pizzaBounce {
  0%, 100% { transform: translateY(0) rotate(-8deg) scale(1); }
  50% { transform: translateY(-14px) rotate(10deg) scale(1.1); }
}

.loading-title {
  font-family: 'Baloo 2', cursive, sans-serif;
  font-weight: 800;
  font-size: 40px;
  color: var(--text-primary);
  margin-top: 8px;
}

.loading-subtitle {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: #5F6274;
  margin: 6px 0 18px;
}

.loading-bar-track {
  width: 100%;
  height: 22px;
  background: #E8D5B0;
  border: 3.5px solid var(--outline);
  border-radius: 999px;
  overflow: hidden;
}

.loading-bar-fill {
  width: 15%;
  height: 100%;
  background: var(--accent-positive);
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* Recovery screen: icon-first so a non-reader knows what to tap */
#oops {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-main);
}

#oops[hidden] {
  display: none;
}

.oops-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  background: var(--surface-base);
  border: 5px solid var(--outline);
  border-radius: 4px;
  padding: 32px 48px;
  box-shadow: 10px 12px 0 rgba(26, 26, 31, 0.16);
}

.oops-icon {
  font-size: 96px;
  line-height: 1;
}

#oops-btn {
  min-width: 160px;
  min-height: 160px;
  font-size: 84px;
  line-height: 1;
  color: var(--outline);
  background: var(--accent-positive);
  border: 5px solid var(--outline);
  border-radius: 4px;
  cursor: pointer;
}

.oops-text {
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 700;
  font-size: 19px;
  color: #5F6274;
}

/* Portrait Orientation Hint Banner */
#portrait-hint {
  position: fixed;
  bottom: max(12px, env(safe-area-inset-bottom, 12px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 45;
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--surface-dark);
  color: var(--text-inverse);
  border: 3.5px solid var(--outline);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 5px 0 var(--outline);
  max-width: 94vw;
  white-space: nowrap;
}

#portrait-dismiss {
  background: var(--accent-primary);
  color: var(--text-primary);
  border: 2.5px solid var(--outline);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-weight: 800;
  cursor: pointer;
}

@media (orientation: portrait) and (max-width: 768px) {
  #portrait-hint:not(.dismissed) {
    display: inline-flex;
  }
}

@media (prefers-reduced-motion: reduce){ .loading-pizza-spinner{animation:none} }
