/* ============================================================
   BanglaTypingTest.com — Main Stylesheet
   Modern Dark Theme with Glassmorphism
   Font: Hind Siliguri (Bangla) + Inter (English)
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── CSS Variables ── */
:root {
  /* Default: Dark Theme */
  --theme-mode: dark;
  --bg-primary: #090e15;
  --bg-secondary: #0e1622;
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-card-hover: rgba(255, 255, 255, 0.07);
  --glass: rgba(14, 22, 34, 0.78);
  --glass-border: rgba(203, 42, 42, 0.16);

  --accent: #CB2A2A;
  --accent-hover: #b52222;
  --accent-2: #9e1a1a;
  --accent-rgb: 203, 42, 42;
  --accent-glow: rgba(203, 42, 42, 0.35);
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-yellow: #f59e0b;
  --accent-pink: #ec4899;
  --link-hover: #ff7a7a;

  --gradient-primary: linear-gradient(135deg, #CB2A2A 0%, #9e1a1a 100%);
  --gradient-hero: linear-gradient(135deg, #090e15 0%, #150a0a 50%, #1f0b0b 100%);

  --text-primary: #fdf2f2;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(203, 42, 42, 0.25);

  --input-bg: rgba(255, 255, 255, 0.04);
  --input-border: rgba(203, 42, 42, 0.25);
  --nav-bg: rgba(9, 14, 21, 0.88);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --font-bangla: 'Hind Siliguri', 'SolaimanLipi', serif;
  --font-en: 'Inter', -apple-system, sans-serif;
}

/* ── Light Theme Variables ── */
[data-theme="light"] {
  --theme-mode: light;
  --bg-primary: #fdfcfc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #fff5f5;
  --glass: rgba(255, 255, 255, 0.88);
  --glass-border: rgba(203, 42, 42, 0.20);

  --accent: #CB2A2A;
  --accent-hover: #b52222;
  --accent-2: #9e1a1a;
  --accent-rgb: 203, 42, 42;
  --accent-glow: rgba(203, 42, 42, 0.25);
  --link-hover: #9e1a1a;

  --gradient-primary: linear-gradient(135deg, #CB2A2A 0%, #9e1a1a 100%);
  --gradient-hero: linear-gradient(135deg, #fff5f5 0%, #fdfcfc 50%, #ffe4e6 100%);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 4px 15px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 35px rgba(203, 42, 42, 0.25);

  --input-bg: #ffffff;
  --input-border: rgba(203, 42, 42, 0.25);
  --nav-bg: rgba(255, 255, 255, 0.90);
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-bangla);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.7;
  overflow-x: hidden;
  padding-top: 68px;
  transition: background 0.3s ease, color 0.3s ease;
}

body.has-announcement {
  padding-top: 112px;
}

/* ── Animated Background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(203, 42, 42, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(158, 26, 26, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(203, 42, 42, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.5s ease;
}

[data-theme="light"] body::before {
  background:
    radial-gradient(ellipse 80% 60% at 20% 20%, rgba(203, 42, 42, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 80%, rgba(244, 63, 94, 0.06) 0%, transparent 60%);
}

/* ── Typography ── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-bangla);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.en {
  font-family: var(--font-en);
}

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

a:hover {
  color: var(--link-hover);
}

/* ── Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 60px;
  align-items: center;
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--glass-border);
  transition: var(--transition);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary) !important;
  text-decoration: none;
}

.navbar-brand .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.navbar-brand span.brand-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.navbar-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--text-primary);
  background: var(--glass);
}

.navbar-nav a.active {
  color: var(--accent);
}

/* ── Nav Dropdown Menu ── */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 1050;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.nav-dropdown-menu a {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.nav-dropdown-menu a:hover,
.nav-dropdown-menu a.active {
  background: var(--glass);
  color: var(--accent);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Theme Switcher Button ── */
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(15deg);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: var(--transition);
  z-index: 1001;
}

.hamburger:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.hamburger span {
  width: 22px;
  height: 2.2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  transform-origin: center;
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7.2px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7.2px) rotate(-45deg);
}

.mobile-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 998;
}

.mobile-menu-backdrop.active {
  display: block;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-bottom: 1px solid var(--glass-border);
  padding: 16px 18px 32px;
  z-index: 999;
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.navbar.has-announcement .mobile-menu {
  top: 112px;
  max-height: calc(100vh - 112px);
}

.mobile-user-card {
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.mobile-menu-section-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 14px 0 6px 8px;
}

.site-announcement {
  height: 44px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.site-announcement-inner {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 14px;
  font-size: 0.86rem;
}

.site-announcement-inner span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-announcement[data-tone="success"] {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
}

.site-announcement[data-tone="warning"] {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
}

.mobile-menu.open {
  display: block;
}

.mobile-menu .navbar-nav {
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  list-style: none;
}

.mobile-menu .navbar-nav a {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.mobile-menu .navbar-nav a:hover,
.mobile-menu .navbar-nav a.active {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-bangla);
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: var(--transition);
}

.btn:hover::before {
  background: rgba(255, 255, 255, 0.08);
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff !important;
  box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.35);
}

.btn-primary:hover {
  box-shadow: 0 8px 30px rgba(var(--accent-rgb), 0.55);
  transform: translateY(-1px);
  color: #fff !important;
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
}

.btn-ghost {
  background: var(--glass);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
}

.btn-ghost:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: rgba(16, 185, 129, 0.25);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1.05rem;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
}

.btn-xl {
  padding: 18px 44px;
  font-size: 1.15rem;
  border-radius: var(--radius);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(10px);
  transition: var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
}

.card-glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
}

/* ── Forms ── */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-bangla);
  transition: var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  background: var(--input-bg);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.20);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.pwd-input-wrap {
  position: relative;
  display: block;
}

