:root {
  --teal: #4ECDC4;
  --teal-dark: #3BB8B0;
  --teal-light: #A8E6CF;
  --red: #E63946;
  --pink: #E84393;
  --green: #00B87A;
  --blue: #5B9BD5;
  --black: #1A1A1A;
  --white: #FFFFFF;
  --off-white: #F5F7F6;
  --gray: #6B7B8D;
}

* { box-sizing: border-box; margin: 0; }

html, body {
  min-height: 100%;
  background: #FFFFFF;
  color: var(--black);
  font-family: "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial, sans-serif;
}

.app {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 16px 14px 24px;
}

.header a, .footer {
  text-align: center;
  padding: 0 0 16px;
  display: flex;
  flex-direction: row;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  text-decoration: none;
}

.logo-badge {
  display: inline-flex;
  background: var(--black);
  color: var(--white);
  border-radius: 50%;
  width: 72px;
  height: 72px;
  line-height: 1;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  padding: 14px 10px;
  margin-bottom: 8px;
}

.logo-badge span {
  display: inline;
}

.logo-image {
  width: 58px;
  height: 58px;
  object-fit: contain;
  margin-bottom: 8px;
}

.title-playground {
  display:L inline-flex;
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 2px 0 6px;
  text-transform: uppercase;
}

.pl-p { color: var(--red); }
.pl-l { color: var(--pink); font-style: italic; }
.pl-a { color: var(--black); }
.pl-y { color: var(--blue); }
.pl-g { color: var(--green); }
.pl-r { color: var(--red); }
.pl-o { color: var(--teal-dark); }
.pl-u { color: var(--blue); }
.pl-n { color: var(--green); }
.pl-d { color: var(--black); }

.subtitle, .status {
  font-size: 16px;
  color: #3d3c3c;
  font-weight: 500;
  padding-bottom: 18px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.btn {
  border: none;
  padding: 13px 10px;
  font-size: 0.88rem;
  border-radius: 40px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:active { opacity: 0.8; }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn-primary {
  background: var(--black);
  color: var(--white);
}

.btn-accent {
  background: var(--red);
  color: var(--white);
}

.btn-stop {
  background: var(--white);
  color: var(--black);
  border: 2px solid rgba(0,0,0,0.15);
}

.btn-download {
  background: var(--green);
  color: var(--white);
}

.btn-share {
  background: var(--blue);
  color: var(--white);
}

.media-actions {
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.sound-options {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.opt-group {
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 10px;
  padding: 5px 7px;
}

.opt-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(0,0,0,0.5);
  min-width: 32px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.opt-btn {
  background: transparent;
  border: 1.5px solid rgba(0,0,0,0.12);
  color: rgba(0,0,0,0.55);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.opt-btn.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.stage-wrap {
  position: relative;
  margin-top: 10px;
}

.stage {
  /* border-radius: 16px; */
  overflow: hidden;
  border: 3px solid rgba(0,0,0,0.12);
  background: #fff;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

#renderCanvas {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 3 / 4;
  max-height: 75vh;
}

.sfx-pad {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 13px;
  z-index: 2;
}

.sfx-btn {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.25);
  padding: 10px 16px;
  border-radius: 32px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.12s;
}

.sfx-btn:active {
  background: rgba(255,255,255,0.3);
  color: #000;
}

.record-wrap {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.record-btn {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 4px solid rgba(0,0,0,0.18);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.record-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.record-btn-inner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--red);
  transition: all 0.15s ease;
}

.record-btn.is-recording .record-btn-inner {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.footer {
  margin-top: 16px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(0,0,0,0.3);
  letter-spacing: 0.05em;
}

.credit {
  color: rgba(0,0,0,0.4);
  letter-spacing: normal;
}

.credit a {
  color: inherit;
  text-decoration: underline;
}

.hidden { display: none !important; }

@media (min-width: 720px) {
  .media-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .app {
    width: min(100%, 640px);
  }
}
