/* Free tools pages. Loaded after styles.css, which holds the tokens and shared components. */
.tool-intro {
  padding: 48px 0 28px;
  text-align: center;
  background: linear-gradient(to bottom, var(--surface-low), var(--bg));
}
.tool-intro h1 {
  margin: 8px auto 12px;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.tool-intro .lead { margin: 0 auto; max-width: 600px; }

.crumbs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 600 13px var(--font-label);
  color: var(--text-muted);
}
.crumbs a { color: var(--primary); }
.crumbs a:hover { text-decoration: underline; }
.crumbs .ms { font-size: 18px; }

.tool-badges {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.tool-badges li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line);
  font: 600 13px var(--font-label);
}
.tool-badges .ms { font-size: 18px; }

/* Converter card */
.converter {
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3), inset 0 0 0 1px var(--line);
}
@media (min-width: 640px) { .converter { padding: 16px; } }
.conv-pane { padding: 20px; }
.conv-pane[hidden] { display: none; }
@media (min-width: 640px) { .conv-pane { padding: 28px; } }
.conv-pane[data-pane='idle'] { padding: 0; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 20px;
  border-radius: var(--r-md);
  border: 2px dashed var(--outline-variant);
  background: color-mix(in srgb, var(--surface-low) 60%, transparent);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
@media (min-width: 640px) { .dropzone { padding: 64px 32px; } }
.dropzone:hover,
.dropzone.over {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 5%, var(--surface));
}
.dropzone:focus-within { outline: 2px solid var(--secondary); outline-offset: 3px; }
.dropzone strong { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.dropzone small { color: var(--text-muted); font: 500 13px var(--font-label); margin-top: 6px; }
.drop-or { color: var(--text-muted); font: 500 13px var(--font-label); }
.drop-icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.drop-icon .ms { font-size: 34px; }
.dropzone.over .drop-icon { animation: lift 0.6s ease-in-out infinite alternate; }
@keyframes lift { to { transform: translateY(-4px); } }

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: var(--r);
  background: var(--surface-low);
}
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta .muted { font: 500 13px var(--font-label); }

.opt { border: 0; padding: 0; margin: 24px 0 0; }
.opt legend { font: 600 13px var(--font-label); margin-bottom: 10px; padding: 0; }
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-mid);
}
.seg label { position: relative; }
.seg label[hidden] { display: none; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span {
  display: block;
  padding: 10px 6px;
  border-radius: 10px;
  text-align: center;
  font: 600 13px var(--font-label);
  color: var(--text-muted);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.seg input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.seg input:focus-visible + span { outline: 2px solid var(--secondary); outline-offset: 2px; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  font: 600 14px var(--font-label);
  cursor: pointer;
  position: relative;
}
.switch-row[hidden] { display: none; }
.switch-row input { position: absolute; opacity: 0; width: 40px; height: 24px; margin: 0; cursor: pointer; }
.switch {
  width: 40px;
  height: 24px;
  flex: none;
  border-radius: 99px;
  background: var(--surface-highest);
  position: relative;
  transition: background 0.2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: transform 0.2s;
}
.switch-row input:checked + .switch { background: var(--secondary); }
.switch-row input:checked + .switch::after { transform: translateX(16px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--secondary); outline-offset: 2px; }

.warn,
.note {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 14px;
}
.warn { background: color-mix(in srgb, var(--primary) 7%, transparent); color: var(--text); }
.warn .ms { color: var(--primary); }
.note { background: color-mix(in srgb, var(--secondary) 8%, transparent); }
.warn[hidden],
.note[hidden] { display: none; }
.opt .note { margin-top: 10px; }

.conv-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.conv-actions .btn { flex: 1 1 200px; }

/* Working */
.working { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.working strong { font-size: 18px; }
.working .muted { font: 500 13px var(--font-label); }
.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 50%, transparent);
  animation: pulse 1.4s ease-out infinite;
}
@keyframes pulse { to { box-shadow: 0 0 0 12px transparent; } }
.bar {
  margin-top: 20px;
  height: 10px;
  border-radius: 99px;
  background: var(--surface-highest);
  overflow: hidden;
}
.bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.2s;
}
.pct {
  margin-top: 10px;
  font: 800 32px var(--font-body);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.small { font-size: 13px; margin-top: 14px; }

/* Done and error */
.done-head { display: flex; gap: 12px; align-items: flex-start; }
.done-head > .ms { font-size: 32px; }
.done-head div { display: flex; flex-direction: column; gap: 2px; }
.done-head strong { font-size: 18px; }
.done-head .muted { font-size: 14px; }
#preview {
  display: block;
  width: 100%;
  max-height: 420px;
  margin-top: 20px;
  border-radius: var(--r);
  background: #0b1c30;
}

/* Below the converter */
.record-tip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin: 20px 0 8px;
  padding: 16px 20px;
  border-radius: var(--r-md);
  background: var(--surface-low);
}
.record-tip p { flex: 1 1 260px; font-size: 14.5px; color: var(--text-muted); }
.record-tip b { color: var(--text); }
.record-tip .f-icon { width: 40px; height: 40px; border-radius: 12px; }
.record-tip .f-icon .ms { font-size: 22px; }

.why-grid { display: grid; gap: 20px; }
@media (min-width: 760px) { .why-grid { grid-template-columns: repeat(3, 1fr); } }
.why { padding: 24px; }
.why .f-icon { margin-bottom: 16px; }
.why h3 { font-size: 18px; margin-bottom: 6px; }
.why p { color: var(--text-muted); font-size: 14.5px; }

