/* The billiard break: a club table seen from above. The cue follows the pointer, draws back and strikes; the balls
   break with real physics, potted ones spiral into the pocket and roll into the ball return, then the wooden
   triangle puts everything back. */
:root {
  --sala: #16120e;
  --sala-luce: #2c2218;
  --testo: #f3e9d6;
  --testo-tenue: #b6a68b;
  --oro: #d8b46a;
  --panno: #1f6b4f;
  --panno-scuro: #134433;
  --sponda: #1a5a42;
  --legno: #6b3a1e;
  --legno-chiaro: #93552c;
  --legno-scuro: #3e1f0e;
  --buca: #0b0907;
  --madreperla: #efe6d2;
  --avorio: #f7f1e3;
  --gesso: #3d7fd1;
  --palla-1: #f2b705;
  --palla-2: #1f4fbf;
  --palla-3: #d3302b;
  --palla-4: #5b2a86;
  --palla-5: #ee6c1b;
  --palla-6: #13784a;
  --palla-7: #7a1f1f;
  --palla-8: #151515;
  /* the elastic curve of the button: it overshoots, then settles */
  --molla: cubic-bezier(0.34, 1.8, 0.45, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(ellipse 70% 55% at 50% 52%, var(--sala-luce), transparent 70%),
    var(--sala);
  color: var(--testo);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sala {
  min-height: 100svh;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(18px, 3.2vh, 34px) 16px clamp(16px, 3vh, 30px);
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 2vh, 20px);
}

.testa {
  text-align: center;
}

.sopra {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--oro);
}

.titolo {
  margin: 0;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-weight: 560;
  font-size: clamp(30px, 5.4vw, 54px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variation-settings: 'SOFT' 100, 'WONK' 1;
}

.riga {
  margin: 8px auto 0;
  max-width: 46ch;
  font-size: 14px;
  line-height: 1.45;
  color: var(--testo-tenue);
}

.tavolo {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  cursor: crosshair;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.tavolo__svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100svh - 250px);
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
}

.tavolo__svg text {
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  font-weight: 800;
  font-stretch: 85%;
  pointer-events: none;
}

.piede {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 18px;
}

.conti {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 22px;
}

.conto,
.stato {
  margin: 0;
  font-size: 13px;
  color: var(--testo-tenue);
}

.conto__nome {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
}

.conto__num {
  display: inline-block;
  min-width: 1.3ch;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--testo);
  font-variant-numeric: tabular-nums;
}

.conto__su {
  font-size: 13px;
}

.stato {
  overflow: hidden;
  height: 1.5em;
  min-width: 12ch;
}

.stato__testo {
  display: inline-block;
  color: var(--oro);
  font-style: italic;
  font-family: 'Fraunces Variable', Georgia, serif;
  font-size: 15px;
}

/* the ball return: a groove of dark wood, the potted balls sit in a row */
.vassoio {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 30px;
  width: calc(15 * 22px + 14px);
  padding: 0 6px;
  border-radius: 15px;
  background: linear-gradient(180deg, var(--legno-scuro), #26130a 60%, var(--legno-scuro));
  box-shadow: inset 0 2px 5px rgb(0 0 0 / 0.65), 0 1px 0 rgb(255 255 255 / 0.06);
}

.vassoio svg {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
}

.tiro {
  position: relative;
  isolation: isolate;
  min-height: 50px;
  min-width: 128px;
  padding: 0 28px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--sala);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tiro__fondo {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--avorio);
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 0.12);
  transition: inset 0.6s var(--molla), background-color 0.3s ease;
}

.tiro__testo {
  display: inline-block;
  font-stretch: 100%;
  transition: font-stretch 0.6s var(--molla);
}

.tiro:active .tiro__fondo {
  inset: 3px;
  transition-duration: 0.12s;
}

.tiro[aria-disabled='true'] {
  cursor: default;
}

.tiro[aria-disabled='true'] .tiro__fondo {
  background: color-mix(in srgb, var(--avorio) 55%, var(--sala));
}

.tiro:focus-visible {
  outline: 2px solid var(--oro);
  outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .tiro:not([aria-disabled='true']):hover .tiro__fondo {
    inset: -5px -8px;
  }

  .tiro:not([aria-disabled='true']):hover .tiro__testo {
    font-stretch: 125%;
  }
}

@media (max-width: 760px) {
  .piede {
    grid-template-columns: 1fr auto;
    gap: 12px;
  }

  .vassoio {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    width: calc(15 * 19px + 12px);
  }

  .vassoio svg {
    width: 17px;
    height: 17px;
  }

  .tavolo__svg {
    max-height: calc(100svh - 300px);
  }

  .riga {
    font-size: 13px;
  }
}
