/* Ivokan design tokens — mirrors frontend/tailwind.config.js */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #e89331;
  --primary-dark: #cf7d20;
  --primary-tint: #fdf2e5;
  --secondary: #2a9d8f;
  --secondary-dark: #218074;
  --secondary-tint: #e6f4f2;
  --background: #ffffff;
  --surface: #ffffff;
  --line: #e7e2d8;
  --ink: #1f1b16;
  --ink-muted: #6f6457;
  --ink-faint: #9a8d7c;
  --danger: #d1495b;
  --radius: 16px;
}

body {
  /* Content protection: text is not selectable (form fields excepted). */
  user-select: none;
  -webkit-user-select: none;
  font-family: "Montserrat", "Helvetica Neue", sans-serif;
  background: var(--background);
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--background);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

header h1 {
  display: flex;
  align-items: center;
}

header h1 img {
  height: 32px;
  display: block;
}

header .who {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Compact progress indicator in the header */
.mini-progress {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hbar {
  width: 56px;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.hbar div {
  height: 100%;
  background: var(--secondary);
  border-radius: 3px;
  transition: width 0.3s;
}

#summary-count {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-muted);
}

select {
  font: inherit;
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 700;
}

.join-form select {
  width: 100%;
  border-radius: 12px;
  padding: 13px 12px;
  font-size: 15px;
  font-weight: 500;
}

main {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Hero */
.hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero img {
  width: 100%;
  max-height: 210px;
  object-fit: cover;
  border-radius: var(--radius);
}

.hero h2 {
  font-family: "Archivo Black", "Helvetica Neue", sans-serif;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.25;
}

.hero p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.join-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

label .optional {
  font-weight: 500;
  color: var(--ink-faint);
}

/* Inline new-language field, right under the language select */
.newlang {
  display: flex;
  gap: 8px;
}

.newlang input {
  flex: 1;
  min-width: 0;
}

.newlang .btn {
  padding: 13px 16px;
  flex-shrink: 0;
}

/* Icon legend (replaces the pitch once the feed starts) */
.legend {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.legend p {
  font-size: 13.5px;
}

.legend ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.4;
}

.legend .ic {
  flex-shrink: 0;
  width: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-faint);
}

.legend .ic svg {
  width: 16px;
  height: 16px;
}

.legend .ic-mic {
  color: var(--primary);
}

.legend .ic-txt {
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: underline;
}

/* Recording tips */
.tips {
  background: var(--secondary-tint);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tips p {
  font-size: 13.5px;
  color: var(--ink);
}

.tips ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tips li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.stat-row {
  display: flex;
  gap: 10px;
}

.stat {
  flex: 1;
  background: var(--primary-tint);
  border-radius: 12px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat b {
  font-size: 20px;
  color: var(--primary-dark);
}

.stat span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
}

/* Corrections list under a row (chevron) */
.corr {
  border-left: 3px solid var(--line);
  padding: 2px 0 2px 10px;
  font-size: 13px;
  line-height: 1.5;
}

.like-btn {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
  background: var(--surface);
}

.like-btn svg {
  width: 13px;
  height: 13px;
}

.like-btn.liked {
  border-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary-dark);
}

.corr .by {
  font-weight: 700;
  color: var(--ink-muted);
}

.corr .accepted {
  color: var(--secondary-dark);
  font-weight: 700;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hint {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.error {
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

label {
  font-size: 13px;
  font-weight: 700;
}

input[type="text"],
input[type="password"] {
  user-select: text;
  -webkit-user-select: text;
  font: inherit;
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  outline-color: var(--primary);
}

button {
  font: inherit;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  transition: transform 0.1s, opacity 0.15s, background 0.15s;
}

button:active {
  transform: scale(0.97);
}

button:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.btn {
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-ghost {
  color: var(--ink-muted);
  text-decoration: underline;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

/* Language filter chips */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--ink-muted);
}

.chip.active {
  background: var(--primary-tint);
  border-color: var(--primary);
  color: var(--primary-dark);
}

/* Item feed: compact rows separated by hairlines */
.feed {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.item {
  border-bottom: 1px solid var(--line);
  padding: 10px 2px;
  display: flex;
  flex-direction: column;
}

.item .top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expander {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.expander svg {
  width: 15px;
  height: 15px;
  transition: transform 0.15s;
}

.expander.open svg {
  transform: rotate(90deg);
}

.item .texts {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}

.item .term {
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.item .translation {
  font-size: 13.5px;
  color: var(--ink-muted);
  margin-left: 8px;
  overflow-wrap: anywhere;
}

/* French source to translate into the language */
.badge-fr {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-tint);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-prop {
  margin-left: 6px;
  font-size: 12px;
}

.count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.count.has-takes {
  color: var(--secondary-dark);
}

.count svg {
  width: 13px;
  height: 13px;
}

.mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mic-btn:hover {
  background: var(--primary-tint);
}

.mic-btn svg {
  width: 20px;
  height: 20px;
}

.mic-btn.recording {
  background: var(--danger);
  color: #fff;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(209, 73, 91, 0.4); }
  70% { box-shadow: 0 0 0 14px rgba(209, 73, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(209, 73, 91, 0); }
}

.item .panel {
  margin: 10px 0 4px 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item .panel .status {
  font-size: 13px;
  font-weight: 600;
  color: var(--danger);
  text-align: center;
}

.edit-link {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-faint);
  text-decoration: underline;
  padding: 0;
  border-radius: 0;
}

audio {
  width: 100%;
  height: 40px;
}

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

.row .btn {
  flex: 1;
}

/* Review page */
.review-item .meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
}

.review-item .term {
  font-size: 22px;
  font-weight: 700;
}

.review-item .translation {
  font-size: 14px;
  color: var(--ink-muted);
}

.stats {
  display: flex;
  gap: 6px;
  justify-content: center;
  font-size: 13px;
  color: var(--ink-muted);
  flex-wrap: wrap;
}

.stats b {
  color: var(--ink);
}

/* New-entry proposal card (sits between main and footer) */
.propose {
  width: calc(100% - 32px);
  max-width: 528px;
  margin: 8px auto 32px;
}

.propose select {
  width: 100%;
  border-radius: 12px;
  padding: 13px 12px;
  font-size: 15px;
  font-weight: 500;
}

/* Footer */
footer {
  border-top: 1px solid var(--line);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

footer nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

footer a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

footer p {
  font-size: 11.5px;
  color: var(--ink-faint);
  text-align: center;
}

/* Feed loading animation */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 0;
}

.spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3.5px solid var(--primary-tint);
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}

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

.hidden {
  display: none !important;
}
