:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #657487;
  --line: #d9e0e7;
  --primary: #176b87;
  --primary-dark: #0e536b;
  --accent: #b2533e;
  --ok: #176b4c;
  --warning: #9a4d00;
  --button-text: #ffffff;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.admin-shell {
  width: min(100%, 1240px);
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 760;
}

h2 {
  font-size: 20px;
}

h3 {
  margin: 0;
  font-size: 17px;
}

.topbar p,
.panel-heading p,
.detail-head p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.admin-link {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary);
  text-decoration: none;
  background: var(--surface);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.hidden {
  display: none !important;
}

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

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.requirements {
  margin-bottom: 18px;
  border: 1px solid #cdd9d3;
  border-radius: 8px;
  background: #f5faf7;
  padding: 14px;
}

.requirements ul {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--text);
  line-height: 1.65;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 11px;
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(23, 107, 135, 0.22);
  outline-offset: 2px;
}

.wide-field {
  grid-column: 1 / -1;
}

.consent-row {
  grid-template-columns: 20px 1fr;
  align-items: start;
  color: var(--text);
  line-height: 1.5;
}

.consent-row input {
  min-height: auto;
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.primary-action,
.secondary-action,
.record-action,
.icon-btn,
.segmented {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.primary-action {
  background: var(--primary);
  color: var(--button-text);
  font-weight: 700;
}

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

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

.record-action {
  min-height: 72px;
  width: 150px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--button-text);
  font-size: 22px;
  font-weight: 800;
}

button:disabled,
.disabled-link {
  cursor: not-allowed;
  opacity: 0.48;
  pointer-events: none;
}

.progress-line {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
}

.progress-copy {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 650;
}

progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: #edf1f4;
}

progress::-webkit-progress-bar {
  background: #edf1f4;
}

progress::-webkit-progress-value {
  background: var(--primary);
}

progress::-moz-progress-bar {
  background: var(--primary);
}

.icon-btn {
  width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  background: #f9fafb;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
}

.sentence-box {
  margin: 18px 0;
  padding: 20px;
  border: 1px solid #cbd7df;
  border-radius: 8px;
  background: #fbfcfd;
}

.sentence-id {
  color: var(--primary);
  font-weight: 760;
  margin-bottom: 10px;
}

.sentence-box p {
  font-size: clamp(25px, 7vw, 42px);
  font-weight: 760;
  line-height: 1.34;
  overflow-wrap: anywhere;
}

.status-line {
  min-height: 30px;
  color: var(--muted);
  font-weight: 650;
}

.status-line[data-variant="ok"] {
  color: var(--ok);
}

.status-line[data-variant="warning"] {
  color: var(--warning);
}

.meter {
  height: 12px;
  overflow: hidden;
  margin: 10px 0 18px;
  border-radius: 99px;
  background: #edf1f4;
}

.meter > div {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 80ms linear;
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  flex-wrap: wrap;
}

.playback {
  width: 100%;
  margin-top: 8px;
}

.jump-row {
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 10px;
  margin-top: 16px;
}

.jump-row label {
  width: 130px;
}

.compact {
  min-height: 38px;
  padding: 7px 11px;
  font-size: 14px;
}

.group-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.group-head h2 {
  margin-top: 4px;
}

.group-head p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.group-label {
  color: var(--primary);
  font-weight: 760;
}

.group-counter {
  flex: 0 0 auto;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  font-weight: 700;
}

.group-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.group-tab {
  display: grid;
  gap: 3px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  padding: 7px;
}

.group-tab strong {
  color: var(--text);
}

.group-tab.active {
  border-color: var(--primary);
  background: #eef7f9;
}

.group-tab.done {
  border-color: #b7d7c8;
  background: #eff8f3;
}

.admin-layout {
  display: grid;
  grid-template-columns: 330px 1fr;
  gap: 16px;
  align-items: start;
}

.participant-panel,
.recording-panel {
  min-height: 340px;
}

.participant-list,
.recording-list {
  display: grid;
  gap: 10px;
}

.participant-item {
  display: grid;
  width: 100%;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  padding: 11px;
  text-align: left;
}

.participant-item.active {
  border-color: var(--primary);
  box-shadow: inset 4px 0 0 var(--primary);
}

.participant-main {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

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

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

.mode-row {
  display: inline-flex;
  gap: 0;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.segmented {
  min-height: 38px;
  border-radius: 0;
  background: #ffffff;
  color: var(--text);
}

.segmented.active {
  background: var(--primary);
  color: var(--button-text);
}

.admin-group-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.admin-group-pill {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 9px 10px;
  color: var(--muted);
}

.admin-group-pill strong {
  color: var(--text);
}

.admin-group-pill.done {
  border-color: #b7d7c8;
  background: #eff8f3;
}

.recording-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.recording-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.recording-copy p {
  margin-top: 7px;
  line-height: 1.5;
}

.recording-copy small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.recording-item audio {
  width: 100%;
}

.tag {
  border-radius: 999px;
  background: #e7f3ee;
  color: var(--ok);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.tag.muted {
  background: #eef1f4;
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  padding: 12px;
}

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

  .detail-head {
    display: grid;
  }

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

@media (max-width: 620px) {
  .app-shell,
  .admin-shell {
    padding-inline: 12px;
  }

  .topbar {
    align-items: stretch;
  }

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

  .panel {
    padding: 14px;
  }

  .sentence-box {
    padding: 16px;
  }

  .record-action {
    width: 132px;
  }

  .group-head {
    display: grid;
  }

  .group-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
