:root {
  --blue: #0071CE;
  --blue-dark: #004f91;
  --gold: #FFC220;
  --orange: #F57C00;
  --red: #C62828;
  --ink: #17202A;
  --muted: #6B7280;
  --bg: #F4F7FB;
  --card: #FFFFFF;
  --line: #DCE4EE;
  --shadow: 0 10px 28px rgba(18, 38, 63, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: max(14px, env(safe-area-inset-top))
           max(14px, env(safe-area-inset-right))
           max(18px, env(safe-area-inset-bottom))
           max(14px, env(safe-area-inset-left));
}

button, select, textarea, input { font: inherit; }

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.eyebrow {
  color: var(--blue);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .18em;
}

h1 {
  margin: 2px 0 0;
  font-size: clamp(1.7rem, 6vw, 2.35rem);
  line-height: 1.05;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.08rem;
}

.stop-btn {
  border: 0;
  border-radius: 15px;
  background: var(--red);
  color: white;
  padding: 15px 16px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 11px 14px;
  margin-bottom: 14px;
  font-weight: 750;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #2E7D32;
  box-shadow: 0 0 0 4px rgba(46,125,50,.12);
}

.status-dot.speaking {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(255,194,32,.18);
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.announce-btn {
  min-height: 118px;
  border: 0;
  border-radius: 22px;
  padding: 18px 14px;
  color: white;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 900;
  letter-spacing: .02em;
}

.announce-btn:active { transform: scale(.985); }

.announce-btn .big {
  font-size: clamp(1.65rem, 8vw, 2.5rem);
  line-height: 1;
}

.announce-btn span:last-child {
  font-size: .82rem;
  opacity: .96;
  text-align: center;
}

.full { grid-column: 1 / -1; min-height: 100px; }

.blue { background: linear-gradient(145deg, var(--blue), var(--blue-dark)); }
.orange { background: linear-gradient(145deg, #FB8C00, #EF6C00); }
.red { background: linear-gradient(145deg, #D32F2F, #A61B1B); }
.gold { background: linear-gradient(145deg, #FFD54F, var(--gold)); }
.dark-text { color: #1a2733; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  margin: 12px 0;
  box-shadow: 0 5px 18px rgba(18, 38, 63, 0.06);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 104px;
  border: 1px solid #CAD5E2;
  border-radius: 14px;
  padding: 13px 14px;
  background: #FAFCFE;
  color: var(--ink);
  outline: none;
}

textarea:focus, select:focus, input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,113,206,.12);
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.row > * { flex: 1; }

.primary-btn, .secondary-btn {
  min-height: 48px;
  border-radius: 13px;
  padding: 11px 13px;
  font-weight: 900;
}

.primary-btn {
  border: 0;
  background: var(--blue);
  color: white;
}

.secondary-btn {
  border: 1px solid #C8D3E0;
  background: #F6F9FC;
  color: var(--ink);
}

details summary {
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: "＋";
  float: right;
  color: var(--blue);
}
details[open] summary::after { content: "−"; }

.settings-body, .editor-body {
  margin-top: 16px;
}

.settings label {
  display: block;
  margin: 14px 0;
  font-weight: 800;
}

select, input[type="range"] {
  width: 100%;
  margin-top: 7px;
}

select {
  min-height: 46px;
  border: 1px solid #CAD5E2;
  border-radius: 12px;
  padding: 8px 10px;
  background: white;
}

.editor-item { margin-bottom: 16px; }
.editor-item label {
  display: block;
  font-weight: 900;
  margin-bottom: 6px;
}
.editor-item textarea { min-height: 120px; }

footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: .78rem;
  padding: 4px 4px 10px;
}

@media (max-width: 420px) {
  .preset-grid { gap: 10px; }
  .announce-btn { min-height: 108px; padding: 14px 10px; }
  .row { flex-direction: column; }
}

@media (display-mode: standalone) {
  body { padding-top: max(18px, env(safe-area-inset-top)); }
}
