/* =====================================================================
   SyntaxMonkey  -  home.css   (index.html only)
   Colours come from theme.css (var(--token)); nothing in here is hard-coded
   except the brand colours of the language icons.
   Sections:  1 Page   2 Navbar   3 Hero   4 Languages   5 Leaderboard
              6 About + FAQ   7 Feedback form   8 Footer   9 Phones and tablets
   ===================================================================== */

/* ---------- 1. Page ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem; /* anchored sections stop below the sticky navbar */
}
body.home-page {
  min-height: 100vh;
  background: var(--bg-gradient);
  color: var(--text-main);
  font-family: var(--ui);
  line-height: 1.5;
  overflow-x: hidden;
}
@media (hover: hover) and (min-width: 769px) {
  body.home-page {
    background-attachment: fixed;
  }
}
.home-page h1,
.home-page h2,
.home-page h3 {
  line-height: 1.25;
}
.home-page a:focus-visible,
.home-page button:focus-visible,
.home-page summary:focus-visible,
.home-page input:focus-visible,
.home-page textarea:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1000;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: 600;
}

/* ---------- 2. Navbar ---------- */
.navclass {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 5%;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}
.logourl {
  display: flex;
  color: var(--text-main);
  text-decoration: none;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1.5rem;
  font-weight: 700;
}
.logo .mk {
  width: 44px;
  height: 44px;
}
.nav-name span {
  color: var(--accent-blue);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.nav-links a {
  color: var(--text-main);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}
.nav-links a:hover {
  color: var(--accent-blue);
}
.nav-links a.btn-start {
  padding: 0.5rem 1.4rem;
  border-radius: 6px;
  background: var(--accent-fill);
  color: var(--on-accent);
  font-weight: 600;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.nav-links a.btn-start:hover {
  color: var(--on-accent);
  filter: brightness(1.12);
  transform: scale(1.05);
}

/* ---------- 3. Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 2.5rem;
  min-height: calc(100vh - 4.5rem);
  padding: 3rem 5% 5.5rem;
}

/* Left: character + speech bubble + intro text */
.hero-left {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "img bubble" "img text";
  align-items: center;
  column-gap: 1.5rem;
  row-gap: 1rem;
  animation: heroIn 0.8s ease-out both;
}
.speech-bubble {
  grid-area: bubble;
  align-self: end;
  justify-self: start;
  position: relative;
  max-width: 100%;
  padding: 1.1rem 1.4rem;
  background: var(--bubble-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 8px 24px -12px rgba(var(--accent-rgb), 0.35);
  animation: bubbleReveal 1.4s steps(24, end) 0.2s backwards;
}
.speech-bubble::after { /* tail pointing at the character */
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  margin-top: -10px;
  border-style: solid;
  border-width: 10px 10px 10px 0;
  border-color: transparent var(--bubble-bg) transparent transparent;
}
.speech-bubble h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.1vw, 1.7rem);
  font-weight: 700;
  color: var(--bubble-fg);
}
#image-home {
  grid-area: img;
  width: 210px;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(var(--accent-rgb), 0.28));
}
.hero-left p {
  grid-area: text;
  align-self: start;
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.hero-left p br {
  display: none; /* the line breaks in the HTML are for source readability, the layout wraps naturally */
}
.hero-left p b {
  display: block;
  margin: 0.45rem 0;
}

/* Right: the "main.py" preview card */
.hero-right {
  display: flex;
  justify-content: flex-end;
  animation: heroIn 0.8s 0.15s ease-out both;
}
.editor-container {
  width: 100%;
  max-width: 600px;
  overflow: hidden;
  background: var(--editor-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, 0.5);
  animation: float 6s ease-in-out infinite;
}
.editor-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--editor-head);
  border-bottom: 1px solid var(--editor-line);
}
.mac-btn {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.mac-btn.close { background: #ff5f56; }
.mac-btn.minimize { background: #ffbd2e; }
.mac-btn.maximize { background: #27c93f; }
.editor-title {
  margin-left: 10px;
  font-size: 12px;
  color: var(--editor-muted);
}
.editor-content {
  margin: 0;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--editor-fg);
  text-align: left;
  white-space: pre;
}
.editor-content code {
  font: inherit;
}
.keyword { color: var(--editor-kw); }
.function { color: var(--editor-fn); }
.comment { color: var(--editor-cm); }
.editor-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 15px;
  padding: 5px 15px;
  background: var(--editor-strip);
  color: var(--editor-strip-fg);
  font-size: 12px;
}
.editor-strip span span {
  color: var(--editor-strip-muted);
}

/* "Scroll Down" hint */
.scroll-down {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.25rem 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  animation: hintBounce 2.5s infinite;
}
.scroll-down:hover {
  color: var(--text-main);
}

@keyframes heroIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bubbleReveal {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes hintBounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

/* ---------- 4. Languages ---------- */
.languages {
  padding: 4rem 5% 3rem;
  text-align: center;
}
.languages h2,
.languages h3 {
  background: linear-gradient(to right, var(--heading-from), var(--heading-to));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.languages h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.7rem, 4.2vw, 2.5rem);
}
.languages h2 u {
  text-underline-offset: 5px;
}
.languages h3 {
  margin: 0 0 2rem;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
  animation: hintBounce 2.1s infinite;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  max-width: 820px;
  margin: 0 auto;
}
.lc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 14px;
  color: var(--text-main);
  text-decoration: none;
  background: var(--side);
  border: 1px solid var(--line);
  border-radius: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lc:hover {
  border-color: var(--acc);
  box-shadow: 0 0 22px -6px var(--glow);
}
.lc .ic {
  width: 52px;
  height: 52px;
  font-size: 17px;
  border-radius: 13px;
}
.lc b {
  font-size: 16px;
  font-weight: 600;
}
.lc small {
  color: var(--dim);
  font-size: 13px;
}
/* brand colours of the language icons (the only fixed colours on this page) */
.ic-python { background: #3776ab; color: #fff; }
.ic-javascript { background: #f7df1e; color: #111; }
.ic-cpp { background: #00599c; color: #fff; }
.ic-c { background: #5c6bc0; color: #fff; }
.ic-java { background: #e76f00; color: #111; }
.ic-html { background: #e44d26; color: #000; }
.ic-css { background: #1572b6; color: #fff; }

/* ---------- 5. Leaderboard ---------- */
/* =====================================================================
   SyntaxMonkey — Leaderboard & Username Modal
   Uses the home-page tokens from theme.css
   ===================================================================== */

.sm-lb-wrapper {
  width: 100%;
  text-align: left;
  border-top: 1px solid var(--border-color);
  color: var(--text-main);
}

.sm-lb {
  padding: 4rem 5% 3.5rem;
  font-family: var(--ui);
}

.sm-lb-container {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.sm-lb-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
}

.sm-lb-header h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.sm-lb-sub {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}

/* Cached Player Pill */
.sm-lb-user-box {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.88rem;
}

.sm-lb-user-label {
  color: var(--text-muted);
}

.sm-lb-user-box strong {
  color: var(--text-main);
  font-family: var(--mono);
}

.sm-lb-edit-btn {
  padding: 0.25rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-blue);
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.sm-lb-edit-btn:hover {
  background: var(--accent-fill);
  color: var(--on-accent);
}

/* Controls Row */
.sm-lb-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
}

.sm-lb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sm-lb-tab {
  padding: 0.42rem 0.8rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.sm-lb-tab:hover {
  color: var(--text-main);
  border-color: rgba(var(--accent-rgb), 0.5);
}

.sm-lb-tab.active {
  color: var(--on-accent);
  background: var(--accent-fill);
  border-color: var(--accent-fill);
}

/* Leaderboard Table */
.sm-lb-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.sm-lb-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.sm-lb-table thead {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border-color);
}

.sm-lb-table th {
  padding: 0.85rem 1.1rem;
  text-align: left;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.sm-lb-table td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

.sm-lb-table tbody tr:last-child td {
  border-bottom: none;
}

.sm-lb-table tbody tr:hover {
  background: var(--row-hover);
}

/* Highlight logged-in user's row */
.sm-lb-row-me {
  background: rgba(var(--accent-rgb), 0.1) !important;
}

.sm-lb-rank {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text-muted);
  width: 56px;
}

.sm-lb-rank.top-1 { color: var(--rank-1); }
.sm-lb-rank.top-2 { color: var(--rank-2); }
.sm-lb-rank.top-3 { color: var(--rank-3); }

.sm-lb-player {
  font-weight: 600;
  font-family: var(--mono);
}

.sm-lb-you-tag {
  margin-left: 0.45rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.7rem;
  font-family: var(--ui);
  font-weight: 600;
  color: var(--text-main);
  background: rgba(var(--accent-rgb), 0.15);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 4px;
}

.sm-lb-lang-chip {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-family: var(--mono);
  background: var(--editor-bg);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  color: var(--text-main);
  text-transform: uppercase;
}

.sm-lb-wpm {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent-blue);
}

.sm-lb-acc {
  font-family: var(--mono);
  color: var(--text-muted);
}

.sm-lb-empty {
  text-align: center;
  padding: 2.25rem 1rem !important;
  color: var(--text-muted) !important;
}

@media (max-width: 640px) {
  .sm-lb {
    padding: 3rem 1rem 2.5rem;
  }

  .sm-lb-header {
    align-items: flex-start;
  }
}

/* ---------- 6. About + FAQ ---------- */
.sm-about-wrapper {
  width: 100%;
  text-align: left;
  /* background: var(--bg-gradient); */
  border-top: 1px solid var(--border-color);
  color: var(--text-main);
}

.sm-about {
  padding: 4.5rem 5% 3.5rem;
  line-height: 1.7;
  font-family: var(--ui);
}

.sm-about-container {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3.25rem;
}

.sm-badge {
  display: inline-block;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-blue);
  background: rgba(var(--accent-rgb), 0.12);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  border-radius: 6px;
}

.sm-badge-red {
  color: var(--accent-red);
  background: rgba(var(--red-rgb), 0.12);
  border-color: rgba(var(--red-rgb), 0.35);
}

.sm-about-block h2 {
  font-size: clamp(1.45rem, 2.5vw, 1.95rem);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0 0 0.9rem;
}

.sm-about-block p {
  color: var(--text-muted);
  font-size: 0.98rem;
  margin: 0 0 1.1rem;
  max-width: 78ch;
}

.sm-about-block p:last-child {
  margin-bottom: 0;
}

.sm-about-block strong {
  color: var(--text-main);
  font-weight: 600;
}

.sm-about-block a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color 0.2s ease;
}

.sm-about-block a:hover {
  text-decoration: underline;
}

.sm-about-block a:focus-visible,
.sm-faq-item summary:focus-visible,
.sm-table-wrapper:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Inline code tokens matching your VS Code editor background */
.sm-about code {
  background: var(--editor-bg);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-family: var(--mono);
  font-size: 0.86em;
  white-space: nowrap;
}

/* 1. Answer Capsule */
.sm-answer-capsule {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--accent-blue);
  border-radius: 12px;
  padding: 1.75rem 2rem;
}

.sm-answer-capsule p {
  max-width: none;
  font-size: 1.02rem;
}

/* 2. Comparison Table */
.sm-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.sm-comparison-table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

.sm-comparison-table thead {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border-color);
}

.sm-comparison-table th,
.sm-comparison-table td {
  padding: 0.9rem 1.15rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border-color);
}

.sm-comparison-table tbody tr:last-child th,
.sm-comparison-table tbody tr:last-child td {
  border-bottom: none;
}

.sm-comparison-table thead th {
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sm-comparison-table thead th:nth-child(2) {
  color: var(--text-muted);
}

.sm-comparison-table thead th:nth-child(3) {
  color: var(--accent-blue);
  background: rgba(var(--accent-rgb), 0.1);
}

.sm-comparison-table tbody th {
  color: var(--text-main);
  font-weight: 600;
  width: 24%;
}

.sm-comparison-table tbody td {
  color: var(--text-muted);
}

.sm-comparison-table tbody td:nth-child(3) {
  color: var(--text-main);
  background: rgba(var(--accent-rgb), 0.05);
}

/* 3. Audience Cards */
.sm-audience-grid {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.sm-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-top: 2px solid var(--accent-blue);
  border-radius: 10px;
  padding: 1.25rem;
}

.sm-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 0.45rem;
}

.sm-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
}

/* 4. Language Grid */
.sm-language-grid {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.sm-language-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.3rem 1.35rem;
  transition: border-color 0.2s ease;
}

.sm-language-card:hover {
  border-color: var(--accent-blue);
}

.sm-language-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 0.5rem;
}

