:root {
  --bazalt: #121318;
  --tas: #1c1e26;
  --tas-2: #262833;
  --tas-kenar: #3a3d4a;
  --kemik: #ece3cf;
  --is: #8a8d9c;
  --kor: #ff6a2b;
  --kor-koyu: #a8340f;
  --pas: #4fd1b5;
  --pas-koyu: #17594f;
  --altin: #e8b14a;

  --display: 'Grenze Gotisch', 'Times New Roman', serif;
  --body: 'Alegreya Sans', system-ui, sans-serif;

  --cell-h: 100px;
  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(120% 60% at 50% 115%, rgba(255, 106, 43, .22), transparent 60%),
    radial-gradient(80% 50% at 15% 0%, rgba(79, 209, 181, .07), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(255,255,255,.018) 46px 48px),
    var(--bazalt);
  color: var(--kemik);
  font-family: var(--body);
  font-size: 16px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, .pill:focus-visible { outline: 2px solid var(--pas); outline-offset: 3px; }
b { font-weight: 800; }

/* ---------- Üst çubuk ---------- */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand {
  margin: 0; font-family: var(--display); font-weight: 900;
  font-size: 30px; line-height: 1; letter-spacing: .5px;
  color: var(--kemik);
  text-shadow: 0 0 18px rgba(255,106,43,.45);
}
.topbar-meta { display: flex; gap: 14px; align-items: center; margin-left: auto; font-size: 14px; color: var(--is); }
.session b { color: var(--kemik); font-variant-numeric: tabular-nums; }
.demo-badge { color: var(--pas); border: 1px solid var(--pas-koyu); padding: 2px 8px; border-radius: 99px; font-size: 13px; }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--tas); border: 1px solid var(--tas-kenar); border-radius: 50%;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: var(--kemik); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg path:first-child { fill: var(--kemik); stroke: none; }
#infoBtn svg path:first-child, #infoClose svg path:first-child { fill: none; stroke: var(--kemik); }
#soundBtn .sound-on { display: none; }
#soundBtn[aria-pressed="true"] .sound-on { display: inline; }
#soundBtn[aria-pressed="true"] .sound-off { display: none; }

/* ---------- Sahne ---------- */
.stage {
  display: grid;
  grid-template-columns: 250px minmax(0, 660px);
  justify-content: center;
  align-items: start;
  gap: 28px;
  padding: 22px 20px 12px;
}

