/* Malboncuk — ana stil */
:root {
  --navy: #0f2250;
  --cobalt: #1d4fb8;
  --blue: #2f6fe4;
  --ink: #0a1020;
  --glass-bg: rgba(255, 255, 255, 0.16);
  --glass-brd: rgba(255, 255, 255, 0.42);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; background: var(--navy); }
html { margin-top: 0 !important; }
body {
  font-family: var(--font);
  color: #fff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: none;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#stage { position: fixed; inset: 0; display: block; z-index: 0; }
body.lens-on #stage { cursor: none; }

.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- cam (glass) */
.glass {
  background: rgba(12, 18, 52, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.34);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
  box-shadow: 0 8px 30px rgba(8, 14, 48, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* ---------- marka */
.brand {
  position: fixed; z-index: 5;
  top: calc(12px + var(--safe-t)); left: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px 0 8px; border-radius: 999px;
  font-weight: 700; font-size: 15px; letter-spacing: -0.01em; color: #fff;
  text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.brand { transition: opacity .5s, transform .5s; }
body.playing .brand { opacity: 0; transform: translateY(-10px); pointer-events: none; transition-delay: 2.5s; }
.brand .dot { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle, #0a1020 0 21%, #5cc3f2 22% 43%, #fff 44% 63%, #1d4fb8 64%); box-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* ---------- ses */
.iconbtn {
  position: fixed; z-index: 5;
  top: calc(12px + var(--safe-t)); right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; cursor: pointer; padding: 0;
  font: inherit;
}
.iconbtn svg { width: 18px; height: 18px; }
.iconbtn .x { display: none; }
.iconbtn.off .w { display: none; }
.iconbtn.off .x { display: inline; }
.iconbtn.haptic { right: 56px; }
.iconbtn:focus-visible, .btn:focus-visible, .linkbtn:focus-visible { outline: 3px solid #9fd0ff; outline-offset: 3px; }

/* ---------- HUD */
.hud {
  position: fixed; z-index: 5; left: 50%; bottom: calc(16px + var(--safe-b));
  transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: 16px;
  padding: 7px 20px 8px; border-radius: 18px;
  color: #fff; font-weight: 800; font-variant-numeric: tabular-nums;
  background: rgba(10, 18, 52, 0.9);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 10px 30px rgba(4, 8, 28, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform .45s cubic-bezier(.2,.9,.25,1.2), opacity .3s, border-color .3s, background-color .3s;
  opacity: 0; pointer-events: none;
}
body.playing .hud { transform: translate(-50%, 0); opacity: 1; }
.hud .cell { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 44px; }
.hud .lbl { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(214, 226, 255, 0.72); line-height: 1; }
.hud .val { display: flex; align-items: center; gap: 6px; font-size: 20px; line-height: 24px; }
.hud .lives { gap: 4px; }
.hud .life { width: 20px; height: 20px; fill: #ff4d6d; stroke: #ff4d6d; stroke-width: 1.5; filter: drop-shadow(0 1px 3px rgba(255, 77, 109, 0.45)); transition: fill .25s, stroke .25s, transform .3s, filter .25s; }
.hud .life.lost { fill: transparent; stroke: rgba(255, 255, 255, 0.4); filter: none; transform: scale(.88); }
.hud .combo { font-size: 12px; font-weight: 800; color: #1a1300; background: #ffd84d; border-radius: 999px; padding: 1px 7px; line-height: 18px; display: none; }
.hud .combo.show { display: inline-block; }
.hud .sep { width: 1px; height: 30px; background: rgba(255, 255, 255, 0.18); }
.hud.hurt { animation: mbHurt .5s ease; border-color: rgba(255, 77, 109, 0.9); background-color: rgba(70, 14, 34, 0.92); }
@keyframes mbHurt {
  0%, 100% { transform: translate(-50%, 0); }
  20% { transform: translate(calc(-50% - 7px), 0); }
  40% { transform: translate(calc(-50% + 6px), 0); }
  60% { transform: translate(calc(-50% - 4px), 0); }
  80% { transform: translate(calc(-50% + 2px), 0); }
}

/* ---------- toast */
.toast {
  position: fixed; z-index: 6; left: 50%; top: calc(62px + var(--safe-t));
  transform: translate(-50%, -10px); opacity: 0;
  padding: 10px 18px; border-radius: 20px; font-weight: 600; font-size: 15px;
  color: #fff; background: rgba(15, 20, 50, 0.82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: opacity .25s, transform .35s; pointer-events: none; width: max-content; max-width: min(440px, calc(100vw - 24px)); text-align: center; line-height: 1.35; text-wrap: balance;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- konuşma balonu */
.bubble {
  position: fixed; z-index: 4;
  transform: translate(-10%, -100%) scale(.6); transform-origin: 0 100%;
  max-width: min(260px, 60vw);
  padding: 10px 14px; border-radius: 18px 18px 18px 4px;
  background: #fff; color: var(--ink); font-weight: 600; font-size: 15px; line-height: 1.3;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .35s cubic-bezier(.2,.9,.25,1.4);
}
.bubble.show { opacity: 1; transform: translate(-10%, -100%) scale(1); }

/* ---------- orta karo içeriği */
.hero {
  position: fixed; z-index: 2;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: var(--bead-space, 50%) 20px 18px;
  pointer-events: none;
}
.hero .intro, .hero .panel { width: 100%; max-width: 560px; display: flex; flex-direction: column; align-items: center; }
.hero h1 {
  margin: 0; font-size: var(--fs, 44px); line-height: 1.05; font-weight: 700; letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero .sub { margin: .45em 0 0; font-size: calc(var(--fs, 44px) * .42); font-weight: 500; color: #cfdaff; line-height: 1.3; text-wrap: balance; }
.hero .cta { margin-top: calc(var(--fs, 44px) * .42); display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.hint { margin: 12px 0 0; font-size: 13px; color: rgba(207,218,255,.7); font-weight: 500; }

.btn {
  pointer-events: auto; cursor: pointer;
  appearance: none; border: 0; font: inherit; font-weight: 600; font-size: 17px; letter-spacing: -0.01em;
  padding: 12px 24px; border-radius: 999px; color: #fff; background: var(--blue);
  box-shadow: 0 6px 18px rgba(47,111,228,.45), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .15s, background .2s, box-shadow .2s;
}
.btn:hover { background: #3d7cf0; transform: translateY(-1px); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.4); }
.btn.ghost:hover { background: rgba(255,255,255,.22); }

.intro > * { opacity: 0; transform: translateY(12px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
body.ready .intro > * { opacity: 1; transform: none; }
body.ready .intro > *:nth-child(2) { transition-delay: .12s; }
body.ready .intro > *:nth-child(3) { transition-delay: .24s; }
body.ready .intro > *:nth-child(4) { transition-delay: .36s; }
body.playing .intro > *, body.over .intro > * { opacity: 0 !important; transform: translateY(12px) !important; transition-delay: 0s !important; }
body.playing .intro .btn, body.over .intro .btn { pointer-events: none; visibility: hidden; }

/* oyun sonu paneli */
.panel { display: none !important; }
body.over .panel.over-panel, body.paused .panel.pause-panel { display: flex !important; animation: rise .5s cubic-bezier(.2,.9,.25,1.15) both; }
body.over .hero, body.paused .hero { justify-content: center; padding-top: 18px; }
.panel { pointer-events: auto; }
.panel .eyebrow { margin: 0; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: #9fb6ff; font-weight: 700; }
.panel h2 { margin: 6px 0 0; font-size: calc(var(--fs, 44px) * .9); line-height: 1.05; letter-spacing: -0.025em; }
.panel p { margin: 8px 0 0; color: #cfdaff; font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; width: 100%; max-width: 380px; }
.stat { border-radius: 16px; padding: 10px 6px; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.stat b { display: block; font-size: 26px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: #b9c7f5; font-weight: 600; }
.rank { margin-top: 12px !important; font-weight: 600; }
.rank strong { color: #ffe27a; }
.newbest { display: inline-block; margin-top: 10px; padding: 4px 10px; border-radius: 999px; background: #ffe27a; color: #3a2a00; font-weight: 800; font-size: 12px; letter-spacing: .04em; }
.panel .cta { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.linkbtn { pointer-events: auto; appearance: none; background: none; border: 0; color: #cfdaff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; margin-top: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- sıralama */
body.board .intro > * { opacity: 0 !important; transform: translateY(12px) !important; transition-delay: 0s !important; }
body.board .intro .btn { pointer-events: none; visibility: hidden; }
body.board .panel.over-panel { display: none !important; }
body.board .panel.board-panel { display: flex !important; animation: rise .45s cubic-bezier(.2,.9,.25,1.15) both; }
body.board .hero { justify-content: center; padding-top: 18px; }
.lb { width: 100%; max-width: 380px; margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lb-form { display: flex; gap: 8px; width: 100%; }
.lb-form[hidden] { display: none; }
.lb-form input {
  flex: 1; min-width: 0; height: 42px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.1); color: #fff;
  font: inherit; font-size: 16px; font-weight: 600; outline: none;
  -webkit-user-select: text; user-select: text; touch-action: manipulation;
}
.lb-form input::placeholder { color: rgba(207,218,255,.65); }
.lb-form input:focus { border-color: #9fd0ff; background: rgba(255,255,255,.16); }
.btn.story { display: inline-flex; align-items: center; gap: 8px; background: linear-gradient(115deg, #f9a33a 0%, #f2366b 45%, #b23ad6 80%, #6b4cf0 100%); box-shadow: 0 8px 22px rgba(226, 54, 120, 0.4); }
.btn.story:hover { background: linear-gradient(115deg, #fbb04f 0%, #f54a7a 45%, #bf4fe0 80%, #7a5df5 100%); }
.btn.story svg { width: 19px; height: 19px; flex: none; }
.btn.story.busy { opacity: .7; pointer-events: none; }
.btn.small { font-size: 15px; padding: 0 18px; height: 42px; }
.lb-status { margin: 0 !important; min-height: 1.3em; font-size: 14px !important; font-weight: 600; color: #ffe27a !important; }
.links { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.links .linkbtn { margin-top: 10px; }
.tabs { display: inline-flex; gap: 4px; margin-top: 14px; padding: 4px; border-radius: 999px; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); pointer-events: auto; }
.tabs button { appearance: none; border: 0; background: none; color: #cfdaff; font: inherit; font-size: 13px; font-weight: 700; padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--navy); }
.board-list { list-style: none; margin: 12px 0 8px; padding: 0; width: 100%; max-width: 380px; max-height: 46vh; overflow-y: auto; touch-action: pan-y; pointer-events: auto; }
.board-list li { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 12px; font-size: 15px; font-weight: 600; text-align: left; }
.board-list li:nth-child(odd) { background: rgba(255,255,255,.05); }
.board-list li .pos { color: #9fb6ff; font-variant-numeric: tabular-nums; font-weight: 800; }
.board-list li:nth-child(1) .pos { color: #ffd34d; }
.board-list li:nth-child(2) .pos { color: #dfe6f5; }
.board-list li:nth-child(3) .pos { color: #f0a868; }
.board-list li .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list li .sc { font-variant-numeric: tabular-nums; font-weight: 800; }
.board-list li.me { background: rgba(255, 226, 122, .18); box-shadow: inset 0 0 0 1px rgba(255, 226, 122, .55); }
.board-panel .btn { margin-top: 8px; }

/* ---------- alt bilgi */
.foot {
  position: fixed; z-index: 5; right: 12px; bottom: calc(12px + var(--safe-b));
  display: flex; align-items: center; gap: 10px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.foot button { appearance: none; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
body.playing .foot { opacity: 0; pointer-events: none; }
body.playing .cookie.show { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }

/* ---------- çerez */
.cookie {
  position: fixed; z-index: 10; left: 50%; bottom: calc(14px + var(--safe-b));
  transform: translate(-50%, 20px); opacity: 0;
  width: min(560px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 20px;
  background: rgba(15, 22, 60, .72); color: #fff;
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 16px 40px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.18);
  transition: opacity .3s, transform .4s;
  font-size: 14px; line-height: 1.4;
}
.cookie.show { opacity: 1; transform: translate(-50%, 0); }
.cookie p { margin: 0; flex: 1 1 260px; color: #dfe6ff; }
.cookie .actions { display: flex; gap: 8px; }
.cookie .btn { font-size: 14px; padding: 9px 16px; }

/* ---------- mobil */
@media (max-width: 640px) {
  .brand { font-size: 14px; height: 32px; }
  .brand .dot { width: 20px; height: 20px; }
  .iconbtn { width: 32px; height: 32px; }
  .iconbtn.haptic { right: 50px; }
  .panel .lead { display: none; }
  .lb { margin-top: 8px; }
  .lb-form input, .btn.small { height: 38px; }
  .board-list li { padding: 5px 10px; font-size: 14px; }
  .tabs { margin-top: 10px; }
  .hud { gap: 12px; padding: 6px 16px 7px; bottom: calc(14px + var(--safe-b)); }
  .hud .val { font-size: 18px; line-height: 22px; }
  .hud .life { width: 18px; height: 18px; }
  .hud .cell { min-width: 38px; }
  .toast { top: calc(56px + var(--safe-t)); font-size: 14px; }
  .btn { font-size: 16px; padding: 11px 20px; }
  .hint { display: none; }
  .foot { left: 50%; right: auto; transform: translateX(-50%); white-space: nowrap; }
  .foot .long { display: none; }
  .bubble { font-size: 14px; max-width: 200px; }
  .panel .eyebrow { font-size: 11px; }
  .panel h2 { font-size: 26px !important; }
  .panel p { font-size: 14px; margin-top: 4px; }
  .newbest { margin-top: 6px; }
  .stats { margin-top: 10px; gap: 6px; }
  .stat { padding: 6px 4px; border-radius: 12px; }
  .panel .cta { margin-top: 10px; }
  .panel .btn { font-size: 15px; padding: 10px 16px; }
  .linkbtn { margin-top: 6px; font-size: 13px; }
  .stat b { font-size: 20px; }
}

@media (max-height: 560px) {
  .hint { display: none; }
  .bubble { font-size: 13px; max-width: 200px; padding: 8px 12px; }
  .foot .long { display: none; }
  .hud { bottom: calc(8px + var(--safe-b)); }
  .toast { top: calc(54px + var(--safe-t)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

noscript p { position: fixed; inset: auto 0 0 0; z-index: 20; margin: 0; padding: 14px; text-align: center; background: #fff; color: #0a1020; font: 600 15px var(--font); }
