:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #64736d;
  --soft: #eef4f1;
  --line: #d8e2de;
  --brand: #276354;
  --brand-dark: #19493d;
  --accent: #c9704f;
  --accent-soft: #fff1eb;
  --paper: #ffffff;
  --wash: #f7faf8;
  --warn: #9a5b00;
  --danger: #9d2f2f;
  --ok: #1f6b4f;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--wash);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

.ghost-button {
  background: transparent;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: rgba(247, 250, 248, 0.92);
  border-bottom: 1px solid rgba(216, 226, 222, 0.82);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 800;
}

.brand-text strong,
.brand-text span {
  display: block;
}

.brand-text strong {
  font-size: 16px;
  line-height: 1.1;
}

.brand-text span {
  color: var(--muted);
  font-size: 12px;
}

.nav-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 5vw, 48px) clamp(16px, 4vw, 40px) calc(44px + env(safe-area-inset-bottom));
  flex: 1;
}

.participant-layout {
  width: min(720px, 100%);
  margin: 0 auto;
}

.screen {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 38px);
  box-shadow: 0 18px 42px rgba(23, 33, 29, 0.06);
}

.kicker {
  color: var(--brand);
  font-weight: 700;
  font-size: 13px;
  margin: 0 0 10px;
  text-transform: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(30px, 8vw, 50px);
  line-height: 1.04;
  letter-spacing: 0;
  margin-bottom: 18px;
}

h2 {
  font-size: clamp(24px, 6vw, 32px);
  line-height: 1.12;
  margin-bottom: 16px;
}

h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

p,
li {
  color: var(--muted);
  line-height: 1.56;
}

.lead {
  color: #3f4d48;
  font-size: 17px;
  line-height: 1.5;
}

.screen > p:last-child,
.notice > p:last-child {
  margin-bottom: 0;
}

.principle {
  margin: 20px 0;
  padding: 15px;
  background: var(--soft);
  border-left: 4px solid var(--brand);
  border-radius: 6px;
  color: #34463f;
  font-weight: 650;
}

.actions {
  display: grid;
  gap: 11px;
  margin-top: 24px;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 750;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.btn:focus-visible,
.choice:focus-visible,
.tag:focus-visible,
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 3px solid rgba(39, 99, 84, 0.22);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: #b8c8c2;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.btn.primary:hover {
  background: var(--brand-dark);
}

.btn.danger {
  background: #fff4f4;
  border-color: #efc5c5;
  color: var(--danger);
}

.btn.ghost {
  background: transparent;
}

.btn.nav-active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.helper {
  margin-top: -2px;
  color: #52635d;
  font-size: 14px;
}

.btn.small {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.protection-list {
  padding-left: 20px;
  margin: 8px 0 18px;
}

.protection-list li {
  margin: 8px 0;
}

.notice {
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 8px;
  padding: 13px 14px;
  color: #3f4d48;
}

.notice.warning {
  background: #fff8ea;
  border-color: #f0d8a2;
  color: var(--warn);
}

.notice.danger {
  background: #fff4f4;
  border-color: #efc5c5;
  color: var(--danger);
}

.options-grid {
  display: grid;
  gap: 9px;
  margin: 20px 0;
}

.choice {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  font-weight: 720;
}

.choice span:last-child {
  width: 24px;
  height: 24px;
  border: 2px solid #b8c8c2;
  border-radius: 999px;
  flex: 0 0 auto;
}

.choice.selected {
  border-color: var(--brand);
  background: #f0f7f4;
}

.choice.selected span:last-child {
  background: radial-gradient(circle at center, var(--brand) 45%, transparent 48%);
  border-color: var(--brand);
}

.timer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 12px;
}

.timer strong {
  font-size: clamp(34px, 12vw, 52px);
  line-height: 1;
}

.meter {
  height: 10px;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.meter > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 180ms ease;
}

.recording-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-weight: 700;
  margin: 12px 0 0;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #9aa8a3;
}

