*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #07080a;
  --surface: #0f1114;
  --surface-2: #161a1e;
  --surface-3: #1e2328;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #eef1f3;
  --muted: #8a939c;
  --faint: #59626b;
  --accent: #3ee38f;
  --accent-soft: rgba(62, 227, 143, 0.14);
  --accent-ink: #03150b;
  --warn: #ffbb4d;
  --danger: #ff6b6b;
  --radius: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: dark;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "Tahoma", system-ui, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.screen {
  position: fixed;
  inset: 0;
}
.hidden {
  display: none !important;
}

/* ================= ویرایشگر ================= */
#editor {
  overflow-y: auto;
  scroll-behavior: smooth;
  background:
    radial-gradient(1200px 500px at 50% -260px, rgba(62, 227, 143, 0.11), transparent 70%),
    var(--bg);
}

.editor-wrap {
  min-height: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: max(env(safe-area-inset-top), 20px) 16px max(env(safe-area-inset-bottom), 20px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #1b2a22, #0d1511);
  border: 1px solid rgba(62, 227, 143, 0.25);
  color: var(--accent);
  box-shadow: 0 6px 24px rgba(62, 227, 143, 0.12);
}
.brand-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.brand h1 {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 1px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: color 0.2s, background 0.2s;
}
.icon-btn:hover {
  color: var(--text);
  background: var(--surface-3);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
}

.script-card {
  flex: 1;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.script-card:focus-within {
  border-color: rgba(62, 227, 143, 0.45);
  box-shadow: 0 0 0 4px rgba(62, 227, 143, 0.08);
}
#script {
  flex: 1;
  width: 100%;
  min-height: 220px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text);
  font: inherit;
  font-size: 18px;
  line-height: 1.95;
  padding: 18px 18px 8px;
}
#script::placeholder {
  color: var(--faint);
}
.script-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 12px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.script-stats b {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.script-stats .sep {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--faint);
}

.setup {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: opacity 0.25s;
}
.setup-card.disabled .stepper {
  opacity: 0.35;
  pointer-events: none;
}
.setup-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.setup-head > div {
  flex: 1;
  min-width: 0;
}
.setup-head h2 {
  font-size: 14.5px;
  font-weight: 700;
}
.setup-head p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.setup-icon {
  width: 36px;
  height: 36px;
  padding: 8px;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}
#voiceCard:only-child {
  grid-column: 1 / -1;
}

/* شمارنده + / − */
.stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px;
  transition: opacity 0.25s;
}
.stepper output {
  flex: 1;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.step {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--surface-3);
  color: var(--text);
  touch-action: manipulation;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
}
.step:active {
  background: var(--accent);
  color: var(--accent-ink);
  transform: scale(0.94);
}

