:root {
  --bg: #F6F3EE; --surface: #FFFFFF; --surface-2: #EFEBE4; --ink: #13213A; --muted: #6B7385; --line: #E4DED3;
  --green: #1FA26B; --amber: #EDB12F; --absent: #8C96A8; --key: #E3DDD2; --key-ink: #13213A;
  --accent: #FF6B4A; --navy: #13213A; --key-absent-ink: #B9BFCA; --tile-border: #D6CFC2; --shadow: 0 1px 2px rgba(19,33,58,.06), 0 8px 24px rgba(19,33,58,.06);
  --radius: 20px; --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0D1524; --surface: #152036; --surface-2: #1B2843; --ink: #EEF2F8; --muted: #93A0B5; --line: #24314A;
    --absent: #3A465C; --key: #34425F; --key-absent-ink: #46526A; --key-ink: #EEF2F8; --tile-border: #33415C; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { overscroll-behavior: none; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }

.app { height: 100dvh; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; padding-top: var(--safe-t); }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px 6px; flex: none; }
.brand { display: flex; gap: 3px; }
.brand i { font-style: normal; width: 25px; height: 25px; border-radius: 7px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; }
.brand i.s2 { background: var(--green); } .brand i.s1 { background: var(--amber); } .brand i.s0 { background: #8C96A8; }
@media (prefers-color-scheme: dark) { .brand i.s0 { background: #46536D; } }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); }
.icon-btn:active { background: var(--surface-2); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 7px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-size: 14px; }

main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: none; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view.active { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
#view-game { overflow: hidden; }

/* Oyun */
.game-meta { text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .3px; padding: 2px 0 4px; flex: none; }
.board-wrap { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px 16px; }
.board { display: grid; grid-template-rows: repeat(6, var(--tile)); gap: var(--gap, 7px); --tile: 58px; }
.row { display: grid; grid-template-columns: repeat(5, var(--tile)); gap: var(--gap, 7px); }
.row.shake { animation: shake .45s; }
@keyframes shake { 10%,90%{transform:translateX(-2px)} 20%,80%{transform:translateX(4px)} 30%,50%,70%{transform:translateX(-7px)} 40%,60%{transform:translateX(7px)} }
.tile { width: var(--tile); height: var(--tile); border-radius: 14px; border: 2px solid var(--tile-border); background: var(--surface);
  display: grid; place-items: center; font-weight: 800; font-size: calc(var(--tile) * .5); text-transform: uppercase; user-select: none; }
.tile.filled { border-color: var(--muted); animation: pop .1s ease; }
@keyframes pop { 50% { transform: scale(1.08); } }
.tile.s0, .tile.s1, .tile.s2 { color: #fff; border-color: transparent; }
.tile.s0 { background: var(--absent); } .tile.s1 { background: var(--amber); } .tile.s2 { background: var(--green); }
.tile.flip { animation: flip .5s ease forwards; }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.row.win .tile { animation: bounce .5s ease; }
@keyframes bounce { 40% { transform: translateY(-14px); } 70% { transform: translateY(3px); } }

.bottom-area { flex: none; padding: 4px 6px calc(6px) }
.keyboard { display: flex; flex-direction: column; gap: 7px; user-select: none; }
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key { flex: 1 1 0; max-width: 44px; height: 54px; border-radius: 10px; background: var(--key); color: var(--key-ink); font-weight: 700; font-size: 16px;
  display: grid; place-items: center; transition: transform .06s, background .2s; touch-action: manipulation; }
.key:active { transform: scale(.94); }
.key.wide { max-width: 66px; flex: 1.5 1 0; font-size: 12px; font-weight: 800; letter-spacing: .3px; }
.key.s0 { background: transparent; color: var(--key-absent-ink); box-shadow: inset 0 0 0 1.5px var(--line); } .key.s1 { background: var(--amber); color: #fff; } .key.s2 { background: var(--green); color: #fff; }
.done-panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin: 4px 8px 6px; }
.done-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.countdown { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }

/* Sekme çubuğu */
.tabbar { flex: none; display: flex; justify-content: space-around; padding: 6px 8px; margin: 0 12px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
body.playing:not(.peek) .tabbar { display: none; }
body.playing:not(.peek) .bottom-area { padding-bottom: calc(8px + var(--safe-b)); }
.menu-btn { display: none; }
body.playing .menu-btn { display: grid; }
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 14px; border-radius: 14px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--ink); }
.tabbar button.on svg { stroke-width: 2.3; }

/* Sayfalar */
.page { padding: 4px 16px 28px; display: flex; flex-direction: column; gap: 14px; }
.page-title { font-size: 30px; letter-spacing: -1px; margin: 4px 2px 2px; font-weight: 800; }
.card { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 10px; font-size: 17px; letter-spacing: -.2px; }
.card p { margin: 0 0 12px; line-height: 1.5; font-size: 14.5px; }

.btn { height: 50px; padding: 0 20px; border-radius: 15px; font-weight: 700; font-size: 15.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .08s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; }
.btn.full { width: 100%; }
.btn.sm { height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.btn-primary { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-primary { background: #EEF2F8; color: #0D1524; } }
.btn-accent { background: linear-gradient(135deg, #FF7A45, #F0457A); color: #fff; }
.btn-green { background: #25D366; color: #fff; }
.btn-secondary { background: var(--surface-2); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); }
.danger { color: #D9455F; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input { height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 16px; outline: none; }
.field input:focus { border-color: var(--ink); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; font-size: 14.5px; }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; transition: background .2s; flex: none; cursor: pointer; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch:checked { background: var(--green); } .switch:checked::after { transform: translateX(20px); }
.keybox { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg); border-radius: 14px; padding: 8px 8px 8px 14px; }
.keybox code { font-size: 15px; letter-spacing: 1px; overflow: hidden; text-overflow: ellipsis; }

/* Sıralama */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; }
.segmented button { height: 38px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.scope-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; margin: 0 -2px; scrollbar-width: none; }
.scope-row::-webkit-scrollbar { display: none; }
.scope { flex: none; height: 36px; padding: 0 14px; border-radius: 99px; background: var(--surface); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; white-space: nowrap; }
.scope.on { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .scope.on { background: #EEF2F8; color: #0D1524; } }
.scope.add { background: transparent; box-shadow: none; border: 1.5px dashed var(--line); color: var(--muted); }
.lb { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lb-row { display: grid; grid-template-columns: 34px 38px 1fr auto; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lb-row:last-child { border-bottom: 0; }
.lb-row.me { background: color-mix(in srgb, var(--green) 10%, transparent); }
.rank { font-weight: 800; font-size: 15px; color: var(--muted); text-align: center; }
.rank.top { font-size: 20px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 15px; }
.lb-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-size: 12.5px; color: var(--muted); }
.lb-score { text-align: right; font-weight: 800; font-size: 16px; }
.lb-score small { display: block; font-weight: 600; font-size: 11.5px; color: var(--muted); }
.empty { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.group-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.group-card .gname { font-weight: 800; font-size: 16px; }
.cta-card { background: linear-gradient(135deg, #13213A, #233B66); color: #fff; }
.cta-card p { color: rgba(255,255,255,.8); }
.cta-card .btn-ghost { border-color: rgba(255,255,255,.3); color: #fff; }
.cta-card .btn-primary { background: #fff; color: #13213A; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Pasaport */
.passport { background: linear-gradient(160deg, #13213A 0%, #1C3156 60%, #2A3F6B 100%); color: #fff; border-radius: 24px; padding: 20px; position: relative; overflow: hidden; box-shadow: 0 12px 30px rgba(19,33,58,.25); }
.passport::before { content: ''; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; border: 1px solid rgba(255,255,255,.08); box-shadow: 0 0 0 24px rgba(255,255,255,.03), 0 0 0 48px rgba(255,255,255,.02); }
.pp-head { display: flex; justify-content: space-between; align-items: flex-start; position: relative; }
.pp-label { font-size: 11px; letter-spacing: 2.5px; font-weight: 700; opacity: .65; }
.pp-name { font-size: 22px; font-weight: 800; margin-top: 4px; letter-spacing: -.5px; }
.pp-count { text-align: right; } .pp-count b { font-size: 34px; letter-spacing: -1px; } .pp-count span { opacity: .6; font-weight: 700; }
.pp-bar { height: 8px; background: rgba(255,255,255,.12); border-radius: 99px; margin: 14px 0 16px; overflow: hidden; }
.pp-bar i { display: block; height: 100%; background: linear-gradient(90deg, #FFB35C, #FF6B4A); border-radius: 99px; transition: width .6s ease; }
.stamps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.stamp { aspect-ratio: 1; border-radius: 50%; border: 1.5px dashed rgba(255,255,255,.22); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: rgba(255,255,255,.35); }
.stamp.on { border: 2px solid #FF8A5C; color: #FFB08F; background: rgba(255,107,74,.12); font-size: 16px; }
.stamp.gift { border-color: rgba(255,200,90,.6); color: #fff; font-size: 18px; }
.stamp.gift.on { background: linear-gradient(135deg, #FFB35C, #FF6B4A); border: 0; }
.pp-note { font-size: 13px; opacity: .75; margin-top: 14px; line-height: 1.5; }
.gift-card { background: linear-gradient(135deg, #FFF4E5, #FFE3DA); color: #13213A; border-radius: var(--radius); padding: 18px; }
.gift-card code { display: inline-block; font-size: 20px; font-weight: 800; letter-spacing: 2px; background: #fff; padding: 8px 14px; border-radius: 12px; margin: 8px 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats b { display: block; font-size: 26px; letter-spacing: -1px; }
.stats span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.dist { display: flex; flex-direction: column; gap: 6px; }
.dist-row { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font-weight: 700; font-size: 13px; }
.dist-bar { height: 24px; border-radius: 7px; background: var(--surface-2); color: var(--ink); display: flex; align-items: center; justify-content: flex-end; padding: 0 8px; font-size: 12.5px; min-width: 28px; transition: width .5s; }
.dist-bar.hl { background: var(--green); color: #fff; }

/* Yardım */
.help h3 { margin: 0 0 10px; }
.help h4 { margin: 18px 0 8px; font-size: 15px; }
.help p, .help li { font-size: 14.5px; line-height: 1.55; }
.help ol, .help ul { padding-left: 20px; margin: 6px 0; }
.ex-row { display: flex; gap: 5px; margin: 10px 0 4px; }
.ex-row .tile { --tile: 38px; border-radius: 10px; font-size: 18px; }
.os-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 3px; margin: 8px 0 10px; }
.os-tabs button { height: 34px; border-radius: 9px; font-weight: 700; font-size: 13.5px; color: var(--muted); }
.os-tabs button.on { background: var(--surface); color: var(--ink); }
.steps { counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { counter-increment: s; position: relative; padding-left: 38px; margin-bottom: 12px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: -1px; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; font-size: 13px; display: grid; place-items: center; }
@media (prefers-color-scheme: dark) { .steps li::before { background: #EEF2F8; color: #0D1524; } }
.ios-share { display: inline-block; vertical-align: -4px; }

/* Alt sayfa (sheet) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(8,14,26,.45); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 40; backdrop-filter: blur(2px); }
.sheet-backdrop.on { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 50%; bottom: 0; width: 100%; max-width: 520px; max-height: 92dvh; transform: translate(-50%, 105%); background: var(--surface); border-radius: 28px 28px 0 0;
  z-index: 50; transition: transform .32s cubic-bezier(.2,.9,.25,1); display: flex; flex-direction: column; padding-bottom: var(--safe-b); }
.sheet.on { transform: translate(-50%, 0); }
.sheet-handle { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 10px auto 0; flex: none; }
.sheet-close { position: absolute; right: 14px; top: 12px; width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); font-size: 14px; color: var(--muted); }
.sheet.locked .sheet-close { display: none; }
.sheet-body { overflow-y: auto; padding: 14px 22px 24px; }
.sheet-title { font-size: 26px; font-weight: 800; letter-spacing: -.8px; margin: 8px 0 6px; }
.sheet-sub { color: var(--muted); margin: 0 0 18px; line-height: 1.5; font-size: 15px; }
.hero-tiles { display: flex; gap: 6px; margin: 10px 0 14px; }
.hero-tiles .tile { --tile: 46px; font-size: 22px; }
.link-btn { color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; padding: 10px; display: block; margin: 6px auto 0; }
.result-head { text-align: center; padding: 6px 0 4px; }
.result-big { font-size: 54px; font-weight: 800; letter-spacing: -2px; line-height: 1; }
.answer-tiles { display: flex; gap: 6px; justify-content: center; margin: 14px 0; }
.answer-tiles .tile { --tile: 44px; font-size: 21px; }
.mini-pp { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: 16px; padding: 12px 14px; margin: 6px 0 16px; }
.mini-pp .pp-bar { flex: 1; margin: 0; background: var(--line); }
.mini-pp b { font-size: 15px; white-space: nowrap; }
.share-preview { width: 46%; max-width: 190px; border-radius: 14px; display: block; margin: 0 auto 14px; box-shadow: var(--shadow); }

/* Bildirim balonu */
.toast-wrap { position: fixed; top: calc(70px + var(--safe-t)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 14px; font-weight: 700; font-size: 14.5px; box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: toastIn .2s ease; max-width: 88vw; text-align: center; }
@media (prefers-color-scheme: dark) { .toast { background: #EEF2F8; color: #0D1524; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }
.confetti { position: fixed; top: -10px; width: 9px; height: 14px; z-index: 70; pointer-events: none; animation: fall linear forwards; border-radius: 2px; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* Altın Pasaport rozeti */
.gold-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 7px; border-radius: 99px; vertical-align: 2px;
  background: linear-gradient(135deg, #F7D774, #D9A21B); color: #4A3300; font-size: 11px; font-weight: 800; letter-spacing: .2px; line-height: 1.4; box-shadow: 0 1px 4px rgba(217,162,27,.35); }
.pp-name + .gold-badge { margin: 8px 0 0; font-size: 12px; padding: 4px 10px; }
.passport.gold { box-shadow: 0 0 0 2px #E9BE4A, 0 12px 30px rgba(217,162,27,.3); }

/* Worday Molası önizleme */
.molasi-demo { position: relative; height: 230px; border-radius: 20px; overflow: hidden; background: linear-gradient(160deg, #6B4F3A, #C89B6D 55%, #EED9B8); }
.molasi-photo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 110px; opacity: .9; }
.molasi-photo span { transform: translate(-70px, 10px); filter: drop-shadow(0 10px 20px rgba(0,0,0,.25)); }
.molasi-demo img { position: absolute; right: 12px; top: 14px; width: 62%; transform: rotate(4deg); filter: drop-shadow(0 6px 14px rgba(0,0,0,.25)); }

/* Profil resimleri */
.avatar { flex: none; line-height: 1; }
.avatar.emoji { box-shadow: inset 0 0 0 1px rgba(0,0,0,.04); }
.av-current { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.av-current b { font-size: 17px; }
.av-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.av-grid .av-opt:first-child { grid-column: 1 / -1; justify-self: start; display: none; }
.av-opt { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; padding: 0; transition: transform .12s; }
.av-opt:active { transform: scale(.92); }
.av-opt.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5.5px var(--green); }
.av-opt .avatar { width: 100% !important; height: 100% !important; }
.pp-avatar { margin: 10px 0 2px; }
.pp-avatar .avatar { box-shadow: 0 0 0 3px rgba(255,255,255,.18); }

/* Çizgi ikonlar */
.btn .ico { flex: none; width: 21px; height: 21px; }
.btn-accent .ico .steam { animation: steam 1.8s ease-in-out infinite; transform-origin: center bottom; }
@keyframes steam { 0%,100% { opacity: .35; transform: translateY(1px); } 50% { opacity: 1; transform: translateY(-1.5px); } }
.molasi-title { display: flex; align-items: center; gap: 10px; }
.molasi-badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #FF7A45, #F0457A); flex: none; }
.molasi-badge .ico { width: 23px; height: 23px; }
.molasi-badge .ico .steam { animation: steam 1.8s ease-in-out infinite; }

/* Klavye: dar ekranlarda ve büyük yazı ayarında taşmasın (iPhone mini) */
.keyboard { width: 100%; max-width: 500px; margin: 0 auto; }
.kb-row { width: 100%; gap: clamp(3px, 1.2vw, 6px); }
.key { min-width: 0; padding: 0; margin: 0; -webkit-appearance: none; appearance: none; font-size: clamp(13px, 4.1vw, 17px); }
.key.wide { font-size: clamp(10px, 3vw, 12px); }
.bottom-area { padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
