:root {
  --bg: #f5f2ea;
  --surface: #ffffff;
  --ink: #1e1b2e;
  --muted: #6b6679;
  --line: #d9d4c7;
  --tile: #ffffff;
  --tile-line: #cfc8b8;
  --accent: #4b3fd1;
  --accent-ink: #ffffff;
  --g: #2e9d68;
  --y: #e0a92b;
  --r: #d4524c;
  --key: #e4dfd2;
  --key-ink: #1e1b2e;
  --key-used: #b9b2a2;
  --key-used-ink: #5c5768;
  --shadow: 0 1px 0 rgba(30, 27, 46, .08), 0 6px 20px rgba(30, 27, 46, .06);
  --radius: 10px;
  --tile-size: min(10.4vw, 5.1dvh, 50px);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #13121a;
  --surface: #1c1b25;
  --ink: #efedf6;
  --muted: #a19db0;
  --line: #2f2d3b;
  --tile: #1f1e29;
  --tile-line: #3a3848;
  --accent: #8f86ff;
  --accent-ink: #13121a;
  --g: #3bb37b;
  --y: #e8b43d;
  --r: #e0625c;
  --key: #2c2a38;
  --key-ink: #efedf6;
  --key-used: #17161e;
  --key-used-ink: #6d6880;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 8px; top: 8px; z-index: 9; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* üst bar */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 8px max(12px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; font-size: 1.15rem; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand svg { width: 28px; height: 28px; }
.tabs { display: flex; gap: 2px; background: var(--key); padding: 3px; border-radius: 999px; }
.tabs a { padding: 4px 12px; border-radius: 999px; text-decoration: none; color: var(--ink); font-size: .9rem; font-weight: 600; }
.tabs a[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); }
.icon-btn { border: 0; background: transparent; color: var(--ink); width: 38px; height: 38px; border-radius: 10px; font-size: 1.15rem; cursor: pointer; display: inline-grid; place-items: center; text-decoration: none; }
.icon-btn:hover { background: var(--key); }
@media (max-width: 560px) {
  .brand span { display: none; }
  .tabs a { padding: 4px 9px; font-size: .85rem; }
}

/* oyun */
.game { max-width: 520px; margin: 0 auto; padding: 10px 10px 4px; min-height: calc(100dvh - 56px); display: flex; flex-direction: column; }
.game[aria-busy="true"]::after { content: attr(data-loading); margin: 40px auto; color: var(--muted); }
.game-head { display: flex; align-items: center; gap: 10px; margin: 2px 4px 10px; font-size: .95rem; }
.gh-title { font-weight: 800; }
.gh-date { color: var(--muted); margin-right: auto; }
.badge { margin-left: auto; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 2px 12px; font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; }
.badge.hard { border-color: var(--r); color: var(--r); }

