/* Settle: layout of the stage, the touch controls and the results. The scene
   itself is drawn on the canvas by app.js. */

@media (min-width: 64rem) {
  .settle-layout { gap: 2rem; }
}

.settle-stage {
  position: relative;
  width: 100%;
  /* Phones: a 4:5 frame; it grows with the tower by zooming out. */
  aspect-ratio: 4 / 5;
  max-height: 64svh;
  min-height: 340px;
  border-radius: 0.75rem;
  overflow: hidden;
  background: #e8f1f7;
  outline: none;
  /* Horizontal drags aim the block; vertical swipes still scroll the page. */
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .settle-stage { background: #141b2c; }

@media (min-width: 40rem) {
  .settle-stage { aspect-ratio: auto; max-height: none; height: clamp(420px, 66vh, 600px); }
}
@media (min-width: 64rem) {
  .settle-stage { height: clamp(460px, 72vh, 660px); }
}

.settle-stage:focus-visible {
  box-shadow: 0 0 0 3px var(--color-base-100), 0 0 0 5px var(--cat, currentColor);
}

.settle-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.settle-icon {
  width: 1.375rem;
  height: 1.375rem;
  fill: currentColor;
}
.settle-icon .settle-stroke,
.settle-icon.settle-stroke-only path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.settle-controls .settle-icon { fill: none; }

.settle-mute .settle-sound-off { display: none; }
.settle-mute[aria-pressed="true"] .settle-sound-on { display: none; }
.settle-mute[aria-pressed="true"] .settle-sound-off { display: block; }

.settle-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1.6fr 1fr 1fr;
  gap: 0.5rem;
}
.settle-key {
  height: 3.25rem;
  min-height: 3.25rem;
  padding-inline: 0;
  font-size: 1rem;
  touch-action: manipulation;
}
.settle-drop { font-weight: 700; letter-spacing: 0.01em; }
@media (min-width: 64rem) {
  .settle-key { height: 2.75rem; min-height: 2.75rem; }
}

.settle-keys .kbd {
  min-height: 1.4rem;
  min-width: 1.4rem;
  padding-inline: 0.3rem;
  font-size: 0.75rem;
}
@media (pointer: coarse) {
  .settle-keys { display: none; }
}

.settle-controls[aria-disabled="true"] .settle-key { opacity: 0.55; }

.settle-results {
  border: 1px solid var(--color-base-300);
  border-radius: 0.75rem;
  padding: 1rem 1.125rem 1.125rem;
  background: color-mix(in oklab, var(--cat, #9a6bd4) 7%, var(--color-base-100));
  animation: settle-rise 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
.settle-big {
  font-size: 3rem;
  line-height: 1.05;
  margin-top: 0.125rem;
}
.settle-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  text-align: center;
}
.settle-stats > div {
  border-radius: 0.5rem;
  background: var(--color-base-100);
  border: 1px solid var(--color-base-300);
  padding: 0.5rem 0.25rem;
}
.settle-stats dt {
  font-size: 0.6875rem;
  line-height: 1.2;
  color: var(--color-muted, inherit);
  opacity: 0.8;
}
.settle-stats dd {
  margin: 0.125rem 0 0;
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

@keyframes settle-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .settle-results { animation: none; }
}
