:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #171717;
  background: #f5f5f7;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

.app { width: min(100%, 980px); margin: 0 auto; padding: 48px 24px; text-align: center; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.25rem); }
header p { max-width: 650px; margin: 14px auto 0; color: #585858; font-size: 1.1rem; line-height: 1.45; }
.status { min-height: 26px; margin: 32px 0 22px; font-weight: 600; }
.keyboard { display: grid; gap: 12px; justify-content: center; }
.key-row { display: flex; gap: 12px; justify-content: center; }
.key {
  position: relative; width: clamp(48px, 7vw, 70px); aspect-ratio: 1; border: 0; border-radius: 12px;
  background: #171717; color: white; font-size: clamp(1.25rem, 3vw, 1.8rem); font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 0 #000; transition: transform 80ms, background 80ms;
}
.key:hover, .key:focus-visible { background: #343434; outline: 3px solid #2375dc; outline-offset: 3px; }
.key:active, .key.playing { transform: translateY(3px); box-shadow: none; background: #4b4b4b; }
.key.wide { width: clamp(220px, 35vw, 330px); }
.key.recorded::after, .recorded-dot { content: ""; display: block; width: 11px; height: 11px; border-radius: 50%; background: #33b249; }
.key.recorded::after { position: absolute; right: 9px; top: 9px; }
.hint { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 28px; color: #585858; }

dialog { border: 0; border-radius: 18px; padding: 30px; max-width: min(92vw, 430px); text-align: center; box-shadow: 0 20px 70px #0005; }
dialog::backdrop { background: #0008; }
dialog h2 { margin-top: 0; font-size: 1.7rem; }
dialog p { color: #555; line-height: 1.45; }
.actions { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }
button:not(.key) { border: 0; border-radius: 10px; background: #1769cc; color: white; padding: 13px 18px; font: inherit; font-weight: 700; cursor: pointer; }
button.secondary { background: #e6e6e8; color: #222; }
button.stop { background: #d92d20; margin-top: 12px; min-width: 150px; }
.mic { color: #d92d20; font-size: 4rem; line-height: .7; margin: 14px; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .35; transform: scale(.8); } }

@media (max-width: 600px) {
  .app { padding: 28px 12px; }
  .keyboard, .key-row { gap: 7px; }
  .key { border-radius: 9px; }
}

.mobile .app { max-width: 720px; padding-top: 30px; }
.configure-button { margin-top: 28px; }
.mobile .status { margin: 20px 0; }
.mobile-keyboard { gap: 14px; }
.mobile-keyboard .key-row { gap: 14px; }
.mobile .key {
  width: min(42vw, 280px); min-height: 160px; aspect-ratio: auto; border-radius: 24px;
  box-shadow: 0 5px 0 #0004; font-size: clamp(2.5rem, 11vw, 4.5rem);
}
.mobile .key:hover, .mobile .key:focus-visible { outline-color: #111; }
.mobile .key.color-0 { background: #e74c3c; }
.mobile .key.color-1 { background: #f39c12; }
.mobile .key.color-2 { background: #f1c40f; color: #2f2800; }
.mobile .key.color-3 { background: #2ecc71; }
.mobile .key.color-4 { background: #3498db; }
.mobile .key.color-5 { background: #9b59b6; }
.mobile .key:active, .mobile .key.playing { background: #222; }
.shape {
  width: min(26vw, 150px); height: min(26vw, 150px); display: grid; place-items: center;
  background: #fff; color: initial; font-size: clamp(3.2rem, 13vw, 6rem); line-height: 1;
  box-shadow: inset 0 -5px #0002;
}
.shape.circle { border-radius: 50%; }
.shape.square { border-radius: 18px; }
.shape.triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); padding-top: 28px; }
.shape.diamond { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.shape.hexagon { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.shape.oval { border-radius: 50%; width: min(31vw, 180px); height: min(21vw, 120px); }

@media (max-width: 430px) {
  .mobile .key { min-height: 130px; }
}