.dot.live {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(201, 112, 79, 0.16);
}

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

.step {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
}

.check {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: white;
  font-size: 14px;
  flex: 0 0 auto;
}

.player {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.wave {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 4px;
  height: 54px;
  align-items: center;
  margin-bottom: 16px;
}

.wave span {
  display: block;
  min-height: 8px;
  border-radius: 999px;
  background: rgba(39, 99, 84, 0.32);
}

.wave.playing span {
  animation: pulse 900ms infinite ease-in-out;
}

.wave span:nth-child(3n) {
  height: 42px;
}

.wave span:nth-child(3n + 1) {
  height: 26px;
}

.wave span:nth-child(3n + 2) {
  height: 14px;
}

@keyframes pulse {
  50% {
    transform: scaleY(0.55);
    background: var(--brand);
  }
}

.admin-layout {
  display: grid;
  gap: 18px;
}

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

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.comment-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  display: grid;
  gap: 12px;
}

.comment-card.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 99, 84, 0.11);
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: #42534d;
  font-size: 12px;
  font-weight: 750;
}

.pill.warn {
  background: #fff8ea;
  color: var(--warn);
}

.pill.ok {
  background: #eaf7f0;
  color: var(--ok);
}

.detail {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 4vw, 28px);
}

.field {
  display: grid;
  gap: 7px;
  margin: 16px 0;
}

.field label {
  font-weight: 750;
  color: #34463f;
}

.input,
.select,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  color: var(--ink);
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

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

.tag {
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  cursor: pointer;
  color: #42534d;
}

.tag.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.empty {
  padding: 28px;
  border: 1px dashed #b8c8c2;
  border-radius: 8px;
  text-align: center;
  background: white;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 32px));
  background: #17211d;
  color: white;
  padding: 13px 15px;
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(23, 33, 29, 0.22);
  z-index: 40;
}

@media (min-width: 860px) {
  .actions {
    display: flex;
    flex-wrap: wrap;
  }

  .btn {
    width: auto;
  }

  .options-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-grid {
    grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.4fr);
    align-items: start;
  }
}

@media (max-width: 520px) {
  body {
    background: var(--paper);
  }

  .topbar {
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 7px;
    font-size: 13px;
  }

  .brand-text strong {
    font-size: 15px;
  }

  .brand-text span {
    display: none;
  }

  .nav-actions {
    gap: 5px;
    flex-wrap: nowrap;
  }

  .nav-actions .btn {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 13px;
    white-space: nowrap;
  }

  .main {
    padding: 12px 16px calc(28px + env(safe-area-inset-bottom));
  }

  h1 {
    font-size: 33px;
    margin-bottom: 14px;
  }

  h2 {
    font-size: 25px;
    margin-bottom: 12px;
  }

  .lead {
    font-size: 16px;
  }

  .screen {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
    margin-inline: -16px;
    padding: 22px 16px 26px;
  }

  .actions .btn,
  .row .btn {
    width: 100%;
  }

  .actions {
    gap: 9px;
    margin-top: 22px;
  }

  .btn {
    min-height: 52px;
    padding: 13px 15px;
  }

  .btn.small {
    min-height: 36px;
  }

  .choice {
    min-height: 56px;
    padding: 13px 14px;
  }

  .principle {
    margin: 18px 0;
  }

  .timer strong {
    font-size: 42px;
  }

  .wave {
    grid-template-columns: repeat(18, 1fr);
    gap: 3px;
  }

  .wave span:nth-child(n + 19) {
    display: none;
  }

  .admin-header {
    align-items: stretch;
  }

  .admin-header .btn {
    width: 100%;
  }

  .comment-card,
  .detail,
  .empty {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin-inline: -16px;
  }

  .comment-card {
    padding: 16px;
  }

  .detail {
    padding: 22px 16px;
  }

  .tag-grid {
    gap: 7px;
  }

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