:root {
  color-scheme: light;
  --bg: #f4f6f4;
  --text: #17211b;
  --muted: #5c6a61;
  --line: #d7ded8;
  --panel: #ffffff;
  --accent: #2f6f4e;
  --accent-strong: #214f38;
  --danger-bg: #fff1f1;
  --danger-text: #8a1f1f;
  --success-bg: #ecf8ef;
  --success-text: #1f6b38;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  background: #17211b;
  color: #fff;
}

.brand {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topbar__identity {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  color: #d7ded8;
  font-size: 0.9rem;
  font-weight: 700;
}

.topbar__identity strong {
  color: #fff;
  overflow-wrap: anywhere;
}

.page {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.section__header {
  margin-bottom: 20px;
}

h1,
h2 {
  margin: 0 0 8px;
  line-height: 1.2;
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

h2 {
  font-size: 1.15rem;
}

p {
  margin: 0 0 12px;
  color: var(--muted);
}

.list {
  display: grid;
  gap: 12px;
}

.item,
.panel,
.radio-log {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.panel,
.radio-log {
  padding: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.resume-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid #c6d5ca;
  border-radius: 8px;
  background: #edf3ee;
}

.resume-panel p {
  margin: 0;
}

dl {
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.9rem;
}

dd {
  margin: 0 0 10px;
  font-weight: 600;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
}

.plain-list li + li {
  margin-top: 8px;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.button:hover,
button:hover {
  background: var(--accent-strong);
}

.button:disabled,
button:disabled {
  background: #8d9990;
  color: #eef2ef;
  cursor: wait;
  opacity: 0.85;
}

.button--secondary {
  border: 1px solid var(--line);
  background: #e7ece8;
  color: var(--text);
}

.button--secondary:hover {
  background: #d8e0da;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e7ece8;
  color: var(--muted);
  font-weight: 700;
}

.start-form,
.radio-form,
.name-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.name-gate {
  min-height: calc(100svh - 82px);
  display: grid;
  align-content: center;
}

.name-form {
  max-width: 460px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font-size: 1rem;
  font: inherit;
}

textarea {
  resize: vertical;
}

.console {
  display: grid;
  gap: 14px;
}

.radio-log {
  display: grid;
  gap: 8px;
}

.radio-log p {
  overflow-wrap: anywhere;
}

.radio-message {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #9ba79e;
  background: #f4f6f4;
  color: var(--text);
}

.radio-message--system {
  border-left-color: var(--accent);
  background: #edf3ee;
}

.log-warning {
  padding: 10px;
  border-radius: 6px;
  background: #fff7e8;
  color: #6d4b0f;
}

.form-status {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #cdd8cf;
  border-radius: 6px;
  background: #edf3ee;
  color: var(--accent-strong);
  font-weight: 700;
}

.report-builder {
  display: grid;
  gap: 12px;
}

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

.report-builder__header h2 {
  margin: 0;
}

.report-progress {
  color: var(--muted);
  font-weight: 800;
}

.report-entry-list {
  display: grid;
  gap: 10px;
}

.report-entry {
  background: var(--panel);
}

.current-report-entry {
  background: var(--panel);
  scroll-margin-top: 12px;
}

.report-entry-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.report-entry-actions > :only-child {
  grid-column: 1 / -1;
}

.processing-panel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.processing-panel h2,
.processing-panel p {
  margin-bottom: 4px;
}

.spinner {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border: 3px solid #cdd8cf;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.score {
  display: grid;
  place-items: center;
  width: 96px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
}

.alert {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #f0caca;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger-text);
}

.alert--success {
  border-color: #bde7c8;
  background: var(--success-bg);
  color: var(--success-text);
}

.section > .panel + .panel {
  margin-top: 12px;
}

.result-actions,
.feedback-report {
  display: grid;
  gap: 12px;
}

.result-action-buttons {
  display: flex;
  gap: 12px;
}

.result-actions {
  margin-top: 16px;
}

@media (max-width: 640px) {
  .topbar,
  .item,
  .result-header,
  .resume-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .score {
    width: 100%;
    aspect-ratio: auto;
    min-height: 72px;
  }

  .topbar {
    gap: 10px;
    padding: 12px;
  }

  .topbar__identity {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .page {
    padding: 16px 12px 40px;
  }

  h1 {
    font-size: 1.65rem;
  }

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

  .item,
  .panel,
  .radio-log {
    padding: 14px;
  }

  .button,
  button {
    width: 100%;
    min-height: 52px;
  }

  .result-action-buttons {
    display: grid;
  }

  textarea {
    min-height: 132px;
  }

  .report-entry-actions {
    grid-template-columns: 1fr;
  }

  .report-entry-actions > :only-child {
    grid-column: auto;
  }

  .report-entry {
    min-height: 112px;
  }
}
