:root {
  color-scheme: light;

  /* Morning Light palette */
  --bg-light: #fdfbf7;
  --bg-warm: #f8f5f0;
  --card-white: #ffffff;
  --card-border: #e8e4de;
  --terracotta: #c45d3a;
  --terracotta-light: #d97b5c;
  --sage: #7d9a78;
  --charcoal: #2c2c2c;
  --brown: #6b5b4f;
  --muted: #9a8f85;

  /* Safe area insets for notched devices */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  /* Prevent iOS bounce scrolling */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", sans-serif;
  background: var(--bg-light);
  overflow: hidden;
  display: grid;
  place-items: center;
  /* Account for safe areas */
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

.frame-glow {
  display: none; /* Removed for minimal design */
}

.app-shell {
  position: relative;
  width: min(96vw, 1380px);
  max-height: calc(100vh - var(--safe-top) - var(--safe-bottom) - 20px);
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 20px);
  padding: 0;
  border-radius: 16px;
  background: var(--card-white);
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--card-border);
}

.password-gate {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(253, 251, 247, 0.92);
  backdrop-filter: blur(6px);
}

.password-gate.is-hidden {
  display: none;
}

.password-card {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border-radius: 14px;
  background: var(--card-white);
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.password-card h1 {
  margin: 0;
  font-family: "Outfit", "Inter", sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--charcoal);
}

.password-card p {
  margin: 0;
  color: var(--brown);
}

.password-card label {
  font-size: 14px;
  font-weight: 600;
  color: var(--charcoal);
}

.password-card input {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  padding: 0 12px;
  font: 500 16px "Inter", "Segoe UI", sans-serif;
  color: var(--charcoal);
  background: #fffdfa;
}

.password-card input:focus {
  outline: 2px solid rgba(196, 93, 58, 0.25);
  border-color: var(--terracotta);
}

.password-card button {
  height: 44px;
  border-radius: 8px;
  border: none;
  background: var(--terracotta);
  color: #ffffff;
  font: 600 16px "Inter", "Segoe UI", sans-serif;
  cursor: pointer;
}

.password-error {
  min-height: 20px;
  font-size: 14px;
  color: #b4472a;
}

#game {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: var(--bg-light);
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Portrait orientation for mobile */
@media (orientation: portrait) {
  .app-shell {
    width: 100vw;
    max-height: calc(100vh - var(--safe-top) - var(--safe-bottom));
    max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  #game {
    aspect-ratio: 9 / 16;
    border-radius: 0;
  }

  .password-card {
    width: min(100%, 520px);
    padding: 26px;
  }

  .password-card h1 {
    font-size: 36px;
  }

  .password-card input,
  .password-card button {
    height: 50px;
    font-size: 18px;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: 100vw;
    border-radius: 0;
    border: none;
  }

  #game {
    border-radius: 0;
  }
}
