@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  --bg: #131315;
  --panel: #1f1f22;
  --panel-soft: #252528;
  --tile: #2c2c2f;
  --key: #353539;
  --line: #38383d;
  --ink: #f5f5f6;
  --muted: #a9a9ae;
  --green: #59a653;
  --yellow: #cabb5e;
  --red: #dc4b50;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: 'DM Sans', sans-serif; }
body { margin: 0; min-width: 320px; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
h1, h2, p { margin-top: 0; }
[hidden] { display: none !important; }

.page-shell { width: min(100%, 1180px); margin: 0 auto; padding: 14px 20px 0; }
.site-header {
  min-height: 88px; padding: 14px 20px; border: 1px solid var(--line);
  border-radius: 20px; background: var(--panel);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 15px; color: var(--ink); text-decoration: none;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 28px; font-weight: 800;
  letter-spacing: -1.4px; line-height: 1;
}
.brand small { display: block; margin-top: 7px; color: #a9a9ae; font: 800 9px 'DM Sans', sans-serif; letter-spacing: 1.7px; }
.brand-accent { color: var(--green); }
.brand-mark { display: grid; grid-template-columns: repeat(2, 21px); gap: 3px; transform: rotate(-4deg); }
.brand-mark i { width: 21px; height: 21px; border-radius: 3px; background: var(--green); }
.brand-mark i:nth-child(2) { background: var(--yellow); }
.brand-mark i:nth-child(3) { background: var(--red); }
.brand-mark i:nth-child(4) { background: #d7d7da; }
.header-actions { display: flex; gap: 10px; }
.icon-button {
  width: 51px; height: 51px; display: grid; place-items: center;
  border: 1px solid #3a3a3e; border-radius: 11px;
  background: #343438; color: #ededee;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 23px; font-weight: 800;
}
.icon-button:hover { background: #414146; }
.icon-button svg { width: 24px; height: 24px; }

.main-layout { display: flex; flex-direction: column; align-items: center; gap: 34px; padding-top: 24px; }
.game-column { width: min(100%, 1020px); display: flex; flex-direction: column; align-items: center; }
.mode-switch { display: flex; gap: 5px; margin: 0 0 17px; padding: 5px; border: 1px solid #3b3b40; border-radius: 12px; background: #202023; }
.mode-button { min-width: 110px; padding: 10px 14px; border: 0; border-radius: 8px; background: transparent; color: #b5b5bb; font-size: 12px; font-weight: 800; }
.mode-button:hover { color: #fff; background: #303034; }
.mode-button.selected { background: var(--green); color: #fff; }
.eyebrow { display: flex; align-items: center; justify-content: center; gap: 10px; color: #c8c8cc; font-size: 10px; font-weight: 800; letter-spacing: 1.7px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(89,166,83,.15); }
.eyebrow-line { width: 20px; height: 1px; background: #77777b; }
.intro-row { text-align: center; }
h1 { margin: 8px 0 7px; font-family: 'Plus Jakarta Sans', sans-serif; font-size: clamp(25px, 3vw, 34px); line-height: 1.2; letter-spacing: -1.5px; }
h1 em { font-style: normal; color: var(--green); }
.intro-copy { max-width: 690px; margin: 0 auto 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.intro-copy strong { color: #ededee; }

.game-card { width: 100%; display: flex; flex-direction: column; align-items: center; }
.game-card-top, .board-head, .board { width: min(100%, 785px); }
.game-card-top { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px; }
.daily-label { color: #d4d4d6; font-size: 12px; font-weight: 700; }
.calendar-icon { display: inline-grid; place-items: center; width: 23px; height: 23px; margin-right: 7px; border-radius: 6px; background: #343438; color: #d9d9db; font-size: 17px; vertical-align: -2px; }
.attempt-label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 1.1px; }
.board-head { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; padding: 0 2px 8px; color: #a3a3a8; font-size: 9px; font-weight: 800; letter-spacing: 1.1px; }
.board-head span:first-child { grid-column: span 5; }
.board-head span:last-child { grid-column: span 3; text-align: center; font-size: 8px; letter-spacing: .2px; }
.board { display: grid; gap: 10px; }
.board-row { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 10px; }
.word-cells, .clue-cells { display: contents; }
.letter-tile, .clue-tile { aspect-ratio: 1; min-width: 0; min-height: 0; display: grid; place-items: center; border-radius: 11px; }
.letter-tile {
  border: 1px solid #343438; background: var(--tile); color: #f8f8f8;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: clamp(17px, 3vw, 39px);
  font-weight: 800; text-transform: uppercase; transition: background .15s, transform .15s, border-color .15s;
}
.board-row.active .letter-tile { border-color: #54545a; background: #333337; }
.board-row.active .letter-tile.filled { border-color: #a0a0a5; background: #404045; }
.board-row.active .letter-tile.blank { color: #b9b9bf; }
.board-row.active .letter-tile.selected { border-color: var(--yellow); box-shadow: inset 0 0 0 2px var(--yellow); }
.board-row.active .letter-tile { cursor: pointer; }
.board-row.invalid { animation: invalid-shake .3s ease-in-out; }
.board-row.active.invalid .letter-tile { position: relative; border-color: #a74449; background: #472c2f; color: #ffd9db; }
.board-row.active.invalid .letter-tile::after { content: ''; position: absolute; left: 10%; right: 10%; top: 50%; height: 3px; border-radius: 3px; background: #ff7379; transform: rotate(-12deg); pointer-events: none; }
@keyframes invalid-shake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@media (prefers-reduced-motion: reduce) { .board-row.invalid { animation: none; } }
.board-row.done .letter-tile { background: #353539; border-color: #3d3d42; cursor: pointer; }
.board-row.done .letter-tile:hover { transform: translateY(-2px); }
.letter-tile.manual-green { background: var(--green) !important; border-color: var(--green) !important; color: #fff; }
.letter-tile.manual-yellow { background: var(--yellow) !important; border-color: var(--yellow) !important; color: #181818; }
.letter-tile.manual-red { background: var(--red) !important; border-color: var(--red) !important; color: #fff; }
.clue-tile { color: #fff; font-family: 'Plus Jakarta Sans', sans-serif; font-size: clamp(16px, 2.8vw, 35px); font-weight: 800; font-variant-numeric: tabular-nums; }
.clue-tile.green { background: var(--green); }
.clue-tile.yellow { background: var(--yellow); color: #1c1a10; }
.clue-tile.red { background: var(--red); }
.status-message { min-height: 22px; margin: 13px 0 6px; color: #c6c6ca; text-align: center; font-size: 12px; font-weight: 700; }
.status-message.error { color: #ff7b80; }
.status-message.success { color: #8bd884; }
.result-reopen { margin: 3px auto 12px; padding: 9px 14px; border: 1px solid #467b43; border-radius: 9px; background: #2a4d2a; color: #e8ffe4; font-size: 11px; font-weight: 800; }
.result-reopen:hover { background: #366736; }
.result-reopen span { margin-left: 4px; font-size: 14px; }

.keyboard { width: min(100%, 1020px); display: grid; gap: 7px; margin-top: 7px; padding: 10px; border: 1px solid #39393d; border-radius: 18px; background: #202023; }
.keyboard-row { display: flex; justify-content: center; gap: 7px; }
.key {
  flex: 1; min-width: 0; height: 56px; padding: 0 2px;
  border: 0; border-radius: 9px; background: var(--key); color: #ededee;
  font-family: 'Plus Jakarta Sans', sans-serif; font-size: 17px; font-weight: 800;
  transition: background .15s, transform .15s;
}
.key:hover { background: #4b4b50; transform: translateY(-1px); }
.key:active { transform: translateY(1px); }
.key.used { background: #141416; color: #717178; }
.key.special { flex: 1.5; background: #3d3d42; font-size: 12px; }
.key.blank-key { flex: 1.7; background: #45454a; font-size: 12px; }
.key.enter { flex: 2.2; background: var(--green); color: #fff; font-size: 12px; }
.key.enter:hover { background: #6bbd64; }
.key.manual-green { background: var(--green); color: #fff; }
.key.manual-yellow { background: var(--yellow); color: #1c1a10; }
.key.manual-red { background: var(--red); color: #fff; }
.game-card-footer { width: min(100%, 785px); display: flex; justify-content: space-between; gap: 12px; padding: 10px 2px 0; color: #88888e; font-size: 10px; }
.game-card-footer button { padding: 0; border: 0; background: none; color: #a9d5a4; font-size: 10px; font-weight: 700; }

.side-column { width: min(100%, 785px); display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.side-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.side-card-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 11px; }
.small-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; background: #333338; color: var(--green); font-size: 16px; }
.side-card h2 { margin: 0; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 15px; letter-spacing: -.4px; }
.side-card p { margin-bottom: 15px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.clue-guide { padding: 10px 0 2px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.clue-guide > div { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.clue-dot { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 6px; color: #fff; font-size: 12px; font-weight: 800; }
.clue-dot.green { background: var(--green); }
.clue-dot.yellow { background: var(--yellow); color: #1c1a10; }
.clue-dot.red { background: var(--red); }
.clue-guide strong { display: block; font-size: 10px; }
.clue-guide small { display: block; color: #939399; font-size: 9px; }
.text-link { padding: 12px 0 0; border: 0; background: none; color: #a3d89e; font-size: 11px; font-weight: 800; }
.text-link span { margin-left: 4px; font-size: 14px; }
.progress-display { display: flex; align-items: baseline; gap: 9px; margin: 6px 0; }
.progress-display strong { color: var(--green); font-family: 'Plus Jakarta Sans', sans-serif; font-size: 42px; line-height: 1; letter-spacing: -2px; }
.progress-display span { color: #9fcb9b; font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.progress-card p { margin-bottom: 0; }
.next-puzzle { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line); }
.next-puzzle span { color: #939399; font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.next-puzzle strong { color: #e8e8ea; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 14px; font-variant-numeric: tabular-nums; }
.aside-note { grid-column: 1 / -1; margin: 0; color: #8f8f95; font-size: 10px; text-align: center; line-height: 1.5; }
.site-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 44px; padding: 22px 0 30px; border-top: 1px solid var(--line); color: #929298; font-size: 10px; }
.footer-spark { margin: 0 3px; color: var(--yellow); }
.site-footer a { color: #c1d9be; text-decoration: underline; text-underline-offset: 2px; }

.modal { width: min(475px, calc(100% - 28px)); max-height: 92vh; overflow-y: auto; padding: 26px; border: 1px solid #45454a; border-radius: 20px; background: #252529; color: var(--ink); box-shadow: 0 26px 80px #000a; }
.modal::backdrop { background: #000b; backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.modal-kicker { color: #9bd395; font-size: 9px; font-weight: 800; letter-spacing: 1.4px; }
.modal h2 { margin: 5px 0 0; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 25px; letter-spacing: -1.1px; }
.modal p { color: #b8b8bc; font-size: 12px; line-height: 1.65; }
.modal-close { width: 31px; height: 31px; flex: none; border: 0; border-radius: 8px; background: #3b3b40; color: #eee; font-size: 21px; line-height: 1; }
.example-box { margin: 17px 0; padding: 15px; border: 1px solid #45454a; border-radius: 12px; background: #303034; }
.example-box > span { color: #aaaab0; font-size: 9px; font-weight: 800; letter-spacing: 1.2px; }
.example-row { display: flex; justify-content: space-between; gap: 10px; margin: 11px 0; }
.example-word, .example-clues { display: flex; gap: 4px; }
.example-word b, .example-clues b { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 6px; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 13px; }
.example-word b { background: #45454a; }
.example-clues b { width: 28px; color: #fff; }
.example-clues .green { background: var(--green); }
.example-clues .yellow { background: var(--yellow); color: #1c1a10; }
.example-clues .red { background: var(--red); }
.example-box small { display: block; color: #b4b4b9; font-size: 10px; line-height: 1.5; }
.modal-tip { padding: 12px; border-radius: 9px; background: #38352b; }
.primary-button { width: 100%; min-height: 43px; border: 0; border-radius: 9px; background: var(--green); color: #fff; font-size: 12px; font-weight: 800; }
.primary-button:hover { background: #6bbd64; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 19px 0; }
.stats-grid > div { padding: 14px 4px; border: 1px solid #424248; border-radius: 10px; background: #303034; text-align: center; }
.stats-grid strong { display: block; color: #8ad285; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 25px; }
.stats-grid span { color: #a9a9af; font-size: 8px; font-weight: 800; letter-spacing: .6px; }
.stats-modal #statsNote { margin: 0 0 18px; }
.result-modal { width: min(520px, calc(100% - 28px)); }
.score-panel { display: flex; align-items: center; gap: 18px; margin: 16px 0 20px; padding: 17px; border: 1px solid #485647; border-radius: 15px; background: #2d382d; }
.score-circle { width: 108px; height: 108px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 8px solid transparent; border-radius: 50%; background: linear-gradient(#252c25,#252c25) padding-box, conic-gradient(var(--green) var(--score-pct,0%),#4b594b 0) border-box; }
.score-circle strong { color: #a0e49b; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 30px; letter-spacing: -1.5px; line-height: 1; }
.score-circle span { margin-top: 3px; color: #b1d6ac; font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.score-summary { min-width: 0; }
.result-badge { display: inline-block; padding: 5px 7px; border-radius: 5px; background: #365d34; color: #b5ecae; font-size: 8px; font-weight: 800; letter-spacing: 1px; }
.result-badge.lost { background: #5c3032; color: #ffb6b9; }
.score-summary > strong { display: block; margin: 8px 0 3px; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 17px; line-height: 1.3; }
.score-summary p { margin: 0; font-size: 11px; }
.comparison-heading { display: flex; justify-content: space-between; align-items: center; padding-top: 17px; border-top: 1px solid var(--line); }
.comparison-heading h3 { margin: 4px 0 0; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; }
.comparison-icon { color: #8ac986; font-size: 21px; }
.rank-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 15px 0 10px; }
.rank-cards > div { padding: 13px; border: 1px solid #444448; border-radius: 10px; background: #303034; }
.rank-cards span { display: block; color: #a9a9af; font-size: 8px; font-weight: 800; letter-spacing: 1px; }
.rank-cards strong { display: block; margin-top: 5px; color: #a2dea0; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 21px; }
.community-description { margin: 0 0 12px; font-size: 11px !important; }
.community-empty { margin: 15px 0 18px; padding: 21px 17px; border: 1px dashed #57575d; border-radius: 12px; background: #2e2e32; text-align: center; }
.community-empty-icon { display: block; margin-bottom: 7px; color: #aaaab0; font-size: 27px; line-height: 1; }
.community-empty strong { color: #d5d5d8; font-size: 12px; }
.community-empty p { max-width: 315px; margin: 6px auto 0; font-size: 11px; }
.practice-comparison-note { margin: 16px 0; padding: 13px; border: 1px solid #444448; border-radius: 9px; background: #303034; font-size: 11px !important; }
.new-practice-button { margin-top: 5px; background: var(--green); }
.new-practice-button:disabled { opacity: .65; cursor: wait; }
.practice-new-error { margin: 8px 0 0; color: #ff8b90 !important; font-size: 11px !important; text-align: center; }
.share-button { margin-top: 5px; }
.secondary-button { width: 100%; height: 38px; margin-top: 5px; border: 0; background: transparent; color: #b1c7af; font-size: 11px; font-weight: 700; }
.secondary-button:hover { color: #d7f1d4; }
.history-heading { margin-bottom: 11px; padding-top: 14px; border-top: 1px solid var(--line); color: #b3b3b8; font-size: 9px; font-weight: 800; letter-spacing: 1.2px; }
.distribution { display: grid; gap: 6px; margin-bottom: 16px; }
.distribution-row { display: grid; grid-template-columns: 18px minmax(0,1fr) 31px; gap: 8px; align-items: center; color: #b5b5ba; font-size: 10px; font-weight: 700; }
.distribution-row.you { color: #a2e09d; }
.distribution-track { height: 16px; overflow: hidden; border-radius: 5px; background: #3a3a3e; }
.distribution-fill { width: var(--bar-width,0%); height: 100%; border-radius: 5px; background: #678f64; }
.distribution-row.you .distribution-fill { background: var(--green); }
.distribution-value { text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 780px) {
  .page-shell { padding: 10px 12px 0; }
  .main-layout { padding-top: 20px; gap: 25px; }
  .board, .board-row { gap: 7px; }
  .board-head { gap: 7px; }
  .letter-tile, .clue-tile { border-radius: 8px; }
  .keyboard-row { gap: 5px; }
  .key { height: 48px; font-size: 13px; border-radius: 7px; }
}
@media (max-width: 540px) {
  .page-shell { padding: 8px 8px 0; }
  .site-header { min-height: 66px; padding: 8px 10px; border-radius: 13px; }
  .brand { gap: 9px; font-size: 21px; }
  .brand-mark { grid-template-columns: repeat(2, 15px); gap: 2px; }
  .brand-mark i { width: 15px; height: 15px; border-radius: 2px; }
  .brand small { margin-top: 4px; font-size: 6px; letter-spacing: .8px; }
  .header-actions { gap: 6px; }
  .icon-button { width: 36px; height: 36px; border-radius: 8px; font-size: 17px; }
  .icon-button svg { width: 18px; height: 18px; }
  .main-layout { padding-top: 18px; }
  .mode-switch { margin-bottom: 13px; }
  .mode-button { min-width: 100px; padding: 9px 11px; font-size: 11px; }
  .eyebrow { font-size: 8px; letter-spacing: 1px; }
  h1 { margin-top: 7px; font-size: 23px; letter-spacing: -.9px; }
  .intro-copy { margin-bottom: 15px; padding: 0 8px; font-size: 10px; }
  .game-card-top { padding-bottom: 8px; }
  .daily-label { font-size: 10px; }
  .attempt-label { font-size: 9px; letter-spacing: .5px; }
  .board, .board-row { gap: 4px; }
  .board-head { gap: 4px; font-size: 7px; letter-spacing: .5px; }
  .board-head span:last-child { font-size: 6px; }
  .letter-tile { border-radius: 5px; font-size: 17px; }
  .clue-tile { border-radius: 5px; font-size: 16px; }
  .keyboard { gap: 4px; margin-top: 4px; padding: 6px; border-radius: 10px; }
  .keyboard-row { gap: 3px; }
  .key { height: 42px; padding: 0; border-radius: 5px; font-size: 11px; }
  .key.special, .key.blank-key, .key.enter { font-size: 9px; }
  .game-card-footer { flex-direction: column; align-items: center; gap: 5px; text-align: center; }
  .side-column { grid-template-columns: 1fr; gap: 10px; }
  .aside-note { grid-column: 1; }
  .site-footer { margin-top: 28px; font-size: 9px; }
  .example-word b { width: 27px; height: 29px; }
  .example-clues b { width: 24px; height: 29px; }
  .score-panel { gap: 12px; padding: 13px; }
  .score-circle { width: 88px; height: 88px; border-width: 6px; }
  .score-circle strong { font-size: 24px; }
  .score-summary > strong { font-size: 14px; }
  .modal { padding: 18px; }
}
