@import url('https://fonts.googleapis.com/css2?family=DotGothic16&display=swap');

:root {
  --app-height: 100dvh;
}

html,
body {
  margin: 0;
  padding: 0;

  overflow: hidden;

  width: 100%;
  height: var(--app-height);

  background: #e7dcc3;

  font-family: monospace;

  touch-action: manipulation;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

.screen {
  width: 100vw;
  height: var(--app-height);

  overflow: hidden;
}

/* =========================
   TITLE
========================= */

#titleScreen {
  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: flex-start;

  padding-top: 18px;

  background:
    radial-gradient(circle at top,
      #fff8eb 0%,
      #dbc7a2 55%,
      #8f5c32 100%);
}

#titleImage {
  width: min(420px, 92vw);

  image-rendering: pixelated;

  user-select: none;
  -webkit-user-drag: none;
}

#guideText {
  margin-top: 28px;

  text-align: center;

  font-family: "DotGothic16", monospace;

  color: #2e1709;

  font-size: 16px;

  line-height: 1.8;

  padding: 0 12px;
}

#startButton {
  width: auto;

  min-width: 230px;

  margin-top: 24px;

  padding: 12px 20px;

  background: #fff4d0;

  color: #2a160b;
}

/* =========================
   GAME
========================= */

#gameScreen {
  display: flex;
  flex-direction: column;

  align-items: center;

  background:
    radial-gradient(circle at top,
      #fff8eb 0%,
      #dbc7a2 55%,
      #8f5c32 100%);
}

/* =========================
   TOP BAR
========================= */

#topBar {
  width: min(430px, 100vw);

  display: flex;

  justify-content: flex-end;

  padding: 8px 10px 0;

  flex-shrink: 0;
}

#titleBackButton {
  width: auto;

  min-width: 0;

  margin-top: 0;

  padding: 6px 10px;

  font-size: 12px;

  background: #fff4d0;

  color: #2a160b;

  border: 3px solid #2a160b;

  box-shadow: 2px 2px 0 #2a160b;
}

/* =========================
   HUD
========================= */

#hud {
  width: min(430px, 100vw);

  display: flex;

  justify-content: space-between;

  padding: 6px 18px 6px;

  color: #2a160b;

  font-size: 21px;

  font-weight: bold;

  text-shadow: 2px 2px #f7deb0;

  flex-shrink: 0;
}

canvas {
  width: auto;

  height: min(
    calc(var(--app-height) - 100px),
    760px
  );

  max-width: 100vw;

  background:
    linear-gradient(#f4d397, #bf7a35);

  image-rendering: pixelated;

  border-top: 5px solid #2a160b;

  border-bottom: 5px solid #2a160b;
}

/* =========================
   RESULT
========================= */

#resultScreen {
  overflow-y: auto;

  background:
    radial-gradient(circle at top,
      #fff8eb 0%,
      #dbc7a2 55%,
      #8f5c32 100%);

  color: #2a160b;
}

#resultInner {
  width: min(420px, 92vw);

  margin: 0 auto;

  padding: 18px 0 34px;

  text-align: center;
}

#resultInner h1 {
  margin: 0 0 8px;

  font-family: "DotGothic16", monospace;

  font-size: 34px;
}

#rankTitle {
  margin-bottom: 18px;

  font-family: "DotGothic16", monospace;

  font-size: 34px;

  line-height: 1.2;
}

#resultText {
  font-family: "DotGothic16", monospace;

  font-size: 16px;

  line-height: 1.55;
}

/* =========================
   RESULT BUTTONS
========================= */

.resultButtons {
  width: min(92%, 360px);

  display: grid !important;
  grid-template-columns: repeat(2, 1fr);

  gap: 10px;

  margin: 12px auto 0;

  opacity: 1;
  transform: translateY(0);

  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.resultButtons.hidden {
  display: grid !important;

  opacity: 0;
  transform: translateY(10px);

  pointer-events: none;
}

.resultButton {
  width: 100%;

  min-height: 56px;

  padding: 8px 6px;

  font-size: 17px;
}

/* =========================
   BUTTON
========================= */

button {
  display: block;

  padding: 12px 18px;

  border: 4px solid #2a160b;

  background: #b94b22;

  color: #fff4d0;

  font-family: "DotGothic16", monospace;

  font-size: 18px;

  box-shadow: 4px 4px 0 #2a160b;
}

button:active {
  transform: translate(4px, 4px);

  box-shadow: none;
}

button:disabled {
  opacity: 0.65;
}

@media (max-height: 760px) {

  #guideText {
    font-size: 14px;
  }

  #hud {
    font-size: 18px;
  }

  #resultInner h1 {
    font-size: 28px;
  }

  #rankTitle {
    font-size: 28px;
  }

  #resultText {
    font-size: 14px;
  }

  button {
    font-size: 16px;
  }

  .resultButton {
    min-height: 50px;
    font-size: 15px;
  }
}