:root {
  color-scheme: light dark;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #667085;
  --line: #e4e8f0;
  --accent: #4f6ef7;
  --accent-soft: #e8edff;
  --danger: #c0392b;
  --ok: #1f8a5b;
  --shadow: 0 10px 30px rgba(29, 36, 51, 0.08);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151d;
    --card: #1a202b;
    --text: #edf1f7;
    --muted: #98a2b3;
    --line: #2b3342;
    --accent: #8aa2ff;
    --accent-soft: #243056;
    --danger: #ff8b7d;
    --ok: #6ee7b7;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

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

[hidden] {
  display: none !important;
}

.wrap {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: 22px 16px 120px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 4px 8px;
}

.hero-copy {
  flex: 1;
  min-width: 0;
}

.hero-art {
  flex: 0 0 auto;
  width: 134px;
  height: 134px;
  border-radius: 50%;
  border: 4px solid var(--card);
  background: #fff;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.eyebrow {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 10px 0 6px;
  font-size: clamp(26px, 6vw, 36px);
  line-height: 1.15;
}

h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.muted {
  margin: 0;
  color: var(--muted);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

.field {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.field > span {
  font-size: 14px;
}

select,
textarea,
input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 500;
}

.check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.check.small {
  color: var(--muted);
  font-size: 14px;
}

.phrase-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.phrase-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.num {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.phrase-text {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.phrase-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.play {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.play:active {
  transform: scale(0.98);
}

.rating {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rating.two {
  gap: 10px;
}

.rate,
.choice {
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.rate.selected,
.choice.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.sticky {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px max(16px, calc((100vw - 860px) / 2 + 16px));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.progress {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.primary {
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.error {
  margin-top: 14px;
  color: var(--danger);
  font-weight: 600;
}

.thanks {
  max-width: 620px;
  padding-top: 80px;
  text-align: center;
}

.thanks .primary {
  margin-top: 24px;
}

.table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td.comments {
  min-width: 220px;
  max-width: 340px;
  white-space: normal;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin: 16px 0;
}

.filters .field {
  min-width: 150px;
}

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

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.stat b {
  display: block;
  font-size: 22px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.danger {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--danger);
  border-radius: 10px;
  background: transparent;
  color: var(--danger);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.login {
  max-width: 420px;
  margin: 40px auto;
}

.login .field {
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .wrap {
    padding-left: 12px;
    padding-right: 12px;
  }

  .hero-art {
    width: 92px;
    height: 92px;
  }

  .panel,
  .phrase-card {
    padding: 14px;
  }

  .phrase-controls {
    align-items: flex-start;
  }

  .sticky {
    padding-left: 12px;
    padding-right: 12px;
  }

  .progress {
    font-size: 13px;
  }
}
