@font-face {
  font-family: "Gluten-Bold";
  src: url("../assets/fonts/Gluten-Bold.ttf") format("truetype");
  font-display: swap;
}

:root {
  --paper: #f7f0e6;
  --cream: #fff8ec;
  --ink: #5a4652;
  --ink2: #8a7280;
  --coral: #f59a8f;
  --coral2: #f27c86;
  --sky: #a8d8f0;
  --sky2: #7cc0e6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
}

#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100vw;
  background: var(--paper);
  overflow: hidden;
}

.bar {
  flex: 0 0 auto;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  padding: 0 20px 0 16px;
  font-family: "Gluten-Bold", "Trebuchet MS", sans-serif;
  font-size: 17px;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  background: var(--coral);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.12s ease;
}

.play:hover { transform: translateY(-1px); }
.play:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.play .tri {
  width: 0;
  height: 0;
  border-left: 12px solid var(--ink);
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
}

@media (max-height: 520px) {
  .bar { height: 38px; }
  .play { height: 28px; font-size: 15px; }
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
  cursor: default;
  image-rendering: auto;
}

#ime {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  font-size: 16px;
  display: none;
  pointer-events: none;
}

#loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 18%, #ffffff 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(#dff0fa 0%, var(--paper) 62%);
  transition: opacity 0.5s ease;
}

#loader.done { opacity: 0; pointer-events: none; }

#loader .card {
  width: min(86vw, 420px);
  padding: 28px 28px 22px;
  text-align: center;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 6px 0 rgba(90, 70, 82, 0.25);
  transform: rotate(-1deg);
}

#loader .logo {
  display: block;
  margin: -64px auto 6px;
  width: 112px;
  height: 112px;
  animation: bob 2.2s ease-in-out infinite;
  filter: drop-shadow(0 4px 0 rgba(90, 70, 82, 0.22));
}

#loader .title {
  font-family: "Gluten-Bold", "Trebuchet MS", sans-serif;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: 1px;
  color: var(--coral2);
  -webkit-text-stroke: 2px var(--ink);
  paint-order: stroke fill;
  margin-bottom: 18px;
}

#loader .track {
  height: 20px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fbefdc;
  overflow: hidden;
}

#loader .fill {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(var(--sky), var(--sky2));
  transition: transform 0.12s linear;
}

#loader .row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-family: "Gluten-Bold", "Trebuchet MS", sans-serif;
  font-size: 17px;
  color: var(--ink2);
}

#loader.failed .fill { background: var(--coral); transform: scaleX(1) !important; }
#loader.failed #loadmsg { color: var(--coral2); }

.nojs {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  font: 20px sans-serif;
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
}

@media (prefers-reduced-motion: reduce) {
  #loader .logo { animation: none; }
}
