@keyframes pendingPulse {
  0%, 100% {
    opacity: 0.42;
  }

  50% {
    opacity: 1;
  }
}

:root {
  --bg: #eff4ef;
  --bg-shadow: #dce7dd;
  --panel: rgba(251, 253, 249, 0.9);
  --panel-strong: rgba(246, 250, 244, 0.96);
  --ink: #16211a;
  --muted: #55665b;
  --line: rgba(22, 33, 26, 0.12);
  --green: #1d5d44;
  --green-soft: rgba(29, 93, 68, 0.1);
  --amber: #956716;
  --amber-soft: rgba(149, 103, 22, 0.12);
  --red: #a13030;
  --red-soft: rgba(161, 48, 48, 0.12);
  --gray: #5f6c63;
  --gray-soft: rgba(95, 108, 99, 0.12);
  --shadow: 0 22px 60px rgba(48, 71, 56, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(92, 151, 127, 0.18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(225, 197, 139, 0.2), transparent 24%),
    linear-gradient(150deg, #f6faf5 0%, var(--bg) 54%, var(--bg-shadow) 100%);
}

.layout {
  width: min(1380px, calc(100vw - 32px));
  margin: 24px auto 40px;
  display: grid;
  grid-template-columns: 340px minmax(320px, 1fr) minmax(320px, 380px);
  gap: 18px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.hero {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 18px;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(250, 253, 247, 0.95), rgba(238, 245, 238, 0.92)),
    radial-gradient(circle at top right, rgba(180, 141, 61, 0.12), transparent 30%);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  color: var(--muted);
}

.hero h1,
.panel h2,
.panel h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

.hero h1 {
  font-size: clamp(2.1rem, 2vw + 1.4rem, 3.4rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
}

.subtitle {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.hero-status {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(22, 33, 26, 0.08);
  background: var(--panel-strong);
}

.hero-line {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(22, 33, 26, 0.08);
}

.hero-line:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.hero-line span {
  color: var(--muted);
}

.panel {
  padding: 20px;
}

.controls,
.debug-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field span,
.meta-label,
.debug-label {
  font-size: 0.84rem;
  color: var(--muted);
}

select,
textarea,
button {
  font: inherit;
}

select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(22, 33, 26, 0.16);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
}

textarea {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(22, 33, 26, 0.16);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  line-height: 1.5;
}

button {
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(22, 33, 26, 0.08);
  color: var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

.primary {
  color: #f6faf5;
  background: linear-gradient(135deg, #184633, #2d6f51);
}

.actions {
  display: flex;
  gap: 10px;
}

.settings-grid,
.meta-grid,
.debug-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-card,
.debug-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid rgba(22, 33, 26, 0.08);
}

.status-summary {
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--green-soft);
  font-weight: 600;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  line-height: 1;
  border: 1px solid transparent;
}

.tone-green {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(29, 93, 68, 0.12);
}

.tone-amber {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(149, 103, 22, 0.12);
}

.tone-red {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(161, 48, 48, 0.12);
}

.tone-gray {
  color: var(--gray);
  background: var(--gray-soft);
  border-color: rgba(95, 108, 99, 0.12);
}

.artifact-box {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(22, 33, 26, 0.08);
  background: rgba(249, 252, 247, 0.92);
}

.artifact-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.artifact-list div {
  display: grid;
  gap: 3px;
}

.artifact-list dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.artifact-list dd,
.debug-value {
  margin: 0;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-word;
}

.debug-value.small {
  font-size: 0.76rem;
}

.transcript-panel {
  display: grid;
  gap: 16px;
  align-content: start;
  grid-template-rows: auto minmax(0, 1fr);
  height: clamp(420px, 72vh, 880px);
  min-height: 0;
  overflow: hidden;
}

.transcript {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

.line {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(250, 252, 248, 0.96);
  border: 1px solid rgba(22, 33, 26, 0.08);
}

.line.student {
  border-left: 5px solid rgba(29, 93, 68, 0.34);
}

.line.coach {
  border-left: 5px solid rgba(149, 103, 22, 0.34);
}

.line.system {
  border-left: 5px solid rgba(95, 108, 99, 0.34);
}

.line.draft {
  border-style: dashed;
  opacity: 0.88;
}

.line-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.line-role {
  font-weight: 600;
}

.line-at {
  color: var(--muted);
  font-size: 0.78rem;
}

.line-body {
  line-height: 1.55;
  white-space: pre-wrap;
}

.line-native {
  color: var(--muted);
  line-height: 1.5;
  padding-top: 2px;
}

.line-native.pending {
  font-style: italic;
  animation: pendingPulse 1.15s ease-in-out infinite;
}

.line-feedback {
  padding: 8px 0 0;
  color: var(--red);
  line-height: 1.5;
  white-space: pre-wrap;
}

.line-empty,
.events-empty {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(22, 33, 26, 0.14);
  color: var(--muted);
  background: rgba(250, 252, 248, 0.8);
}

.events {
  display: grid;
  gap: 8px;
  min-height: 280px;
}

.event-row {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(248, 251, 246, 0.92);
  border: 1px solid rgba(22, 33, 26, 0.08);
}

.event-type {
  font-weight: 600;
}

.event-detail,
.event-at {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
  word-break: break-word;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .transcript-panel {
    height: clamp(360px, 64vh, 720px);
  }
}

@media (max-width: 720px) {
  .layout {
    width: min(100vw - 20px, 100vw);
    margin: 12px auto 24px;
  }

  .hero,
  .panel {
    border-radius: 22px;
    padding: 18px;
  }

  .settings-grid,
  .meta-grid,
  .debug-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .transcript-panel {
    height: clamp(320px, 58vh, 560px);
  }
}
