:root{color-scheme:dark;--bg:#000;--surface:#080808;--ink:#f5f5f5;--muted:#8b8b8b;--line:#242424;--tile:#080808;--tile-fill:#171717;--exact:#48c8b3;--near:#f2b36b;--no:#555;--sans:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;--mono:ui-monospace,SFMono-Regular,Consolas,monospace}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;background:#000}body{min-height:100vh;min-height:100dvh;color:var(--ink);font:15px/1.45 var(--sans);background:#000}button{font:inherit}main{width:100%;min-height:100vh;min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:24px 14px}.game{width:min(100%,620px);margin:auto;display:flex;flex-direction:column;align-items:stretch}.game-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 14px}.game-header h1{margin:0;font-size:clamp(17px,3vw,22px);font-weight:650;letter-spacing:.01em;color:#f5f5f5}.how-to-button{flex:0 0 auto;padding:8px 12px;border:1px solid #3a3a3a;border-radius:6px;background:#111;color:#f3f3f3;font-size:12px;font-weight:600;cursor:pointer}.how-to-button:hover,.how-to-button:focus-visible{border-color:#8b8b8b;background:#1b1b1b;outline:2px solid #777;outline-offset:2px}.attempt-counter{display:flex;align-items:center;justify-content:center;gap:10px;margin:0 0 17px;padding:10px 14px;border:1px solid #303030;border-radius:8px;background:#101010;color:#ddd;font-size:16px;font-weight:600;letter-spacing:.01em}.attempt-counter strong{color:#fff;font:700 25px var(--mono);line-height:1}.rules,.progress-track,.target-meta{display:none!important}.board{display:flex;flex-direction:column;align-items:center;gap:8px;margin:0 0 15px;overflow-x:auto;padding:4px 2px 8px;scrollbar-width:thin;scrollbar-color:#383838 transparent}.guess-row{display:flex;flex-direction:row;flex-wrap:nowrap;align-items:center;justify-content:center;gap:4px;width:max-content;min-width:max-content;margin:auto}.word-group{display:flex;flex-direction:row;flex-wrap:nowrap;gap:4px}.word-group+.word-group{margin-left:7px}.tile{display:grid;place-items:center;flex:0 0 auto;width:clamp(21px,3.7vw,35px);height:39px;padding:0;border:1px solid #393939;border-radius:3px;background:var(--tile);color:var(--ink);font:600 13px var(--mono);transition:border-color .12s,background .12s}.tile.filled{background:var(--tile-fill);border-color:#666}.tile.exact{background:var(--exact);border-color:var(--exact);color:#061a17}.tile.near{background:var(--near);border-color:var(--near);color:#171025}.tile.no{background:#303030;border-color:#303030;color:#a5a5a5}.tile.current{cursor:pointer}.tile.selected{outline:2px solid #f5f5f5;outline-offset:2px;border-color:#f5f5f5}.tile:focus-visible{outline:2px solid #fff;outline-offset:3px}.status{min-height:18px;margin:0 0 11px;color:#929292;font-size:11px;text-align:center}.status.success{color:var(--exact)}.status.error{color:#ff7777}.keyboard{display:flex;flex-direction:column;gap:7px;width:100%;max-width:510px;margin:0 auto}.key-row{display:flex;justify-content:center;gap:5px}.key{min-width:0;flex:1;height:43px;padding:0 3px;border:1px solid #262626;border-radius:4px;background:#191919;color:#eee;font:500 13px var(--mono);cursor:pointer;box-shadow:none;transition:background .12s,border-color .12s}.key:active{background:#303030}.key.wide{flex:1.55;font:600 9px var(--sans);letter-spacing:0}.key.space{flex:1.8;font:500 10px var(--sans)}.key:disabled{cursor:default;opacity:.4}.key.exact{background:var(--exact);border-color:var(--exact);color:#061a17}.key.near{background:var(--near);border-color:var(--near);color:#171025}.key.no{background:#303030;border-color:#303030;color:#888}.how-to-dialog{width:min(560px,calc(100% - 28px));max-height:min(82dvh,720px);padding:0;border:1px solid #454545;border-radius:12px;background:#101010;color:#eee;box-shadow:0 20px 70px #000b}.how-to-dialog::backdrop{background:rgba(0,0,0,.78);backdrop-filter:blur(3px)}.how-to-content{padding:20px 22px 22px;overflow-y:auto}.how-to-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.how-to-heading h2{margin:0;font-size:21px}.close-how-to{width:34px;height:34px;border:1px solid #393939;border-radius:6px;background:#1b1b1b;color:#fff;font-size:24px;line-height:1;cursor:pointer}.how-to-content p{margin:10px 0;color:#d0d0d0;font-size:13px;line-height:1.6}.how-to-content h3{margin:18px 0 8px;font-size:14px;color:#fff}.color-explanations{display:grid;gap:9px;margin:0;padding:0;list-style:none}.color-explanations li{display:flex;align-items:flex-start;gap:10px;color:#d0d0d0;font-size:13px;line-height:1.5}.color-explanations i{flex:0 0 13px;width:13px;height:13px;margin-top:3px;border-radius:3px}.color-explanations i.exact{background:var(--exact)}.color-explanations i.near{background:var(--near)}.color-explanations i.no{background:#555}.how-to-tip{padding:10px 12px;border-left:3px solid #555;background:#191919;border-radius:0 5px 5px 0}
@media(min-width:700px){.board{margin-bottom:17px}.tile{height:41px}.keyboard{gap:8px}.key{height:45px}}
@media(max-width:520px){main{padding:18px 8px}.game-header{margin-bottom:12px}.attempt-counter{gap:8px;margin-bottom:14px;padding:9px 11px;font-size:15px}.attempt-counter strong{font-size:23px}.board{align-items:flex-start;gap:7px;margin-bottom:12px}.guess-row{gap:2px}.word-group{gap:2px}.word-group+.word-group{margin-left:4px}.tile{width:clamp(27px,7.5vw,38px);height:42px;border-radius:4px;font-size:17px}.key-row{gap:4px}.key{height:49px;font-size:16px;border-radius:5px}.key.wide{font-size:11px}.key.erase-key{font-size:15px}.status{font-size:10px}.how-to-content{padding:17px 16px 18px}.how-to-heading h2{font-size:19px}.how-to-content p,.color-explanations li{font-size:12px}}

/* Teclas de ação principais do teclado */
.key.erase-key{flex:1.35;min-width:39px;background:#4a2024;border:2px solid #e05a63;color:#fff;font-size:13px;font-weight:800;line-height:1;box-shadow:0 0 0 1px #e05a6333}
.key.erase-key:hover,.key.erase-key:focus-visible{background:#69262c;border-color:#ff858c;outline:2px solid #ff858c;outline-offset:1px}
.key.confirm-key{flex:2.2;min-width:0;padding:0 1px;white-space:nowrap;background:#176b61;border:1px solid #39b8a6;color:#fff;font:700 12px var(--sans);letter-spacing:0}
.key.confirm-key:hover,.key.confirm-key:focus-visible{background:#218779;border-color:#6de0ce;outline:2px solid #6de0ce;outline-offset:1px}

/* Mensagens rápidas em destaque no topo */
.status{position:fixed;z-index:1000;top:12px;left:50%;width:min(calc(100% - 24px),560px);min-height:0;margin:0;padding:12px 16px;border:1px solid #454545;border-radius:8px;background:#171717;color:#f2f2f2;font-size:14px;line-height:1.4;text-align:center;box-shadow:0 8px 28px rgba(0,0,0,.65);transform:translate(-50%,-150%);opacity:0;visibility:hidden;pointer-events:none;transition:transform .22s ease,opacity .22s ease,visibility .22s ease}
.status.visible{transform:translate(-50%,0);opacity:1;visibility:visible}
.status.error{border-color:#a74343;color:#ffb4b4;background:#251111}
.status.success{border-color:#258b7b;color:#d2fff7;background:#10221f}
@media(max-width:520px){.status{top:8px;width:calc(100% - 16px);padding:10px 12px;font-size:13px}}


/* Caixa compacta de vitória/derrota, centralizada e modal */
.result-dialog{width:min(390px,calc(100% - 28px));max-height:80dvh;padding:0;border:1px solid #454545;border-radius:11px;background:#101010;color:#eee;box-shadow:0 20px 70px #000b}
.result-dialog::backdrop{background:rgba(0,0,0,.82);backdrop-filter:blur(3px)}
.result-content{padding:16px 17px 17px}
.result-heading{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.result-heading h2{margin:0;font-size:17px;line-height:1.3}
.result-content>p{margin:8px 0 12px;color:#d0d0d0;font-size:13px;line-height:1.55}
.share-result{width:100%;padding:9px 12px;border:1px solid #39b8a6;border-radius:6px;background:#176b61;color:#fff;font:650 13px var(--sans);cursor:pointer}
.share-result:hover,.share-result:focus-visible{background:#218779;outline:2px solid #6de0ce;outline-offset:2px}
.share-result[hidden]{display:none}
.result-content .share-feedback{margin:8px 0 0;color:var(--exact);font-size:11px}
@media(max-width:520px){.result-content{padding:14px}.result-heading h2{font-size:16px}.result-content>p{font-size:12px}}


/* Cabeçalho enxuto: controles alinhados à direita, sem título visível */
.game-header{position:relative;min-height:40px;justify-content:flex-end;margin-bottom:14px}
.header-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;width:100%}
.icon-button{display:grid;place-items:center;width:36px;height:36px;padding:0;border:1px solid #3a3a3a;border-radius:7px;background:#111;color:#f3f3f3;font-size:20px;line-height:1;cursor:pointer}
.icon-button:hover,.icon-button:focus-visible{border-color:#8b8b8b;background:#1b1b1b;outline:2px solid #777;outline-offset:2px}
.menu-button{font-size:19px}
.menu-panel{position:absolute;z-index:20;top:43px;right:0;width:min(250px,calc(100vw - 32px));padding:14px;border:1px solid #414141;border-radius:9px;background:#111;box-shadow:0 12px 35px #000a}
.menu-panel p{margin:0 0 5px;font-size:14px;font-weight:700}.menu-panel span{color:#aaa;font-size:12px}
.settings-dialog{width:min(380px,calc(100% - 28px));padding:0;border:1px solid #454545;border-radius:12px;background:#101010;color:#eee;box-shadow:0 20px 70px #000b}
.settings-dialog::backdrop{background:rgba(0,0,0,.78);backdrop-filter:blur(3px)}
.settings-content{padding:18px}
.theme-setting{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0;cursor:pointer}
.theme-setting>span:first-child{display:flex;flex-direction:column;gap:4px}.theme-setting strong{font-size:14px}.theme-setting small{color:#aaa;font-size:12px}
.theme-control{position:relative;flex:0 0 46px;width:46px;height:26px}.theme-control input{position:absolute;width:1px;height:1px;opacity:0}.toggle-track{position:absolute;inset:0;border:1px solid #555;border-radius:99px;background:#292929;transition:background .15s}.toggle-track:after{content:"";position:absolute;top:3px;left:3px;width:18px;height:18px;border-radius:50%;background:#eee;transition:transform .15s}.theme-control input:checked+.toggle-track{background:#168477;border-color:#42cdb8}.theme-control input:checked+.toggle-track:after{transform:translateX(20px)}.theme-control input:focus-visible+.toggle-track{outline:2px solid #fff;outline-offset:3px}
body.light,body.light main{background:#f4f4f4;color:#191919}body.light .attempt-counter{background:#fff;border-color:#d0d0d0;color:#333}body.light .attempt-counter strong{color:#111}body.light .tile{background:#fff;border-color:#b8b8b8;color:#171717}body.light .tile.filled{background:#e8e8e8;border-color:#777}body.light .tile.exact{background:var(--exact);border-color:var(--exact);color:#061a17}body.light .tile.near{background:var(--near);border-color:var(--near);color:#171025}body.light .tile.no{background:#d0d0d0;border-color:#d0d0d0;color:#555}body.light .key{background:#e5e5e5;border-color:#c6c6c6;color:#161616}body.light .key.exact{background:var(--exact);border-color:var(--exact)}body.light .key.near{background:var(--near);border-color:var(--near)}body.light .key.no{background:#d0d0d0;border-color:#d0d0d0;color:#555}body.light .how-to-button,body.light .icon-button{background:#fff;border-color:#ccc;color:#222}body.light .game-header h1{color:#191919}body.light .status{background:#fff;color:#222;border-color:#ccc;box-shadow:0 8px 28px #0002}body.light .status.error{background:#fff0f0;color:#8d2020;border-color:#d88}body.light .status.success{background:#edfffa;color:#125d52;border-color:#72b9ae}body.light .how-to-dialog,body.light .settings-dialog,body.light .result-dialog{background:#fff;color:#222;border-color:#ccc;box-shadow:0 20px 70px #0003}body.light .how-to-content p,body.light .color-explanations li,body.light .result-content>p{color:#444}body.light .close-how-to{background:#f2f2f2;border-color:#ccc;color:#222}body.light .menu-panel{background:#fff;border-color:#ccc;box-shadow:0 12px 35px #0002}body.light .menu-panel span,body.light .theme-setting small{color:#555}
@media(max-width:520px){.header-actions{gap:6px}.how-to-button{padding:8px 10px}.icon-button{width:35px;height:35px}}
.daily-meta{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:-5px 0 10px;color:#aaa;font-size:11px}.daily-meta strong{font-size:13px;color:#f1f1f1}.daily-meta span{font-variant-numeric:tabular-nums}.next-challenge{font-size:12px!important;color:#aaa!important}.guess-row{flex-direction:column;min-width:0;width:100%;gap:5px}.word-group+.word-group{margin-left:0}.board{overflow-x:hidden;width:100%;align-items:center}.word-group{max-width:100%;justify-content:center}@media(max-width:520px){.daily-meta{font-size:10px}.daily-meta strong{font-size:12px}.guess-row{min-width:0}.word-group{gap:2px}}


/* Correção definitiva do tabuleiro: todos os quadradinhos de cada tentativa ficam na horizontal. */
.board {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
.board .guess-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: max-content !important;
  min-width: max-content !important;
  gap: 4px !important;
  margin: 0 auto !important;
}
.board .word-group {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  flex: 0 0 auto !important;
  max-width: none !important;
  gap: 4px !important;
}
.board .word-group + .word-group { margin-left: 7px !important; }
@media (max-width: 520px) {
  .board .guess-row { gap: 2px !important; }
  .board .word-group { gap: 2px !important; }
  .board .word-group + .word-group { margin-left: 4px !important; }
}


/* Tabuleiro: cada palavra fica numa linha; as letras de cada palavra ficam lado a lado. */
#board.board {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 12px !important;
  width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
#board .guess-attempt-row {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 4px !important;
  width: 100% !important;
  padding: 7px 0 !important;
  border-bottom: 1px solid #202020;
}
#board .guess-row.word-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: center !important;
  align-items: center !important;
  width: max-content !important;
  min-width: 0 !important;
  margin: 0 !important;
  gap: 0 !important;
}
#board .word-group {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: center !important;
  gap: 4px !important;
  margin: 0 !important;
  max-width: none !important;
}
#board .tile {
  flex: 0 0 auto !important;
}
@media (max-width: 520px) {
  #board.board { gap: 8px !important; }
  #board .guess-attempt-row { gap: 3px !important; padding: 5px 0 !important; }
  #board .word-group { gap: 2px !important; }
}

/* Layout corrigido: cada tentativa ocupa uma linha horizontal; palavras lado a lado. */
.guess-attempt-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: max-content;
  min-width: max-content;
  margin: 0 auto;
}
.guess-attempt-row .word-group {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 4px;
}
.guess-attempt-row .word-group + .word-group { margin-left: 0; }
.board { align-items: center; }
@media (max-width: 520px) {
  .guess-attempt-row { gap: 6px; }
  .guess-attempt-row .word-group { gap: 2px; }
}


/* FIX FINAL: uma tentativa por linha; todas as palavras dessa tentativa lado a lado. */
#board.board {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 8px !important;
  width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 4px 2px 8px !important;
}
#board .guess-attempt-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: max-content !important;
  min-width: max-content !important;
  margin: 0 auto !important;
  padding: 3px 0 !important;
  border-bottom: 0 !important;
}
#board .guess-attempt-row .word-group {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 3px !important;
  flex: 0 0 auto !important;
  width: max-content !important;
  max-width: none !important;
  margin: 0 !important;
}
#board .guess-attempt-row .tile {
  flex: 0 0 auto !important;
}
@media (max-width: 520px) {
  #board.board { gap: 5px !important; }
  #board .guess-attempt-row { gap: 5px !important; }
  #board .guess-attempt-row .word-group { gap: 2px !important; }
}


/* Histórico local de desempenho */
.header-actions { display:flex; align-items:center; gap:7px; }
.performance-dialog { width:min(620px,calc(100% - 28px)); }
.performance-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin:14px 0 18px; }
.performance-stat { display:flex; flex-direction:column; gap:5px; padding:12px 8px; border:1px solid #303030; border-radius:8px; background:#171717; text-align:center; }
.performance-stat strong { color:#65e6d2; font-size:22px; line-height:1.2; }
.performance-stat span { color:#bdbdbd; font-size:11px; }
.performance-history { max-width:100%; overflow-x:auto; }
.performance-table { width:100%; border-collapse:collapse; font-size:12px; white-space:nowrap; }
.performance-table th,.performance-table td { padding:9px 8px; border-bottom:1px solid #303030; text-align:left; }
.performance-table th { color:#aaa; font-weight:600; }
.performance-table td { color:#eee; }
.performance-table .performance-win { color:#65e6d2; font-weight:700; }
.performance-table .performance-loss { color:#ff9999; }
.performance-empty,.performance-note { color:#aaa!important; font-size:12px!important; }
.performance-note { margin-top:16px!important; }
@media(max-width:520px) {
  .header-actions { gap:5px; }
  .how-to-button { padding:7px 8px; font-size:11px; }
  .performance-summary { grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; }
  .performance-stat { padding:10px 4px; }
  .performance-stat strong { font-size:19px; }
  .performance-stat span { font-size:10px; }
  .performance-table { font-size:11px; }
  .performance-table th,.performance-table td { padding:8px 6px; }
}