.sm-language-card p {
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0;
}

.sm-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sm-lang-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  padding: 0.45rem 0.9rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-main) !important;
  background: rgba(var(--accent-rgb), 0.14);
  border: 1px solid rgba(var(--accent-rgb), 0.4);
  border-radius: 7px;
  text-decoration: none !important;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.sm-lang-cta:hover {
  color: var(--on-accent) !important;
  background: var(--accent-fill);
  border-color: var(--accent-fill);
}

/* 5 & 6. FAQ & Hinglish Solutions Accordions */
.sm-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.sm-faq-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  transition: border-color 0.2s ease;
}

.sm-faq-item[open] {
  border-color: rgba(var(--accent-rgb), 0.45);
}

.sm-faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  user-select: none;
}

.sm-faq-item summary::-webkit-details-marker {
  display: none;
}

.sm-faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--nav-bg);
  border: 1px solid var(--border-color);
  color: var(--accent-blue);
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1;
}

.sm-faq-item[open] summary::after {
  content: "−";
  color: var(--accent-red);
  border-color: rgba(var(--red-rgb), 0.4);
}

.sm-faq-body {
  padding: 0.95rem 1.25rem 1.2rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.sm-faq-body p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--text-muted);
  max-width: none;
}

/* Footer */
.sm-about-footer {
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.sm-about-footer p {
  margin: 0 auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 640px) {
  .sm-about {
    padding: 3rem 1rem 2.5rem;
  }

  .sm-about-container {
    gap: 2.25rem;
  }

  .sm-answer-capsule {
    padding: 1.35rem 1.15rem;
  }

  .sm-comparison-table th,
  .sm-comparison-table td {
    padding: 0.75rem 0.85rem;
  }

  .sm-faq-item summary {
    padding: 0.9rem 1rem;
    font-size: 0.94rem;
  }

  .sm-faq-body {
    padding: 0.85rem 1rem 1rem;
  }
}

/* ---------- 5b. Leaderboard additions (tab panel, month, notes) ---------- */
.sm-lb-month {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sm-lb-title {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-main);
}
.sm-lb-note {
  margin: 0.7rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sm-lb-table {
  min-width: 460px;
}

/* ---------- 7. Feedback form ---------- */
.sm-fb-wrapper {
  width: 100%;
  border-top: 1px solid var(--border-color);
  color: var(--text-main);
}
.sm-fb {
  padding: 4rem 5% 4rem;
  font-family: var(--ui);
}
.sm-fb-container {
  max-width: 760px;
  margin: 0 auto;
}
.sm-fb h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}
.sm-fb-sub {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}
.sm-fb-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
}
.sm-fb-field label,
.sm-fb-rating legend {
  display: block;
  margin: 0 0 0.4rem;
  padding: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}