/* Tools index */
.tool-list { display: grid; gap: 16px; margin-top: 8px; }
.tool-group { margin: 36px 0 12px; font-size: 22px; }
.tool-group:first-child { margin-top: 0; }
.tool-card { display: flex; align-items: center; gap: 18px; padding: 24px 28px; }
.tool-card:hover { box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line); transform: translateY(-2px); }
.tool-card div { flex: 1; }
.tool-card h2 { font-size: 20px; margin-bottom: 4px; }
.tool-card p { color: var(--text-muted); font-size: 14.5px; }
.tool-card .arrow { color: var(--text-muted); transition: transform 0.2s; }
.tool-card:hover .arrow { transform: translateX(3px); color: var(--primary); }
.more-soon { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 24px 0 0; font: 500 14px var(--font-label); }
.more-soon .ms { font-size: 18px; }
.tools-cta { padding-top: 64px; }

/* Link to the converter going the other way, under the badges */
.swap-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font: 600 14px var(--font-label);
  color: var(--secondary);
}
.swap-link:hover { text-decoration: underline; }
.swap-link .ms { font-size: 20px; }
.tool-card h3 { font-size: 18px; margin-bottom: 4px; }
.faq details p a { color: var(--primary); font-weight: 600; }

.tools-help { text-align: center; margin-top: 10px; font-size: 14px; }
.tools-help a { color: var(--primary); font-weight: 600; }

/* Start and end picker (GIF and trim tools) */
.timeline { margin-top: 20px; }
.timeline video {
  display: block;
  width: 100%;
  max-height: 340px;
  border-radius: var(--r);
  background: #0b1c30;
}
.tl-no-preview { margin-top: 10px; }
.tl-track {
  position: relative;
  height: 44px;
  margin: 14px 14px 0;
  cursor: pointer;
  touch-action: none;
}
.tl-track::before,
.tl-range {
  content: '';
  position: absolute;
  top: 50%;
  height: 8px;
  border-radius: 4px;
  transform: translateY(-50%);
}
.tl-track::before { left: 0; right: 0; background: var(--surface-highest); }
.tl-range { background: var(--secondary); }
.tl-playhead {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--text);
  transform: translateX(-1px);
  pointer-events: none;
}
.tl-handle {
  position: absolute;
  top: 50%;
  width: 22px;
  height: 36px;
  padding: 0;
  border: 3px solid var(--secondary);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transform: translate(-50%, -50%);
  cursor: ew-resize;
  touch-action: none;
}
.tl-handle:focus-visible { outline: 2px solid var(--secondary); outline-offset: 3px; }
.tl-times {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  font: 500 13px var(--font-label);
  color: var(--text-muted);
}
.tl-times b { color: var(--text); font-variant-numeric: tabular-nums; }
.tl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tl-actions .btn { flex: 1 1 130px; }

/* GIF result */
#gif-result {
  display: block;
  max-width: 100%;
  max-height: 420px;
  margin: 20px auto 0;
  border-radius: var(--r);
}
.estimate { margin-top: 20px; font: 600 14px var(--font-label); text-align: center; }

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

/* Mic and webcam test */
.device-grid { display: grid; gap: 16px; }
@media (min-width: 760px) { .device-grid { grid-template-columns: 1fr 1fr; } }
.device { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.device[hidden] { display: none; }
.device .warn,
.device .note { margin-top: 0; }
.device-head { display: flex; align-items: center; gap: 12px; }
.device-head h2 { flex: 1; margin: 0; font-size: 20px; }
.status-chip {
  padding: 4px 10px;
  border-radius: 99px;
  font: 600 12px var(--font-label);
  background: var(--surface-mid);
  color: var(--text-muted);
}
.status-chip[data-tone='good'] { background: color-mix(in srgb, var(--tertiary) 12%, transparent); color: var(--tertiary); }
.status-chip[data-tone='warn'] { background: #fef3c7; color: #92400e; }
.status-chip[data-tone='bad'] { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.device-pick { display: flex; flex-direction: column; gap: 6px; font: 600 13px var(--font-label); }
.device-pick[hidden] { display: none; }
.device-pick select {
  padding: 10px 12px;
  border: 1px solid var(--surface-highest);
  border-radius: 12px;
  font: 500 14px var(--font-label);
  background: var(--surface);
  color: var(--text);
}
.level-row { display: flex; align-items: center; gap: 12px; }
.level { flex: 1; display: grid; grid-template-columns: repeat(16, 1fr); gap: 4px; height: 40px; }
.level span { border-radius: 4px; background: var(--surface-highest); transition: background 0.08s; }
.level span[data-on='true'] { background: var(--tertiary); }
.level span:nth-child(n + 11)[data-on='true'] { background: #d97706; }
.level span:nth-child(n + 14)[data-on='true'] { background: var(--primary); }
#mic-db { min-width: 56px; text-align: right; font: 600 13px var(--font-label); font-variant-numeric: tabular-nums; }
#mic-playback { width: 100%; }
#cam-preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-radius: var(--r);
  background: #0b1c30;
  transform: scaleX(-1);
}
.device-hint { font-size: 14px; }
.device-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.device-actions .btn { flex: 1 1 160px; }
#devices-unsupported { grid-column: 1 / -1; }
