@import url('https://fonts.googleapis.com/css2?family=Silkscreen:wght@400;700&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --screen: #E8E7D9;
  --lit: #23261C;
  --ghost: #C9C8B7;
  --secondary: #6E7263;
  --font-display: 'Silkscreen', 'Courier New', monospace;
  --font-body: 'Space Mono', 'Courier New', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  background: var(--screen);
  color: var(--lit);
  font-family: var(--font-body);
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Persistent scene above whichever screen is showing. */
#hill-stage {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: none;
  position: relative;
}

/* Sisyphus speaking, over the sky on the left where the hill never reaches. */
#speech {
  position: absolute;
  left: 13%;
  top: 22%;
  max-width: 56%;
  background: var(--screen);
  border: 2px solid var(--lit);
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.35;
  z-index: 2;
}

#speech::after {
  content: '';
  position: absolute;
  left: 14px;
  bottom: -10px;
  width: 10px;
  height: 10px;
  background: var(--screen);
  border-left: 2px solid var(--lit);
  border-bottom: 2px solid var(--lit);
}

#hill-container {
  display: flex;
  justify-content: center;
}

#hill-container svg {
  width: 100%;
  height: auto;
}

/* Pixel grid overlay, ~5% opacity, sits over the whole screen */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background-image:
    repeating-linear-gradient(0deg, rgba(35,38,28,0.05) 0px, rgba(35,38,28,0.05) 1px, transparent 1px, transparent 4px),
    repeating-linear-gradient(90deg, rgba(35,38,28,0.05) 0px, rgba(35,38,28,0.05) 1px, transparent 1px, transparent 4px);
}

button {
  font-family: var(--font-display);
  background: var(--screen);
  color: var(--lit);
  border: 2px solid var(--lit);
  border-radius: 0;
  padding: 14px 20px;
  font-size: 16px;
  cursor: pointer;
  min-height: 48px;
  box-shadow: none;
}

button:active {
  background: var(--lit);
  color: var(--screen);
}

button:disabled {
  opacity: 0.4;
  cursor: default;
}

.screen {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  gap: 16px;
}

/* Question screen: prompt sits under the hill, the answer controls are
   pushed toward the bottom of the screen where a thumb can reach them. */
#question-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#question-container > :last-child {
  margin-top: auto;
}

#question-container button {
  display: block;
  width: 100%;
}

#question-container input {
  display: block;
  width: 100%;
}

.answer-area {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Reveal screen: explanation up top, continue at the thumb. */
#btn-continue {
  margin-top: auto;
}

.hidden {
  display: none !important;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.label {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.prompt {
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.4;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  text-align: left;
  min-height: 48px;
  font-family: var(--font-body);
  font-size: 15px;
  white-space: normal;
}

.reveal-text {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--lit);
}

.share-block {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.2;
  white-space: pre;
  background: var(--ghost);
  padding: 12px;
  overflow-x: auto;
  flex: none; /* scrollable boxes shrink inside a flex column otherwise */
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* The one save, shown like an LCD indicator: lit while you have it,
   ghosted once it's been used. */
#save-indicator {
  color: var(--lit);
  border: 2px solid var(--lit);
  padding: 2px 6px;
}

#save-indicator.spent {
  color: var(--ghost);
  border-color: var(--ghost);
}

.mute-toggle {
  min-height: 40px;
  padding: 6px 10px;
  font-size: 12px;
}

input[type="text"], input[type="number"], input[type="email"] {
  font-family: var(--font-body);
  font-size: 16px;
  padding: 12px;
  border: 2px solid var(--lit);
  background: var(--screen);
  color: var(--lit);
  border-radius: 0;
  min-height: 48px;
  width: 100%;
}

.title-footer {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fact {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--lit);
  margin-top: 4px;
}

.tagline {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13px;
  color: var(--secondary);
  text-align: center;
  padding-top: 8px;
  border-top: 1px solid var(--ghost);
}

.result-badge {
  font-family: var(--font-display);
  font-size: 14px;
  padding: 2px 8px;
  border: 2px solid var(--lit);
  align-self: flex-start;
}

/* Mouse and trackpad: the one hover the design allows is an inverted block. */
@media (hover: hover) and (pointer: fine) {
  button:hover:not(:disabled) {
    background: var(--lit);
    color: var(--screen);
  }
}

/* Desktop. The phone layout pushes answers to the bottom of the viewport for
   thumb reach; on a tall window that strands them, so here everything sits
   under the hill and the hill is capped by height instead of width. */
@media (min-width: 760px) {
  #hill-stage,
  .screen {
    max-width: 680px;
  }

  #hill-stage {
    padding-top: 32px;
  }

  #hill-container svg {
    width: auto;
    height: 38vh;
    max-width: 100%;
  }

  .screen {
    padding: 16px 24px 40px;
  }

  #question-container {
    flex: none;
  }

  #question-container > :last-child {
    margin-top: 0;
  }

  #question-container .options,
  #question-container .answer-area,
  #question-container input,
  #question-container button {
    max-width: 560px;
  }

  #btn-continue {
    margin-top: 8px;
    align-self: flex-start;
    min-width: 220px;
  }

  #screen-results button,
  #screen-archive button,
  #screen-unavailable button,
  #screen-title button:not(.mute-toggle) {
    align-self: flex-start;
    min-width: 260px;
  }

  /* The results screen carries more below the hill, so it gets less of it. */
  body[data-screen="screen-results"] #hill-container svg {
    height: 26vh;
  }

  /* No hill on the title screen, so the footer follows the content instead
     of being stranded at the bottom of a tall window. */
  .title-footer {
    margin-top: 0;
    padding-top: 56px;
  }

  #signup-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
    max-width: 420px;
  }

  #signup-area input {
    max-width: 420px;
  }

  .prompt {
    font-size: 19px;
  }

  .reveal-text {
    font-size: 16px;
  }

  .share-block {
    align-self: flex-start;
  }
}