.board { display: grid; gap: 5px; justify-content: center; margin-bottom: 8px; }
.row { display: flex; gap: 5px; align-items: center; }
.tile {
  width: var(--tile-size); height: var(--tile-size);
  display: grid; place-items: center;
  border: 2px solid var(--tile-line); border-radius: 8px;
  background: var(--tile); color: var(--ink);
  font: 800 calc(var(--tile-size) * .5)/1 inherit; font-family: inherit;
  text-transform: none; padding: 0; cursor: default;
  transition: background-color .15s, border-color .15s, transform .1s;
}
.row.done .tile { cursor: pointer; border-color: transparent; background: var(--key); }
.row.done .tile:active { transform: scale(.94); }
.row.cur .tile { border-color: color-mix(in srgb, var(--accent) 45%, var(--tile-line)); }
.tile[data-mark="typed"] { border-color: var(--accent) !important; animation: pop .1s; }
.tile[data-mark="1"] { background: var(--r) !important; color: #fff; }
.tile[data-mark="2"] { background: var(--y) !important; color: #1e1b2e; }
.tile[data-mark="3"] { background: var(--g) !important; color: #fff; }
.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }

.fb { display: flex; gap: 4px; margin-left: 6px; }
.fb .n {
  width: calc(var(--tile-size) * .72); height: calc(var(--tile-size) * .72);
  display: grid; place-items: center; border-radius: 50%;
  font-weight: 800; font-size: calc(var(--tile-size) * .36);
  border: 0; color: transparent;
}
.fb .g { background: color-mix(in srgb, var(--g) 16%, transparent); }
.fb .y { background: color-mix(in srgb, var(--y) 16%, transparent); }
.fb .r { background: color-mix(in srgb, var(--r) 16%, transparent); }
.fb.show .n { border: 0; color: #fff; }
.fb.show .g { background: var(--g); }
.fb.show .y { background: var(--y); color: #1e1b2e; }
.fb.show .r { background: var(--r); }
.row.reveal .fb .n { animation: flip .35s both; }
.row.reveal .fb .y { animation-delay: .08s; }
.row.reveal .fb .r { animation-delay: .16s; }
.row.shake { animation: shake .35s; }
.row.invalid .tile { color: var(--r); text-decoration: line-through; text-decoration-thickness: 3px; border-color: var(--r) !important; }
.row.forced .tile { cursor: not-allowed; }
.row.won .tile { animation: hop .5s both; }
.row.won .tile:nth-child(2) { animation-delay: .08s; } .row.won .tile:nth-child(3) { animation-delay: .16s; }
.row.won .tile:nth-child(4) { animation-delay: .24s; } .row.won .tile:nth-child(5) { animation-delay: .32s; }
@keyframes hop { 40% { transform: translateY(-10px); } }

@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes flip { from { transform: rotateX(90deg); } to { transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* klavye */
.kb { margin-top: auto; display: grid; gap: 6px; padding: 8px 6px max(8px, env(safe-area-inset-bottom)); user-select: none; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); }
.kb-row { display: flex; gap: 4px; justify-content: center; }
.key {
  position: relative; flex: 1 1 0; max-width: 46px; height: min(52px, 6.4dvh);
  border: 0; border-radius: 7px; background: var(--key); color: var(--key-ink);
  font: 700 1.05rem/1 inherit; font-family: inherit; cursor: pointer; padding: 0;
  touch-action: manipulation; transition: background-color .2s, color .2s, opacity .2s;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12);
}
.key.wide { max-width: 64px; flex-grow: 1.5; font-size: 1.1rem; }
.kb-row:last-child .key { max-width: none; height: min(46px, 5.6dvh); font-size: .82rem; letter-spacing: .02em; }
.kb-row:last-child .key.space { flex-grow: 2.6; }
.kb-row:last-child .key.enter { flex-grow: 1.4; background: var(--accent); color: var(--accent-ink); }
.key:active:not(:disabled) { transform: translateY(1px); filter: brightness(.92); }
/* kullanılan harf: zemin koyulaşır, harf soluklaşır, altında küçük nokta */
.key[data-state="used"] { background: var(--key-used); color: var(--key-used-ink); box-shadow: none; }
.key[data-state="used"]::after { content: ""; position: absolute; left: 50%; bottom: 5px; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
/* elenen harf (5 kırmızı satırda geçti) */
.key[data-state="dead"] { background: color-mix(in srgb, var(--r) 30%, var(--key-used)); color: color-mix(in srgb, var(--r) 70%, var(--key-used-ink)); box-shadow: none; text-decoration: line-through; }
/* standart seviyede gizli kelimede olamayacak harf */
.key[data-state="excluded"] { background: transparent; color: var(--muted); opacity: .35; box-shadow: inset 0 0 0 1px var(--line); text-decoration: line-through; }
.key:disabled { opacity: .4; cursor: default; box-shadow: none; }
.key[data-state="excluded"]:disabled { opacity: .3; }
.kb-row:last-child .key.enter:disabled { background: var(--key); color: var(--key-ink); }
.mark-help, .mode-note { text-align: center; color: var(--muted); font-size: .8rem; margin: 6px 0 0; }

/* oyun sonu */
.end { text-align: center; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin: 4px 0 10px; }
.end-msg { margin: 0; font-weight: 800; font-size: 1.15rem; }
.end-msg.lost { color: var(--r); }
.end-word { margin: 2px 0 0; letter-spacing: .3em; font-weight: 800; font-size: 1.4rem; color: var(--g); }
.end-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.next { margin: 10px 0 0; color: var(--muted); font-size: .9rem; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 18px; font: inherit; font-weight: 700; cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* bildirimler */
.toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 20; display: grid; gap: 6px; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: 8px; font-weight: 700; font-size: .92rem; transition: opacity .3s; text-align: center; }
.toast.out { opacity: 0; }

/* pencere */
.modal { border: 0; border-radius: 16px; padding: 18px 20px 22px; width: min(420px, calc(100vw - 24px)); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal::backdrop { background: rgba(10, 9, 18, .55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal h2 { margin: 0; font-size: 1.15rem; }
.modal h3 { font-size: .9rem; margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 6px; }
.stat strong { display: block; font-size: 1.7rem; line-height: 1.1; }
.stat span { font-size: .75rem; color: var(--muted); }
.dist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.dist li { display: flex; gap: 6px; align-items: center; font-size: .85rem; }
.dist-n { width: 12px; font-weight: 700; }
.dist-bar { width: var(--w); background: var(--key); padding: 1px 8px; text-align: right; border-radius: 4px; font-weight: 700; }
.dist-bar.cur { background: var(--g); color: #fff; }
fieldset { border: 0; padding: 0; margin: 0 0 14px; }
legend { font-weight: 800; margin-bottom: 6px; }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.opt small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.opt input { margin-top: 5px; accent-color: var(--accent); }
.seg { display: flex; gap: 6px; }
.seg .opt { flex: 1; margin: 0; }

/* arşiv */
.archive { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.arc { display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; padding: 10px 14px; background: var(--surface); border-radius: var(--radius); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.arc em { font-style: normal; font-weight: 700; color: var(--accent); font-size: .85rem; }
.arc.won em { color: var(--g); }
.arc.lost em { color: var(--r); }

/* içerik (SEO) */
.content { max-width: 760px; margin: 0 auto; padding: 24px 18px 40px; border-top: 1px solid var(--line); }
.content h1 { font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.2; letter-spacing: -.02em; margin: 8px 0 12px; }
.content h2 { font-size: 1.25rem; margin: 30px 0 8px; }
.content h3 { font-size: 1.05rem; margin: 16px 0 4px; }
.lead { font-size: 1.05rem; }
.content dl dt { font-weight: 800; margin-top: 10px; }
.content dl dd { margin: 2px 0 0; }
.content details { background: var(--surface); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; box-shadow: var(--shadow); }
.content summary { font-weight: 700; cursor: pointer; }
.content details p { margin: 8px 0 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 0; list-style: none; }
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 18px; height: 18px; border-radius: 50%; display: inline-block; }
.dot.g { background: var(--g); } .dot.y { background: var(--y); } .dot.r { background: var(--r); }
.ex { width: 100%; border-collapse: collapse; font-size: .95rem; }
.ex th, .ex td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ex .w { font-weight: 800; letter-spacing: .15em; white-space: nowrap; }
.ex .c { text-align: center; font-weight: 800; }
.ex .c.g { color: var(--g); } .ex .c.y { color: var(--y); } .ex .c.r { color: var(--r); }
.cta { display: inline-block; margin-top: 18px; }
.letters { display: flex; flex-wrap: wrap; gap: 4px; padding: 0; list-style: none; }
.letters a { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 8px; background: var(--key); color: var(--ink); text-decoration: none; font-weight: 800; }
.wordcols { columns: 6 92px; column-gap: 12px; padding: 0; list-style: none; font-variant: small-caps; }
.wordcols li { break-inside: avoid; }
.crumbs { font-size: .85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.foot { max-width: 760px; margin: 0 auto; padding: 18px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); }
.foot nav { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 6px; }
.page { min-height: auto; }