/* کلید روشن/خاموش */
.switch {
  position: relative;
  width: 46px;
  height: 28px;
  flex: none;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 0.2s;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cfd5da;
  transition: transform 0.25s var(--ease), background 0.2s;
}
.switch input:checked + span {
  background: var(--accent);
  border-color: transparent;
}
.switch input:checked + span::after {
  transform: translateX(18px);
  background: #fff;
}
.switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(62, 227, 143, 0.22);
  transition: transform 0.12s, box-shadow 0.2s, filter 0.2s;
}
.btn-primary:hover {
  filter: brightness(1.05);
}
.btn-primary:active {
  transform: scale(0.985);
}
.btn-primary svg {
  width: 20px;
  height: 20px;
}
.btn-primary.shake {
  animation: shake 0.35s;
}
@keyframes shake {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ================= معرفی و راهنما ================= */
.more-link {
  align-self: center;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 10px;
}
.more-link:hover {
  color: var(--accent);
}

.landing {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 16px max(env(safe-area-inset-bottom), 32px);
  display: flex;
  flex-direction: column;
  gap: 44px;
  line-height: 1.95;
}
.landing h2 {
  font-size: 21px;
  font-weight: 800;
  margin-bottom: 14px;
  scroll-margin-top: 20px;
}
.landing h3 {
  font-size: 15px;
  font-weight: 700;
}
.landing p {
  color: #b8c0c7;
  font-size: 15px;
}
.intro p strong {
  color: var(--text);
}
.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.badges li {
  font-size: 13px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 99px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(62, 227, 143, 0.2);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.feature svg {
  width: 34px;
  height: 34px;
  padding: 7px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 10px;
}
.feature p {
  font-size: 13.5px;
  line-height: 1.85;
  margin-top: 4px;
}

.steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-block: 14px;
  padding-inline: 58px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.steps li::before {
  content: attr(data-n);
  position: absolute;
  inset-inline-start: 14px;
  top: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--accent-ink);
  background: var(--accent);
}
.steps p {
  font-size: 14px;
}

.uses {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}
.uses li {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.uses b {
  font-size: 14.5px;
}
.uses span {
  font-size: 13px;
  color: var(--muted);
}

.faq {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.faq details + details {
  border-top: 1px solid var(--border);
}
.faq summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "+";
  color: var(--accent);
  font-size: 20px;
  line-height: 1.4;
  transition: transform 0.25s var(--ease);
}
.faq details[open] summary::after {
  transform: rotate(45deg);
}
.faq details p {
  padding: 0 16px 16px;
  font-size: 14.5px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.site-footer p {
  font-size: 13px;
  color: var(--muted);
}
.site-footer a {
  color: var(--accent);
  text-decoration: none;
}

/* ================= صفحه نمایش ================= */
#prompter {
  background: #000;
  overflow: hidden;
}

#talent {
  --ly: 36vh;
  --band: 100px;
  position: absolute;
  inset: 0;
  transition: transform 0.3s var(--ease);
}

#stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 90%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 7%, #000 90%, transparent 100%);
}
#stage:active {
  cursor: grabbing;
}
#stage.focus {
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0,
    rgba(0, 0, 0, 0.3) calc(var(--ly) - var(--band) * 2.3),
    #000 calc(var(--ly) - var(--band) * 0.85),
    #000 calc(var(--ly) + var(--band) * 1.1),
    rgba(0, 0, 0, 0.45) calc(var(--ly) + var(--band) * 3),
    rgba(0, 0, 0, 0.1) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0,
    rgba(0, 0, 0, 0.3) calc(var(--ly) - var(--band) * 2.3),
    #000 calc(var(--ly) - var(--band) * 0.85),
    #000 calc(var(--ly) + var(--band) * 1.1),
    rgba(0, 0, 0, 0.45) calc(var(--ly) + var(--band) * 3),
    rgba(0, 0, 0, 0.1) 100%
  );
}

#content {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: var(--w, 88%);
  max-width: calc(100% - 32px);
  padding-bottom: 100vh;
  font-weight: 700;
  text-align: center;
  overflow-wrap: break-word;
  will-change: transform;
}
#content.align-start p {
  text-align: start;
}
#content p {
  text-wrap: pretty;
}
#content p.gap {
  height: 0.7em;
}

#readline {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--ly, 36vh);
  height: 0;
  pointer-events: none;
}
#readline::before {
  content: "";
  position: absolute;
  left: 34px;
  right: 34px;
  top: -1px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(62, 227, 143, 0.22) 15%, rgba(62, 227, 143, 0.22) 85%, transparent);
}
#readline i {
  position: absolute;
  top: -9px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  filter: drop-shadow(0 0 6px rgba(62, 227, 143, 0.6));
}
#readline i:first-child {
  left: 8px;
  border-left: 14px solid var(--accent);
}
#readline i:last-child {
  right: 8px;
  border-right: 14px solid var(--accent);
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: env(safe-area-inset-top) 12px 0;
  pointer-events: none;
  transition: opacity 0.5s;
}
.progress {
  height: 3px;
  margin: 0 -12px;
  background: rgba(255, 255, 255, 0.07);
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(62, 227, 143, 0.7);
}
.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.hud-group {
  display: flex;
  gap: 6px;
}
.hud-chip {
  padding: 5px 11px;
  border-radius: 10px;
  background: rgba(16, 18, 21, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.hud-chip.muted {
  color: var(--muted);
}
.pace.on-time {
  color: var(--accent);
}
.pace.late {
  color: var(--warn);
}
.voice-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 46vw;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.voice-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
}
.pulse {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.6);
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(255, 107, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, 0); }
}

