@font-face {
  font-family: "Kenney Future";
  src: url("./assets/fonts/kenney-future.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "Kenney Future", Arial, Helvetica, sans-serif;
  background: #f4ead7;
  color: #2f2118;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button {
  font: inherit;
}

.game-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.game-shell {
  width: min(1100px, 100%);
}

.game-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #8a5a2b;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
}

.kids-mode-link {
  display: inline-flex;
  margin-bottom: 12px;
  border: 1px solid #6d4427;
  border-radius: 999px;
  background: #fff8e8;
  color: #6d4427;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 14px;
  text-decoration: none;
}

.kids-mode-link:hover,
.kids-mode-link:focus-visible {
  background: #6d4427;
  color: white;
}

.game-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.game-stats span {
  border: 1px solid #bd8c50;
  border-radius: 999px;
  background: #fff8e8;
  padding: 8px 14px;
}

.pause-button {
  border: 1px solid #6d4427;
  border-radius: 999px;
  background: #6d4427;
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 16px;
}

.pause-button:hover,
.pause-button:focus-visible {
  background: #8a5a2b;
}

.pause-button[hidden] {
  display: none;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border: 5px solid #6d4427;
  border-radius: 18px;
  background: #c6e5ef;
  box-shadow: 0 18px 40px rgb(65 40 20 / 18%);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 10 / 7;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  background: rgb(35 24 15 / 55%);
  color: white;
  text-align: center;
  padding: 24px;
}

.game-overlay[hidden] {
  display: none;
}

.history-scroll-overlay {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(19 15 11 / 65%);
  padding: 24px;
}

.history-scroll-overlay[hidden] {
  display: none;
}

.history-scroll-card {
  display: grid;
  width: min(620px, 92%);
  min-height: 390px;
  align-content: center;
  justify-items: center;
  background: url("./assets/images/history-scroll.png") center / 100% 100% no-repeat;
  color: #392312;
  text-align: center;
  padding: 90px 95px;
}

.history-scroll-card h2 {
  margin: 0 0 14px;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
}

.history-scroll-card p {
  max-width: 380px;
  margin: 0 0 14px;
  line-height: 1.5;
}

.history-scroll-card .history-scroll-status:empty {
  display: none;
}

.history-scroll-text {
  width: 100%;
  max-height: 210px;
  overflow-y: auto;
  padding: 0 12px 6px;
  scrollbar-color: #8f5a22 rgb(255 245 194 / 60%);
  scrollbar-width: thin;
  overscroll-behavior: contain;
}

.history-scroll-text::-webkit-scrollbar {
  width: 9px;
}

.history-scroll-text::-webkit-scrollbar-track {
  background: rgb(255 245 194 / 60%);
  border-radius: 999px;
}

.history-scroll-text::-webkit-scrollbar-thumb {
  background: #8f5a22;
  border-radius: 999px;
}

.history-scroll-source {
  color: #704015;
  font-weight: 800;
  margin: 0 0 18px;
}

.history-scroll-source:hover,
.history-scroll-source:focus-visible {
  color: #a45414;
}

.history-scroll-source[hidden] {
  display: none;
}

.game-overlay h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 6vw, 4rem);
}

.game-overlay p {
  margin: 0 0 24px;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.overlay-button {
  border: 3px solid #4d301c;
  border-radius: 12px;
  background: #d89324 url("./assets/ui/button-yellow.png") center / 100% 100% no-repeat;
  color: #20150d;
  cursor: pointer;
  font-weight: 800;
  padding: 12px 28px;
}

.overlay-button:hover,
.overlay-button:focus-visible {
  background: #f2b43f;
}

.overlay-button[hidden] {
  display: none;
}

.secondary-button {
  background: #477c91;
  background-image: none;
  color: white;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  background: #5b94aa;
}

.game-help {
  margin: 12px 0 0;
  text-align: center;
}

@media (max-width: 700px) {
  .game-header {
    align-items: start;
    flex-direction: column;
  }

  .history-scroll-card {
    min-height: 320px;
    padding: 70px 55px;
  }

  .history-scroll-text {
    max-height: 170px;
  }
}
