@font-face { font-family: "Cinzel"; src: url(fonts/cinzel-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url(fonts/cinzel-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cinzel Decorative"; src: url(fonts/cinzel-decorative-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

/* Das Spiel ist bewusst immer dunkel: ein Grab bei Fackellicht. */
:root {
  color-scheme: dark;
  --bg: #0d0a14;
  --stone: #2b2132;
  --stone-hi: #43354a;
  --sandstone: #b78a4f;
  --gold: #f2c548;
  --gold-hi: #fff1b0;
  --gold-lo: #8a5208;
  --lapis: #1f3f9e;
  --karneol: #c8361b;
  --tuerkis: #22a99a;
  --text: #f3e6c8;
  --muted: #b6a68a;
  --cell: min(17vw, 120px, calc((100dvh - 330px) / 3));
  --gap: 6px;
  --cell-h: var(--cell);
  --spin-ms: 1;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Cinzel", Georgia, serif;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
[hidden] { display: none !important; }

/* ---------- Grabkammer im Hintergrund ---------- */
.tomb {
  position: fixed; inset: 0; z-index: -1; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 45% at 50% 40%, rgba(242, 160, 60, .16), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 58px, rgba(0,0,0,.35) 58px 60px),
    repeating-linear-gradient(90deg, transparent 0 118px, rgba(0,0,0,.28) 118px 120px),
    linear-gradient(180deg, #1c1420 0%, #120d18 60%, #0a070e 100%);
}
.tomb::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 50%, transparent 40%, rgba(0,0,0,.75) 100%);
}
.torch { position: absolute; top: 18%; width: 18px; height: 70px; border-radius: 4px;
  background: linear-gradient(#6b4a2a, #2c1c10); }
.torch-l { left: 3%; } .torch-r { right: 3%; }
.torch span { position: absolute; left: 50%; bottom: 100%; width: 34px; height: 52px; transform: translateX(-50%);
  border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
  background: radial-gradient(ellipse at 50% 75%, #fff6c8 0%, #ffb53a 35%, #e0541a 65%, transparent 72%);
  filter: blur(1px); animation: flame 1.6s infinite alternate ease-in-out; transform-origin: 50% 100%; }
.torch span::after { content: ""; position: absolute; inset: -140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,170,60,.22), transparent 60%); animation: glow 2.3s infinite alternate; }
@keyframes flame {
  0% { transform: translateX(-50%) scale(1, 1) skewX(0deg); }
  33% { transform: translateX(-50%) scale(.92, 1.08) skewX(-4deg); }
  66% { transform: translateX(-50%) scale(1.05, .95) skewX(3deg); }
  100% { transform: translateX(-50%) scale(.97, 1.04) skewX(-2deg); }
}
@keyframes glow { from { opacity: .7; } to { opacity: 1; } }
.dust { position: absolute; inset: 0; opacity: .5;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, #f6d77a, transparent),
    radial-gradient(1px 1px at 70% 60%, #f6d77a, transparent),
    radial-gradient(1.2px 1.2px at 40% 80%, #f6d77a, transparent),
    radial-gradient(1px 1px at 85% 20%, #f6d77a, transparent),
    radial-gradient(1.3px 1.3px at 10% 70%, #f6d77a, transparent);
  background-size: 300px 300px; animation: drift 40s linear infinite; }
@keyframes drift { to { background-position: 300px -600px; } }
@media (max-width: 700px) { .torch { display: none; } }

/* ---------- Schrift & Logo ---------- */
.logo {
  font-family: "Cinzel Decorative", "Cinzel", serif; font-weight: 700; margin: 0;
  font-size: clamp(30px, 7vw, 52px); letter-spacing: .04em; text-align: center;
  background: linear-gradient(180deg, var(--gold-hi) 10%, var(--gold) 45%, var(--gold-lo) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #2a1606) drop-shadow(0 0 18px rgba(242,197,72,.35));
}
.logo-small { font-size: clamp(20px, 4.6vw, 30px); text-align: left; }

/* ---------- Anmeldung ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); text-align: center; padding: 32px 24px;
  background: linear-gradient(180deg, rgba(67,53,74,.75), rgba(28,20,32,.85));
  border: 2px solid rgba(242,197,72,.45); border-radius: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.login-ankh svg { width: 84px; height: 84px; filter: drop-shadow(0 0 16px rgba(242,197,72,.5)); animation: hover 3s ease-in-out infinite alternate; }
@keyframes hover { to { transform: translateY(-6px); } }
.login-sub { color: var(--muted); margin: 8px 0 22px; }
#login-form { display: grid; gap: 12px; }
#pin { font: inherit; font-size: 22px; text-align: center; letter-spacing: .4em; padding: 12px; border-radius: 10px;
  background: #120d18; color: var(--text); border: 1px solid var(--stone-hi); }
#pin:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.login-error { color: #ff9a7a; min-height: 1.2em; margin: 0; font-size: 14px; }

/* ---------- Kopfzeile ---------- */
.game { max-width: 920px; margin: 0 auto; padding: max(10px, env(safe-area-inset-top)) 16px max(14px, env(safe-area-inset-bottom));
  min-height: 100dvh; display: flex; flex-direction: column; gap: 10px; }
.top { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "logo menu" "purse purse"; align-items: center; gap: 8px; }
.top .logo { grid-area: logo; }
.menu { grid-area: menu; display: flex; gap: 4px; }
.purse { grid-area: purse; justify-self: center; display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 8px;
  border-radius: 999px; background: linear-gradient(180deg, #1e1524, #0f0a14); border: 1px solid rgba(242,197,72,.4);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.purse-value { font-weight: 700; font-size: 20px; color: var(--gold-hi); font-variant-numeric: tabular-nums; min-width: 4ch; text-align: right; }
.purse-unit { color: var(--muted); font-size: 12px; }
.coin { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b0, #f2c548 45%, #8a5208);
  box-shadow: 0 0 0 2px #5a3608 inset; }
.purse.bump .purse-value { animation: bump .4s; }
@keyframes bump { 50% { transform: scale(1.18); color: #fff; } }
@media (min-width: 640px) {
  .top { grid-template-columns: 1fr auto auto; grid-template-areas: "logo purse menu"; }
}
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: transparent;
  border: 1px solid transparent; }
.icon-btn:hover, .icon-btn:focus-visible { border-color: rgba(242,197,72,.35); background: rgba(242,197,72,.06); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg path:first-child { fill: none; }
#btn-sound.off .wave { display: none; }
#btn-sound.off svg { stroke: var(--muted); }

/* ---------- Automat ---------- */
.cabinet { position: relative; padding: 10px; border-radius: 18px;
  background: linear-gradient(180deg, #6e5130 0%, #8d6a3d 8%, #5a4026 50%, #3a2816 100%);
  box-shadow: 0 0 0 2px #2a1606, 0 0 0 4px rgba(242,197,72,.55), 0 30px 60px rgba(0,0,0,.7); }
.cabinet::before { /* Steinstruktur */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .25;
  background: repeating-linear-gradient(115deg, transparent 0 7px, rgba(0,0,0,.25) 7px 8px); }
.lintel { position: relative; display: flex; justify-content: center; padding: 2px 0 8px; }
.glyphs { display: flex; gap: clamp(6px, 2vw, 18px); }
.glyphs svg { width: clamp(22px, 5vw, 34px); height: clamp(22px, 5vw, 34px); filter: sepia(1) saturate(.6) brightness(.9) drop-shadow(0 1px 0 #2a1606); opacity: .85; }
.machine { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: stretch; }
.pillar { width: 14px; border-radius: 6px;
  background: linear-gradient(90deg, #8a5208, #f2c548 40%, #fff1b0 50%, #f2c548 60%, #8a5208),
              repeating-linear-gradient(180deg, transparent 0 18px, rgba(0,0,0,.4) 18px 20px);
  background-blend-mode: multiply; }
.window { position: relative; justify-self: center; padding: var(--gap); border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, #05030a, #120c1a 50%, #05030a);
  box-shadow: inset 0 0 0 2px #2a1606, inset 0 0 30px rgba(0,0,0,.9); }
.reels { display: grid; grid-template-columns: repeat(5, var(--cell)); gap: var(--gap); }
.reel { position: relative; height: calc(var(--cell-h) * 3); overflow: hidden; border-radius: 8px;
  background: linear-gradient(180deg, #e9d5a8, #f6e8c6 50%, #d7bc87);
  box-shadow: inset 0 10px 14px -8px rgba(0,0,0,.6), inset 0 -10px 14px -8px rgba(0,0,0,.6); }
.reel::after { /* Lichtkante oben/unten */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,.45), transparent 18%, transparent 82%, rgba(0,0,0,.45)); }
.strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.cell { height: var(--cell-h); display: grid; place-items: center; position: relative; }
.cell svg { width: 82%; height: 82%; filter: drop-shadow(0 3px 2px rgba(42,22,6,.45)); transition: transform .2s; }
.reel.spinning .strip { filter: blur(1.4px); }
.reel.landed { animation: land .22s ease-out; }
@keyframes land { 40% { transform: translateY(5px); } }

/* Gewinn-Hervorhebung */
.reels.showing .cell:not(.hit) { opacity: .38; filter: grayscale(.5); transition: opacity .25s; }
.cell.hit::before { content: ""; position: absolute; inset: 4px; border-radius: 10px;
  background: radial-gradient(circle, rgba(242,197,72,.55), transparent 70%); animation: pulse .9s ease-in-out infinite alternate; }
.cell.hit svg { animation: dance .9s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .4; } to { opacity: 1; } }
@keyframes dance { from { transform: scale(1); } to { transform: scale(1.1) rotate(-2deg); } }
.lines { position: absolute; inset: var(--gap); width: calc(100% - 2 * var(--gap)); height: calc(100% - 2 * var(--gap)); pointer-events: none; overflow: visible; }
.lines polyline { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 4px currentColor); stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: draw .45s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Sandsturm */
.reel.storm::before { content: ""; position: absolute; inset: -20%; z-index: 2; pointer-events: none;
  background: repeating-linear-gradient(100deg, rgba(226,190,132,0) 0 10px, rgba(226,190,132,.85) 10px 13px, rgba(226,190,132,0) 13px 26px),
              radial-gradient(ellipse at 50% 50%, rgba(214,170,100,.9), rgba(214,170,100,0) 70%);
  animation: storm 1s ease-in-out forwards; }
@keyframes storm { 0% { opacity: 0; transform: translateX(-60%); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateX(60%); } }
.reel.wild-reel { box-shadow: 0 0 0 3px var(--karneol), 0 0 22px rgba(200,54,27,.8), inset 0 10px 14px -8px rgba(0,0,0,.6); }

/* Nachricht & Gewinn */
.message { min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 6px 2px; text-align: center; color: #f6e8c6; font-size: clamp(13px, 3.4vw, 16px); text-shadow: 0 1px 0 #2a1606; }
.win-amount { font-family: "Cinzel Decorative", serif; font-size: clamp(22px, 6vw, 34px); color: var(--gold-hi);
  text-shadow: 0 0 14px rgba(242,197,72,.8), 0 2px 0 #5a3608; font-variant-numeric: tabular-nums; }
.win-amount:empty { display: none; }
.win-amount.big { animation: bigwin 1.2s ease-in-out infinite alternate; }
@keyframes bigwin { to { transform: scale(1.12); text-shadow: 0 0 28px #fff1b0, 0 2px 0 #5a3608; } }

.feature-bar { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin: 0 0 8px; padding: 6px 14px;
  border-radius: 10px; font-size: 14px; background: linear-gradient(90deg, #6e140a, #c8361b, #6e140a); color: #fff1d6;
  box-shadow: 0 0 18px rgba(200,54,27,.6); }
.feature-bar b { color: var(--gold-hi); font-size: 18px; }
.fs-mult { font-size: 12px; opacity: .9; }
@media (max-width: 420px) { .fs-mult { display: none; } }
body.feature .cabinet { box-shadow: 0 0 0 2px #2a1606, 0 0 0 4px var(--karneol), 0 0 50px rgba(200,54,27,.55), 0 30px 60px rgba(0,0,0,.7); }

/* ---------- Bedienung ---------- */
.controls { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "bet spin side" "gamble gamble gamble" "refill refill refill";
  align-items: center; gap: 12px; padding: 4px 0; }
.bet { grid-area: bet; display: flex; align-items: center; gap: 8px; justify-self: start; }
.bet-value { display: grid; text-align: center; min-width: 54px; }
.bet-value small { font-size: 11px; color: var(--muted); }
.bet-value b { font-size: 22px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.round-btn { width: 40px; height: 40px; border-radius: 50%; font-size: 22px; line-height: 1;
  background: linear-gradient(180deg, #43354a, #1e1524); border: 1px solid rgba(242,197,72,.45); color: var(--gold); }
.spin { grid-area: spin; position: relative; width: 104px; height: 104px; border-radius: 50%; border: 0; padding: 0;
  background: radial-gradient(circle at 50% 35%, #fff1b0, #f2c548 35%, #c8891c 70%, #8a5208);
  box-shadow: 0 0 0 4px #2a1606, 0 0 0 7px rgba(242,197,72,.5), 0 10px 30px rgba(242,160,60,.35), inset 0 -6px 12px rgba(90,54,8,.7);
  transition: transform .12s; }
.spin:not(:disabled):active { transform: scale(.94); }
.spin-label { position: relative; font-weight: 700; font-size: 17px; color: #2a1606; letter-spacing: .06em; text-shadow: 0 1px 0 rgba(255,255,255,.5); }
.spin-ring { position: absolute; inset: 8px; border-radius: 50%; border: 2px dashed rgba(42,22,6,.45); }
.spin.busy .spin-ring { animation: turn 1s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }
.spin.stop .spin-label { font-size: 15px; }
.side { grid-area: side; display: flex; flex-direction: column; gap: 8px; justify-self: end; }
.pill { min-width: 84px; padding: 8px 12px; border-radius: 999px; font-size: 13px; background: #1e1524; border: 1px solid var(--stone-hi); color: var(--muted); }
.pill[aria-pressed="true"] { color: #2a1606; background: linear-gradient(180deg, #fff1b0, #f2c548); border-color: var(--gold); font-weight: 700; }
.gamble-bar { grid-area: gamble; display: flex; justify-content: center; gap: 10px; }
.refill { grid-area: refill; justify-self: center; }
.btn { padding: 11px 20px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; letter-spacing: .03em; }
.btn-gold { color: #2a1606; background: linear-gradient(180deg, #fff1b0, #f2c548 50%, #c8891c); border-color: #8a5208; box-shadow: 0 4px 14px rgba(242,197,72,.25); }
.btn-ghost { background: transparent; border-color: var(--stone-hi); color: var(--text); }
.btn-red { color: #fff1d6; background: linear-gradient(180deg, #ff8a5c, #c8361b 55%, #6e140a); border-color: #4a0d06; }
.btn-sand { color: #2a1606; background: linear-gradient(180deg, #fbeccb, #e2be84 60%, #a57940); border-color: #6b4a2a; }
.fine { text-align: center; color: var(--muted); font-size: 11px; margin: auto 0 0; opacity: .7; }

@media (max-width: 480px) {
  .spin { width: 88px; height: 88px; }
  .pill { min-width: 70px; padding: 7px 10px; }
  .round-btn { width: 36px; height: 36px; }
  .cabinet { padding: 8px 6px; }
  .pillar { width: 6px; }
  .machine { gap: 4px; }
  :root { --gap: 4px; --cell: 16.4vw; --cell-h: min(25vw, calc((100dvh - 360px) / 3)); }
  .logo-small { font-size: 19px; }
  .game { gap: 14px; }
}

/* ---------- Dialoge ---------- */
.dlg { width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 20px; border-radius: 16px;
  color: var(--text); background: linear-gradient(180deg, #2b2132, #160f1c); border: 2px solid rgba(242,197,72,.5);
  box-shadow: 0 30px 80px rgba(0,0,0,.8); }
.dlg::backdrop { background: rgba(5,3,10,.72); backdrop-filter: blur(3px); }
.dlg h2 { margin: 0 0 12px; text-align: center; color: var(--gold); font-family: "Cinzel Decorative", serif; }
.dlg h3 { color: var(--gold); font-size: 15px; margin: 18px 0 6px; }
.dlg form { display: flex; justify-content: center; margin-top: 16px; }
.paytable { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pay { display: grid; grid-template-columns: 56px 1fr; gap: 6px; align-items: center; padding: 6px; border-radius: 10px; background: rgba(0,0,0,.25); }
.pay svg { width: 56px; height: 56px; background: linear-gradient(180deg, #e9d5a8, #d7bc87); border-radius: 8px; padding: 3px; }
.pay dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0 8px; font-size: 13px; font-family: Georgia, serif; }
.pay dt { color: var(--muted); } .pay dd { margin: 0; color: var(--gold-hi); text-align: right; font-variant-numeric: tabular-nums; }
.pay .pay-name { grid-column: 1 / -1; font-size: 12px; color: var(--gold); }
.rules { font-family: Georgia, serif; font-size: 14px; line-height: 1.5; color: #e8dcc0; }
.rules p { margin: 8px 0; }
.line-map { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.line-map figure { margin: 0; text-align: center; }
.line-map svg { width: 100%; height: auto; }
.line-map figcaption { font-size: 11px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat { padding: 10px; border-radius: 10px; background: rgba(0,0,0,.25); }
.stat small { display: block; color: var(--muted); font-size: 11px; }
.stat b { color: var(--gold-hi); font-size: 18px; font-variant-numeric: tabular-nums; }
.history { list-style: none; padding: 0; margin: 0; font-family: Georgia, serif; font-size: 13px; max-height: 240px; overflow: auto; }
.history li { display: grid; grid-template-columns: 52px 1fr auto auto; gap: 10px; padding: 5px 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.history .t { color: var(--muted); } .history .w { color: var(--gold-hi); text-align: right; }
.history .b { color: var(--muted); text-align: right; min-width: 6ch; }

.dlg-gamble { text-align: center; }
.gamble-info { color: var(--muted); font-family: Georgia, serif; }
.gamble-info b { color: var(--gold-hi); }
.scale { width: min(320px, 100%); height: auto; }
#beam { transform-origin: 150px 46px; transition: transform 1s cubic-bezier(.3,1.6,.5,1); }
#beam .pan { transition: transform 1s cubic-bezier(.3,1.6,.5,1); }
#beam.tip-herz { transform: rotate(-14deg); }
#beam.tip-feder { transform: rotate(14deg); }
#beam.tip-herz .pan-l { transform: rotate(14deg); transform-origin: 60px 46px; }
#beam.tip-herz .pan-r { transform: rotate(14deg); transform-origin: 240px 46px; }
#beam.tip-feder .pan-l { transform: rotate(-14deg); transform-origin: 60px 46px; }
#beam.tip-feder .pan-r { transform: rotate(-14deg); transform-origin: 240px 46px; }
#beam.wobble { animation: wobble .9s ease-in-out infinite; }
@keyframes wobble { 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }
.g-result { min-height: 1.4em; font-size: 17px; }
.g-result.won { color: var(--gold-hi); } .g-result.lost { color: #ff9a7a; }
.gamble-choices { display: flex; gap: 12px; justify-content: center; margin: 8px 0 12px; }
.gamble-choices .btn { min-width: 120px; }

.dlg-feature { text-align: center; border-color: var(--karneol); }
.feature-sarg svg { width: 120px; height: 120px; filter: drop-shadow(0 0 24px rgba(242,197,72,.7)); animation: hover 2s ease-in-out infinite alternate; }
#f-text { font-family: Georgia, serif; font-size: 17px; line-height: 1.5; }
#f-text b { color: var(--gold-hi); font-size: 1.3em; }

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

/* Münzregen bei großen Gewinnen */
.coin-rain { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.coin-rain i { position: absolute; top: -40px; width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff1b0, #f2c548 45%, #8a5208); box-shadow: 0 0 0 2px #5a3608 inset;
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotateY(720deg); } }