/* ---------- شمارش معکوس ---------- */
#countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10;
}
#countNum {
  font-size: min(40vmin, 260px);
  font-weight: 900;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 60px rgba(62, 227, 143, 0.4);
}
#countNum.pop {
  animation: pop 0.9s var(--ease);
}
@keyframes pop {
  0% { transform: scale(0.5); opacity: 0; }
  35% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.06); opacity: 0.6; }
}

/* ---------- نوار کنترل ---------- */
#dock {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100%);
  padding: 0 12px max(env(safe-area-inset-bottom), 12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 5;
  transition: transform 0.45s var(--ease), opacity 0.35s;
}
.dock-speed,
.dock-main {
  display: flex;
  align-items: center;
  background: rgba(18, 21, 24, 0.82);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--border-strong);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.dock-speed {
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  transition: opacity 0.25s;
}
.dock-speed.disabled {
  opacity: 0.35;
  pointer-events: none;
}
.dock-speed .step {
  width: 40px;
  height: 40px;
  background: transparent;
}
.speed-read {
  min-width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
.speed-read output {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.speed-read small {
  font-size: 10.5px;
  color: var(--muted);
}
.dock-main {
  width: 100%;
  justify-content: space-between;
  gap: 6px;
  padding: 7px;
  border-radius: 22px;
}
.ctrl {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: var(--text);
  transition: background 0.2s, color 0.2s, transform 0.12s;
}
.ctrl:hover {
  background: rgba(255, 255, 255, 0.07);
}
.ctrl:active {
  transform: scale(0.92);
}
.ctrl.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.ctrl.play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 6px 24px rgba(62, 227, 143, 0.35);
}
.ctrl.play svg {
  width: 26px;
  height: 26px;
}
.ctrl.play.listening {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 6px 24px rgba(255, 107, 107, 0.35);
}
#voiceBtn.unsupported {
  opacity: 0.35;
}

/* حالت بی‌کاری حین پخش: کنترل‌ها کنار می‌روند */
#prompter.idle #dock {
  transform: translate(-50%, calc(100% + 20px));
  opacity: 0;
  pointer-events: none;
}
#prompter.idle #hud {
  opacity: 0.45;
}
#prompter.idle #stage {
  cursor: none;
}

/* ---------- برگه تنظیمات ---------- */
#scrim {
  position: absolute;
  inset: 0;
  z-index: 19;
}
#sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: rgba(14, 16, 19, 0.9);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border-top: 1px solid var(--border-strong);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.6);
  z-index: 20;
  animation: sheet-in 0.35s var(--ease);
}
@keyframes sheet-in {
  from { transform: translateY(40px); opacity: 0; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
}
.sheet-head h2 {
  font-size: 16px;
  font-weight: 800;
}
.sheet-body {
  overflow-y: auto;
  padding: 4px 18px max(env(safe-area-inset-bottom), 20px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field label,
.field-label {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
}
.field output {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 6px;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), var(--surface-3) var(--fill, 50%));
}
input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 6px;
  background: var(--surface-3);
}
input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 6px;
  background: var(--accent);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: #fff;
}

.swatches {
  display: flex;
  gap: 10px;
}
.swatch {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  position: relative;
}
.swatch[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
}

