:root {
  color-scheme: dark;
  --bg: #000;
  --text: #fff;
  --dim: #747474;
  --line: #fff;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Courier New", "Miriam Mono CLM", "Noto Sans Hebrew", monospace;
  letter-spacing: 0;
}

button {
  font: inherit;
  letter-spacing: 0;
}

.is-hidden {
  display: none !important;
}

.loader-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: center;
  gap: 10px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}

.loader-screen p {
  margin: 0;
  font-size: 14px;
  line-height: 1;
}

.screen {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 32px 18px;
}

.landing,
.experience {
  display: flex;
  width: 100%;
  min-height: calc(100vh - 64px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.landing h1 {
  margin: 0;
  font-size: clamp(52px, 12vw, 150px);
  font-weight: 400;
  line-height: 0.92;
  text-align: center;
}

.landing-portrait {
  display: block;
  width: min(30vw, 310px);
  max-height: 44vh;
  height: auto;
  object-fit: contain;
}

.portrait {
  display: block;
  width: min(34vw, 390px);
  max-height: 62vh;
  height: auto;
  object-fit: contain;
  transition: filter 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.choice-panel {
  display: grid;
  width: min(52vw, 620px);
  gap: 12px;
}

.prompt-line {
  margin: 0 0 2px;
  color: var(--text);
  font-size: 14px;
  line-height: 1;
  text-align: center;
}

.options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.options button,
.start-button,
.restart-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  line-height: 1.1;
  text-align: center;
}

.options button {
  padding: 10px 8px;
}

.options button:hover,
.options button:focus-visible,
.start-button:hover,
.start-button:focus-visible,
.restart-button:hover,
.restart-button:focus-visible {
  background: var(--text);
  color: var(--bg);
  outline: none;
}

.options button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.start-button {
  min-width: 120px;
  padding: 10px 18px;
}

.is-transforming .portrait {
  animation: transformPulse 760ms steps(5, end) both;
}

.is-transforming .choice-panel::before {
  content: "משתנה";
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 12px;
  line-height: 1;
  text-align: center;
  animation: textBlink 160ms steps(2, end) infinite;
}

.is-final .options {
  display: none;
}

.restart-button {
  display: none;
  justify-self: center;
  min-width: 120px;
  padding: 10px 14px;
}

.is-final .restart-button {
  display: block;
}

@media (max-width: 760px) {
  .screen {
    justify-content: flex-start;
    gap: 22px;
    padding-top: 28px;
  }

  .landing,
  .experience {
    min-height: calc(100vh - 56px);
    gap: 20px;
  }

  .landing h1 {
    font-size: clamp(48px, 16vw, 92px);
  }

  .landing-portrait {
    width: min(68vw, 330px);
    max-height: 48vh;
  }

  .portrait,
  .choice-panel {
    width: min(92vw, 520px);
  }

  .portrait {
    width: min(72vw, 360px);
    max-height: 58vh;
  }

  .options {
    grid-template-columns: 1fr 1fr;
  }
}

@keyframes transformPulse {
  0% {
    filter: none;
    opacity: 1;
    transform: translateX(0) scale(1);
  }

  20% {
    filter: invert(1) contrast(2);
    opacity: 0.72;
    transform: translateX(-9px) scale(1.015);
  }

  40% {
    filter: grayscale(1) contrast(2.6);
    opacity: 0.88;
    transform: translateX(7px) scale(0.985);
  }

  60% {
    filter: invert(1) grayscale(1);
    opacity: 0.66;
    transform: translateX(12px) scale(1.025);
  }

  80% {
    filter: contrast(3) brightness(1.5);
    opacity: 0.9;
    transform: translateX(-5px) scale(1);
  }

  100% {
    filter: none;
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes textBlink {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}
