:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #241b3c;
  --violet: #5b43a6;
  --violet-dark: #3d2b73;
  --cream: #fff9ed;
  --gold: #ffca62;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 5%, #f9dfff 0, transparent 28%),
    radial-gradient(circle at 90% 20%, #dce9ff 0, transparent 30%),
    linear-gradient(160deg, #fff9ed, #f2eaff);
}

button, input, select { font: inherit; }
button { touch-action: manipulation; }

.shell {
  width: min(900px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 24px 32px;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 22px;
  color: white;
  font-size: 32px;
  background: linear-gradient(145deg, #8068d3, var(--violet-dark));
  box-shadow: 0 12px 30px #3d2b7330;
}

h1 { margin: 0; font-size: clamp(30px, 5vw, 48px); line-height: 1; }
header p { margin: 7px 0 0; color: #685d7e; font-size: 18px; }

.voice-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -8px 0 18px;
  padding-left: 80px;
}

.voice-bar label { margin: 0; font-size: 16px; }
.voice-bar select, .preview-button {
  min-height: 42px;
  border: 1px solid #d5cae9;
  border-radius: 13px;
  color: var(--ink);
  background: #ffffffd9;
}
.voice-bar select { padding: 0 34px 0 12px; }
.preview-button { padding: 0 15px; color: var(--violet-dark); font-weight: 750; }

.panel {
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid #ffffffa8;
  border-radius: 32px;
  background: #ffffffd9;
  box-shadow: 0 24px 70px #4b367a1c;
  backdrop-filter: blur(14px);
}

label { display: block; margin-bottom: 12px; font-size: 22px; font-weight: 750; }
.input-row { display: flex; gap: 10px; }

input {
  width: 100%;
  min-height: 62px;
  padding: 0 18px;
  border: 2px solid #dcd3ed;
  border-radius: 18px;
  color: var(--ink);
  background: white;
  font-size: 20px;
  outline: none;
}

input:focus { border-color: var(--violet); box-shadow: 0 0 0 4px #5b43a61f; }

.mic-button {
  flex: 0 0 62px;
  min-height: 62px;
  border: 0;
  border-radius: 18px;
  background: #eee8fa;
  font-size: 27px;
}

.mic-button.listening { color: white; background: #d94c65; animation: pulse 1s infinite; }

.primary, .secondary, .choice {
  min-height: 64px;
  border: 0;
  border-radius: 20px;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  width: 100%;
  margin-top: 18px;
  color: white;
  background: linear-gradient(135deg, #725ac1, var(--violet-dark));
  font-size: 24px;
  box-shadow: 0 12px 28px #4f38884d;
}

.secondary { width: 100%; margin-top: 12px; color: var(--violet-dark); background: var(--gold); font-size: 20px; }
.status { min-height: 28px; color: var(--violet); font-weight: 750; }
.scene { font-family: Georgia, serif; font-size: clamp(22px, 3.3vw, 30px); line-height: 1.58; }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 28px 0; }
.choice { padding: 12px 18px; color: white; background: var(--violet); font-size: 19px; }
.change-box { padding-top: 24px; border-top: 1px solid #e6e0ee; }
.change-box label { font-size: 18px; }
.text-button { display: block; margin: 22px auto 0; border: 0; color: #655a76; background: transparent; text-decoration: underline; }
.hidden { display: none; }
button:disabled { opacity: .55; cursor: wait; }

@keyframes pulse { 50% { transform: scale(1.06); } }

@media (max-width: 620px) {
  .shell { padding-inline: 14px; }
  .panel { border-radius: 24px; }
  .choices { grid-template-columns: 1fr; }
  .voice-bar { padding-left: 0; flex-wrap: wrap; }
}