/* ---------- Kule ---------- */
.tower {
  position: relative;
  padding: 16px 14px 14px;
  background: linear-gradient(180deg, #1a1c24, #15161d);
  border: 1px solid var(--tas-kenar);
  border-radius: 14px 14px 6px 6px;
  box-shadow: inset 0 0 0 4px #15161d, inset 0 0 0 5px rgba(255,255,255,.04);
}
.tower-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.tower-title { font-family: var(--display); font-size: 24px; font-weight: 700; }
.tower-bet { font-size: 13px; color: var(--is); font-variant-numeric: tabular-nums; }

.summit {
  position: relative;
  margin: 9px 18px 8px;
  padding: 10px 10px 8px;
  text-align: center;
  background: var(--tas);
  border: 1px solid var(--tas-kenar);
  border-radius: 4px;
  transition: background .4s, box-shadow .4s;
}
.summit::before {
  content: ''; position: absolute; left: -1px; right: -1px; top: -9px; height: 9px;
  background: repeating-linear-gradient(90deg, var(--tas-kenar) 0 14px, transparent 14px 26px);
}
.summit-name { display: block; font-family: var(--display); font-size: 22px; font-weight: 900; color: var(--is); }
.summit-desc { display: block; font-size: 12px; color: var(--is); line-height: 1.25; }
.summit.lit { background: linear-gradient(180deg, #4a1d0c, #2a120a); }
.summit.lit .summit-name { color: var(--altin); text-shadow: 0 0 14px rgba(255,160,60,.8); }
.summit.lit .summit-desc { color: var(--kemik); }

.floors { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.floor {
  position: relative;
  display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center;
  padding: 8px 10px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 22px 100%,
    var(--tas);
  border: 1px solid var(--tas-kenar);
  border-radius: 4px;
  color: var(--is);
  transition: background .4s, color .4s, border-color .4s, box-shadow .4s;
}
.floor-no {
  font-family: var(--display); font-size: 26px; font-weight: 900; line-height: 1;
  text-align: center;
}
.floor-name { font-size: 14px; font-weight: 700; line-height: 1.15; }
.floor-desc { display: block; font-size: 12px; font-weight: 400; line-height: 1.25; }
.floor.done { color: #b9c9c4; border-color: var(--pas-koyu); }
.floor.done .floor-no { color: var(--pas); }
.floor.current {
  color: var(--kemik);
  border-color: var(--kor);
  background: linear-gradient(90deg, rgba(255,106,43,.22), rgba(255,106,43,.06)), var(--tas-2);
  box-shadow: 0 0 22px rgba(255,106,43,.25), inset 0 0 12px rgba(255,106,43,.15);
}
.floor.current .floor-no { color: var(--kor); text-shadow: 0 0 10px rgba(255,106,43,.7); }
.floor.ignite { animation: ignite 1.4s ease-out; }
@keyframes ignite {
  0% { box-shadow: 0 0 0 rgba(255,106,43,0); transform: scale(1); }
  25% { box-shadow: 0 0 50px rgba(255,140,60,.9), inset 0 0 30px rgba(255,200,120,.6); transform: scale(1.05); }
  100% { box-shadow: 0 0 22px rgba(255,106,43,.25); transform: scale(1); }
}

.meter { margin-top: 12px; }
.meter-label { display: flex; justify-content: space-between; font-size: 14px; color: var(--is); margin-bottom: 5px; }
.meter-label b { color: var(--pas); font-variant-numeric: tabular-nums; }
.meter-track {
  height: 12px; border-radius: 99px; background: #0d0e12; border: 1px solid var(--tas-kenar); overflow: hidden;
}
.meter-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--pas-koyu), var(--pas));
  box-shadow: 0 0 12px var(--pas);
  transition: width .45s cubic-bezier(.3,.8,.3,1);
}
.meter.pulse .meter-fill { animation: meterPulse .5s; }
@keyframes meterPulse { 50% { filter: brightness(1.8); } }
.tower-note { margin: 10px 0 0; font-size: 12px; color: var(--is); line-height: 1.3; }

.tower-current { display: none; margin-top: 6px; font-size: 13px; color: var(--kemik); line-height: 1.3; }
.tower-current b { color: var(--kor); }

/* ---------- Makine ---------- */
.machine { min-width: 0; }
.feature-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px;
  margin-bottom: 10px; padding: 8px 14px;
  background: linear-gradient(90deg, rgba(79,209,181,.14), rgba(79,209,181,.03));
  border: 1px solid var(--pas-koyu); border-radius: var(--radius);
  font-size: 15px;
}
.feature-bar.off { visibility: hidden; }
.feature-bar.summit-mode { background: linear-gradient(90deg, rgba(255,140,60,.22), rgba(255,106,43,.04)); border-color: var(--kor-koyu); }
.feature-name { font-family: var(--display); font-size: 22px; font-weight: 700; }
.feature-left b, .feature-total b { font-variant-numeric: tabular-nums; }
.feature-total { margin-left: auto; }
.mult {
  font-family: var(--display); font-weight: 900; font-size: 24px; line-height: 1;
  padding: 3px 12px; border-radius: 6px;
  background: var(--kor); color: #1b0a03;
  box-shadow: 0 0 16px rgba(255,106,43,.6);
}
.mult.bump { animation: bump .45s; }
@keyframes bump { 40% { transform: scale(1.35) rotate(-4deg); } }

.frame {
  position: relative;
  padding: 10px;
  background: linear-gradient(180deg, #2a2c37, #1a1b22);
  border: 1px solid var(--tas-kenar);
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.06);
}
.reels {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px;
}
.reel {
  position: relative;
  height: calc(var(--cell-h) * 3);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(0,0,0,.55), transparent 18%, transparent 82%, rgba(0,0,0,.55)),
    #101116;
  border-radius: 8px;
}
.reel.expanding { animation: expand 1s ease-out; }
@keyframes expand {
  0% { box-shadow: inset 0 0 0 rgba(255,106,43,0); }
  40% { box-shadow: inset 0 0 40px rgba(255,140,60,.9), 0 0 30px rgba(255,106,43,.7); }
  100% { box-shadow: inset 0 0 14px rgba(255,106,43,.4); }
}
.strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.cell {
  position: relative;
  height: var(--cell-h);
  display: grid; place-items: center;
  transition: opacity .25s, filter .25s;
}
.cell > svg { width: 84%; height: 84%; overflow: visible; filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
.reels.showing .cell { opacity: .32; filter: saturate(.4); }
.reels.showing .cell.hit { opacity: 1; filter: none; }
.cell.hit > svg { animation: hit .9s ease-in-out infinite; }
@keyframes hit { 50% { transform: scale(1.1); filter: drop-shadow(0 0 10px rgba(255,190,90,.9)); } }

.cell.smolder > svg { opacity: 0; }
.cell.smolder::before {
  content: ''; position: absolute; inset: 18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,120,50,.35), transparent 70%);
  animation: smolder 1s ease-in-out infinite;
}
@keyframes smolder { 50% { transform: scale(1.2); opacity: .5; } }
.cell.breath > svg { animation: breathIn .8s ease-out; }
.cell.breath::after {
  content: ''; position: absolute; inset: -10%;
  background: radial-gradient(circle, rgba(255,240,180,.95), rgba(255,120,40,.7) 35%, rgba(200,40,10,0) 70%);
  animation: flame .8s ease-out forwards; pointer-events: none;
}
@keyframes flame { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes breathIn { 0% { transform: scale(.3) rotate(-20deg); opacity: 0; } 100% { transform: none; opacity: 1; } }

.rune-mark {
  position: absolute; right: 6%; top: 6%;
  width: 30%; aspect-ratio: 1;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79,209,181,.9), rgba(23,89,79,.9) 60%, rgba(23,89,79,0) 72%);
  box-shadow: 0 0 12px var(--pas);
  animation: runeIn .5s cubic-bezier(.3,1.6,.5,1);
  z-index: 2;
}
.rune-mark svg { width: 62%; height: 62%; fill: none; stroke: #eafffa; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@keyframes runeIn { from { transform: scale(0); } }
.rune-fly {
  position: fixed; z-index: 50; width: 18px; height: 18px; border-radius: 50%;
  background: radial-gradient(circle, #eafffa, var(--pas) 50%, transparent 70%);
  box-shadow: 0 0 14px var(--pas);
  pointer-events: none;
}

.lines { position: absolute; inset: 10px; width: calc(100% - 20px); height: calc(100% - 20px); pointer-events: none; overflow: visible; }
.lines polyline {
  fill: none; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 4px currentColor);
}

.win-banner {
  position: absolute; left: 50%; bottom: -22px; transform: translateX(-50%) scale(.6);
  padding: 10px 26px 12px;
  background: rgba(14, 10, 8, .88);
  border: 1px solid var(--altin);
  border-radius: 12px;
  text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .3s cubic-bezier(.3,1.5,.5,1);
  white-space: nowrap;
  z-index: 5;
}
.win-banner.show { opacity: 1; transform: translateX(-50%) scale(1); }
.win-banner .wb-label { display: block; font-family: var(--display); font-size: 22px; color: var(--altin); }
.win-banner .wb-amount { display: block; font-size: 40px; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff4d8; text-shadow: 0 0 18px rgba(255,170,60,.7); }
.win-banner.big .wb-label { font-size: 30px; }
.win-banner.big .wb-amount { font-size: 54px; }

.ticker {
  min-height: 24px; margin-top: 30px; text-align: center;
  font-size: 15px; color: var(--is);
}
.ticker b { color: var(--kemik); }

/* ---------- Kontroller ---------- */
.controls {
  display: grid;
  grid-template-columns: 1fr auto auto auto 1fr;
  align-items: center;
  gap: 20px;
  max-width: 980px; width: 100%; margin: 0 auto;
  padding: 12px 20px max(16px, env(safe-area-inset-bottom));
}
.readout { display: flex; flex-direction: column; gap: 2px; }
.readout-win { text-align: right; align-items: flex-end; }
.readout-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--is); }
.readout-value { font-size: 22px; font-variant-numeric: tabular-nums; }
.readout-win .readout-value { color: var(--altin); }
.bet { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.bet-row { display: flex; align-items: center; gap: 10px; }
.bet-row .readout-value { min-width: 94px; text-align: center; }
.step {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--tas-2); border: 1px solid var(--tas-kenar);
  font-size: 22px; line-height: 1;
}
.step:disabled { opacity: .35; cursor: default; }

