:root {
  --night: #1b1f4b;
  --gold: #f4c542;
  --text: #fffaf0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #6495ed; /* cornflower blue, the calendar's clear colour */
  color: var(--text);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#calendar {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  text-align: center;
  z-index: 10;
}

.overlay[hidden] {
  display: none;
}

/* Start screen: browsers only allow sound after a tap */
#start {
  background: radial-gradient(circle at 50% 30%, #2d3478, var(--night));
}

#start h1 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
}

.start-dorothy {
  width: clamp(80px, 22vh, 180px);
  height: auto;
}

#start-button {
  font: inherit;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: bold;
  color: var(--night);
  background: var(--gold);
  border: none;
  border-radius: 999px;
  padding: 0.7em 1.6em;
  box-shadow: 0 4px 0 #b88f1d;
  cursor: pointer;
}

#start-button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.error {
  max-width: 32em;
  margin: 0;
}

/* Video */
.video {
  background: #000;
  padding: 0;
  z-index: 20;
}

.video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.close {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: max(10px, env(safe-area-inset-left));
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 30px;
  line-height: 44px;
  cursor: pointer;
}

/* Short messages, e.g. a locked door */
.toast {
  position: fixed;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  max-width: 80vw;
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(27, 31, 75, 0.92);
  border: 3px solid var(--gold);
  font-size: clamp(1rem, 2.6vw, 1.3rem);
  z-index: 15;
}

.toast[hidden] {
  display: none;
}

/* Portrait: the calendar is landscape only, like the native app */
.rotate {
  display: none;
  background: var(--night);
  z-index: 30;
}

@media (orientation: portrait) {
  .rotate {
    display: flex;
  }
}

.rotate p {
  font-size: 1.2rem;
  max-width: 16em;
}

.rotate-phone {
  width: 48px;
  height: 84px;
  border: 4px solid var(--text);
  border-radius: 10px;
  animation: rotate-hint 2s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%, 30% { transform: rotate(0deg); }
  60%, 100% { transform: rotate(-90deg); }
}
