/* ART DIRECTOR'S FILE. Page styling: the letterboxed 16:9 stage, the arcade
   link, and the "turn me sideways" card, in the game's palette (see the art
   notes in design/design.md). Everything a finger can touch is at least
   44 CSS px tall, round, cream-rimmed and ink-outlined, like the canvas buttons. */
:root {
  --plum: #2a1830;
  --plum-hi: #4a2a52;
  --cream: #fff4dc;
  --ink: #2a1830;
  --red: #e23a3a;
  --red-deep: #a8202c;
  --gold: #ffc531;
  --green: #2fa05a;
  --vh: 100vh;
  /* Safe-area insets in one place: the body padding and the #stage size
     limits must both use these, or the stage stops being 16:9. */
  --inset-t: env(safe-area-inset-top, 0px);
  --inset-r: env(safe-area-inset-right, 0px);
  --inset-b: env(safe-area-inset-bottom, 0px);
  --inset-l: env(safe-area-inset-left, 0px);
}
@supports (height: 100dvh) {
  :root { --vh: 100dvh; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, var(--plum-hi), var(--plum) 70%);
  font-family: "Trebuchet MS", "Comic Sans MS", system-ui, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: none;
}

body {
  height: var(--vh);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--inset-t) var(--inset-r) var(--inset-b) var(--inset-l);
}

#stage {
  position: relative;
  width: 100%;
  height: 100%;
  /* 16:9 inside the body's content box (viewport minus safe-area insets). */
  max-width: calc((var(--vh) - var(--inset-t) - var(--inset-b)) * 16 / 9);
  max-height: calc((100vw - var(--inset-l) - var(--inset-r)) * 9 / 16);
  margin: auto;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.arcade-link {
  display: none;
  position: fixed;
  top: max(env(safe-area-inset-top, 0px), 0.4rem);
  left: max(env(safe-area-inset-left, 0px), 0.4rem);
  z-index: 20;
  align-items: center;
  gap: 0.2em;
  min-height: 44px;
  padding: 0.3em 0.8em;
  border-radius: 999px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 3px var(--cream), 0 4px 0 3px rgba(20, 8, 24, 0.35);
  color: var(--ink);
  font-weight: bold;
  font-size: 1rem;
  text-decoration: none;
}
.arcade-link.show { display: inline-flex; }
.arcade-link:hover,
.arcade-link:focus-visible { background: var(--gold); outline: none; }

#rotate-hint {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 28px;
  text-align: center;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 200, 110, 0.18), transparent 60%),
    linear-gradient(var(--plum-hi), var(--plum));
  z-index: 30;
}
#rotate-hint p {
  margin: 0;
  font-size: 28px;
  font-weight: bold;
  text-shadow: 0 3px 0 var(--ink);
}
.rotate-phone {
  font-size: 84px;
  animation: tip 2.4s ease-in-out infinite;
}
@keyframes tip {
  0%, 30% { transform: rotate(0deg); }
  55%, 85% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .rotate-phone { animation: none; }
}
#rotate-anyway {
  font: inherit;
  font-size: 22px;
  font-weight: bold;
  min-height: 56px;
  padding: 12px 30px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--red);
  color: var(--cream);
  box-shadow: 0 0 0 4px var(--cream), 0 6px 0 4px var(--red-deep);
  text-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
}
#rotate-anyway:focus-visible { box-shadow: 0 0 0 4px var(--cream), 0 0 0 10px var(--gold); outline: none; }
@media (pointer: coarse) and (orientation: portrait) and (max-width: 1100px) {
  #rotate-hint:not(.dismissed) { display: flex; }
}
