:root {
  --bg: #fafafa;
  --fg: #222;
  --muted: #888;
  --accent: #6f42c1;
  --bubble-bg: #fff;
  --bubble-shadow: 0 2px 12px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
}

main {
  max-width: 720px;
  margin: 2em auto;
  padding: 0 1em;
}

h1 {
  font-size: 1.4em;
  font-weight: 500;
  margin: 0 0 1em;
  color: var(--muted);
}

#stage {
  position: relative;
  height: 360px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 1.5em;
}

#puppet {
  position: relative;
  width: 177px;
  height: 300px;
  background-image: url('/cat.png');
  background-position: 0 0;
  background-repeat: no-repeat;
}

#mouth {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/cat.png');
  background-position: 0 0;
  background-repeat: no-repeat;
  display: none;
}

#bubble {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  min-width: 240px;
  max-width: 480px;
  padding: 12px 16px;
  background: var(--bubble-bg);
  border-radius: 12px;
  box-shadow: var(--bubble-shadow);
  text-align: center;
  font-size: 1.1em;
  min-height: 1.5em;
  visibility: hidden;
}

#bubble.visible { visibility: visible; }

#bubble .word {
  display: inline-block;
  margin: 0 0.15em;
  opacity: 0.25;
  transition: opacity 120ms ease-out, color 120ms ease-out;
}
#bubble .word.spoken { opacity: 1; color: var(--accent); }
#bubble .word.past { opacity: 0.55; color: var(--fg); }

form {
  display: grid;
  gap: 0.75em;
}

textarea, select, input[type="text"] {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
}

label {
  display: block;
  font-size: 0.9em;
  color: var(--muted);
}

label > select, label > input { display: block; margin-top: 2px; width: 100%; }

/* checkboxes inline with their label, no full-width input override */
label.checkbox { display: flex; align-items: center; gap: 6px; }
label.checkbox > input { display: inline; width: auto; margin: 0; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75em;
}
.row:has(label.checkbox) {
  grid-template-columns: 1fr 1fr auto 1fr;
}

button {
  padding: 8px 18px;
  font: inherit;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  width: max-content;
}
button:disabled { opacity: 0.5; cursor: wait; }

#status {
  display: inline-block;
  margin-left: 1em;
  color: var(--muted);
  font-size: 0.9em;
}
