:root {
  color-scheme: dark;
  --bg: #14111c;
  --panel: #1f1a2b;
  --line: #352c49;
  --text: #f3eefc;
  --muted: #b3a8c7;
  --accent: #e7b75f;
  --good: #6fd39b;
  --bad: #ff8a80;
  --close: #ffd36b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}

h1 {
  font-size: 1.6rem;
  margin: 8px 0 4px;
}

h2 {
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--accent);
}

.lead,
.detail,
.label,
.card-label {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 4px 0 10px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin: 14px 0;
}

.engine-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.engine-name {
  font-weight: 600;
}

.badge {
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--line);
  white-space: nowrap;
}

.badge[data-tone="good"] {
  background: #1f4d36;
  color: var(--good);
}

.badge[data-tone="bad"] {
  background: #4d2323;
  color: var(--bad);
}

button {
  font: inherit;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  background: var(--line);
  touch-action: manipulation;
}

button:disabled {
  opacity: 0.45;
}

button.primary {
  width: 100%;
  background: var(--accent);
  color: #1b1408;
  font-weight: 700;
}

button.secondary {
  width: 100%;
}

button.ghost {
  background: transparent;
  font-size: 1.6rem;
  padding: 4px 14px;
}

button.big {
  margin-top: 14px;
  padding: 20px;
  font-size: 1.2rem;
}

button.big[data-listening] {
  background: var(--good);
}

.segmented {
  display: flex;
  gap: 8px;
  border: 0;
  padding: 0;
  margin: 16px 0 4px;
}

.segmented legend {
  color: var(--muted);
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.segmented label {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  border-radius: 10px;
  background: var(--line);
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented label:has(input:checked) {
  background: var(--accent);
  color: #1b1408;
  font-weight: 700;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
}

.toggle input {
  width: 22px;
  height: 22px;
}

.progress,
.meter {
  height: 8px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
  margin: 8px 0 12px;
}

.progress > div,
.meter > div {
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.meter > div {
  background: var(--good);
  transition: transform 60ms linear;
}

.moment-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
}

.situation {
  font-size: 1.05rem;
  margin: 8px 0;
}

.bubble {
  display: inline-block;
  font-size: 1.35rem;
  font-weight: 600;
  background: #2b2440;
  border-radius: 16px 16px 16px 4px;
  padding: 12px 16px;
  margin: 4px 0 12px;
}

.card {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

.choices {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.choice {
  font-size: 1.1rem;
  text-align: left;
  padding: 16px;
}

.heard {
  font-size: 1.25rem;
  min-height: 1.5em;
  margin: 0 0 8px;
}

.verdict {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 6px;
}

.verdict[data-verdict="match"] {
  color: var(--good);
}

.verdict[data-verdict="close"] {
  color: var(--close);
}

.verdict[data-verdict="miss"] {
  color: var(--bad);
}

.log {
  padding-left: 20px;
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--muted);
}

.log li {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

#copy-status {
  white-space: pre-wrap;
  user-select: text;
  -webkit-user-select: text;
}
