@font-face {
  font-family: gt_eesti_displayultra_bold;
  src:
    url(/build/assets/GT-Eesti-Display-Ultra-Bold-B9ghiBl0.woff2) format("woff2"),
    url(/build/assets/GT-Eesti-Display-Ultra-Bold-CAgK4ZoB.woff) format("woff");
  font-weight: bolder;
  font-style: normal;
  font-display: swap;
}

:root {
  --display: gt_eesti_displayultra_bold, "Inter", system-ui, sans-serif;
  --pink: #fcc6d6; /* backdrop pink */
  --pink-deep: #f7a8c0;
  --ink: #1f1f1f; /* near-black brand ink */
  --white: #ffffff;
  --shadow: rgba(31, 31, 31, 0.18);
  font-size: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--pink);
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

/* ---------- Screen system ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}
.screen.is-active {
  display: flex;
}

/* Fullscreen 16:9 friendly. Everything scales from viewport. */

/* ========================================================= */
/* GALLERY / IDLE SCREEN                                      */
/* ========================================================= */
#screen-gallery {
  flex-direction: column;
}
.gallery-bg {
  position: absolute;
  inset: 0;
  background: var(--pink);
  z-index: 0;
}
.gallery-logo {
  position: absolute;
  top: 4vh;
  left: 4vh;
  height: clamp(34px, 5vh, 64px);
  width: auto;
  z-index: 3;
}
.floating-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.floating-doodle {
  position: absolute;
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 10px 30px var(--shadow);
  padding: 6px 6px 22px 6px;
  will-change: transform;
}
.floating-doodle img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.floating-doodle .fd-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.gallery-overlay {
  position: relative;
  z-index: 2;
  text-align: center;
  pointer-events: none;
  padding: 0 4vw;
  text-shadow: 0 2px 18px rgba(252, 198, 214, 0.65);
}
.gallery-title {
  font-family: var(--display);
  font-size: clamp(2.5rem, 6vw, 5.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 0.95;
}
.gallery-sub {
  font-family: var(--display);
  margin-top: 1rem;
  font-size: clamp(1rem, 1.8vw, 1.6rem);
  font-weight: 600;
}

.btn-get-drawing {
  position: absolute;
  bottom: 4vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 1.1rem 3.2rem;
  font-family: inherit;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 12px 34px var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn-get-drawing:hover {
  transform: translateX(-50%) translateY(-3px);
  box-shadow: 0 18px 40px var(--shadow);
}
.btn-get-drawing:active {
  transform: translateX(-50%) translateY(0);
}

/* ========================================================= */
/* START / DETAILS SCREEN                                    */
/* ========================================================= */
#screen-start {
  background: var(--pink);
  position: relative;
  overflow: hidden;
}
/* Randomly scattered sample doodles behind the details card so people
   see the kind of drawing we expect. Positions are injected by JS. */
.start-scatter {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.start-scatter img {
  position: absolute;
  width: var(--w, 180px);
  height: auto;
  opacity: 0.18;
  transform: rotate(var(--r, 0deg));
}
.card {
  position: relative;
  z-index: 1;
  width: min(92vw, 460px);
  background: var(--white);
  border-radius: 28px;
  padding: 3rem 2.6rem 2.4rem;
  box-shadow: 0 24px 70px var(--shadow);
  text-align: center;
}
.card-logo {
  height: 34px;
  width: auto;
  margin: 0 auto 1.6rem;
  display: block;
}
.card-title {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.card-sub {
  margin-top: 0.5rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: #6b6b6b;
}
.details-form {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  text-align: left;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.field-label {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.field input {
  font-family: inherit;
  font-size: 1.1rem;
  padding: 0.9rem 1.1rem;
  border: 2px solid #ededed;
  border-radius: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}
.field input:focus {
  border-color: var(--pink-deep);
}
.form-error {
  color: #c0223b;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 1.1rem;
}
.btn-primary {
  margin-top: 0.4rem;
  background: var(--ink);
  color: var(--white);
  border: none;
  border-radius: 999px;
  padding: 1.1rem 2rem;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
}
.btn-text {
  margin-top: 1.2rem;
  background: none;
  border: none;
  color: #9a9a9a;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-text:hover {
  color: var(--ink);
}

/* ========================================================= */
/* GAME SCREEN                                               */
/* ========================================================= */
#screen-game {
  background: var(--pink);
  flex-direction: column;
}
.game-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4vh;
}
.game-topbar {
  width: 700px;
  max-width: 92vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.player-tag {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.timer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  height: 64px;
  padding: 0 1.1rem;
  background: var(--ink);
  color: var(--white);
  border-radius: 16px;
  box-shadow: 0 10px 26px var(--shadow);
}
.timer-num {
  font-size: 2.4rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.timer.is-low {
  background: #c0223b;
  animation: pulse 0.6s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.canvas-wrap {
  position: relative;
  width: 700px;
  height: 700px;
  max-width: 92vw;
  max-height: 78vh;
  aspect-ratio: 1 / 1;
}
#canvas {
  width: 100%;
  height: 100%;
  background: var(--white);
  border-radius: 18px;
  box-shadow: 0 18px 50px var(--shadow);
  touch-action: none;
  cursor: crosshair;
}
.canvas-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border-radius: 18px;
  background: rgba(252, 198, 214, 0.72);
  backdrop-filter: blur(2px);
}
.canvas-overlay.is-hidden {
  display: none;
}
.overlay-text {
  font-size: clamp(3rem, 12vw, 11rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ink);
  text-align: center;
  line-height: 0.9;
}

/* countdown number animation: shrink onto screen */
.countdown-num {
  display: inline-block;
  animation: shrinkIn 1s ease forwards;
}
@keyframes shrinkIn {
  0% {
    transform: scale(3.4);
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.pop-text {
  display: inline-block;
  animation: popIn 0.5s cubic-bezier(0.17, 0.84, 0.44, 1) forwards;
}
@keyframes popIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ========================================================= */
/* RESULT SCREEN                                             */
/* ========================================================= */
#screen-result {
  flex-direction: column;
}
.result-bg {
  position: absolute;
  inset: 0;
  background: var(--pink);
  z-index: 0;
}
.result-logo {
  position: absolute;
  top: 4vh;
  left: 4vh;
  height: clamp(34px, 5vh, 64px);
  width: auto;
  z-index: 3;
}
.result-stage {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
}
.result-frame {
  background: var(--white);
  border-radius: 22px;
  padding: 14px;
  box-shadow: 0 26px 70px var(--shadow);
}
.result-img {
  display: block;
  width: min(62vh, 560px);
  height: min(62vh, 560px);
  object-fit: contain;
  border-radius: 12px;
}
.result-name {
  font-family: var(--display);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 16px rgba(252, 198, 214, 0.7);
}
.result-status {
  font-family: var(--display);
  font-size: clamp(1.1rem, 2.4vw, 2rem);
  font-weight: 700;
  color: var(--ink);
  opacity: 0.85;
}

/* The "fly down into the gallery" animation is handled via JS transforms. */
.flying {
  position: fixed;
  z-index: 50;
  transition: all 1s cubic-bezier(0.5, 0, 0.2, 1);
  background: var(--white);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 14px 40px var(--shadow);
}
.flying img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