.pwd-toggle-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, transform 0.15s;
  padding: 0;
  border-radius: var(--radius-sm);
  z-index: 2;
}

.pwd-toggle-btn:hover {
  color: var(--text-primary);
}

.pwd-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.auth-page {
  min-height: calc(100vh - 68px);
  display: flex;
  align-items: center;
  padding: 108px 0 60px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 32px;
  border-radius: var(--radius-lg);
}

.image-tool-page {
  padding-top: 112px;
  padding-bottom: 64px;
}

.image-tool-heading {
  max-width: 720px;
  margin: 0 auto 28px;
  text-align: center;
}

.image-tool-heading h1 {
  margin: 8px 0;
  font-size: 2rem;
}

.image-tool-heading > p:last-child,
.image-preview-heading p,
.image-source-info,
.image-output-info,
.image-privacy-note {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.image-tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.82fr);
  align-items: start;
  gap: 18px;
}

.image-tool-controls,
.image-tool-preview {
  min-width: 0;
  padding: 22px;
}

.image-dropzone {
  min-height: 190px;
  padding: 22px;
  border: 1px dashed var(--input-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  background: var(--input-bg);
  color: var(--text-secondary);
}

.image-dropzone strong {
  color: var(--text-primary);
}

.image-dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.image-drop-icon {
  color: var(--accent);
  font-size: 1.8rem;
  line-height: 1;
}

.image-source-info {
  min-height: 1.4em;
  margin: 12px 0 18px;
  overflow-wrap: anywhere;
}

.image-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.image-color-control input[type="color"] {
  min-height: 44px;
  padding: 5px;
}

.image-quality-control input[type="range"],
.image-crop-controls input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.image-crop-controls {
  margin: 4px 0 16px;
}

.image-crop-controls label {
  margin-top: 10px;
}

.image-tool-status {
  min-height: 1.5em;
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.86rem;
}

.image-tool-status[data-kind="error"] {
  color: var(--accent-red);
}

.image-tool-status[data-kind="success"] {
  color: var(--accent-green);
}

.image-preview-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.image-preview-heading h2 {
  font-size: 1.05rem;
}

.image-preview-heading p {
  margin-top: 3px;
}

.image-canvas-stage {
  min-height: 250px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  background-image: linear-gradient(45deg, var(--bg-card-hover) 25%, transparent 25%), linear-gradient(-45deg, var(--bg-card-hover) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--bg-card-hover) 75%), linear-gradient(-45deg, transparent 75%, var(--bg-card-hover) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.image-canvas-stage canvas {
  display: block;
  max-width: 100%;
  max-height: 360px;
  height: auto;
  object-fit: contain;
}

.image-output-info {
  min-height: 1.4em;
  margin: 14px 0;
}

.image-download {
  width: 100%;
}

.image-download[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.image-privacy-note {
  margin: 12px 0 0;
  text-align: center;
}

.home-featured-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.home-featured-tool {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-primary);
  text-decoration: none;
}

.home-featured-tool span {
  color: var(--text-secondary);
  font-size: 0.88rem;
}

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-en);
}

