/* The marble run logo: the logo intro of a made-up wooden toy shop. Glass marbles roll down a beech marble run on a
   plywood board, ring two brass bells and drop through little trapdoors into a walnut base; every marble pops up a
   painted letter block. Rich style: full palette, real materials, lots of small details. */
:root {
  --wall: #1f6f6a;          /* the wall behind the board, top */
  --wall-low: #174f4c;      /* the wall behind the board, bottom */
  --board: #efd9b4;         /* the plywood board */
  --board-grain: #d9bb8a;   /* the grain of the plywood */
  --beech: #f1c98f;         /* the top of the rails */
  --beech-side: #c78f52;    /* the side of the rails */
  --walnut: #6b4127;        /* the base */
  --walnut-light: #8e5b39;  /* the top edge of the base */
  --brass: #e2b24f;         /* bells, brackets and screws */
  --brass-dark: #9c6d1f;
  --block-1: #e8473b;       /* the painted letter blocks and their marbles */
  --block-2: #f2b033;
  --block-3: #23a58f;
  --block-4: #3b73d9;
  --block-5: #f07a2a;
  --block-6: #b65cc9;
  --letter: #fff4df;        /* the engraved letters */
  --ink: #fff4df;           /* the small text */
  --hint: #bfe3dc;          /* the caption */
  --button: #f2b033;        /* the replay button */
  --button-ink: #3a2412;
  --elastic: cubic-bezier(0.34, 1.9, 0.45, 1);
  --screen: 100vh;
}
@supports (height: 100lvh) {
  :root { --screen: 100lvh; }
}

* { box-sizing: border-box; }
html,
body {
  margin: 0;
  height: 100%;
}
body {
  background: radial-gradient(120% 90% at 50% 30%, var(--wall) 0%, var(--wall-low) 100%);
  color: var(--ink);
  font-family: 'Fredoka Variable', 'Avenir Next', Arial, sans-serif;
  overflow: hidden;
}

.scena {
  position: relative;
  height: var(--screen);
  max-height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
/* a faint wallpaper stripe behind the board */
.scena::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 26px, transparent 26px 52px);
  pointer-events: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  margin: 0;
}

.marca {
  position: absolute;
  top: 18px;
  left: 22px;
  right: 22px;
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 16px;
  font-weight: 650;
  z-index: 2;
}
.marca__dida {
  color: var(--hint);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.disegno {
  position: absolute;
  left: 0;
  right: 0;
  top: 46px;
  bottom: 96px;
  width: 100%;
  height: calc(100% - 142px);
}
.disegno [data-block] { cursor: pointer; }

.motto {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 66px;
  margin: 0;
  text-align: center;
  color: var(--hint);
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 500;
  font-stretch: 96%;
  opacity: 0;
}

.pillola {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--button-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  isolation: isolate;
  opacity: 0;
  visibility: hidden;
}
.pillola::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--button);
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.5);
  transition: inset 0.6s var(--elastic);
}
.pillola__scritta {
  font-stretch: 86%;
  transition: font-stretch 0.6s var(--elastic);
}
.pillola__scritta::before {
  content: attr(data-testo);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-stretch: 112%;
}
@media (hover: hover) and (pointer: fine) {
  .pillola:hover::before { inset: -2px -7px; }
  .pillola:hover .pillola__scritta { font-stretch: 112%; }
}
.pillola:active::before { inset: 2px 3px; }
.pillola:focus-visible {
  outline: 2px solid var(--letter);
  outline-offset: 4px;
}

@media (max-height: 520px) {
  .marca { top: 12px; font-size: 14px; }
  .disegno { top: 36px; bottom: 80px; height: calc(100% - 116px); }
  .motto { bottom: 54px; font-size: 12px; }
  .pillola { bottom: 12px; min-height: 34px; }
}
