/* ==========================================================
   All Keyboards – styles
   ========================================================== */
:root {
  --teal: #3fa7bf;
  --teal-dark: #135e6e;
  --teal-mid: #2b8ea5;
  --gray: #f5f5f5;
  --border: #d9dee0;
  --text: #333;
  --white: #fff;
  --yellow: #f6d629;
  --radius: 8px;
  --font: "Lato", "Open Sans", system-ui, sans-serif;
  --font-hi: "Noto Sans Devanagari", "Mangal", "Kohinoor Devanagari", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--white);
}

.container-xl { max-width: 1100px; }

/* ---------- Header ---------- */
.site-header { padding: 14px 0; }
/* Bootstrap's .navbar resets the container's side padding; restore it so the
   logo and menu button line up with the page content on small screens */
.site-header .navbar { padding-left: .75rem; padding-right: .75rem; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text);
}
.brand-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 38px;
  border: 2px solid var(--teal);
  border-radius: 6px;
  color: var(--teal);
  font-size: 1.5rem;
}
.brand-text { font-weight: 900; font-size: 1.15rem; }

.navbar-toggler {
  border: 1px solid var(--teal);
  color: var(--teal);
}
.navbar-toggler:focus { box-shadow: 0 0 0 .15rem rgba(63, 167, 191, .35); }

.main-nav .nav-link {
  color: #444;
  font-size: .85rem;
  padding: 6px 12px !important;
  position: relative;
}
.main-nav .nav-link:hover,
.main-nav .nav-link.active { color: var(--teal); }
.main-nav .nav-link.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: var(--teal);
}

.social-square { display: flex; gap: 8px; }
.social-square a {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--teal);
  border-radius: 4px;
  color: var(--teal);
  font-size: .85rem;
  text-decoration: none;
  transition: background .2s, color .2s;
}
.social-square a:hover { background: var(--teal); color: var(--white); }

/* ---------- Font type ---------- */
.page { padding-top: 24px; }

