:root {
  --bg: #0f1117;
  --card-bg: #1a1d27;
  --card-hover: #222632;
  --text: #e8e8ed;
  --muted: #8a8fa6;
  --accent: #00c896;
  --accent-hover: #00b386;
  --accent-2: #ff6b6b;
  --border: #2a2e3f;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --radius: 14px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Readex Pro', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body[dir="rtl"] {
  font-family: 'Readex Pro', 'Tajawal', 'Cairo', sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(8px);
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-weight: 700;
  font-size: 22px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  display: inline-block;
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--accent), #00d4a0);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0a0a0a;
  font-weight: 800;
  font-size: 18px;
}
.nav { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 15px; }
.nav a:hover { color: var(--text); }
.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--accent);
  color: #0a0a0a;
  border-radius: 10px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s ease;
  font-family: inherit;
}
.btn:hover { background: var(--accent-hover); color: #0a0a0a; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--card-hover); color: var(--text); }
.btn-lg { padding: 14px 28px; font-size: 17px; }

/* Hero */
.hero {
  padding: 80px 0 60px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.15;
  margin-bottom: 18px;
  letter-spacing: -0.02em;
}
.hero h1 .accent { color: var(--accent); }
.hero .sub {
  font-size: clamp(16px, 2vw, 20px);
  color: var(--muted);
  max-width: 640px;
  margin: 0 auto 32px;
}
.hero-ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Sections */
.section { padding: 60px 0; }
.section h2 {
  font-size: clamp(24px, 3vw, 34px);
  margin-bottom: 32px;
  text-align: center;
  letter-spacing: -0.01em;
}

/* Feature grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h3 { font-size: 18px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; }
.card .icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: inline-block;
}

/* Pricing */
.pricing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.plan {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}
.plan.featured { border-color: var(--accent); position: relative; }
.plan.featured::before {
  content: "Most popular";
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #0a0a0a;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
body[dir="rtl"] .plan.featured::before { content: "الأكثر شعبية"; }
.plan h3 { font-size: 20px; margin-bottom: 6px; }
.plan .price { font-size: 36px; font-weight: 700; margin: 10px 0 6px; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 400; }
.plan ul { list-style: none; text-align: start; margin: 18px 0; padding: 0; }
.plan li { padding: 6px 0; color: var(--muted); font-size: 14px; }
.plan li::before { content: "✓ "; color: var(--accent); font-weight: 700; }

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 60px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Tutor page */
.tutor-shell {
  max-width: 720px;
  margin: 40px auto;
  padding: 0 16px;
}
.tutor-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.mode-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.mode-switch button {
  flex: 1;
  padding: 10px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}
.mode-switch button.active {
  background: var(--accent);
  color: #0a0a0a;
}

#chat {
  min-height: 320px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.msg {
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.55;
  font-size: 16px;
  position: relative;
}
.msg-play {
  position: absolute;
  bottom: -10px;
  inset-inline-start: 8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--accent);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  font-family: inherit;
}
.msg-play:hover {
  background: var(--accent);
  color: #0a0a0a;
}
.tts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.tts-badge {
  font-size: 12px;
  color: var(--muted);
}
.tts-toggle {
  display: flex;
  gap: 4px;
}
.tts-toggle button {
  padding: 4px 10px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.tts-toggle button.active {
  background: var(--accent);
  color: #0a0a0a;
  border-color: var(--accent);
}
.msg.user {
  background: var(--accent);
  color: #0a0a0a;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  background: var(--card-hover);
  color: var(--text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg.system {
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  align-self: center;
  font-style: italic;
}
body[dir="rtl"] .msg.user {
  align-self: flex-end;
  border-bottom-right-radius: 14px;
  border-bottom-left-radius: 4px;
}
body[dir="rtl"] .msg.assistant {
  align-self: flex-start;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 4px;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  align-items: stretch;
}
.controls input {
  flex: 1;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.controls input:focus {
  outline: none;
  border-color: var(--accent);
}

.mic-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: #0a0a0a;
  border: none;
  cursor: pointer;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s ease, background 0.15s ease;
  flex-shrink: 0;
}
.mic-btn:hover { background: var(--accent-hover); }
.mic-btn.recording {
  background: var(--accent-2);
  animation: pulse 1.2s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(255,107,107,0.2); }
}

.status {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

.lang-toggle {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.lang-toggle:hover { color: var(--text); }

@media (max-width: 640px) {
  .hero { padding: 50px 0 40px; }
  .section { padding: 40px 0; }
  .nav { gap: 12px; }
  .nav .nav-link { display: none; }
  .controls { flex-wrap: wrap; }
  .mic-btn { width: 56px; height: 56px; }
}