.badge-easy {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-medium {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-yellow);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-hard {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-primary {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
}

.badge-purple {
  background: rgba(124, 58, 237, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(124, 58, 237, 0.25);
}

/* ── Alert / Flash messages ── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  animation: slideDown 0.3s ease;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #fca5a5;
}

.alert-info {
  background: rgba(79, 142, 247, 0.1);
  border: 1px solid rgba(79, 142, 247, 0.25);
  color: #93c5fd;
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Stat boxes ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: var(--transition);
}

.stat-box:hover::before {
  opacity: 1;
}

.stat-box:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.stat-value {
  font-family: var(--font-en);
  font-size: 2.4rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  display: block;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 1.3rem;
}

/* ── Typing Area ── */
.typing-area-wrapper {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.passage-display {
  font-family: var(--font-bangla);
  font-size: 1.5rem;
  line-height: 2.2;
  padding: 32px;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: relative;
  min-height: 160px;
  user-select: none;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  transition: var(--transition);
}

.passage-display .char {
  position: relative;
}

.passage-display .char.correct {
  color: var(--accent-green);
  font-weight: 500;
}

.passage-display .char.incorrect {
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.18);
  border-radius: 2px;
}

.passage-display .char.current {
  background: rgba(var(--accent-rgb), 0.35);
  border-radius: 3px;
  animation: blink 1s step-end infinite;
}

.passage-display .char.pending {
  color: var(--text-muted);
}

@keyframes blink {

  0%,
  100% {
    background: rgba(var(--accent-rgb), 0.35);
  }

  50% {
    background: rgba(var(--accent-rgb), 0.10);
  }
}

.typing-input {
  width: 100%;
  padding: 20px 32px;
  background: var(--input-bg);
  border: 1px solid var(--glass-border);
  border-top: 1px solid transparent;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  color: var(--text-primary);
  font-size: 1.3rem;
  font-family: var(--font-bangla);
  outline: none;
  transition: var(--transition);
  caret-color: var(--accent);
}

.typing-input:focus {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.20);
}

.typing-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Timer display ── */
.timer-ring {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.timer-ring svg {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.timer-ring .timer-value {
  font-family: var(--font-en);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  z-index: 1;
}

/* ── Progress bar ── */
.progress-bar-wrap {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 100px;
  transition: width 0.3s ease;
}

/* ── Leaderboard ── */
.leaderboard-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
}

.leaderboard-table th {
  padding: 12px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  font-family: var(--font-en);
}

.leaderboard-table td {
  padding: 14px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
}

.leaderboard-table td:first-child {
  border-left: 1px solid var(--glass-border);
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.leaderboard-table td:last-child {
  border-right: 1px solid var(--glass-border);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.leaderboard-table tr:hover td {
  background: var(--bg-card-hover);
}

.rank-medal {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  font-family: var(--font-en);
}

.rank-1 {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #000;
}

.rank-2 {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
  color: #000;
}

.rank-3 {
  background: linear-gradient(135deg, #cd7f32, #a05000);
  color: #fff;
}

.rank-other {
  background: var(--glass);
  color: var(--text-secondary);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

/* ── Footer ── */
.footer {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), rgba(255, 255, 255, 0.035));
  border-top: 1px solid var(--border);
  padding: 56px 0 20px;
  margin-top: 72px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px);
  margin-bottom: 36px;
}

.footer-brand {
  max-width: 340px;
}

.footer-brand-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.footer-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.footer-brand-name {
  font-size: 1.12rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-brand-copy {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
  max-width: 34ch;
}

.footer-social-links {
  margin-top: 18px;
}

.footer-brand h3 {
  font-size: 1.2rem;
  margin-bottom: 12px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.8;
}

.footer-col h4 {
  font-size: 0.96rem;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
}

.footer-col ul {
  list-style: none;
}

.footer-col ul li {
  margin-bottom: 0;
}

.footer-col ul li a {
  display: inline-flex;
  align-items: baseline;
  padding: 5px 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
  transition: var(--transition);
  line-height: 1.5;
}

.footer-col ul li a:hover {
  color: var(--accent);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-legal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.footer-legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.footer-legal-links a {
  color: var(--text-secondary);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

.footer-credit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.social-links {
  display: flex;
  gap: 10px;
}

.social-link {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}

.social-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Section helpers ── */
.section-header {
  text-align: center;
  margin-bottom: 56px;
}

.section-header .section-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
  font-family: var(--font-en);
}

.section-header h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  margin-bottom: 16px;
}

.section-header p {
  font-size: 1rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto;
}

/* ── Tooltips ── */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 22, 40, 0.95);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  border: 1px solid var(--glass-border);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ── Utility classes ── */
.text-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-secondary);
}

.text-sm {
  font-size: 0.875rem;
}

.text-xs {
  font-size: 0.78rem;
}

.text-lg {
  font-size: 1.1rem;
}

.text-xl {
  font-size: 1.25rem;
}

.font-en {
  font-family: var(--font-en);
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.items-center {
  align-items: center;
}

.gap-2 {
  gap: 8px;
}

.gap-3 {
  gap: 12px;
}

.gap-4 {
  gap: 16px;
}

.mt-1 {
  margin-top: 4px;
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mt-6 {
  margin-top: 24px;
}

.mt-8 {
  margin-top: 32px;
}

.mt-12 {
  margin-top: 48px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

.mb-6 {
  margin-bottom: 24px;
}

.mb-8 {
  margin-bottom: 32px;
}

.hidden {
  display: none !important;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

.glow {
  box-shadow: 0 0 30px rgba(var(--accent-rgb), 0.2);
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ── Animations ── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

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

@keyframes float {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-8px);
  }
}

.animate-fade-up {
  animation: fadeInUp 0.6s ease both;
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

/* ============================================================
   ── Responsive foundation (desktop · tablet · mobile) ──
   Breakpoints: 1920 / 1440 / 1280 / 1100 / 860 / 768 / 640 / 480 / 380
   ============================================================ */

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 84px;
}

body {
  -webkit-tap-highlight-color: rgba(var(--accent-rgb), 0.15);
}

img,
video,
canvas,
iframe {
  max-width: 100%;
}

img,
video {
  height: auto;
}

pre,
code {
  max-width: 100%;
  overflow-x: auto;
}

a,
button,
label,
[role="button"],
input[type="submit"],
input[type="button"] {
  touch-action: manipulation;
}

/* Notch / home-indicator safe areas */
.navbar {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.footer {
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

/* Keyboard focus ring (inputs keep their own glow ring) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form-control:focus-visible,
.typing-input:focus-visible {
  outline: none;
}

/* Fluid typography for the typing area */
.passage-display {
  font-size: clamp(1.15rem, 0.6rem + 2.2vw, 1.5rem);
  overflow-wrap: break-word;
}

.typing-input {
  font-size: clamp(1.05rem, 0.6rem + 1.6vw, 1.3rem);
}

.image-tool-heading h1 {
  font-size: clamp(1.5rem, 4.5vw, 2rem);
}

/* Password toggle must not overlap the typed text */
.pwd-input-wrap .form-control {
  padding-right: 52px;
}

/* Browser autofill keeps the theme colours */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text-primary);
  caret-color: var(--text-primary);
  box-shadow: 0 0 0 1000px var(--bg-secondary) inset;
  transition: background-color 9999s ease-out 0s;
}

/* Table helper: horizontal scroll instead of page overflow */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Dropdown: JS can add .open for touch devices; never leave the viewport */
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(4px);
}

.nav-dropdown-menu {
  max-width: calc(100vw - 32px);
}

/* Tooltips: wrap on narrow screens, off on touch */
[data-tooltip]::after {
  white-space: normal;
  width: max-content;
  max-width: min(240px, 70vw);
  text-align: center;
}

/* Mobile menu: dynamic viewport height, safe area, no scroll chaining */
.mobile-menu {
  overscroll-behavior: contain;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

@supports (height: 100dvh) {
  .mobile-menu {
    max-height: calc(100dvh - 68px);
  }

  .navbar.has-announcement .mobile-menu {
    max-height: calc(100dvh - 112px);
  }

  .auth-page {
    min-height: calc(100dvh - 68px);
  }
}

.mobile-menu .navbar-nav a {
  min-height: 44px;
}

/* ── Large screens ── */
@media (min-width: 1440px) {
  .container {
    max-width: 1320px;
  }

  .container-wide {
    max-width: 1520px;
  }
}

@media (min-width: 1920px) {
  html {
    font-size: 17px;
  }

  .container {
    max-width: 1440px;
  }

  .container-wide {
    max-width: 1680px;
  }
}

/* Desktop: the mobile drawer never shows (e.g. after rotating/resizing) */
@media (min-width: 1101px) {
  .mobile-menu,
  .mobile-menu.open,
  .mobile-menu-backdrop,
  .mobile-menu-backdrop.active {
    display: none !important;
  }
}

/* ── Compact desktop ── */
@media (max-width: 1280px) {
  .navbar-inner {
    gap: 10px;
  }

  .navbar-nav {
    gap: 2px;
  }

  .navbar-nav a {
    padding: 8px 10px;
    font-size: 0.86rem;
  }
}

/* ── Tablet: hamburger navigation ── */
@media (max-width: 1100px) {
  .navbar-nav {
    display: none;
  }

  .navbar-actions > a {
    display: none !important;
  }

  .hamburger {
    display: flex;
  }

  .mobile-menu .navbar-nav {
    display: flex;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-brand {
    grid-column: 1 / -1;
    max-width: 600px;
  }

  .home-hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    gap: 36px;
  }
}

@media (max-width: 900px) {
  .image-tool-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .home-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .hero-section {
    padding: 108px 0 52px !important;
  }

  .home-demo {
    animation: none;
  }
}

/* ── Large phones / small tablets ── */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 26px 18px;
  }

  .footer-brand {
    grid-column: 1 / -1;
    max-width: none;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .footer-legal {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .footer-credit {
    white-space: normal;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .passage-display {
    padding: 20px;
    min-height: 130px;
  }

  .typing-input {
    padding: 16px 20px;
  }

  /* 16px inputs stop iOS Safari from zooming the page on focus */
  .form-control,
  select.form-control,
  input,
  textarea,
  select {
    font-size: 16px;
  }

  .form-control {
    min-height: 46px;
  }

  .section-header {
    margin-bottom: 40px;
  }

  .auth-page {
    padding: 96px 0 40px;
  }

  .home-cta {
    padding: 36px 20px !important;
  }

  .home-cta h2 {
    font-size: 1.55rem !important;
  }
}

/* ── Phones ── */
@media (max-width: 640px) {
  .card {
    padding: 18px;
  }

  /* Leaderboard scrolls sideways inside itself */
  .leaderboard-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    padding: 10px 12px;
  }

  .image-control-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .image-tool-page {
    padding-top: 96px;
    padding-bottom: 40px;
  }

  .image-tool-controls,
  .image-tool-preview {
    padding: 16px;
  }

  .image-dropzone {
    min-height: 150px;
    padding: 16px;
  }

  .image-canvas-stage {
    min-height: 200px;
  }
}

@media (max-width: 480px) {
  .container,
  .container-wide {
    padding-right: 14px;
    padding-left: 14px;
  }

  .navbar-brand {
    font-size: 1.1rem;
    gap: 8px;
  }

  .navbar-brand .logo-icon {
    width: 36px;
    height: 36px;
  }

  .btn-lg,
  .btn-xl {
    white-space: normal;
    text-align: center;
  }

  .btn-xl {
    padding: 14px 28px;
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.9rem;
  }

  .home-hero-actions {
    display: grid !important;
    grid-template-columns: 1fr;
  }

  .home-hero-actions .btn {
    width: 100%;
  }

  .home-stats {
    gap: 14px !important;
    margin-top: 30px !important;
    padding-top: 24px !important;
  }

  .home-stats > div {
    flex: 1 1 28%;
  }

  .home-stats .stat-value {
    font-size: 1.5rem !important;
  }

  .home-demo > .card-glass {
    padding: 20px !important;
  }

  .auth-card {
    padding: 22px;
  }

  .footer-grid {
    gap: 22px 14px;
  }

  .footer-col h4 {
    font-size: 0.9rem;
  }

  .footer-col ul li a {
    font-size: 0.84rem;
  }
}

@media (max-width: 380px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-box {
    padding: 14px 10px;
  }

  .mobile-auth-actions {
    grid-template-columns: 1fr;
  }
}

/* Landscape phones: short viewport */
@media (max-height: 480px) and (orientation: landscape) {
  .passage-display {
    padding: 14px 20px;
    line-height: 1.9;
    min-height: 100px;
  }

  .auth-page {
    align-items: flex-start;
    padding-top: 84px;
  }
}

/* Touch screens: comfortable tap targets, no sticky hover effects */
@media (pointer: coarse) {
  .btn {
    min-height: 44px;
  }

  .btn-icon,
  .theme-toggle-btn,
  .hamburger,
  .social-link,
  .pwd-toggle-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .btn-icon,
  .social-link {
    width: 44px;
    height: 44px;
  }

  .footer-col ul li a {
    padding: 8px 0;
  }
}

@media (hover: none) {
  .btn-primary:hover,
  .stat-box:hover,
  .theme-toggle-btn:hover {
    transform: none;
  }

  [data-tooltip]::after {
    display: none;
  }
}

/* Respect "reduce motion" */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Print: content only */
@media print {
  .navbar,
  .mobile-menu,
  .mobile-menu-backdrop,
  .site-announcement,
  .theme-toggle-btn,
  .footer,
  .typing-input,
  .passage-display {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  body::before {
    display: none;
  }
}

/* ============================================================
   ── Client-side hardening (CSS) ──
   CSS cannot enforce real security. These rules discourage
   copy-paste cheating, dragging/saving UI assets, bot form spam,
   double submits and framing. Real protection (CSP frame-ancestors,
   X-Frame-Options, HSTS, Secure/HttpOnly cookies, CSRF, rate
   limits) must be set in PHP / .htaccess.
   ============================================================ */

/* 1. Always honour the [hidden] attribute */
[hidden] {
  display: none !important;
}

/* 2. Typing test: passage cannot be selected, copied or dragged */
.passage-display,
.passage-display * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}

.passage-display::selection,
.passage-display *::selection {
  background: transparent;
  color: inherit;
}

/* 3. UI chrome is not selectable (no accidental highlight / drag-select) */
.btn,
.hamburger,
.theme-toggle-btn,
.navbar-brand,
.timer-ring,
.rank-medal,
.badge {
  -webkit-user-select: none;
  user-select: none;
}

/* 4. Site images cannot be dragged out or long-press saved */
img {
  -webkit-user-drag: none;
  user-drag: none;
  -webkit-touch-callout: none;
}

/* 5. Native password reveal (Edge/IE) would duplicate the custom toggle */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none;
}

/* 6. Honeypot field for bots. Add to login/register/review forms:
      <input type="text" name="website" class="hp-field" tabindex="-1"
             autocomplete="off" aria-hidden="true">
      and reject the request in PHP when it is not empty. */
.hp-field,
.honeypot {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* 7. Frame guard. Add this one line in <head> (before the CSS loads):
      if (top !== self) document.documentElement.classList.add('is-framed');
      The page stays blank when embedded in another site's iframe. */
html.is-framed body {
  display: none !important;
}

/* 8. Disabled / busy controls cannot be clicked twice.
      JS adds .is-submitting to a <form> while a request runs. */
.btn:disabled,
.btn[disabled],
[aria-disabled="true"],
form.is-submitting button[type="submit"],
form.is-submitting input[type="submit"] {
  opacity: 0.55;
  pointer-events: none;
  cursor: not-allowed;
}

/* 9. Screen-reader-only text (labels for icon buttons, honeypot labels) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Global Tools & Pages Mobile Optimization ── */
@media (max-width: 860px) {
  #lessons-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  #lesson-list-wrap {
    max-height: 240px;
    overflow-y: auto;
  }
}

@media (max-width: 768px) {
  .test-container {
    padding: 20px 14px !important;
  }

  /* Dual Editor Textareas (Unicode / Bijoy Converters) */
  #unicode-input,
  #bijoy-output,
  #bijoy-input,
  #kb-screen {
    height: 200px !important;
    font-size: 1rem !important;
    padding: 12px !important;
  }

  /* Cards in tools & pages */
  .card {
    padding: 18px 14px !important;
    border-radius: 12px !important;
  }

  /* Headings & badges */
  h1 {
    font-size: 1.65rem !important;
  }

  /* Buttons & Flex Controls wrap gracefully */
  .test-container .card > div[style*="display:flex"],
  .test-container .card > div[style*="display: flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .test-container .card > div[style*="display:flex"] > div,
  .test-container .card > div[style*="display: flex"] > div {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
  }

  /* Dual editor grid */
  div[style*="grid-template-columns:repeat(auto-fit,minmax(320px,1fr))"],
  div[style*="grid-template-columns: repeat(auto-fit, minmax(320px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Leaderboard Podium on mobile */
  div[style*="grid-template-columns:1fr 1.15fr 1fr"],
  div[style*="grid-template-columns: 1fr 1.15fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Juktoborno search & grid */
  #jukto-grid {
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr)) !important;
    gap: 8px !important;
  }
  .jukto-card {
    padding: 8px 6px !important;
  }
  .jukto-char {
    font-size: 1.2rem !important;
  }
}

@media (max-width: 480px) {
  .test-container {
    padding: 16px 10px !important;
  }

  h1 {
    font-size: 1.45rem !important;
    letter-spacing: normal !important;
  }

  .card {
    padding: 14px 12px !important;
  }

  .v-key {
    height: 42px !important;
    font-size: 0.95rem !important;
  }

  /* Metric cards on mobile */
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
}

/* ── Modern Single Blog Article Styling ── */
.blog-article-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 40px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  margin-bottom: 40px;
}
.blog-featured-media {
  margin: -44px -40px 36px -40px;
  overflow: hidden;
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  max-height: 480px;
  position: relative;
  background: #0d1117;
}
.blog-featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  max-height: 480px;
}
.blog-featured-badge {
  position: absolute;
  top: 20px;
  left: 24px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.blog-content-body {
  font-size: 1.12rem;
  line-height: 2;
  color: var(--text-secondary);
  word-wrap: break-word;
}
.blog-content-body p {
  margin-bottom: 22px;
}
.blog-content-body h2.blog-heading {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 38px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.blog-content-body h3.blog-subheading {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 28px 0 12px;
}
.blog-content-body strong {
  color: var(--text-primary);
  font-weight: 700;
}
.blog-content-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Shortcode Components */
.blog-callout {
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 12px;
  margin: 26px 0;
  border-left: 5px solid;
  align-items: flex-start;
  font-size: 1rem;
  line-height: 1.7;
}
.blog-callout-icon {
  flex-shrink: 0;
  margin-top: 2px;
}
.blog-callout-text {
  flex: 1;
}
.blog-callout-info {
  background: rgba(79, 142, 247, 0.08);
  border-color: #4f8ef7;
  color: var(--text-primary);
}
.blog-callout-info .blog-callout-icon { color: #4f8ef7; }

.blog-callout-success {
  background: rgba(16, 185, 129, 0.08);
  border-color: #10b981;
  color: var(--text-primary);
}
.blog-callout-success .blog-callout-icon { color: #10b981; }

.blog-callout-warning,
.blog-callout-tip {
  background: rgba(245, 158, 11, 0.1);
  border-color: #f59e0b;
  color: var(--text-primary);
}
.blog-callout-warning .blog-callout-icon,
.blog-callout-tip .blog-callout-icon { color: #f59e0b; }

.blog-callout-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  color: var(--text-primary);
}
.blog-callout-danger .blog-callout-icon { color: #ef4444; }

.blog-quote {
  margin: 28px 0;
  padding: 20px 26px;
  border-left: 4px solid var(--accent);
  background: var(--glass);
  border-radius: 0 12px 12px 0;
  font-style: italic;
  color: var(--text-primary);
  font-size: 1.15rem;
  line-height: 1.8;
}
.blog-quote cite {
  display: block;
  font-style: normal;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 10px;
}

.blog-figure {
  margin: 30px 0;
  text-align: center;
}
.blog-inline-img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: block;
  margin: 0 auto;
}
.blog-figure figcaption {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 10px;
  font-style: italic;
}

.blog-list {
  margin: 18px 0 24px 20px;
  padding-left: 10px;
  list-style: disc;
}
.blog-list li {
  margin-bottom: 10px;
  line-height: 1.8;
  color: var(--text-secondary);
}

.blog-share-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 0;
  margin-top: 36px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.blog-share-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 680px) {
  .blog-article-wrap {
    padding: 24px 18px;
    border-radius: var(--radius-lg);
  }
  .blog-featured-media {
    margin: -24px -18px 24px -18px;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    max-height: 280px;
  }
  .blog-content-body {
    font-size: 1.02rem;
    line-height: 1.85;
  }
  .blog-content-body h2.blog-heading {
    font-size: 1.35rem;
  }
  .blog-quote {
    padding: 16px 18px;
    font-size: 1rem;
  }
}
