:root {
  --blue: #004fb8;
  --blue-2: #1279ff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d8e2f5;
  --panel: rgba(255, 255, 255, 0.92);
  --soft: #eef6ff;
  --pink: #ff6aa2;
  --green: #10b981;
  --red: #ef4444;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255,255,255,.86), rgba(235,245,255,.92)),
    radial-gradient(circle at 80% 10%, rgba(255,106,162,.18), transparent 30%),
    linear-gradient(135deg, #dff2ff, #ffffff 48%, #dcecff);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.icon-button,
.small-button,
.primary-button,
.secondary-button,
.segment {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: var(--panel);
  color: var(--blue);
  font-weight: 900;
  box-shadow: 0 8px 24px rgba(0, 79, 184, .14);
}

.status-card,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 14px 42px rgba(0, 79, 184, .12);
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: 22px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.status-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-text {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 800;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 10px;
  background: #e7eefc;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.badge.ready {
  background: #dff8ed;
  color: #047857;
}

.badge.warn {
  background: #fff2d8;
  color: #a16207;
}

.panel {
  border-radius: 26px;
  padding: 16px;
  margin-bottom: 14px;
}

.settings-panel {
  display: none;
}

.settings-panel.open {
  display: block;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 15px;
  color: var(--ink);
  background: #fff;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.small-button {
  border-radius: 12px;
  padding: 9px 12px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.small-button.ghost {
  background: #eef3fb;
  color: var(--blue);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 5px;
  border-radius: 18px;
  background: #eaf2ff;
}

.segment {
  min-height: 48px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
}

.segment.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 7px 18px rgba(0,79,184,.14);
}

.transcript-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.text-box {
  min-height: 128px;
  margin-top: 8px;
  border-radius: 20px;
  padding: 16px;
  background: #f4f7fc;
  line-height: 1.55;
  word-break: break-word;
}

.text-box.strong {
  color: #07172f;
  font-size: 24px;
  font-weight: 900;
}

.text-box.muted {
  color: var(--muted);
  font-size: 19px;
  font-weight: 700;
}

.control-row {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.primary-button,
.secondary-button {
  min-height: 62px;
  border-radius: 22px;
  font-size: 18px;
  font-weight: 900;
}

@media (max-width: 420px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .panel {
    padding: 14px;
  }

  .text-box.strong {
    font-size: 21px;
  }

  .segment {
    font-size: 14px;
  }
}

.primary-button {
  color: #fff;
  background: linear-gradient(135deg, #08a84f, #34d86e);
  box-shadow: 0 12px 28px rgba(16, 185, 129, .28);
}

.primary-button.listening {
  background: linear-gradient(135deg, #ef3340, #ff5964);
  box-shadow: 0 12px 28px rgba(239, 68, 68, .24);
}

.secondary-button {
  color: var(--blue);
  background: #eef6ff;
}

.volume-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 15px;
  color: var(--muted);
  font-weight: 800;
}

.volume-row input {
  grid-column: 1 / -1;
  width: 100%;
}

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

.history-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.history-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: #fff;
}

.speaker-input {
  width: min(180px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 800;
}

.history-source {
  color: var(--muted);
  line-height: 1.45;
}

.history-target {
  color: var(--ink);
  font-weight: 900;
  line-height: 1.45;
}

@media (min-width: 720px) {
  .transcript-grid {
    grid-template-columns: 1fr 1fr;
  }

  .control-row {
    grid-template-columns: 1fr 190px;
  }
}
