/* Match the recovered 480px Windows Phone screen, without its system chrome. */
:root {
  color-scheme: dark;
  --app-background: #000;
  --app-foreground: #fff;
  --app-muted: #b5b5b5;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--app-foreground);
  background: var(--app-background);
  scrollbar-color: #666 var(--app-background);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* A tight grip mid-swing must not double-tap zoom; pinch zoom still works. */
html { touch-action: manipulation; }
body {
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
::selection { color: var(--app-background); background: var(--app-foreground); }
a { color: inherit; text-underline-offset: .15em; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; border-radius: 0; }
button:disabled { cursor: default; opacity: .6; }
:focus-visible { outline: 2px dashed var(--app-foreground); outline-offset: 5px; }
/* The dialog's ok button is focused on arrival so Enter works, and browsers
   then show its ring before anyone has touched a key. whip-app.js marks the
   page once a key is pressed; until then, phones and mice see no ring. */
html:not([data-keyboard]) #welcome-ok:focus-visible { outline: none; }

.phone-app {
  width: min(100%, 480px);
  min-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  min-height: calc(100svh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin-inline: auto;
  padding: .85em 1.2em .6em;
  font-size: min(4.1667vw, 20px);
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  /* Like the native app: a palm on the screen selects no text and opens no image menu. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.phone-app h1 { font: inherit; margin: 0 0 2em; }
.phone-app:focus { outline: none; }
.instructions { margin: 0 0 1.8em; }
.gesture-diagrams { display: grid; grid-template-columns: 1fr 1fr; }
.gesture-diagrams figure { margin: 0; text-align: center; }
.gesture-diagrams img { display: block; width: auto; height: 7.6em; max-width: 100%; margin-inline: auto; object-fit: contain; }
.gesture-diagrams figcaption { margin-top: 1.2em; text-decoration-thickness: 2px; text-underline-offset: .35em; }
.gesture-diagrams [data-active="true"] figcaption { text-decoration-line: underline; }
.crack-action {
  flex: 1;
  min-height: 13.4em;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: 1em;
}
.crack-button, #motion-button, #welcome-ok {
  width: 100%;
  min-height: max(44px, 2.4em);
  padding: .18em .5em;
  border: 3px solid var(--app-foreground);
  background: transparent;
  font-size: 1.1em;
  font-weight: 600;
}
.crack-button:hover:not(:disabled), #motion-button:hover:not(:disabled), #welcome-ok:hover { background: #202020; }
.crack-button:active:not(:disabled), #motion-button:active:not(:disabled), #welcome-ok:active { color: var(--app-background); background: var(--app-foreground); }
.sound-status, .motion-status, .no-script-note { margin: .8em 0; font-size: .75em; line-height: 1.5; }
.sound-status:not([data-error="true"]) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.motion-notice { margin-top: .5em; }
#motion-button { min-height: 44px; border-width: 2px; font-size: .8em; }
.audio-fallback { margin-top: .8em; }
audio { display: block; width: 100%; }
.original-credit p { margin: 0; }
.original-credit a { display: inline-block; }

/* Only with ?debug in the URL. Never blocks taps on the app underneath. */
.debug-display {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  margin: 0;
  padding: max(8px, env(safe-area-inset-top)) 10px 8px;
  color: #fff;
  background: #000;
  border-bottom: 1px solid #555;
  font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre;
  overflow: hidden;
  pointer-events: none;
}

#welcome-dialog {
  width: min(calc(100% - 32px), 480px);
  max-width: none;
  margin: auto;
  padding: 24px;
  border: 0;
  border-radius: 0;
  color: var(--app-foreground);
  background: #1f1f1f;
  font-size: 20px;
  line-height: 1.35;
}
#welcome-dialog::backdrop { background: rgb(0 0 0 / 70%); }
#welcome-title { margin: 0 0 16px; font-size: 28px; font-weight: 400; }
#welcome-description { margin: 0 0 24px; }
#welcome-ok:hover { background: #333; }

@media (forced-colors: active) {
  .gesture-diagrams img { forced-color-adjust: none; background: #000; }
}