.spin {
  width: 86px; height: 86px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #ff9a5a, var(--kor) 45%, var(--kor-koyu));
  border: 5px solid #2a2c37;
  box-shadow: 0 0 0 1px var(--tas-kenar), 0 8px 30px rgba(255,106,43,.45), inset 0 -6px 12px rgba(0,0,0,.35);
  transition: transform .12s, filter .2s;
}
.spin svg { width: 46px; height: 46px; fill: none; stroke: #1b0a03; stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.spin:active { transform: scale(.95); }
.spin.busy svg { animation: spinIcon .7s linear infinite; }
.spin:disabled { filter: grayscale(.7) brightness(.7); cursor: default; }
.spin.auto-on { background: radial-gradient(circle at 50% 35%, #8ff0dc, var(--pas) 45%, var(--pas-koyu)); }
@keyframes spinIcon { to { transform: rotate(360deg); } }

.toggles { display: flex; flex-direction: column; gap: 6px; }
.pill {
  min-width: 96px; padding: 7px 12px; border-radius: 99px;
  background: var(--tas); border: 1px solid var(--tas-kenar);
  font-size: 14px; font-weight: 700;
}
.pill[aria-pressed="true"], .pill.on { border-color: var(--pas); color: var(--pas); box-shadow: 0 0 10px rgba(79,209,181,.25); }
.auto-wrap { position: relative; }
.auto-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px;
  padding: 6px; background: var(--tas-2); border: 1px solid var(--tas-kenar); border-radius: 10px;
}
.auto-menu button { padding: 8px 12px; background: var(--tas); border: 1px solid var(--tas-kenar); border-radius: 6px; font-weight: 700; }

/* ---------- Katmanlar ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 16px;
  background: radial-gradient(circle, rgba(18,19,24,.7), rgba(8,8,10,.92));
  animation: fadeIn .3s;
}
.overlay-card { text-align: center; max-width: 440px; animation: rise .5s cubic-bezier(.3,1.4,.5,1); }
.overlay-card .oc-eyebrow { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: var(--pas); }
.overlay-card h2 { margin: 6px 0; font-family: var(--display); font-weight: 900; font-size: 64px; line-height: .95; color: var(--kemik); text-shadow: 0 0 30px rgba(255,106,43,.7); }
.overlay-card p { margin: 8px 0 0; font-size: 18px; color: var(--kemik); }
.overlay-card .oc-amount { font-size: 44px; font-weight: 800; color: var(--altin); font-variant-numeric: tabular-nums; }
.overlay-card.summit-card h2 { color: var(--altin); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(30px) scale(.9); opacity: 0; } }

.toast {
  position: fixed; left: 50%; bottom: 130px; transform: translateX(-50%); z-index: 45;
  max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: 10px;
  background: #2a1610; border: 1px solid var(--kor-koyu); color: var(--kemik);
  font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.toast button { margin-left: 10px; padding: 4px 10px; border-radius: 6px; background: var(--kor); color: #1b0a03; border: 0; font-weight: 800; }

.info {
  width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 1px solid var(--tas-kenar); border-radius: 14px;
  background: #16171e; color: var(--kemik);
}
.info::backdrop { background: rgba(5,5,8,.75); }
.info-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: #16171e; border-bottom: 1px solid var(--tas-kenar); z-index: 1; }
.info-head h2 { margin: 0; font-family: var(--display); font-size: 28px; }
.info-body { padding: 8px 18px 22px; font-size: 15px; line-height: 1.5; }
.info-body h3 { font-family: var(--display); font-size: 22px; margin: 18px 0 8px; color: var(--altin); font-weight: 700; }
.info-body p { margin: 6px 0; color: #d5ccb9; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pay-item { display: grid; grid-template-columns: 54px 1fr; gap: 8px; align-items: center; padding: 8px; background: var(--tas); border-radius: 8px; }
.pay-item svg { width: 54px; height: 54px; }
.pay-item dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0 8px; font-size: 14px; font-variant-numeric: tabular-nums; }
.pay-item dt { color: var(--is); }
.pay-item dd { margin: 0; text-align: right; font-weight: 700; }
.pay-item.wide { grid-column: span 2; }
.rule-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.rule-table th, .rule-table td { padding: 6px 8px; border-bottom: 1px solid var(--tas-kenar); text-align: left; }
.rule-table th { color: var(--is); font-weight: 500; }
.line-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.line-mini { padding: 4px; background: var(--tas); border-radius: 6px; text-align: center; font-size: 12px; color: var(--is); }
.line-mini svg { display: block; width: 100%; height: auto; }

/* ---------- Mobil ---------- */
@media (max-width: 860px) {
  .stage { grid-template-columns: minmax(0, 1fr); align-content: center; gap: 12px; padding: 10px 16px 6px; }
  .topbar { padding: 8px 16px; gap: 10px; }
  .brand { font-size: 24px; }
  .topbar-meta { font-size: 13px; gap: 8px; }
  .demo-badge { display: none; }

  .tower { padding: 10px 12px; border-radius: 12px; }
  .tower-head { margin-bottom: 6px; }
  .tower-title { font-size: 20px; }
  .summit { display: none; }
  .floors { flex-direction: row-reverse; gap: 4px; }
  .floor { flex: 1; grid-template-columns: 1fr; padding: 6px 4px; text-align: center; }
  .floor-no { font-size: 22px; }
  .floor-name, .floor-desc { display: none; }
  .meter { margin-top: 8px; }
  .tower-note { display: none; }
  .tower-current { display: block; }
}

@media (max-width: 600px) {
  .controls {
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "bal bet win" "tog spin .";
    gap: 10px 8px; padding: 8px 16px max(12px, env(safe-area-inset-bottom));
  }
  .controls > .readout:first-child { grid-area: bal; }
  .bet { grid-area: bet; }
  .readout-win { grid-area: win; }
  .spin { grid-area: spin; width: 74px; height: 74px; }
  .toggles { grid-area: tog; flex-direction: row; justify-self: start; }
  .pill { min-width: 0; padding: 7px 10px; font-size: 13px; }
  .readout-value { font-size: 17px; }
  .bet-row { gap: 6px; }
  .bet-row .readout-value { min-width: 66px; }
  .step { width: 30px; height: 30px; font-size: 18px; }
  .frame { padding: 6px; border-radius: 12px; }
  .reels { gap: 4px; }
  .lines { inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); }
  .win-banner .wb-amount { font-size: 30px; }
  .win-banner.big .wb-amount { font-size: 38px; }
  .feature-bar.off { display: none; }
  .feature-bar { font-size: 14px; padding: 6px 10px; gap: 4px 12px; }
  .feature-name { font-size: 18px; }
  .overlay-card h2 { font-size: 48px; }
  .toast { bottom: 150px; }
}

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