:root {
    --bg: #ffffff;
    --text: #1a1a2e;
    --tile-border: #d3d6da;
    --tile-filled: #1a1a2e;
    --correct: #538d4e;
    --elsewhere: #b59f3b;
    --absent: #818384;
    --key-bg: #d3d6da;
    --key-text: #1a1a2e;
    --header-bg: #fff;
    --header-border: #d3d6da;
    --modal-bg: rgba(0,0,0,0.5);
    --modal-card: #fff;
    --green-accent: #3ce23c;
    --hint-bg: #1a1a2e;
    --hint-text: #fff;
  }
  body.dark {
    --bg: #121213;
    --text: #fff;
    --tile-border: #3a3a3c;
    --tile-filled: #fff;
    --correct: #538d4e;
    --elsewhere: #b59f3b;
    --absent: #3a3a3c;
    --key-bg: #818384;
    --key-text: #fff;
    --header-bg: #121213;
    --header-border: #3a3a3c;
    --modal-card: #1e1e1f;
    --hint-bg: #fff;
    --hint-text: #121213;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
  }
  /* HEADER */
  header {
    background: var(--header-bg);
    border-bottom: 2px solid var(--header-border);
    padding: 0 16px;
    height: 60px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .header-left { display: flex; align-items: center; justify-content: flex-start; }
  .logo { display: flex; align-items: center; justify-content: center; }
  .logo img { height: 60px; }
  .header-right { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
  .icon-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text); padding: 6px; border-radius: 8px;
    transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
  }
  .icon-btn:hover { background: var(--tile-border); }
  /* TOAST */
  #toast {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
    background: var(--hint-bg); color: var(--hint-text);
    padding: 10px 20px; border-radius: 10px;
    font-weight: 700; font-size: 15px;
    z-index: 999; opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
  }
  #toast.show { opacity: 1; }
  /* MAIN */
  main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 0 10px;
    gap: 20px;
  }
  /* BOARD */
  #board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 6px;
    padding: 4px;
  }
  .row {
    display: flex;
    gap: 6px;
  }
  .tile {
    width: 62px; height: 62px;
    border: 2px solid var(--tile-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 800;
    text-transform: uppercase;
    color: var(--text);
    transition: border-color 0.1s;
    position: relative;
    user-select: none;
  }
  .tile.filled {
    border-color: #999;
    animation: pop 0.1s ease;
  }
  .tile.correct { background: var(--correct); color: #fff; border-color: var(--correct); }
  .tile.elsewhere { background: var(--elsewhere); color: #fff; border-color: var(--elsewhere); }
  .tile.absent { background: var(--absent); color: #fff; border-color: var(--absent); }
  .tile.reveal {
    animation: flip 0.5s ease forwards;
  }
  @keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
  }
  @keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(-90deg); }
    100% { transform: rotateX(0); }
  }
  .row.shake {
    animation: shake 0.4s ease;
  }
  @keyframes shake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
  }
  /* KEYBOARD */
  #keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
    max-width: 480px;
    padding: 0 8px;
  }
  .kb-row {
    display: flex;
    gap: 6px;
    justify-content: center;
  }
  .key {
    height: 58px;
    min-width: 43px;
    padding: 0 8px;
    background: var(--key-bg);
    color: var(--key-text);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex; align-items: center; justify-content: center;
    flex: 1;
    max-width: 50px;
  }
  .key.wide { min-width: 65px; max-width: 75px; font-size: 12px; }
  .key.correct { background: var(--correct); color: #fff; }
  .key.elsewhere { background: var(--elsewhere); color: #fff; }
  .key.absent { background: var(--absent); color: #fff; }
  .key:hover { filter: brightness(1.15); }
  .key:active { filter: brightness(0.9); }
  /* MODAL */
  .modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: var(--modal-bg);
    z-index: 500;
    align-items: center;
    justify-content: center;
  }
  .modal-overlay.open { display: flex; }
  .modal-card {
    background: var(--modal-card);
    color: var(--text);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: var(--text); line-height: 1;
  }
  .modal-title {
    font-size: 1.3rem; font-weight: 800;
    text-align: center; margin-bottom: 18px;
    text-transform: uppercase; letter-spacing: 2px;
  }
  /* SETTINGS toggles */
  .setting-row {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--tile-border);
  }
  .setting-row:last-child { border-bottom: none; }
  .setting-label { font-size: 14px; font-weight: 600; }
  .setting-desc { font-size: 12px; color: var(--absent); margin-top: 2px; }
  .toggle {
    width: 50px; height: 26px;
    background: var(--tile-border);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
    flex-shrink: 0;
  }
  .toggle::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    top: 3px; left: 3px;
    transition: transform 0.3s;
  }
  .toggle.on { background: var(--correct); }
  .toggle.on::after { transform: translateX(24px); }
  /* HOW TO PLAY modal */
  .howto-card { padding: 24px 24px 20px; max-width: 480px; }
  .howto-header {
    display: flex; align-items: center; gap: 0;
    margin-bottom: 14px; position: relative;
  }
  .howto-title-plain { font-size: 1.25rem; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; }
  .howto-title-dash { font-size: 1.25rem; font-weight: 900; margin: 0 4px; }
  .howto-title-colored { font-size: 1.25rem; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; color: #00bcd4; }
  .howto-header .modal-close { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
  .howto-divider { border: none; border-top: 1px solid var(--tile-border); margin: 12px 0; }
  .howto-intro { font-size: 13.5px; line-height: 1.65; color: var(--text); margin-bottom: 0; }
  .howto-example-title { font-weight: 700; font-size: 14px; text-align: center; margin: 10px 0 8px; }
  .howto-example-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
  .howto-tile {
    width: 58px; height: 58px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 900;
    text-transform: uppercase;
    color: #fff;
    border-radius: 4px;
  }
  .howto-tile.correct { background: var(--correct); }
  .howto-tile.elsewhere { background: var(--elsewhere); }
  .howto-tile.absent { background: var(--absent); }
  .howto-desc { font-size: 13px; line-height: 1.6; text-align: center; margin-bottom: 4px; }
  .howto-note { font-size: 13.5px; line-height: 1.65; color: var(--text); }
  .howto-close-btn {
    display: block; width: 100%;
    background: none; border: none;
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text); cursor: pointer;
    padding: 8px 0 0;
    text-align: center;
  }
  .howto-close-btn:hover { opacity: 0.7; }
  /* RESULT screen */
  .result-word {
    font-size: 2rem; font-weight: 900;
    text-align: center; letter-spacing: 3px;
    text-transform: uppercase; margin: 12px 0;
    color: var(--correct);
  }
  .result-word.lost { color: var(--elsewhere); }
  .result-title {
    font-size: 1.1rem; font-weight: 700;
    text-align: center; margin-bottom: 4px;
  }
  .result-subtitle {
    text-align: center; font-size: 13px;
    color: var(--absent); margin-bottom: 16px;
  }
  .btn-primary {
    display: block; width: 100%;
    padding: 14px;
    background: var(--correct); color: #fff;
    border: none; border-radius: 10px;
    font-size: 16px; font-weight: 800;
    cursor: pointer; margin-top: 12px;
    text-transform: uppercase; letter-spacing: 1px;
    transition: filter 0.2s;
  }
  .btn-primary:hover { filter: brightness(1.1); }
  /* STATS bar */
  .stat-grid { display: flex; gap: 12px; justify-content: center; margin: 14px 0; }
  .stat-item { text-align: center; }
  .stat-num { font-size: 2rem; font-weight: 800; }
  .stat-lbl { font-size: 11px; color: var(--absent); text-transform: uppercase; }
  .dist-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
  .dist-bar-outer { flex: 1; background: var(--tile-border); border-radius: 3px; height: 18px; }
  .dist-bar-inner { height: 18px; background: var(--correct); border-radius: 3px; min-width: 20px; display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; color: #fff; font-size: 12px; font-weight: 700; transition: width 0.5s; }
  @media (max-width: 440px) {
    .tile { width: 52px; height: 52px; font-size: 1.7rem; }
    .key { height: 52px; min-width: 34px; font-size: 12px; }
    .key.wide { min-width: 52px; }
  }

/* ── PAGE / INSTRUCTIONS ───────────────────────────────────────────────────── */

:root {
    --bg: #ffffff;
    --text: #1a1a2e;
    --tile-border: #d3d6da;
    --tile-filled: #1a1a2e;
    --correct: #538d4e;
    --elsewhere: #b59f3b;
    --absent: #818384;
    --key-bg: #d3d6da;
    --key-text: #1a1a2e;
    --header-bg: #fff;
    --header-border: #d3d6da;
    --modal-bg: rgba(0,0,0,0.5);
    --modal-card: #fff;
    --green-accent: #3ce23c;
    --hint-bg: #1a1a2e;
    --hint-text: #fff;
  }
  body.dark {
    --bg: #121213;
    --text: #fff;
    --tile-border: #3a3a3c;
    --tile-filled: #fff;
    --correct: #538d4e;
    --elsewhere: #b59f3b;
    --absent: #3a3a3c;
    --key-bg: #818384;
    --key-text: #fff;
    --header-bg: #121213;
    --header-border: #3a3a3c;
    --modal-card: #1e1e1f;
    --hint-bg: #fff;
    --hint-text: #121213;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
    overflow-x: hidden;
  }
  /* HEADER */
  header {
    background: var(--header-bg);
    border-bottom: 2px solid var(--header-border);
    padding: 0 16px;
    height: 60px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
  }
  .header-left { display: flex; align-items: center; justify-content: flex-start; }
  .logo { display: flex; align-items: center; justify-content: center; }
  .logo img { height: 60px; }
  .header-right { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
  .icon-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text); padding: 6px; border-radius: 8px;
    transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
  }
  .icon-btn:hover { background: var(--tile-border); }
  /* TOAST */
  #toast {
    position: fixed; top: 80px; left: 50%; transform: translateX(-50%);
    background: var(--hint-bg); color: var(--hint-text);
    padding: 10px 20px; border-radius: 10px;
    font-weight: 700; font-size: 15px;
    z-index: 999; opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
  }
  #toast.show { opacity: 1; }
  /* MAIN */
  main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 0 10px;
    gap: 20px;
  }
  /* BOARD */
  #board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 6px;
    padding: 4px;
  }
  .row {
    display: flex;
    gap: 6px;
  }
  .tile {
    width: 62px; height: 62px;
    border: 2px solid var(--tile-border);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 800;
    text-transform: uppercase;
    color: var(--text);
    transition: border-color 0.1s;
    position: relative;
    user-select: none;
  }
  .tile.filled {
    border-color: #999;
    animation: pop 0.1s ease;
  }
  .tile.correct { background: var(--correct); color: #fff; border-color: var(--correct); }
  .tile.elsewhere { background: var(--elsewhere); color: #fff; border-color: var(--elsewhere); }
  .tile.absent { background: var(--absent); color: #fff; border-color: var(--absent); }
  .tile.reveal {
    animation: flip 0.5s ease forwards;
  }
  @keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
  }
  @keyframes flip {
    0% { transform: rotateX(0); }
    50% { transform: rotateX(-90deg); }
    100% { transform: rotateX(0); }
  }
  .row.shake {
    animation: shake 0.4s ease;
  }
  @keyframes shake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
  }
  /* KEYBOARD */
  #keyboard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    width: 100%;
    max-width: 480px;
    padding: 0 8px;
  }
  .kb-row {
    display: flex;
    gap: 6px;
    justify-content: center;
  }
  .key {
    height: 58px;
    min-width: 43px;
    padding: 0 8px;
    background: var(--key-bg);
    color: var(--key-text);
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex; align-items: center; justify-content: center;
    flex: 1;
    max-width: 50px;
  }
  .key.wide { min-width: 65px; max-width: 75px; font-size: 12px; }
  .key.correct { background: var(--correct); color: #fff; }
  .key.elsewhere { background: var(--elsewhere); color: #fff; }
  .key.absent { background: var(--absent); color: #fff; }
  .key:hover { filter: brightness(1.15); }
  .key:active { filter: brightness(0.9); }
  /* MODAL */
  .modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: var(--modal-bg);
    z-index: 500;
    align-items: center;
    justify-content: center;
  }
  .modal-overlay.open { display: flex; }
  .modal-card {
    background: var(--modal-card);
    color: var(--text);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; cursor: pointer;
    font-size: 22px; color: var(--text); line-height: 1;
  }
  .modal-title {
    font-size: 1.3rem; font-weight: 800;
    text-align: center; margin-bottom: 18px;
    text-transform: uppercase; letter-spacing: 2px;
  }
  /* SETTINGS toggles */
  .setting-row {
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--tile-border);
  }
  .setting-row:last-child { border-bottom: none; }
  .setting-label { font-size: 14px; font-weight: 600; }
  .setting-desc { font-size: 12px; color: var(--absent); margin-top: 2px; }
  .toggle {
    width: 50px; height: 26px;
    background: var(--tile-border);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    border: none;
    transition: background 0.3s;
    flex-shrink: 0;
  }
  .toggle::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    background: #fff;
    border-radius: 50%;
    top: 3px; left: 3px;
    transition: transform 0.3s;
  }
  .toggle.on { background: var(--correct); }
  .toggle.on::after { transform: translateX(24px); }
  /* HOW TO PLAY modal */
  .howto-card { padding: 24px 24px 20px; max-width: 480px; }
  .howto-header {
    display: flex; align-items: center; gap: 0;
    margin-bottom: 14px; position: relative;
  }
  .howto-title-plain { font-size: 1.25rem; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; }
  .howto-title-dash { font-size: 1.25rem; font-weight: 900; margin: 0 4px; }
  .howto-title-colored { font-size: 1.25rem; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; color: #00bcd4; }
  .howto-header .modal-close { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }
  .howto-divider { border: none; border-top: 1px solid var(--tile-border); margin: 12px 0; }
  .howto-intro { font-size: 13.5px; line-height: 1.65; color: var(--text); margin-bottom: 0; }
  .howto-example-title { font-weight: 700; font-size: 14px; text-align: center; margin: 10px 0 8px; }
  .howto-example-row { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
  .howto-tile {
    width: 58px; height: 58px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; font-weight: 900;
    text-transform: uppercase;
    color: #fff;
    border-radius: 4px;
  }
  .howto-tile.correct { background: var(--correct); }
  .howto-tile.elsewhere { background: var(--elsewhere); }
  .howto-tile.absent { background: var(--absent); }
  .howto-desc { font-size: 13px; line-height: 1.6; text-align: center; margin-bottom: 4px; }
  .howto-note { font-size: 13.5px; line-height: 1.65; color: var(--text); }
  .howto-close-btn {
    display: block; width: 100%;
    background: none; border: none;
    font-size: 13px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    color: var(--text); cursor: pointer;
    padding: 8px 0 0;
    text-align: center;
  }
  .howto-close-btn:hover { opacity: 0.7; }
  /* RESULT screen */
  .result-word {
    font-size: 2rem; font-weight: 900;
    text-align: center; letter-spacing: 3px;
    text-transform: uppercase; margin: 12px 0;
    color: var(--correct);
  }
  .result-word.lost { color: var(--elsewhere); }
  .result-title {
    font-size: 1.1rem; font-weight: 700;
    text-align: center; margin-bottom: 4px;
  }
  .result-subtitle {
    text-align: center; font-size: 13px;
    color: var(--absent); margin-bottom: 16px;
  }
  .btn-primary {
    display: block; width: 100%;
    padding: 14px;
    background: var(--correct); color: #fff;
    border: none; border-radius: 10px;
    font-size: 16px; font-weight: 800;
    cursor: pointer; margin-top: 12px;
    text-transform: uppercase; letter-spacing: 1px;
    transition: filter 0.2s;
  }
  .btn-primary:hover { filter: brightness(1.1); }
  /* STATS bar */
  .stat-grid { display: flex; gap: 12px; justify-content: center; margin: 14px 0; }
  .stat-item { text-align: center; }
  .stat-num { font-size: 2rem; font-weight: 800; }
  .stat-lbl { font-size: 11px; color: var(--absent); text-transform: uppercase; }
  .dist-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 13px; }
  .dist-bar-outer { flex: 1; background: var(--tile-border); border-radius: 3px; height: 18px; }
  .dist-bar-inner { height: 18px; background: var(--correct); border-radius: 3px; min-width: 20px; display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; color: #fff; font-size: 12px; font-weight: 700; transition: width 0.5s; }
  @media (max-width: 440px) {
    .tile { width: 52px; height: 52px; font-size: 1.7rem; }
    .key { height: 52px; min-width: 34px; font-size: 12px; }
    .key.wide { min-width: 52px; }
  }

.instructions {
  margin: auto;
  font-size: 16px;
  color: var(--color-tone-1);
 background:#374151;
}
.ins1 {
    padding: 40px 40px;
    text-align: center;
    margin-top: 40px;
    color:#fff;
}
.ins2{
    background:#1e293b;
    color:#fff;
padding: 40px 40px;}
h2 {
    text-align:center;
    margin:40px 0 20px;
    font-size:28px;
    font-weight:700;
  }
  /* How to Play */
  .howto {
    display:grid;
    grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
    gap:20px;
    max-width:900px;
    margin:0 auto;
    padding:20px;
  }
  .card {
    border-radius:10px;
    padding:24px 16px;
    text-align:center;
    box-shadow:0 2px 6px rgba(0,0,0,0.3);
  }
  .card:nth-child(odd) { background:#2d3748; }
  .card:nth-child(even){ background:#374151; }
  .card span.icon {
    font-size:32px;
    display:block;
    margin-bottom:12px;
  }
  .card h3 {
    margin:0 0 8px;
    font-size:18px;
    font-weight:700;
  }
  .card p {
    margin:0;
    font-size:14px;
    color:#cbd5e1;
  }
  .tiles {
    display:flex;
    justify-content:center;
    gap:8px;
    margin:30px 0;
  }
  .ins1 .tile {
    width:265px;
    height:50px;
    font-size:22px;
    font-weight:bold;
    border-radius:4px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#fff;
  }
  .green { background:#6aaa64; }
  .yellow{ background:#c9b458; }
  .gray  { background:#787c7e; }
/* Why Play Here */
  .features {
    display:grid;
    grid-template-columns: repeat(auto-fit,minmax(220px,1fr));
    gap:20px;
    max-width:1000px;
    margin:0 auto;
    padding:20px;
  }
  .feature {
    border-radius:10px;
    padding:24px 16px;
    text-align:center;
    box-shadow:0 2px 6px rgba(0,0,0,0.3);
  }
  .feature:nth-child(odd) { background:#2d3748; }
  .feature:nth-child(even){ background:#374151; }
  .feature span.icon {
    font-size:32px;
    display:block;
    margin-bottom:12px;
  }
  .feature h3 {
    margin:0 0 8px;
    font-size:18px;
    font-weight:700;
  }
  .feature p {
    margin:0;
    font-size:14px;
    color:#cbd5e1;
  }
.ins3{margin:0;
    font-family:'Segoe UI',sans-serif;
    background:#fdfaf6;
    color:#1e293b;}
.section {
    text-align:center;
    padding:40px 20px;
  }
  .section h2 {
    font-size:28px;
    font-weight:700;
    margin-bottom:10px;
  }
  .section p {
    font-size:16px;
    color:#4b5563;
    margin:0 0 30px;
  }
  .languages {
    display:grid;
    grid-template-columns: repeat(auto-fit,minmax(200px,1fr));
    gap:16px;
    max-width:1000px;
    margin:0 auto;
  }
  .lang {
    background:#fff;
    border:1px solid #e5e7eb;
    border-radius:8px;
    padding:12px 16px;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    font-weight:600;
    font-size:15px;
    cursor:pointer;
    transition: all 0.2s ease;
  }
  .lang img {
    width:28px;
    height:20px;
    margin-right:12px;
    border-radius:3px;
    object-fit:cover;
  }
  .lang:hover {
    background:#f3f4f6;
    transform:translateY(-2px);
  }
  .highlight {
    color:#059669; /* xanh lá nổi bật */
  }
/* Footer */
  footer {
    display:flex;
    justify-content:end;
    gap:20px;
    padding:20px;
    color:#cbd5e1;
    font-size:14px;
    flex-wrap:wrap;
background:#374151;
  }
  footer a {color:#cbd5e1;text-decoration:none;}
  footer a:hover{text-decoration:underline;}
.page {
    width: 900px;
    margin: auto;
}
/* ── MOBILE FIXES ─────────────────────────────────────────────────────────── */
html {
  -webkit-text-size-adjust: 100%;
}

img {
  max-width: 100%;
  height: auto;
}

main,
.instructions,
footer,
.page {
  width: 100%;
}

.page {
  max-width: 900px;
  width: min(900px, calc(100% - 24px));
}

#board {
  width: 100%;
  justify-items: center;
}

#keyboard {
  width: min(100%, 520px);
  padding: 0 10px max(10px, env(safe-area-inset-bottom));
}

.kb-row {
  display: grid;
  width: 100%;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.key {
  min-width: 0;
  max-width: none;
  width: 100%;
  padding: 0;
}

.key.wide {
  min-width: 0;
  max-width: none;
  padding: 0 6px;
}

.instructions {
  overflow-x: hidden;
}

.wordle-subtitle {
    color: #fff;
    margin-bottom: 15px;
    text-align: center;
}

.wordle-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.wordle-buttons button {
    background: #fff;
    color: #666;
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
}

.tiles {
  flex-wrap: wrap;
}

.ins1 .tile {
  width: min(100%, 265px);
}

.languages,
.howto,
.features {
  width: 100%;
}

.lang {
  min-width: 0;
}

.lang a {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  color: inherit;
  text-decoration: none;
}

#toast {
  width: min(calc(100vw - 24px), 320px);
  white-space: normal;
  text-align: center;
}

.modal-card {
  width: min(420px, calc(100vw - 24px));
}


/* ===== Example box ===== */
.example-box {
  max-width: 760px;
  margin: 28px auto 0;
  padding: 24px 22px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.example-box .title {
  margin: 0 0 16px;
  font-size: 18px;
  line-height: 1.5;
  text-align: center;
  color: #fff;
}

.example-box .word-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 0 0 20px;
  flex-wrap: wrap;
}

.example-box .tile {
  width: 52px;
  height: 52px;
  min-width: 52px;
  padding: 0;
  border: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  color: #fff;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.example-box .tile.green {
  background: #6aaa64;
}

.example-box .tile.yellow {
  background: #c9b458;
}

.example-box .tile.gray {
  background: #787c7e;
}

.example-box .desc {
  margin: 12px 0;
  font-size: 15px;
  line-height: 1.75;
  color: #e5e7eb;
  text-align: left;
}

.example-box .tile.inline {
  width: 30px;
  height: 30px;
  min-width: 30px;
  margin: 0 4px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  vertical-align: middle;
  display: inline-flex;
  box-shadow: none;
}

/* mobile */
@media (max-width: 768px) {
  .example-box {
    margin-top: 22px;
    padding: 20px 16px;
    border-radius: 14px;
  }

  .example-box .word-row {
    gap: 8px;
    margin-bottom: 16px;
  }

  .example-box .tile {
    width: 46px;
    height: 46px;
    min-width: 46px;
    font-size: 21px;
  }

  .example-box .desc {
    font-size: 14px;
    line-height: 1.65;
  }
}

@media (max-width: 480px) {
  .example-box {
    padding: 16px 12px;
  }

  .example-box .title {
    font-size: 16px;
    margin-bottom: 14px;
  }

  .example-box .tile {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 18px;
    border-radius: 6px;
  }

  .example-box .tile.inline {
    width: 26px;
    height: 26px;
    min-width: 26px;
    font-size: 13px;
    margin: 0 3px;
  }

  .example-box .desc {
    font-size: 13.5px;
  }
}
@media (max-width: 768px) {
  main {
    padding: 16px 0 8px;
    gap: 16px;
  }

  .logo img {
    height: 34px;
  }

  .modal-card {
    padding: 22px 18px;
  }

  .howto-card {
    padding: 20px 16px 16px;
  }

  .howto-example-row {
    gap: 6px;
  }

  .howto-tile {
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
  }

  .stat-grid {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  header {
    height: 56px;
    padding: 0 10px;
  }

  .header-right {
    gap: 2px;
  }

  .icon-btn {
    padding: 5px;
  }

  .logo img {
    height: 30px;
  }

  main {
    gap: 14px;
  }

  .row {
    gap: 5px;
  }

  .tile {
    width: min(16.8vw, 58px);
    height: min(16.8vw, 58px);
    font-size: clamp(1.45rem, 6vw, 1.8rem);
  }

  #keyboard {
    padding-inline: 8px;
  }

  .kb-row {
    gap: 4px;
  }

  .key {
    height: 48px;
    font-size: 11px;
    border-radius: 5px;
  }

  .key.wide {
    font-size: 10px;
  }

  .modal-title,
  .result-word {
    letter-spacing: 1px;
  }

  .ins1,
  .ins2,
  .section {
    padding: 24px 14px;
  }

  h1,
  h2,
  .section h2 {
    line-height: 1.25;
  }

  .howto,
  .features,
  .languages {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px 0 0;
  }

  .card,
  .feature {
    padding: 18px 14px;
  }

  footer {
    gap: 10px 16px;
    padding: 18px 14px;
    text-align: center;
  }
}

@media (max-width: 360px) {
  .tile {
    width: min(16.2vw, 52px);
    height: min(16.2vw, 52px);
    font-size: 1.3rem;
  }

  .key {
    height: 44px;
    font-size: 10px;
  }

  .key.wide {
    font-size: 9px;
  }

  .howto-tile {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
  }
}

/* =========================================================
   WORDLE MOBILE RESPONSIVE FIX - 4/6/7/8/9 BUCHSTABEN
   Dán block này ở CUỐI file static/css/style.css
   ========================================================= */

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100svh;
}

header {
  width: 100%;
}

main {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

#board {
  max-width: 100vw;
  overflow: visible;
}

#board .row {
  max-width: calc(100vw - 16px);
  justify-content: center;
}

#keyboard,
.kb-row {
  max-width: 100%;
}

.kb-row {
  min-width: 0;
}

.key {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.wordle-buttons {
  flex-wrap: wrap;
  align-items: center;
}

.wordle-buttons button {
  min-height: 40px;
  line-height: 1.25;
}

.instructions,
.ins1,
.ins2,
.section,
.page,
footer {
  max-width: 100%;
}

.instructions p,
.card p,
.feature p,
.example-box .desc {
  overflow-wrap: anywhere;
  word-break: normal;
}

/* Board tự co theo số chữ trên mobile */
@media (max-width: 600px) {
  main {
    padding: 14px 0 10px;
    gap: 14px;
  }

  #board {
    width: 100%;
    padding: 2px 8px;
    gap: clamp(3px, 1.1vw, 6px);
  }

  #board .row {
    width: 100%;
    gap: clamp(3px, 1.1vw, 6px);
  }

  /* 4 chữ */
  #board .row:has(.tile:nth-child(4):last-child) .tile {
    width: min(56px, calc((100vw - 36px) / 4));
    height: min(56px, calc((100vw - 36px) / 4));
  }

  /* 5 chữ - dùng cho trang home nếu cùng CSS */
  #board .row:has(.tile:nth-child(5):last-child) .tile {
    width: min(56px, calc((100vw - 40px) / 5));
    height: min(56px, calc((100vw - 40px) / 5));
  }

  /* 6 chữ */
  #board .row:has(.tile:nth-child(6):last-child) .tile {
    width: min(54px, calc((100vw - 44px) / 6));
    height: min(54px, calc((100vw - 44px) / 6));
  }

  /* 7 chữ */
  #board .row:has(.tile:nth-child(7):last-child) .tile {
    width: min(50px, calc((100vw - 48px) / 7));
    height: min(50px, calc((100vw - 48px) / 7));
  }

  /* 8 chữ */
  #board .row:has(.tile:nth-child(8):last-child) .tile {
    width: min(46px, calc((100vw - 52px) / 8));
    height: min(46px, calc((100vw - 52px) / 8));
  }

  /* 9 chữ */
  #board .row:has(.tile:nth-child(9):last-child) .tile {
    width: min(41px, calc((100vw - 56px) / 9));
    height: min(41px, calc((100vw - 56px) / 9));
  }

  #board .tile {
    flex: 0 0 auto;
    font-size: clamp(1rem, 5.4vw, 1.7rem);
    border-width: 2px;
  }

  /* Bàn phím German 11 phím mỗi dòng không tràn */
  #keyboard {
    width: 100%;
    max-width: 520px;
    gap: 6px;
    padding: 0 6px max(8px, env(safe-area-inset-bottom));
  }

  .kb-row {
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .key,
  .key.wide {
    min-width: 0;
    max-width: none;
    width: 100%;
    height: clamp(42px, 12vw, 50px);
    padding: 0 2px;
    border-radius: 6px;
    font-size: clamp(9px, 3vw, 12px);
  }

  .key.wide {
    font-size: clamp(8px, 2.8vw, 11px);
  }

  /* Header gọn trên điện thoại */
  header {
    height: 54px;
    padding: 0 8px;
    grid-template-columns: 44px 1fr 88px;
  }

  .logo img {
    height: 32px;
    max-width: min(180px, 52vw);
    object-fit: contain;
  }

  .header-right {
    gap: 2px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    padding: 7px;
  }

  /* Modal không bị dính mép màn hình */
  .modal-overlay {
    padding: 10px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .modal-card,
  .howto-card {
    width: 100%;
    max-width: 480px;
    margin: 12px auto;
    padding: 20px 15px 16px;
    max-height: calc(100svh - 24px);
    border-radius: 14px;
  }

  .howto-header {
    padding-right: 32px;
    flex-wrap: wrap;
  }

  .howto-title-plain,
  .howto-title-dash,
  .howto-title-colored {
    font-size: clamp(15px, 4.5vw, 20px);
    letter-spacing: 1px;
  }

  .howto-example-row {
    gap: 5px;
  }

  .howto-tile {
    width: min(44px, 15vw);
    height: min(44px, 15vw);
    font-size: clamp(1rem, 5vw, 1.3rem);
  }

  .setting-row {
    gap: 14px;
    align-items: flex-start;
  }

  /* Nội dung SEO bên dưới game */
  .ins1,
  .ins2,
  .section {
    padding: 26px 14px;
    margin-top: 0;
  }

  .ins1 h1,
  .ins1 h2,
  .ins2 h2,
  .section h2,
  h2 {
    font-size: clamp(22px, 6vw, 28px);
    line-height: 1.25;
    margin: 22px 0 14px;
  }

  .ins1 p,
  .ins2 p,
  .section p {
    font-size: 15px;
    line-height: 1.65;
  }

  .howto,
  .features,
  .languages {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px 0 0;
  }

  .card,
  .feature {
    padding: 18px 14px;
  }

  .card h3,
  .feature h3 {
    font-size: 17px;
    line-height: 1.35;
  }

  .tiles {
    margin: 22px 0;
  }

  .ins1 .tile {
    width: 100%;
    max-width: 280px;
    min-height: 48px;
    height: auto;
    padding: 12px 14px;
    font-size: 18px;
    line-height: 1.25;
  }

  .ins1 .tile a {
    color: #fff;
    text-decoration: none;
  }

  .wordle-buttons {
    gap: 8px;
  }

  .wordle-buttons button {
    flex: 1 1 calc(50% - 8px);
    min-width: 135px;
    padding: 10px 8px;
    font-size: 14px;
  }

  footer {
    justify-content: center;
    text-align: center;
    gap: 10px 16px;
    padding: 18px 14px;
  }
}

@media (max-width: 380px) {
  #board {
    padding-inline: 6px;
  }

  #board .row {
    gap: 3px;
  }

  #board .tile {
    font-size: clamp(0.92rem, 5vw, 1.35rem);
  }

  #keyboard {
    padding-inline: 4px;
  }

  .kb-row {
    gap: 3px;
  }

  .key,
  .key.wide {
    height: 40px;
    border-radius: 5px;
    font-size: 9px;
  }

  .wordle-buttons button {
    flex-basis: 100%;
  }
}

/* Fallback cho trình duyệt rất cũ không hỗ trợ :has() */
@supports not selector(.row:has(.tile)) {
  @media (max-width: 600px) {
    #board .tile {
      width: min(38px, 9.8vw);
      height: min(38px, 9.8vw);
      font-size: clamp(0.95rem, 4.8vw, 1.3rem);
    }
  }
}
