body {
  min-height: 100vh;
  background: #f4f6f8;
  color: #212529;
}

.site-header {
  width: 100%;
  background: linear-gradient(135deg, #181a1f, #22252c);
  color: #fff;
}

.site-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .2px;
  margin: 0;
  line-height: 1.2;
  color: #ffffffc7;
}

.navbar-toggler {
  border-color: #ffffff40;
  box-shadow: none !important;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.header-menu {
  gap: .5rem;
}

.header-menu .nav-link {
  color: #ffffffc7;
  font-weight: 500;
  padding-left: .85rem;
  padding-right: .85rem;
  border-radius: 0;
}

.header-menu .nav-link:hover,
.header-menu .nav-link:focus {
  color: #fff;
  background: #ffffff14;
}

.hero-card,
.about-card,
.content-card {
  border: 1px solid #e6e8ec;
  border-radius: 1.25rem;
  overflow: hidden;
}

.form-select,
.form-control,
.alert,
.font-card,
.about-card,
.content-card {
  border-radius: 0;
}

.accordion-button {
  font-weight: 600;
}

.accordion-button:focus {
  box-shadow: none;
}

.site-footer {
  width: 100%;
  background: #181a1f;
  color: #ffffffb8;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  color: #ffffffc7;
  text-decoration: none;
  font-size: .925rem;
}

.footer-links a:hover,
.footer-links a:focus {
  color: #fff;
  text-decoration: underline;
}

.hero-intro {
  max-width: 820px;
}


.rng-board {
  border: 1px solid #e6e8ec;
  background: #f9fafb;
  border-radius: 0;
  padding: 1rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 0;
}

.stat-label,
.preview-label {
  color: #6b7280;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.stat-card strong {
  color: #111827;
  font-size: 2rem;
  line-height: 1.1;
}

.number-display {
  display: grid;
  grid-template-columns: minmax(240px, .85fr) 1.15fr;
  align-items: stretch;
  gap: 1rem;
}

.number-panel,
.sequence-panel {
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 0;
  padding: 1rem;
}

.number-panel {
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.number-orb {
  width: 156px;
  height: 156px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: .9rem 0;
  border-radius: 0;
  background: #f4f6f8;
  border: 1px solid #e6e8ec;
  color: #111827;
  font-size: 4.5rem;
  font-weight: 900;
  line-height: 1;
  box-shadow: inset 0 0 0 .55rem #ffffff;
}

.number-panel strong {
  color: #181a1f;
  font-size: 1.05rem;
}

.sequence-panel h3 {
  color: #181a1f;
  font-weight: 800;
}

.history-list {
  min-height: 222px;
  max-height: 310px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: .5rem;
  padding: .8rem;
  background: #f9fafb;
  border: 1px solid #e6e8ec;
  border-radius: 0;
}

.empty-history {
  color: #6b7280;
  font-weight: 600;
}

.history-number {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  background: #fff;
  color: #111827;
  border: 1px solid #e6e8ec;
  font-weight: 800;
  font-size: .95rem;
}

.result-alert {
  font-weight: 700;
  text-align: center;
}

.action-row {
  display: flex;
  justify-content: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.generate-button,
.reset-button {
  min-width: 180px;
  font-weight: 800;
}

.generate-button:disabled {
  cursor: not-allowed;
  opacity: .75;
}

.keyword-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.keyword-pill {
  display: inline-flex;
  padding: .45rem .75rem;
  border-radius: 0;
  background: #f4f6f8;
  color: #343a40;
  border: 1px solid #e6e8ec;
  font-weight: 600;
  font-size: .92rem;
}

.step-list {
  padding-left: 1.15rem;
}

.step-list li {
  margin-bottom: .45rem;
}

@media (max-width: 991.98px) {
  .header-navbar-row {
    flex-wrap: wrap;
  }

  .site-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .navbar-toggler {
    flex: 0 0 auto;
  }

  .navbar-collapse {
    flex: 0 0 100%;
    width: 100%;
    margin-top: 1rem;
    padding: .75rem;
    background: #ffffff0f;
    border: 1px solid #ffffff1a;
    border-radius: 0;
  }

  .header-menu {
    width: 100%;
  }

  .header-menu .nav-link {
    padding: .75rem .85rem;
  }
}

@media (max-width: 767.98px) {
  main.py-5 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }

  .rng-board {
    padding: .85rem;
  }

  .stats-row,
  .number-display {
    grid-template-columns: 1fr;
    gap: .75rem;
  }

  .stat-card {
    min-height: 78px;
  }

  .number-panel {
    min-height: 245px;
  }

  .number-orb {
    width: 132px;
    height: 132px;
    font-size: 3.7rem;
  }

  .history-list {
    min-height: 180px;
    max-height: 260px;
  }

  .generate-button,
  .reset-button {
    width: 100%;
  }
}

[dir="rtl"] .step-list {
  padding-right: 1.15rem;
  padding-left: 0;
}

[dir="rtl"] .me-3 {
  margin-left: 1rem !important;
  margin-right: 0 !important;
}


/* Mobile-first usability refinements for the generator */
.draw-panel {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.footer-language-switcher {
  border-top: 1px solid #ffffff1a;
  margin-top: 1rem;
  padding-top: 1rem;
}

.footer-language-title {
  color: #ffffffd9;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-align: center;
  text-transform: uppercase;
}

.footer-language-links a {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ffffff26;
  padding: .3rem .65rem;
  line-height: 1.2;
}

.footer-language-links a:hover,
.footer-language-links a:focus {
  background: #ffffff12;
}

@media (max-width: 767.98px) {
  main.py-5 {
    padding-top: .85rem !important;
    padding-bottom: 1.25rem !important;
  }

  .hero-card .card-body {
    padding: .75rem !important;
  }

  .rng-board {
    padding: .65rem;
  }

  .stats-row {
    grid-template-columns: repeat(3, 1fr);
    gap: .35rem;
    margin-bottom: .55rem !important;
  }

  .stat-card {
    min-height: 52px;
    padding: .3rem .2rem;
  }

  .stat-label,
  .preview-label {
    font-size: .62rem;
    letter-spacing: .025em;
  }

  .stat-card strong {
    font-size: 1.25rem;
  }

  .number-display {
    gap: .55rem;
    margin-bottom: .55rem !important;
  }

  .number-panel,
  .sequence-panel {
    padding: .65rem;
  }

  .number-panel {
    min-height: 145px;
  }

  .number-orb {
    width: 88px;
    height: 88px;
    margin: .35rem 0;
    font-size: 2.8rem;
    box-shadow: none;
  }

  .number-panel strong {
    font-size: .9rem;
  }

  .result-alert {
    font-size: .82rem;
    line-height: 1.25;
    padding: .55rem .65rem;
    margin-top: .55rem !important;
    margin-bottom: .55rem !important;
  }

  .action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
  }

  .generate-button,
  .reset-button {
    width: 100%;
    min-width: 0;
    padding: .62rem .45rem;
    font-size: .95rem;
  }

  .sequence-panel .d-flex {
    gap: .45rem !important;
    margin-bottom: .55rem !important;
  }

  .sequence-panel h3 {
    font-size: .85rem;
  }

  .history-list {
    min-height: 78px;
    max-height: 118px;
    padding: .45rem;
    gap: .35rem;
  }

  .history-number {
    width: 32px;
    height: 32px;
    font-size: .78rem;
  }

  .hero-intro {
    margin-top: 1rem !important;
  }

  .hero-intro .h1 {
    font-size: 1.45rem;
  }

  .hero-intro p {
    font-size: .95rem;
  }
}


/* Final QA overrides: sharp inner elements and mobile generator usability */
.rng-board, .stat-card, .number-panel, .sequence-panel, .number-orb, .history-list, .history-number, .keyword-pill, .mini-info-card, .accordion-item, .accordion-button, .btn, .alert, .navbar-collapse, .footer-language-links a { border-radius: 0 !important; }
.hero-card, .about-card, .content-card { border-radius: 1.25rem; }
@media (max-width: 575.98px) {
  main.py-5 { padding-top: .5rem !important; }
  .container { padding-left: .65rem; padding-right: .65rem; }
  .hero-card .card-body { padding: .55rem !important; }
  .rng-board { padding: .5rem; }
  .stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; margin-bottom: .45rem !important; }
  .stat-card { min-height: 44px; padding: .22rem .12rem; }
  .stat-label, .preview-label { font-size: .56rem; line-height: 1.1; letter-spacing: .015em; }
  .stat-card strong { font-size: 1.05rem; }
  .number-display { display: grid; grid-template-columns: 1fr; gap: .45rem; margin-bottom: .45rem !important; }
  .number-panel, .sequence-panel { padding: .5rem; }
  .number-panel { min-height: 118px; }
  .number-orb { width: 72px; height: 72px; margin: .25rem 0; font-size: 2.25rem; box-shadow: none; }
  .number-panel strong { font-size: .8rem; line-height: 1.2; }
  .result-alert { font-size: .76rem; line-height: 1.2; padding: .42rem .48rem; margin-top: .42rem !important; margin-bottom: .42rem !important; }
  .action-row { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
  .generate-button, .reset-button { min-width: 0; width: 100%; font-size: .82rem; padding: .5rem .3rem; }
  .sequence-panel .d-flex { margin-bottom: .4rem !important; }
  .sequence-panel h2, .sequence-panel h3 { font-size: .78rem; }
  #copyHistory { font-size: .72rem; padding: .25rem .4rem; }
  .history-list { min-height: 54px; max-height: 74px; padding: .32rem; gap: .25rem; }
  .history-number { width: 27px; height: 27px; font-size: .68rem; }
  .hero-intro { margin-top: .85rem !important; }
  .hero-intro .h1 { font-size: 1.22rem; line-height: 1.18; }
  .hero-intro p { font-size: .86rem; line-height: 1.42; }
}
