:root {
  --page-bg: #ffffff;
  --card-bg: #D9EDF9;
  --surface: #ffffff;
  --input-bg: #f3f8fc;
  --blue: #0084ff;
  --blue-dark: #0070db;
  --blue-soft: #e3f2fd;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #d1dce6;
  --border-dashed: #c5d4e0;
  --danger: #d63a52;
  --radius: 16px;
  --radius-input: 10px;
  --hero-eyebrow: #00aeef;
  --hero-title: #001f3f;
  --hero-sub: #666666;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Noto Sans", "Noto Sans Devanagari", "Noto Sans Arabic", "Noto Sans Bengali", "Noto Sans Malayalam", system-ui, sans-serif;
  color: var(--text);
  line-height: 1.5;
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

button {
  font: inherit;
}

/* ===== Layout ===== */

.page {
  display: flex;
  justify-content: center;
  padding: 40px 16px 72px;
}

.form-shell {
  width: 100%;
  max-width: 620px;
}

/* ===== Hero (above form) ===== */

.hero-intro {
  text-align: center;
  margin-bottom: 28px;
  padding: 0 4px;
}

.hero-eyebrow {
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hero-eyebrow);
}

.hero-title {
  margin: 0 0 16px;
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--hero-title);
}

.hero-sub {
  margin: 0 auto;
  max-width: 520px;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--hero-sub);
}

.lang-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.lang-btn {
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
  white-space: nowrap;
}

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

.lang-btn.active {
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--blue);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.form {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 36px 36px;
}

.form[dir="rtl"] .consent-label,
.form[dir="rtl"] .field-label,
.form[dir="rtl"] .section-title-blue {
  text-align: right;
}

.form[dir="rtl"] .text-input,
.form[dir="rtl"] .story-textarea {
  text-align: right;
}

.head {
  margin-bottom: 24px;
}

.section-title-blue {
  margin: 0 0 20px;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--blue);
  text-align: left;
  letter-spacing: -0.01em;
}

.field {
  margin-bottom: 24px;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
}

.field-label-first {
  margin-top: 0;
}

.field-label-block {
  margin: 0 0 10px;
}

/* ===== Inputs ===== */

.text-input {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--input-bg);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input::placeholder,
.story-textarea::placeholder {
  color: #9ca3af;
}

.text-input:focus,
.story-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 132, 255, 0.12);
}

/* ===== Photo dropzone ===== */

.dropzone {
  border: 2px dashed var(--border-dashed);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--blue);
  background: rgba(255, 255, 255, 0.9);
  outline: none;
}

.dropzone.dragging {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.dz-icon {
  display: inline-flex;
  width: 48px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  color: var(--blue);
  margin-bottom: 10px;
}

.dz-icon svg {
  width: 32px;
  height: 32px;
}

.dz-title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text);
}

.dz-sub {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.45;
}

.photo-preview {
  margin-top: 14px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}

.photo-preview img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.photo-preview .secondary-btn {
  border-radius: 0;
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border);
}

/* ===== Pill toggles ===== */

.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.pill svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.pill:hover:not(.active) {
  border-color: #b8c9d8;
  color: #4b5563;
}

.pill.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: none;
}

.pill:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* ===== Panels / cards ===== */

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.story-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid #e8eef3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 28px 24px 24px;
}

.voice-card {
  text-align: center;
}

.mic-hero {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--blue);
  margin-bottom: 10px;
}

.mic-hero svg {
  width: 40px;
  height: 40px;
  stroke-width: 2;
}

.mic-hero.recording {
  animation: micPulse 1.2s infinite;
}

@keyframes micPulse {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.75;
    transform: scale(1.08);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.voice-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.voice-sub {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.5;
  max-width: 340px;
  margin-left: auto;
  margin-right: auto;
}

.timer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.live-timer {
  font-size: 1.5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--blue);
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--danger);
  font-weight: 700;
  font-size: 0.9rem;
}

.live-status .rec-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1s infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.voice-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.record-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 32px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s ease;
}

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

.record-btn:active {
  transform: translateY(0);
}

.record-btn:focus-visible {
  outline: 3px solid rgba(0, 132, 255, 0.35);
  outline-offset: 3px;
}

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

.record-btn.recording {
  background: var(--danger);
}

.record-btn.recording:hover {
  background: #c23149;
}

.link-btn {
  border: 0;
  padding: 0;
  background: none;
  color: var(--blue);
  font-weight: 600;
  font-size: inherit;
  cursor: pointer;
  text-decoration: none;
}

.link-btn:hover {
  color: var(--blue-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.preview audio {
  width: 100%;
}

.secondary-btn {
  padding: 11px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--surface);
  color: var(--blue);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.secondary-btn:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

/* ===== Write it ===== */

.story-textarea {
  width: 100%;
  min-height: 250px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--input-bg);
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  resize: vertical;
}

.char-hint {
  margin: 8px 0 0;
  text-align: right;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ===== Consent ===== */

.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--muted);
  box-shadow: none;
}

.consent-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}

/* ===== Submit / messages ===== */

.submit-btn {
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

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

.form-message {
  margin: 16px 0 0;
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--surface);
  font-weight: 600;
  font-size: 0.875rem;
}

.form-message.success {
  background: #e6fbf0;
  color: #0b7a44;
}

.form-message.error {
  background: #fdecef;
  color: var(--danger);
}

.form-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-input);
  background: #fdecef;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.8125rem;
  text-align: left;
}

/* ===== Responsive ===== */

@media (max-width: 560px) {
  .page {
    padding: 24px 12px 48px;
  }

  .lang-btn {
    padding: 8px 16px;
    font-size: 0.8125rem;
  }

  .form {
    padding: 28px 20px 24px;
  }

  .section-title-blue {
    font-size: 1.0625rem;
  }

  .story-card {
    padding: 22px 16px 18px;
  }

  .pill {
    padding: 9px 16px;
    font-size: 0.8125rem;
  }

  .record-btn {
    padding: 11px 26px;
  }

  .live-timer {
    font-size: 1.3rem;
  }
}
