* { -webkit-tap-highlight-color: transparent; box-sizing: border-box; margin: 0; padding: 0; }
html { line-height: 1.5; text-size-adjust: 100%; font-family: system-ui, -apple-system, sans-serif; -webkit-font-smoothing: antialiased; }
body { background: #fff; color: #1A202C; min-height: 100vh; position: relative; margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; border-style: none; }
button { cursor: pointer; font-family: inherit; background: transparent; padding: 0; border: none; }
:where(blockquote, dl, dd, h1, h2, h3, h4, h5, h6, hr, figure, p, pre) { margin: 0; }

/* Header */
.header { background: #fff; color: #000; width: 100%; padding: 8px 0 4px; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid #e0e0e0; }
.header-inner { width: 100%; max-width: 1280px; margin: 0 auto; display: flex; justify-content: space-between; padding: 0 16px; }
.header-logo { display: flex; align-items: center; }
.header-logo img { width: 170px; height: auto; }
.header-nav { display: flex; align-items: center; gap: 0; margin-right: 10px; }
.header-nav a { display: inline-flex; align-items: center; justify-content: center; padding: 7px 8px; font-size: 14px; font-weight: 400; color: #13141c; transition: .2s; position: relative; margin: 0 4px; }
.header-nav a:hover { text-decoration: none; }
.header-nav a:after { content: ""; position: absolute; bottom: -7px; left: 0; right: 0; height: 1.5px; background: currentColor; transform: scaleY(0); transform-origin: center bottom; border-radius: 9999px; transition: transform 0.2s; }
.header-nav a:hover:after { transform: scaleY(1); }
.btn-create { background: linear-gradient(48deg, #f1bbf2, #f3c4ee, #f5cce9, #f9ddeb, #f9dfe7, #fae4df, #fbe7db, #fbe9d7); background-size: 500% 400%; display: flex; justify-content: center; align-items: center; border-radius: 9999px; margin-left: 8px; font-weight: 700; transition: box-shadow .3s; padding: 0; }
.btn-create:hover { box-shadow: 0 4px 8px #00000026; }
.btn-create span { padding: 8px 20px; display: block; font-weight: 700; font-size: 14px; }

/* Main container */
.main-container { max-width: 650px; margin: 0 auto; padding: 20px 16px; text-align: center; }

/* Title bar */
.title-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.title-bar h1 { font-size: 28px; font-weight: 700; }
.title-svg { width: 28px; height: 28px; display: inline-block; vertical-align: middle; color: #000; }
.title-previous, .title-next { display: flex; align-items: center; padding: 4px; cursor: pointer; }
.title-previous:hover, .title-next:hover { opacity: 0.6; }
#createdAt { font-size: 14px; color: #666; margin-bottom: 16px; }

/* Game grid */
.game-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-width: 550px; margin: 0 auto; }
.tile { background: #E5E4E2; color: #000; font-weight: 700; font-size: 14px; padding: 16px 8px; border-radius: 6px; cursor: pointer; transition: background 0.15s; border: none; min-height: 56px; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.3; }
.tile:hover { background: #d8d8d6; }
.tile.selected { background: #5a5a5a; color: #fff; }
.tile.solved { cursor: default; color: #fff; text-transform: uppercase; font-size: 13px; }
.tile.solved.difficulty-1 { background: #FFDB58; }
.tile.solved.difficulty-2 { background: #50C878; }
.tile.solved.difficulty-3 { background: #468FEA; }
.tile.solved.difficulty-4 { background: #B272E0; }
.tile.wrong { animation: shake 0.4s; }

@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }

/* Mistakes */
.mistakes { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 16px 0; font-size: 15px; color: #333; }
.mistake-dot { width: 12px; height: 12px; border-radius: 50%; background: #000; display: inline-block; }
.mistake-dot.used { background: #ccc; }
#infinity-icon svg { width: 20px; height: 20px; }

/* Buttons */
.game-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0; }
.game-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 22px; border-radius: 9999px; font-size: 14px; font-weight: 600; border: 1px solid #000; background: transparent; color: #000; transition: all 0.2s; min-width: 80px; }
.game-btn:hover { background: rgba(0,0,0,0.06); }
.game-btn.primary { background: #000; color: #fff; border-color: #000; }
.game-btn.primary:hover { background: rgba(0,0,0,0.8); border-color: rgba(0,0,0,0.8); }
.game-btn:disabled { opacity: 0.4; cursor: default; }
.game-btn:disabled:hover { background: transparent; }
.game-btn.hidden { display: none; }

/* Difficulty selector */
.difficulty-bar { display: flex; justify-content: center; gap: 0; margin: 24px 0; border: 1px solid #e0e0e0; border-radius: 8px; overflow: hidden; max-width: 300px; margin-left: auto; margin-right: auto; }
.diff-btn { flex: 1; padding: 10px 16px; font-size: 14px; font-weight: 500; background: #fff; color: #333; border: none; cursor: pointer; transition: all 0.15s; }
.diff-btn:hover { background: #f5f5f5; }
.diff-btn.active { background: #000; color: #fff; font-weight: 600; }
.diff-btn + .diff-btn { border-left: 1px solid #e0e0e0; }

/* Hint Button */
.hint-btn { background: #FFF8E1; border-color: #FFB300; color: #E65100; }
.hint-btn:hover { background: #FFECB3; }

/* Hint Glow on tiles */
.tile.hint-glow { animation: hintPulse 0.6s ease-in-out infinite alternate; box-shadow: 0 0 0 3px #FFB300, 0 0 16px rgba(255,179,0,0.5); border-radius: 6px; z-index: 2; position: relative; }
@keyframes hintPulse { 0% { box-shadow: 0 0 0 3px #FFB300, 0 0 10px rgba(255,179,0,0.3); } 100% { box-shadow: 0 0 0 3px #FF8F00, 0 0 20px rgba(255,143,0,0.6); } }

/* Result popup */
.popup-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.48); z-index: 1400; }
.result-popup { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); background: #fff; border-radius: 6px; padding: 24px; z-index: 1401; width: 90%; max-width: 400px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.result-popup.show { display: block; }
.close-button { position: absolute; top: 8px; right: 12px; font-size: 24px; cursor: pointer; background: rgba(0,0,0,0.06); width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; border: none; }
.close-button:hover { background: rgba(0,0,0,0.12); }
.result-popup h2 { font-size: 22px; font-weight: 700; margin-bottom: 16px; text-align: center; }
.result-grid { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 20px; min-height: 80px; }
.result-row { display: flex; gap: 4px; }
.result-box { width: 36px; height: 36px; border-radius: 4px; }
.result-box.yellow { background: #FFDB58; }
.result-box.green { background: #50C878; }
.result-box.blue { background: #468FEA; }
.result-box.purple { background: #B272E0; }
.result-box.gray { background: #ccc; }
.popup-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.popup-buttons .game-btn { font-size: 13px; padding: 8px 18px; min-width: auto; }

/* Solved group in game */
.solved-group { border-radius: 6px; padding: 12px 16px; margin-bottom: 8px; max-width: 550px; margin-left: auto; margin-right: auto; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.solved-group.yellow { background: #FFDB58; }
.solved-group.green { background: #50C878; }
.solved-group.blue { background: #468FEA; }
.solved-group.purple { background: #B272E0; }
.solved-group h3 { font-size: 16px; font-weight: 700; color: #fff; text-transform: uppercase; }
.solved-group p { font-size: 13px; color: #fff; opacity: 0.9; margin-top: 2px; }

/* Message popup */
#gameMessage { position: fixed; top: -50px; left: 50%; transform: translateX(-50%); background: #000 !important; color: #fff; padding: 10px 20px; border-radius: 50px; z-index: 1000; opacity: 0; transition: top 0.5s ease, opacity 0.5s ease; font-size: 15px; pointer-events: none; }
#gameMessage.show { top: 60px; opacity: 1; }
#gameMessage.hide { opacity: 0; transform: translateX(-50%) scale(0.8); transition: transform 0.3s ease, opacity 0.3s ease; }

/* Sections */
.section { padding: 40px 16px; }
.section--grey { background: #f5f5f5; }
.section--yellow { background: #fff8e1; }
.section-inner { max-width: 800px; margin: 0 auto; text-align: center; }
.section h2 { font-size: 26px; font-weight: 900; color: #13141c; margin-bottom: 8px; }
.section p { color: #2b2e3a; font-size: 16px; line-height: 28px; margin-bottom: 12px; }

/* Other games */
.games-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-top: 24px; }
.game-card2 { display: block; background: #fff; border-radius: 10px; padding: 16px; text-decoration: none; width: 200px; border: 1px solid #eee; transition: box-shadow 0.2s; }
.game-card2:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); text-decoration: none; }
.game-card2 img { width: 40px; height: 40px; margin-bottom: 8px; }
.game-card2 .card-title { font-weight: 700; color: #13141c; font-size: 15px; }
.game-card2 .card-text { font-size: 13px; color: #666; }
.game-card2 .card-play { display: inline-block; margin-top: 8px; padding: 6px 20px; background: #41a7fb; color: #fff !important; border-radius: 10px; font-size: 14px; font-weight: 600; }

/* Buttons in sections */
.btn-blue { display: inline-flex; align-items: center; gap: 8px; padding: 15px 20px; background: #41a7fb; color: #fff !important; border-radius: 10px; font-size: 16px; font-weight: 600; text-decoration: none; transition: .25s; }
.btn-blue:hover { background: #3596e8; text-decoration: none; }
.btn-blue svg { width: 28px; height: 28px; }

/* How to play */
.how-to-play { max-width: 700px; margin: 0 auto; text-align: left; }
.how-to-play h2 { text-align: center; }
.how-to-play ol { list-style: none; counter-reset: step; padding: 0; }
.how-to-play li { counter-increment: step; margin-bottom: 24px; }
.how-to-play li h3 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.how-to-play li h3:before { content: counter(step) ". "; }
.how-to-play li p { color: #2b2e3a; font-size: 16px; line-height: 28px; }
.how-to-play li img { max-width: 100%; border-radius: 8px; margin-top: 8px; }

/* FAQ */
.faq-list { max-width: 700px; margin: 0 auto; text-align: left; }
.faq-list h2 { text-align: center; }
.faq-item { margin-bottom: 20px; }
.faq-item h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; cursor: pointer; }
.faq-item p { color: #2b2e3a; font-size: 15px; line-height: 26px; }

/* Footer */
.footer { background: #fff; border-top: 1px solid #e0e0e0; padding: 24px 16px; text-align: center; }
.footer-inner { max-width: 800px; margin: 0 auto; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin-bottom: 8px; }
.footer-links a { font-size: 14px; color: #555; }
.footer-links a:hover { color: #000; }
.footer-copy { font-size: 13px; color: #888; }
.footer-message { font-size: 12px; color: #aaa; margin-top: 8px; }

/* Blog pages */
.blog-container { max-width: 800px; margin: 40px auto; padding: 0 20px; }
.blog-container h1 { font-size: 32px; font-weight: 800; margin-bottom: 8px; line-height: 1.3; }
.blog-container article { overflow-wrap: break-word; word-wrap: break-word; }

/* Archive page */
.archive-search { margin-bottom: 20px; position: relative; max-width: 400px; margin-left: auto; margin-right: auto; }
.archive-search input { width: 100%; padding: 10px 14px 10px 40px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px; outline: none; }
.archive-search input:focus { border-color: #000; }
.archive-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #888; }
.archive-filters { display: flex; justify-content: center; gap: 8px; margin-bottom: 20px; }
.filter-btn { padding: 8px 18px; border: 1px solid #ddd; border-radius: 9999px; font-size: 14px; background: #fff; color: #333; cursor: pointer; transition: all 0.15s; }
.filter-btn:hover { border-color: #000; }
.filter-btn.active { background: #000; color: #fff; border-color: #000; }
.archive-table { width: 100%; border-collapse: collapse; }
.archive-table th { text-transform: uppercase; font-size: 12px; letter-spacing: 0.05em; color: #555; padding: 8px 12px; text-align: left; border-bottom: 1px solid #eee; font-weight: 700; }
.archive-table td { padding: 10px 12px; border-bottom: 1px solid #eee; font-size: 14px; }
.archive-table tr:hover td { background: #f9f9f9; }
.archive-table td:last-child { text-align: right; }
.archive-pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.archive-pagination button { padding: 8px 20px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; background: #fff; cursor: pointer; }
.archive-pagination button:hover { background: #f5f5f5; }
.archive-pagination button:disabled { opacity: 0.4; cursor: default; }

/* Create page */
.create-layout { display: flex; flex-direction: column; align-items: center; gap: 30px; max-width: 900px; margin: 0 auto; padding: 20px 16px; }
@media (min-width: 80em) { .create-layout { flex-direction: row; align-items: flex-start; gap: 50px; } }
.create-form { width: 100%; max-width: 550px; }
.create-form input { width: 100%; padding: 10px 14px; border: 1px solid #ddd; border-radius: 6px; font-size: 15px; outline: none; font-weight: 700; margin-bottom: 8px; }
.create-form input:focus { border-color: #000; }
.create-group { padding: 12px; border-radius: 6px; margin-bottom: 16px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.create-group.yellow { background: #FFDB58; }
.create-group.green { background: #50C878; }
.create-group.blue { background: #468FEA; }
.create-group.purple { background: #B272E0; }
.create-group label { display: block; font-size: 13px; font-weight: 600; color: #333; margin-bottom: 4px; }
.create-group input { background: #fff; border: none; margin-bottom: 6px; }
.create-preview { width: 100%; max-width: 550px; position: sticky; top: 20vh; align-self: flex-start; }
.create-preview h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; text-align: center; }
.create-preview .subtitle { font-size: 14px; color: #666; margin-bottom: 4px; text-align: center; }
.create-preview .game-grid { max-width: 550px; }
.create-preview .tile { font-size: 13px; padding: 12px 4px; min-height: 48px; cursor: default; }
.create-preview .tile.filled { background: #c8c8c8; }
.create-preview-buttons { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }

/* ═══════════════════════════════════════════
   RESPONSIVE DESIGN
   ═══════════════════════════════════════════ */

/* Logo variants */
.desk-logo-only { display: block; }
.mob-logo-only { display: none; }

/* Hamburger hidden on desktop */
@media (min-width: 769px) {
  .hamburger { display: none; }
}

/* Spoiler toggle */
.spoiler-toggle { display: inline-flex; align-items: center; justify-content: center; padding: 10px 24px; border-radius: 9999px; font-size: 14px; font-weight: 600; border: 1px solid #000; background: transparent; color: #000; cursor: pointer; transition: all 0.2s; margin-bottom: 16px; }
.spoiler-toggle:hover { background: rgba(0,0,0,0.06); }
.spoiler-content { max-height: 0; overflow: hidden; transition: max-height 0.4s ease, opacity 0.3s ease; opacity: 0; }
.spoiler-content.spoiler-visible { max-height: 600px; opacity: 1; }

/* Games page */
.topics-container { max-width: 1200px; margin: 0 auto; padding: 30px 16px; }
.topics-heading { font-size: 28px; font-weight: 900; text-align: center; margin-bottom: 12px; }
.topics-container > p { text-align: center; color: #555; max-width: 700px; margin: 0 auto 30px; font-size: 16px; line-height: 1.6; }
.topics-games { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.game-item2 { display: flex; background: #fff; border: 1px solid #eee; border-radius: 10px; padding: 14px; text-decoration: none; width: 340px; transition: box-shadow 0.2s; gap: 12px; }
.game-item2:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.game-item__img { flex-shrink: 0; }
.game-item__img svg, .game-item__img img { width: 40px; height: 40px; border-radius: 8px; }
.game-item__info { flex: 1; min-width: 0; }
.game-item__title { font-weight: 700; color: #13141c; font-size: 14px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.game-item__text { font-size: 12px; color: #888; margin-bottom: 6px; }
.game-item__bottom { display: flex; align-items: center; }
.game-item__play { padding: 4px 18px; background: #41a7fb; color: #fff; border-radius: 8px; font-size: 13px; font-weight: 600; }
.game-item__play:hover { background: #3596e8; }

/* Pagination */
.page { overflow: hidden; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; margin: 30px 0; }
.page a, .page span { font-size: 14px; line-height: 29px; padding: 0 13px; margin: 5px 3px; font-weight: 500; border-radius: 8px; transition: 0.2s ease; text-decoration: none; }
.page .off { color: #777; border: 1px solid #ccc; background: #fff; }
.page .on, .page .on:hover { color: #eee; border: 1px solid #333; background: #333; }
.page .off:hover { color: #eee; border: 1px solid #333; background: #333; }
.page .hellip { border: 1px solid #bbb; background: #fff; opacity: 0.5; }

/* ── Floating Social Share Bar ── */
.social-share-bar {
  position: fixed;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 90;
}
.social-share-bar a,
.social-share-bar button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  text-decoration: none;
}
.social-share-bar a:hover,
.social-share-bar button:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.share-fb { background: #1877F2; }
.share-x { background: #000; }
.share-wa { background: #25D366; }
.share-tg { background: #0088cc; }
.share-copy { background: #555; }
.share-copy.copied { background: #2ecc71; }
.social-share-bar svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Blog content responsive images & embeds */
.blog-content img { max-width: 100%; height: auto; border-radius: 8px; }
.blog-content iframe { max-width: 100%; }
.blog-content table { width: 100%; overflow-x: auto; display: block; }

/* SEO content */
.seo-content { text-align: left; line-height: 1.8; font-size: 16px; color: #2b2e3a; }

/* ─── TABLET: 769px – 1024px ─── */
@media (max-width: 1024px) {
  .header-nav a { padding: 7px 6px; font-size: 13px; margin: 0 2px; }
  .btn-create span { padding: 8px 14px; font-size: 13px; }
  .section-inner { max-width: 100%; padding: 0 8px; }
  .how-to-play { max-width: 100%; }
  .faq-list { max-width: 100%; }
  .create-layout { gap: 24px; }
}

/* ─── MOBILE NAV + LAYOUT: ≤768px ─── */
@media (max-width: 768px) {
  /* Header & Nav */
  .header { position: sticky; }
  .header-inner { align-items: center; }
  .header-logo img { width: 140px; }
  .header-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    padding: 8px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 200;
  }
  .header-nav.open { display: flex; }
  .header-nav a {
    padding: 12px 20px;
    font-size: 15px;
    margin: 0;
    justify-content: flex-start;
    min-height: 44px;
  }
  .header-nav a:after { display: none; }
  .btn-create { margin-left: 0; margin: 4px 16px; border-radius: 10px; }
  .btn-create span { padding: 10px 20px; font-size: 15px; }
  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    cursor: pointer;
    border: none;
    background: transparent;
    flex-direction: column;
    gap: 5px;
  }
  .hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: #13141c;
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
  }
  .hamburger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .hamburger.active span:nth-child(2) { opacity: 0; }
  .hamburger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Main container */
  .main-container { padding: 14px 12px; }

  /* Title bar */
  .title-bar h1 { font-size: 22px; }
  .title-svg { width: 24px; height: 24px; }

  /* Game grid */
  .game-grid { gap: 6px; max-width: 100%; }
  .tile { font-size: 13px; padding: 14px 6px; min-height: 52px; word-break: break-word; }

  /* Game buttons — ensure good touch targets */
  .game-btn { font-size: 13px; padding: 10px 16px; min-height: 44px; }
  .game-buttons { gap: 6px; }

  /* Difficulty bar */
  .difficulty-bar { max-width: 100%; }
  .diff-btn { padding: 10px 12px; font-size: 13px; min-height: 44px; }

  /* Solved groups */
  .solved-group { padding: 10px 12px; max-width: 100%; }
  .solved-group h3 { font-size: 14px; }
  .solved-group p { font-size: 12px; }

  /* Sections */
  .section { padding: 30px 14px; }
  .section h2 { font-size: 22px; }
  .section p { font-size: 15px; line-height: 26px; }

  /* Games grid (other games cards) */
  .games-grid { gap: 12px; }
  .game-card2 { width: 160px; padding: 12px; }
  .game-card2 .card-title { font-size: 14px; }
  .game-card2 .card-play { padding: 5px 16px; font-size: 13px; }

  /* How to play */
  .how-to-play li h3 { font-size: 16px; }
  .how-to-play li p { font-size: 15px; line-height: 26px; }

  /* FAQ */
  .faq-item h3 { font-size: 16px; }
  .faq-item p { font-size: 14px; line-height: 24px; }

  /* Archive page */
  .archive-search { max-width: 100%; }
  .archive-filters { flex-wrap: wrap; }
  .filter-btn { min-height: 44px; }
  .archive-table th { font-size: 11px; padding: 6px 8px; }
  .archive-table td { padding: 8px; font-size: 13px; }

  /* Create page */
  .create-layout { flex-direction: column; padding: 16px 12px; gap: 20px; }
  .create-form { max-width: 100%; }
  .create-preview { max-width: 100%; position: static; }
  .create-preview .game-grid { max-width: 100%; }
  .create-preview .tile { font-size: 12px; padding: 10px 4px; min-height: 44px; }
  .create-group label { font-size: 12px; }
  .create-group input, .create-form input { font-size: 16px; padding: 12px 14px; }

  /* Games page (topics) */
  .topics-container { padding: 20px 12px; }
  .topics-heading { font-size: 22px; }
  .topics-games { gap: 10px; }
  .game-item2 { width: 100%; max-width: none; }

  /* Blog */
  .blog-container { margin: 20px auto; padding: 0 14px; max-width: 100%; }
  .blog-container h1 { font-size: 26px; }
  .blog-content { font-size: 15px !important; line-height: 1.7 !important; }

  /* Result popup */
  .result-popup { width: 94%; max-width: 380px; padding: 20px 16px; }
  .result-popup h2 { font-size: 20px; }
  .result-box { width: 32px; height: 32px; }

  /* Pagination */
  .page a, .page span { font-size: 13px; padding: 0 10px; margin: 4px 2px; }
  .archive-pagination button { min-height: 44px; }

  /* Footer */
  .footer { padding: 20px 14px; padding-bottom: 70px; }
  .footer-links { gap: 12px; }
  .footer-links a { font-size: 13px; min-height: 44px; display: inline-flex; align-items: center; }

  /* Social share — bottom bar */
  .social-share-bar {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
    flex-direction: row;
    justify-content: center;
    padding: 8px 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid #eee;
    gap: 12px;
  }
  .social-share-bar a,
  .social-share-bar button {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }

  /* Message popup position for mobile */
  #gameMessage { font-size: 14px; padding: 8px 16px; max-width: 90%; white-space: nowrap; }
}

/* ─── SMALL MOBILE: ≤480px ─── */
@media (max-width: 480px) {
  .header-logo img { width: 120px; }
  .desk-logo-only { display: none; }
  .mob-logo-only { display: block; }
  .mob-logo-only img { width: 120px; height: auto; }

  .main-container { padding: 10px 8px; }
  .title-bar h1 { font-size: 19px; }
  .title-svg { width: 22px; height: 22px; }
  #createdAt { font-size: 13px; }

  /* Game grid — tighter on small screens */
  .game-grid { gap: 4px; }
  .tile { font-size: 11px; padding: 10px 3px; min-height: 44px; letter-spacing: -0.2px; }

  /* Game buttons — wrap nicely */
  .game-buttons { gap: 5px; }
  .game-btn { font-size: 12px; padding: 8px 12px; min-width: 70px; }

  /* Difficulty bar */
  .difficulty-bar { margin: 16px 0; }
  .diff-btn { padding: 8px 8px; font-size: 12px; }

  /* Mistakes */
  .mistakes { font-size: 13px; gap: 4px; }
  .mistake-dot { width: 10px; height: 10px; }

  /* Blog */
  .blog-container { margin: 12px auto; padding: 0 10px; }
  .blog-container h1 { font-size: 22px; }

  /* Sections */
  .section { padding: 24px 10px; }
  .section h2 { font-size: 20px; }
  .section p { font-size: 14px; line-height: 24px; }

  /* Games cards on homepage */
  .games-grid { flex-direction: column; align-items: center; gap: 10px; }
  .game-card2 { width: 100%; max-width: 280px; }

  /* Button styles */
  .btn-blue { padding: 12px 16px; font-size: 14px; }
  .btn-blue svg { width: 22px; height: 22px; }

  /* How to play */
  .how-to-play li { margin-bottom: 18px; }
  .how-to-play li h3 { font-size: 15px; }
  .how-to-play li p { font-size: 14px; line-height: 24px; }

  /* Archive — hide less important columns */
  .archive-table th:first-child,
  .archive-table td:first-child { display: none; }
  .archive-table th:nth-child(3),
  .archive-table td:nth-child(3) { font-size: 11px; }
  .archive-table td a.game-btn { padding: 4px 10px; font-size: 11px; }

  /* Create page */
  .create-group { padding: 10px; margin-bottom: 12px; }

  /* Popup */
  .result-popup { width: 96%; padding: 16px 12px; }
  .result-popup h2 { font-size: 18px; margin-bottom: 12px; }
  .result-box { width: 28px; height: 28px; border-radius: 3px; }
  .result-row { gap: 3px; }
  .result-grid { gap: 4px; margin-bottom: 14px; }
  .popup-buttons .game-btn { font-size: 12px; padding: 8px 14px; }
  .close-button { width: 28px; height: 28px; font-size: 20px; }

  /* Footer */
  .footer-links { flex-direction: column; gap: 4px; align-items: center; }
  .footer-copy { font-size: 12px; }
  .footer-message { font-size: 11px; }

  /* Solved groups */
  .solved-group h3 { font-size: 13px; }
  .solved-group p { font-size: 11px; }
  .solved-group { padding: 8px 10px; }
}

/* ─── VERY SMALL PHONES: ≤360px ─── */
@media (max-width: 360px) {
  .title-bar h1 { font-size: 17px; }
  .tile { font-size: 10px; padding: 8px 2px; min-height: 40px; }
  .game-grid { gap: 3px; }
  .game-btn { font-size: 11px; padding: 7px 10px; min-width: 60px; }
  .diff-btn { padding: 7px 6px; font-size: 11px; }
  .section h2 { font-size: 18px; }
  .result-box { width: 24px; height: 24px; }
  .header-logo img { width: 100px; }
  .mob-logo-only img { width: 100px; height: auto; }
}

/* ─── LANDSCAPE PHONE ─── */
@media (max-height: 500px) and (orientation: landscape) {
  .header { padding: 4px 0 2px; }
  .main-container { padding: 8px; }
  .game-grid { max-width: 400px; }
  .tile { min-height: 38px; padding: 6px 4px; font-size: 11px; }
  .section { padding: 20px 12px; }
  .game-buttons { margin: 8px 0; }
  .difficulty-bar { margin: 12px 0; }
  .mistakes { margin: 8px 0; }
}