.segmented {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 3px;
}
.segmented button {
  flex: 1;
  padding: 9px 6px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.toggles {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.toggle + .toggle {
  border-top: 1px solid var(--border);
}
.toggle b {
  display: block;
  font-size: 14px;
  font-weight: 600;
}
.toggle small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
}
.btn-secondary svg {
  width: 18px;
  height: 18px;
}
.shortcuts {
  font-size: 12px;
  color: var(--faint);
  line-height: 2.2;
  text-align: center;
}
kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 5px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  color: var(--muted);
}

/* ---------- پیام ---------- */
#toast {
  position: fixed;
  left: 50%;
  top: max(env(safe-area-inset-top), 16px);
  transform: translate(-50%, -20px);
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: 14px;
  background: rgba(30, 35, 40, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-strong);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 0.25s, transform 0.35s var(--ease);
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- صفحه‌های بزرگ ---------- */
@media (min-width: 900px) {
  #sheet {
    left: auto;
    right: auto;
    inset-inline-end: 16px;
    top: 16px;
    bottom: 16px;
    width: 360px;
    max-height: none;
    border-radius: 22px;
    border: 1px solid var(--border-strong);
  }
}

/* افقی یا ارتفاع کم: نوار در یک ردیف */
@media (max-height: 520px) {
  #dock {
    flex-direction: row;
    width: auto;
    gap: 8px;
  }
  .dock-main {
    width: auto;
  }
  .ctrl {
    width: 44px;
    height: 44px;
  }
  .ctrl.play {
    width: 52px;
    height: 52px;
  }
  #sheet {
    max-height: 88vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ================= راست‌به‌چپ و زبان‌ها ================= */
[dir="rtl"] .switch input:checked + span::after {
  transform: translateX(-18px);
}
[dir="rtl"] input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(to left, var(--accent) var(--fill, 50%), var(--surface-3) var(--fill, 50%));
}
/* فلش «بازگشت» در چپ‌به‌راست به چپ اشاره می‌کند */
[dir="ltr"] #backBtn svg {
  transform: scaleX(-1);
}
.brand-name {
  unicode-bidi: isolate;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}
.lang-menu {
  position: relative;
}
.lang-menu summary {
  list-style: none;
  width: auto;
  padding: 0 10px;
  gap: 6px;
  display: flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
}
.lang-menu summary::-webkit-details-marker {
  display: none;
}
.lang-menu nav {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  z-index: 30;
}
.lang-menu nav a {
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.lang-menu nav a:hover {
  background: var(--surface-3);
}
.lang-menu nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.lang-hint {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: max(env(safe-area-inset-top), 10px);
  background: rgba(22, 26, 30, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-strong);
  font-size: 14px;
}
.lang-hint a {
  color: var(--accent-ink);
  background: var(--accent);
  padding: 4px 14px;
  border-radius: 99px;
  font-weight: 700;
  text-decoration: none;
}
.lang-hint button {
  color: var(--muted);
  font-size: 14px;
  padding: 4px;
}

.footer-langs {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
}

/* ---------- رضایت کوکی ---------- */
.consent {
  position: fixed;
  inset-inline: 16px;
  bottom: max(env(safe-area-inset-bottom), 16px);
  margin-inline: auto;
  max-width: 520px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(22, 26, 30, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: sheet-in 0.35s var(--ease);
}
.consent p {
  font-size: 14px;
  line-height: 1.8;
  color: #c9d0d6;
}
.consent-actions {
  display: flex;
  gap: 8px;
}
/* دو دکمه هم‌وزن، تا رد کردن به اندازه پذیرفتن آسان باشد */
.consent-btn {
  flex: 1;
  padding: 11px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
}
.consent-btn:hover {
  background: #262c32;
}
#prompter:not(.hidden) ~ .consent {
  display: none;
}
.link-btn {
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover {
  color: var(--text);
}

/* زبان گفتار: پنج گزینه؛ در صفحه باریک دو ردیف می‌شود */
#langSeg {
  flex-wrap: wrap;
}
#langSeg button {
  flex: 1 1 18%;
  min-width: 64px;
}