.font-type {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.font-type label { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.font-type .form-select { max-width: 240px; border-color: #999; }

/* ---------- Editor ---------- */
.editor {
  border: 1px solid var(--teal);
  border-radius: 2px;
  background: var(--white);
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  background: var(--teal);
  min-height: 42px;
}

.tool-group {
  min-height: 46px;          /* keeps space above/below the icons, even when the toolbar wraps */
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px 0 0;
  border-right: 2px solid rgba(255, 255, 255, .6);
  flex: 0 0 auto;
}

.tool-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--white);
  border-radius: 50%;
  background: transparent;
  color: var(--white);
  font-size: .8rem;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.tool-btn:hover { background: rgba(255, 255, 255, .2); }
.tool-btn:active { transform: scale(.92); }
.tool-btn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

/* first icon sits on a dark-teal block */
.tool-btn--primary {
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  padding: 0 8px;
  align-self: stretch;
  background: var(--teal-dark);
}
.tool-btn--primary i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid var(--white);
  border-radius: 50%;
}
.tool-btn--primary:hover { background: #0f4f5d; }

.translate-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 1 1 auto;
  padding: 6px 14px;
}
.translate-group label { color: var(--white); font-weight: 700; font-size: .9rem; }
.translate-group .form-select {
  width: 110px;
  background-color: var(--teal);
  border: 1px solid rgba(255, 255, 255, .8);
  color: var(--white);
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.translate-group .form-select option { color: var(--text); background: var(--white); }

.btn-translate {
  border: 0;
  border-radius: 3px;
  background: var(--teal-mid);
  color: var(--white);
  font-size: .8rem;
  padding: 5px 14px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25);
  transition: background .2s;
}
.btn-translate:hover { background: var(--teal-dark); }

.editor-text {
  width: 100%;
  min-height: 175px;
  border: 0;
  resize: vertical;
  padding: 14px 16px;
  font-family: var(--font-hi);
  font-size: 1.05rem;
  line-height: 1.7;
  color: #222;
  outline: none;
}
.editor-text::placeholder { color: #a9b3b6; font-weight: 400; opacity: 1; }

/* ---------- Voice to Hindi text ---------- */
.editor-body {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}
.editor-body .editor-text { display: block; padding-right: 68px; } /* keep text clear of the mic */

/* mic: same circular white-outline icon as the toolbar, on a teal disc */
.editor-body .voice-btn {
  position: absolute;
  right: 22px;
  bottom: 18px;
  z-index: 2;
  width: 44px;
  height: 44px;
  background: var(--teal);
  box-shadow: 0 0 0 3px var(--teal), 0 2px 6px rgba(19, 94, 110, .35);
  font-size: 1rem;
}
.editor-body .voice-btn:hover { background: var(--teal-mid); }

.editor-body .voice-btn.is-recording {
  background: #e53935;
  border-color: #e53935;
  box-shadow: 0 0 0 3px #e53935;
  animation: voice-pulse 1.3s ease-out infinite;
}
.editor-body .voice-btn.is-recording:hover { background: #c62828; }

@keyframes voice-pulse {
  0%   { box-shadow: 0 0 0 3px #e53935, 0 0 0 3px rgba(229, 57, 53, .55); }
  100% { box-shadow: 0 0 0 3px #e53935, 0 0 0 16px rgba(229, 57, 53, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .editor-body .voice-btn.is-recording { animation: none; }
}

/* unsupported browser: looks disabled but keeps its tooltip */
.editor-body .voice-btn.is-unsupported { opacity: .45; cursor: not-allowed; }
.editor-body .voice-btn.is-unsupported:hover { background: var(--teal); }
.editor-body .voice-btn.is-unsupported:active { transform: none; }

.voice-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 12px 0;
  padding: 8px 10px 8px 12px;
  border: 1px solid #f1c0c0;
  border-radius: 6px;
  background: #fdf2f2;
  color: #9b2c2c;
  font-size: .85rem;
}
.voice-alert[hidden] { display: none; }
.voice-alert-text { flex: 1; }
.voice-alert-close {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 4px;
  cursor: pointer;
}

@media (max-width: 480px) {
  .editor-body .voice-btn { width: 38px; height: 38px; right: 14px; bottom: 12px; font-size: .9rem; }
  .editor-body .editor-text { padding-right: 56px; }
}

/* Fullscreen editor */
/* Fullscreen: editor fills the screen, virtual keyboard stays usable below it.
   :fullscreen is the native API; .is-fullscreen is the fallback when the
   browser refuses it (e.g. inside an iframe). */
.workspace:fullscreen,
.workspace.is-fullscreen {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--white);
  overflow: auto;
}
.workspace.is-fullscreen { position: fixed; inset: 0; z-index: 1050; }
.workspace:fullscreen .editor,
.workspace.is-fullscreen .editor { flex: 1 1 auto; min-height: 0; }
.workspace:fullscreen .editor-body,
.workspace.is-fullscreen .editor-body { min-height: 0; }
.workspace:fullscreen .editor-text,
.workspace.is-fullscreen .editor-text { flex: 1; min-height: 120px; resize: none; font-size: 1.3rem; }
.workspace:fullscreen .vkeyboard,
.workspace.is-fullscreen .vkeyboard { flex: 0 0 auto; width: 100%; margin: 0 auto; }

/* only the fullscreen action that applies is enabled */
.tool-btn:disabled { opacity: .4; cursor: default; }
.tool-btn:disabled:hover { background: transparent; }
.tool-btn:disabled:active { transform: none; }

/* ---------- Virtual keyboard ----------
   Sized to the design: ~900px wide, ~320px tall, square 50px keys */
.vkeyboard {
  --key-h: 50px;
  --gap: 9px;
  max-width: 900px;
  margin: 22px auto;
  padding: 15px;
  border: 1.5px solid #cfd4d6;
  border-radius: 22px;
  background: var(--white);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  user-select: none;
  -webkit-user-select: none;
}

.kb-row { display: flex; gap: var(--gap); }

.key {
  --w: 1;
  flex: var(--w) 1 0;
  min-width: 0;
  height: var(--key-h);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  border: 1.5px solid #cfd4d6;
  border-radius: 9px;
  background: var(--white);
  color: #2f3a3d;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  -webkit-font-smoothing: antialiased;
  transition: background .12s, transform .06s, border-color .12s;
}
.key:hover { border-color: var(--teal); }
.key:active,
.key.pressed { transform: translateY(1px); background: #e9f5f8; }
.key:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

.key .lbl-top,
.key .lbl-main { display: block; }
.key .lbl-top { font-size: 10px; }
.key .glyph { display: none; }

/* Hindi mode: small English legend top-left, large Hindi glyph (as in the reference screenshots) */
.kb-hindi .key--char { justify-content: flex-end; padding-bottom: 5px; }
.kb-hindi .key--char .lbl-top { display: none; }
.kb-hindi .key--char .lbl-main {
  position: absolute;
  top: 5px;
  left: 7px;
  font-size: 10px;
  color: #7a8588;
  text-transform: lowercase;
}
.kb-hindi .key--char .glyph {
  display: block;
  font-family: var(--font-hi);
  font-size: 21px;
  line-height: 1.2;
  min-height: 1.2em;
  color: var(--teal-dark);
  transition: color .15s;
}
/* matra on a dotted circle (◌ा). System Devanagari fonts draw a full-size
   circle (Noto's is tiny), so prefer them for these keys. */
.kb-hindi .key--char .glyph.is-mark {
  font-family: var(--font-marks, var(--font-hi));
  font-size: 22px;
  font-weight: 500;
}
.kb-hindi .vkeyboard[data-layer="shift"] .glyph { color: var(--teal); }
.kb-hindi .vkeyboard[data-layer="alt"] .glyph { color: #c2185b; }

.db-error {
  max-width: 900px;
  margin: 22px auto;
  padding: 16px 20px;
  border: 1px solid #f1c0c0;
  border-radius: 12px;
  background: #fdf2f2;
  color: #9b2c2c;
  font-size: .95rem;
}

/* highlighted modifiers */
.key--mod {
  background: var(--teal);
  border-color: var(--teal);
  color: var(--white);
}
.key--mod:hover { border-color: var(--teal-dark); }
.key--mod.active,
.key--mod.pressed,
.key--mod:active { background: var(--teal-dark); border-color: var(--teal-dark); }

.key[data-code="CapsLock"]::after {
  content: "";
  position: absolute;
  top: 6px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
  opacity: .75;
  transition: opacity .15s, box-shadow .15s;
}
.key[data-code="CapsLock"].active::after { opacity: 1; box-shadow: 0 0 6px var(--yellow); }

/* non-highlighted twin modifiers (right Shift / Ctrl) when engaged */
.key.active:not(.key--mod) { background: var(--teal); border-color: var(--teal); color: var(--white); }

.key--arrows {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: var(--key-h);
}
.key--arrows .key { height: auto; flex: 1; font-size: 10px; border-radius: 6px; }
.key i { font-size: 11px; }

/* ---------- Content sections ---------- */
.info {
  padding: 26px 12px 60px;
  margin-top: 18px;
}
.info h1, .info h2 {
  font-size: 1.55rem;
  font-weight: 700;
  margin-bottom: 18px;
}
.info p { font-size: .93rem; line-height: 1.55; margin: 0; }

.info--teal { background: var(--teal); color: var(--white); }
.info--gray { background: var(--gray); color: var(--teal); margin-top: 0; }
.info--gray + .info--teal { margin-top: 0; }
.info--teal + .info--gray { margin-top: 0; }

/* ----- home content: how-to, joining letters, about Hindi ----- */
.info h3 { margin: 24px 0 10px; font-size: 1.1rem; font-weight: 700; }
.info [lang]:not([lang="en"]) { font-family: var(--font-hi); }
.info strong { font-weight: 700; }
.info--gray strong { color: var(--teal-dark); }
.info a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

.info kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 1px 6px;
  border-radius: 5px;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
}
.info--teal kbd { background: var(--white); color: var(--teal-dark); }
.info--gray kbd { background: var(--white); color: var(--teal-dark); border: 1px solid #cfe3e8; }

.info-steps { margin: 4px 0 0; padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.info-steps li {
  position: relative;
  padding: 14px 16px 14px 56px;
  border-radius: 10px;
  background: var(--white);
  color: #33454a;
  font-size: .93rem;
  line-height: 1.6;
  counter-increment: step;
}
.info-steps li::before {
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--white);
  font-weight: 700;
  font-size: .85rem;
}
.info-steps em { font-style: normal; font-weight: 600; color: var(--teal-dark); }

.info-rules { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: .93rem; line-height: 1.6; }
.info-rules [lang]:not([lang="en"]) { font-size: 1.1em; }

.info-table-wrap { overflow-x: auto; border-radius: 10px; }
.info-table { width: 100%; min-width: 560px; border-collapse: collapse; background: var(--white); color: #33454a; font-size: .92rem; }
.info-table th {
  padding: 10px 14px;
  background: var(--teal-dark);
  color: var(--white);
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.info-table td { padding: 10px 14px; border-top: 1px solid #e6eef0; vertical-align: middle; }
.info-table td:first-child { font-size: 1.3rem; font-weight: 600; color: var(--teal-dark); white-space: nowrap; }
.info-table td[lang]:not([lang="en"]):nth-child(3) { font-size: 1.05rem; white-space: nowrap; }
.info-table td kbd { background: #eef6f8; border: 1px solid #cfe3e8; }

.info-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 18px 0; }
.info-fact { padding: 18px 20px; border-radius: 10px; background: var(--white); }
.info-fact h3 { margin: 0 0 8px; font-size: 1rem; color: var(--teal-dark); }
.info-fact p { color: #33454a; }

.info-more { margin-top: 16px !important; }

@media (max-width: 991.98px) {
  .info-facts { grid-template-columns: 1fr; }
}
@media (max-width: 767.98px) {
  .info-steps li { padding-left: 50px; }
}


/* ---------- Footer ---------- */
.site-footer {
  background: var(--teal-dark);
  color: var(--white);
  margin-top: 18px;
  padding: 26px 26px 18px;
}
.brand--light { color: var(--white); }
.brand--light .brand-icon { border-color: #8fd0df; color: #8fd0df; width: 42px; height: 30px; font-size: 1.15rem; }

.footer-about {
  font-size: .75rem;
  line-height: 1.5;
  margin-top: 14px;
  opacity: .92;
}
.footer-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 8px 0 14px;
}

.quick-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, max-content);
  column-gap: 48px;
  row-gap: 8px;
}
.quick-links a,
.contact-list a { color: var(--white); text-decoration: none; font-size: .78rem; }
.quick-links a:hover,
.contact-list a:hover { text-decoration: underline; }

.contact-list { font-style: normal; margin: 0; }
.contact-list p { font-size: .78rem; margin-bottom: 8px; }
.contact-list i { width: 16px; }

.social-round { display: flex; gap: 8px; }
.social-round a {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--white);
  color: var(--teal-dark);
  font-size: .85rem;
  text-decoration: none;
  transition: transform .15s, background .15s;
}
.social-round a:hover { transform: translateY(-2px); background: #d8f0f5; }

.copyright {
  text-align: center;
  font-size: .72rem;
  opacity: .7;
  margin: 26px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .15);
}

/* ---------- Toast ---------- */
.toast-msg {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--teal-dark);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 6px;
  font-size: .9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 2000;
}
.toast-msg.show { opacity: 1; transform: translate(-50%, 0); }
.toast-msg.has-action.show { pointer-events: auto; }
.toast-action {
  margin-left: 14px;
  border: 0;
  background: transparent;
  color: #8fe3f5;
  font-weight: 700;
  text-transform: uppercase;
  font-size: .8rem;
  letter-spacing: .04em;
  cursor: pointer;
}
.toast-action:hover { text-decoration: underline; }

/* ---------- Print ---------- */
#printArea { display: none; }

@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea {
    display: block !important;
    white-space: pre-wrap;
    font-family: var(--font-hi);
    font-size: 14pt;
    line-height: 1.6;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
  .main-nav { margin: 10px 0; }
  .main-nav .nav-link.active::after { right: auto; width: 60px; }
  .social-square { margin-bottom: 8px; }
}

@media (max-width: 767.98px) {
  .tool-group {
    flex: 1 1 100%;
    min-height: 48px;
    gap: 8px;
    padding-right: 10px;
    border-right: 0;
  }
  .translate-group {
    justify-content: flex-start;
    border-top: 1px solid rgba(255, 255, 255, .5);
    flex-basis: 100%;
  }
  .vkeyboard { --key-h: 36px; --gap: 4px; padding: 8px; border-radius: 14px; }
  .key { font-size: 8px; border-radius: 6px; border-width: 1px; gap: 1px; }
  .key i { font-size: 8px; }
  .key[data-code="CapsLock"]::after { top: 3px; right: 3px; width: 5px; height: 5px; }
  .kb-hindi .key--char { padding-bottom: 2px; }
  .kb-hindi .key--char .lbl-main { top: 2px; left: 3px; font-size: 7px; }
  .kb-hindi .key--char .glyph { font-size: 14px; }
  .kb-hindi .key--char .glyph.is-mark { font-size: 15px; }
  .info h1, .info h2 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
  .vkeyboard { --key-h: 30px; --gap: 3px; padding: 5px; border-radius: 10px; }
  .key { font-size: 7px; border-radius: 4px; }
  .key--arrows .key { font-size: 6px; border-radius: 3px; }
  .kb-hindi .key--char { padding-bottom: 1px; }
  .kb-hindi .key--char .lbl-main { top: 1px; left: 2px; font-size: 6px; }
  .kb-hindi .key--char .glyph { font-size: 11px; }
  .kb-hindi .key--char .glyph.is-mark { font-size: 11px; }
  .tool-btn:not(.tool-btn--primary) { width: 28px; height: 28px; }
  .tool-btn--primary i { width: 28px; height: 28px; }
  .quick-links { column-gap: 32px; }
}

/* ----- home: Hindi alphabet at a glance ----- */
.abc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0 4px; }
.abc-card { padding: 18px 20px; border-radius: 10px; background: var(--white); color: #33454a; }
.abc-card--wide { grid-column: span 3; }
.abc-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--teal-dark);
}
.abc-card h3 [lang]:not([lang="en"]) { font-weight: 600; }
.abc-count {
  margin-left: auto;
  padding: 1px 10px;
  border-radius: 999px;
  background: #e3f1f4;
  font-size: .8rem;
  color: var(--teal-dark);
}
.info .abc-letters {
  margin: 0 0 8px;
  font-size: 1.45rem;
  line-height: 1.5;
  letter-spacing: .06em;
  word-spacing: .25em;
  color: var(--teal-dark);
}
.info .abc-note { font-size: .86rem; color: #5b6b70; }

.abc-groups {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 10px;
}
.abc-groups div { padding: 10px 12px; border-radius: 8px; background: #f3f8f9; }
.abc-groups dt { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #5b6b70; }
.abc-groups dd { margin: 4px 0 0; font-size: 1.3rem; line-height: 1.5; color: var(--teal-dark); word-spacing: .15em; }

@media (max-width: 1199.98px) {
  .abc-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
  .abc-grid { grid-template-columns: 1fr 1fr; }
  .abc-card--wide { grid-column: span 2; }
}
@media (max-width: 575.98px) {
  .abc-grid { grid-template-columns: 1fr; }
  .abc-card--wide { grid-column: auto; }
  .abc-groups { grid-template-columns: 1fr 1fr; }
}
.abc-card--span2 { grid-column: span 2; }
@media (max-width: 991.98px) { .abc-card--span2 { grid-column: span 2; } }
@media (max-width: 575.98px) { .abc-card--span2 { grid-column: auto; } }

/* ---------- Header: "Languages" dropdown (multi-column) ---------- */
.nav-dropdown-toggle {
  border: 0;
  background: transparent;
  font: inherit;
}
.nav-dropdown-toggle i { font-size: .6rem; margin-left: 3px; transition: transform .2s; }
.nav-dropdown-toggle[aria-expanded="true"] { color: var(--teal); }
.nav-dropdown-toggle[aria-expanded="true"] i { transform: rotate(180deg); }
.main-nav .dropdown-toggle::after { display: none; }

.lang-mega {
  --bs-dropdown-min-width: 0;
  width: 540px;
  margin-top: 8px !important;
  padding: 16px;
  border: 1px solid #e2e9eb;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 38, 44, .12);
}
.lang-mega-title {
  margin: 0 4px 10px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #5b6b70;
}
.lang-mega-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lang-mega-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 12px;
  border-radius: 10px;
  color: #10262c;
  text-decoration: none;
  transition: background .15s;
}
.lang-mega-item:hover,
.lang-mega-item:focus-visible { background: #e3f1f4; color: #10262c; outline: none; }
.lang-mega-item.is-active { background: var(--teal-dark); color: var(--white); }
.lang-mega-item.is-active .lang-mega-name { color: rgba(255, 255, 255, .8); }
.lang-mega-native { font-size: 1.05rem; font-weight: 600; line-height: 1.35; }
.lang-mega-native[dir="rtl"] { text-align: left; }
.lang-mega-name { font-size: .78rem; color: #5b6b70; }
.lang-mega-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 12px 4px 0;
  padding-top: 12px;
  width: calc(100% - 8px);
  border-top: 1px solid #e2e9eb;
  color: var(--teal-dark);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
}
.lang-mega-more:hover { color: var(--teal); }
.lang-mega-more i { font-size: .75rem; }

@media (max-width: 991.98px) {
  /* inside the collapsed mobile menu the list opens in place */
  .lang-mega { width: 100%; margin: 4px 0 8px !important; box-shadow: none; }
  .lang-mega-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Phonetic typing: suggestion box (English QWERTY mode) ---------- */
.ph-box {
  position: absolute;
  z-index: 30;
  min-width: 150px;
  max-width: 260px;
  padding: 6px;
  border: 1px solid #dde7ea;
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 10px 28px rgba(16, 38, 44, .14), 0 2px 6px rgba(16, 38, 44, .06);
  font-family: var(--font);
}
.ph-box[hidden] { display: none; }
.ph-head {
  padding: 4px 10px 6px;
  border-bottom: 1px solid #edf2f3;
  margin-bottom: 4px;
  color: #8a979b;
  font-size: .82rem;
  letter-spacing: .02em;
}
.ph-head.is-loading::after { content: " …"; }
.ph-list { margin: 0; padding: 0; list-style: none; }
.ph-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #22343a;
  cursor: pointer;
}
.ph-item.is-active { background: #dceef0; color: #1b5e6b; }
.ph-num {
  flex-shrink: 0;
  width: 18px;
  font-size: .75rem;
  font-weight: 700;
  color: #9aa7ab;
  text-align: center;
}
.ph-item.is-active .ph-num { color: #1b5e6b; }
.ph-word { font-family: var(--font-hi); font-size: 1.1rem; line-height: 1.35; }
.ph-word--roman { font-family: var(--font); font-size: .98rem; color: #5b6b70; }
.ph-item.is-active .ph-word--roman { color: #1b5e6b; }

@media (max-width: 767.98px) {
  .ph-item { padding: 8px 10px; } /* bigger touch targets */
}

/* ---------- Header: "Tools" dropdown ---------- */
.tools-menu {
  --bs-dropdown-min-width: 0;
  width: 280px;
  margin-top: 8px !important;
  padding: 8px;
  border: 1px solid #e2e9eb;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16, 38, 44, .12);
  list-style: none;
}
.tools-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #10262c;
  text-decoration: none;
  transition: background .15s;
}
.tools-item:hover,
.tools-item:focus-visible { background: #e3f1f4; color: #10262c; outline: none; }
.tools-item.is-active { background: #e3f1f4; }
.tools-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #e3f1f4;
  color: var(--teal-dark);
  font-size: 1rem;
}
.tools-item:hover .tools-icon,
.tools-item.is-active .tools-icon { background: var(--teal-dark); color: var(--white); }
.tools-label { display: block; font-size: .92rem; font-weight: 700; line-height: 1.3; }
.tools-text { display: block; font-size: .78rem; color: #5b6b70; }

/* desktop with a mouse: open on hover (click / keyboard still work through Bootstrap) */
@media (min-width: 992px) and (hover: hover) {
  .nav-hover-dropdown { position: relative; }
  .nav-hover-dropdown:hover > .dropdown-menu { display: block; top: 100%; left: 0; }
  .nav-hover-dropdown > .dropdown-menu::before { /* bridge the gap so the menu stays open */
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -10px;
    height: 10px;
  }
  .nav-hover-dropdown:hover > .nav-dropdown-toggle { color: var(--teal); }
  .nav-hover-dropdown:hover > .nav-dropdown-toggle i { transform: rotate(180deg); }
}

@media (max-width: 991.98px) {
  .tools-menu { width: 100%; margin: 4px 0 8px !important; box-shadow: none; }
}

/* ---------- Site language ---------- */
/* current language next to the logo */
.brand-lang {
  margin-left: -4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #e3f1f4;
  color: var(--teal-dark);
  font-family: var(--font-hi);
  font-size: .82rem;
  font-weight: 600;
  line-height: 1.5;
}
.lang-toggle .fa-globe { font-size: .85em; margin-right: 2px; }
/* language menu: search + groups by region (52 languages) */
.lang-mega { width: 620px; padding: 0; overflow: hidden; }
.lang-mega-head { padding: 16px 16px 12px; border-bottom: 1px solid #e2e9eb; background: var(--white); }
.lang-mega-head .lang-mega-title { margin-bottom: 10px; }
.lang-search { position: relative; display: block; margin: 0; }
.lang-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8a989c; font-size: .85rem; }
.lang-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1px solid #d5dfe2;
  border-radius: 10px;
  font: inherit;
  font-size: .92rem;
}
.lang-search input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(63, 167, 191, .18); }
.lang-mega-body { max-height: min(60vh, 520px); overflow-y: auto; padding: 8px 12px 12px; overscroll-behavior: contain; }
.lang-group + .lang-group { margin-top: 10px; }
.lang-group-title { margin: 8px 4px 6px; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #8a989c; }
.lang-mega-item { position: relative; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding: 8px 28px 8px 10px; }
.lang-mega .lang-mega-name { font-size: .88rem; font-weight: 600; color: #10262c; }
.lang-mega .lang-mega-native { font-size: .9rem; font-weight: 400; color: #5b6b70; line-height: 1.4; }
.lang-mega-item.is-active { background: #e3f1f4; box-shadow: inset 0 0 0 1px var(--teal); }
.lang-mega-item.is-active .lang-mega-name { color: var(--teal-dark); }
.lang-mega-check { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--teal-dark); font-size: .8rem; }
.lang-mega-item[hidden], .lang-group[hidden] { display: none; }
.lang-empty { margin: 12px 6px; color: #5b6b70; font-size: .9rem; }
.lang-mega .lang-mega-more { margin: 0; padding: 12px 16px; width: 100%; border-top: 1px solid #e2e9eb; }
@media (max-width: 991.98px) {
  .lang-mega { width: 100%; }
  .lang-mega-body { max-height: 50vh; }
}

/* key facts about the language (home page) */
.info-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0 8px;
}
.info-quick div { padding: 12px 16px; border-radius: var(--radius); background: var(--white); border: 1px solid var(--border); }
.info-quick dt { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--teal-dark); }
.info-quick dd { margin: 4px 0 0; font-size: .95rem; }

/* right-to-left languages (Urdu): text boxes and script text run right to left */
.lang-rtl .editor-text,
.lang-rtl .tr-panel--source .tr-textarea,
.lang-rtl .ocr-text { direction: rtl; text-align: right; }
[dir="rtl"] { unicode-bidi: isolate; }

/* ---------- Typing area extras ---------- */
.tool-group { flex-wrap: wrap; row-gap: 6px; }
.tool-sep { width: 2px; align-self: stretch; margin: 8px 2px; background: rgba(255, 255, 255, .45); }
.tool-btn--text { font-family: var(--font); font-weight: 900; font-size: .72rem; letter-spacing: -.02em; }
.tool-btn[data-action="keyboard"][aria-pressed="false"] { background: rgba(255, 255, 255, .22); }
.vkeyboard[hidden] { display: none; }

.editor-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  background: #f8fbfb;
  font-size: .8rem;
  color: #5b6b70;
}
.editor-count { font-variant-numeric: tabular-nums; }
.editor-note i { margin-right: 4px; }
.translate-group--off { color: var(--white); font-size: .85rem; font-weight: 700; }

/* ---------- Common phrases ---------- */
.phrase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 16px; }
.phrase-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  text-align: start;
  font: inherit;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s;
}
.phrase-card:hover { box-shadow: 0 6px 18px rgba(16, 38, 44, .15); }
.phrase-card:active { transform: translateY(1px); }
.phrase-card:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.phrase-text { font-family: var(--font-hi); font-size: 1.2rem; font-weight: 600; color: var(--teal-dark); line-height: 1.5; }
.phrase-roman { font-size: .85rem; font-style: italic; color: #5b6b70; }
.phrase-meaning { font-size: .85rem; color: #33454a; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 8px; margin-top: 14px; }
.faq-item { border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
.faq-item summary { padding: 12px 16px; font-weight: 700; cursor: pointer; list-style: none; position: relative; padding-right: 40px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; color: var(--teal-dark); }
.faq-item[open] summary::after { content: "−"; }
.faq-item p { margin: 0; padding: 0 16px 14px; line-height: 1.6; }

/* ---------- Not available yet ---------- */
.feature-off {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  max-width: 760px;
  margin: 8px 0 32px;
  padding: 20px 22px;
  border: 1px dashed #c9d6d9;
  border-radius: 16px;
  background: #f8fbfb;
  color: #33454a;
}
.feature-off i { margin-top: 3px; font-size: 1.3rem; color: var(--teal-dark); }
.feature-off h2 { margin: 0 0 6px; font-size: 1.1rem; font-weight: 800; color: #10262c; }
.feature-off p { margin: 0 0 6px; line-height: 1.6; }
.feature-off a { color: var(--teal-dark); font-weight: 700; }
.tools-soon { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #eef3f4; color: #5b6b70; font-size: .68rem; font-weight: 700; }

/* right-to-left: phrase cards and FAQ follow the text direction of their content */
.lang-rtl .phrase-text { direction: rtl; }

/* Social media icons (header + footer) are hidden for now – delete this rule to show them again */
.social-square, .social-round, .social-title { display: none !important; }

/* footer: reopen the consent message */
.privacy-choices { margin-left: 12px; color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Keyboard page: next steps (practise, share, report) ---------- */
.kb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.kb-actions a,
.kb-actions button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--teal-dark);
  font: inherit;
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.kb-actions a:hover,
.kb-actions button:hover { background: var(--teal); border-color: var(--teal); color: var(--white); }

/* "Practise typing" – appears after 50+ characters */
.kb-nudge {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px 12px 16px;
  border-radius: var(--radius);
  background: #e3f1f4;
  border: 1px solid #b9dbe3;
  color: var(--teal-dark);
}
.kb-nudge[hidden] { display: none; }
.kb-nudge p { margin: 0; flex: 1; font-size: .9rem; font-weight: 600; }
.kb-nudge-btn {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--teal-dark);
  color: var(--white);
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.kb-nudge-btn:hover { background: var(--teal-mid); color: var(--white); }
.kb-nudge-close { border: 0; background: none; color: var(--teal-dark); padding: 4px 6px; cursor: pointer; }
@media (max-width: 575.98px) {
  .kb-nudge { flex-wrap: wrap; }
  .kb-nudge p { flex-basis: calc(100% - 60px); }
}

/* related keyboards */
.related-kb {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.info .related-kb a {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--border);
  text-decoration: none;
  font-weight: 400;
  transition: border-color .15s, box-shadow .15s;
}
.info .related-kb a:hover { border-color: var(--teal); box-shadow: 0 6px 18px rgba(16, 38, 44, .08); }
.related-kb-name { font-weight: 700; color: var(--teal-dark); }
.related-kb-native { font-size: 1.05rem; color: #33454a; }
.related-kb-native[dir="rtl"] { text-align: left; }
.related-kb-script { font-size: .78rem; color: #5b6b70; }
.info-updated { margin-top: 16px !important; font-size: .82rem; color: #5b6b70; }

/* ---------- Intent pages (English to X typing, voice typing): answer first, tool below ---------- */
.landing-hero { max-width: 860px; margin: 4px 0 18px; }
.landing-crumbs { margin: 0 0 6px; font-size: .8rem; color: #5b6b70; }
.landing-crumbs a { color: var(--teal-dark); text-decoration: none; font-weight: 700; }
.landing-crumbs a:hover { text-decoration: underline; }
.landing-hero h1 { margin: 0 0 8px; font-size: clamp(1.5rem, 3.4vw, 2.1rem); font-weight: 900; color: #10262c; }
.landing-answer { margin: 0; font-size: 1rem; line-height: 1.6; color: #33454a; }

.cluster-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.info .cluster-links a {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--teal-dark);
  font-size: .88rem;
  text-decoration: none;
}
.info .cluster-links a:hover { border-color: var(--teal); }