.sm-fb-hint {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.sm-fb input[type="email"],
.sm-fb textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text-main);
  background: var(--nav-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}
.sm-fb input::placeholder,
.sm-fb textarea::placeholder {
  color: var(--text-muted);
}
.sm-fb textarea {
  min-height: 6rem;
  resize: vertical;
}
.sm-fb input[type="email"]:focus,
.sm-fb textarea:focus {
  border-color: var(--accent-blue);
}
.sm-fb-rating {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.sm-fb-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.sm-fb-scale input { /* hidden but still reachable with the keyboard */
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.sm-fb-scale label {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin: 0;
  font-weight: 600;
  color: var(--text-main);
  background: var(--nav-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.sm-fb-scale label:hover {
  border-color: var(--accent-blue);
}
.sm-fb-scale input:checked + label {
  color: var(--on-accent);
  background: var(--accent-fill);
  border-color: var(--accent-fill);
}
.sm-fb-scale input:focus-visible + label {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}
.sm-fb-scale-legend {
  display: flex;
  justify-content: space-between;
  max-width: calc(5 * 3rem + 4 * 0.5rem);
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.sm-fb-error {
  display: block;
  min-height: 1.1rem;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--accent-red);
}
.sm-fb-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.sm-fb-status {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}
.sm-fb-status[data-state="ok"] {
  color: var(--grn);
}
.sm-fb-status[data-state="error"] {
  color: var(--accent-red);
}

/* ---------- 8. Footer ---------- */
.site-footer {
  padding: 2rem 5%;
  text-align: center;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
}
.site-footer p {
  margin: 10px 0 0;
  font-size: 0.9rem;
}
.site-footer a {
  color: var(--accent-blue);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}

/* ---------- 9. Tablets and phones ---------- */

/* Laptops and small tablets: one column. The character + text sit side by side, the preview card goes below. */
@media (max-width: 1100px) {
  .nav-links {
    gap: 1.25rem;
  }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    min-height: 0;
    padding: 2.5rem 5% 2rem;
  }
  .hero-left {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
  }
  .hero-right {
    justify-content: center;
  }
  .scroll-down {
    position: static;
    translate: none;
    order: 3; /* after the preview card */
    justify-self: center;
  }
}

/* Navbar on tablets and phones (below 860px the links no longer fit in one row) */
@media (max-width: 860px) {
  html {
    scroll-padding-top: 1rem;
  }

  /* Navbar: logo + theme switch, then the links, then the big button. Scrolls away with the page. */
  .navclass {
    position: relative;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 12px;
    padding: 10px 16px;
  }
  .navclass::before { /* line break after the logo row */
    content: "";
    order: 2;
    flex: 0 0 100%;
    height: 0;
  }
  .logourl { order: 0; }
  .logo { font-size: 1.15rem; }
  .logo .mk { width: 36px; height: 36px; }
  .nav-name { white-space: nowrap; }
  .nav-links { display: contents; }
  .nav-links .tg { order: 1; margin-left: auto; width: 36px; height: 36px; }
  .nav-links a:not(.btn-start) {
    order: 3;
    flex: 1 1 auto;
    padding: 6px 4px;
    text-align: center;
    font-size: 0.95rem;
  }
  .nav-links a.btn-start {
    order: 4;
    flex: 1 0 100%;
    padding: 0.55rem 1rem;
    text-align: center;
    font-size: 0.9rem;
  }
}

/* Phones */
@media (max-width: 768px) {
  .hero {
    gap: 1.5rem;
    padding: 1.5rem 16px 1.25rem;
  }
  .hero-left {
    column-gap: 1.1rem;
  }
  #image-home {
    width: clamp(120px, 34vw, 190px);
  }
  .hero-left p {
    font-size: 1rem;
  }
  .editor-container {
    animation: none;
  }
  .editor-content {
    padding: 1rem 14px;
    font-size: clamp(0.6rem, 2.9vw, 0.8rem); /* shrinks with the screen so the longest line fits */
  }
  .languages {
    padding: 2rem 16px 2.5rem;
  }
  .sm-fb {
    padding: 3rem 1rem 2.5rem;
  }
  .sm-fb-form {
    padding: 1.1rem;
  }
}

/* Small phones: character above the text, bubble tail points down at it */
@media (max-width: 560px) {
  .hero-left {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "bubble" "img" "text";
    justify-items: center;
    text-align: center;
  }
  .speech-bubble {
    justify-self: center;
    margin-bottom: 10px;
    text-align: center;
  }
  .speech-bubble::after {
    left: 50%;
    top: 100%;
    margin: 0 0 0 -10px;
    border-width: 10px 10px 0;
    border-color: var(--bubble-bg) transparent transparent;
  }
  #image-home {
    width: clamp(140px, 44vw, 190px);
  }
}
@media (max-width: 380px) {
  .logo { font-size: 1.05rem; }
  .editor-content { padding: 0.9rem 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-left,
  .hero-right,
  .speech-bubble,
  .editor-container,
  .scroll-down,
  .languages h3 {
    animation: none !important;
  }
}
