@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; }

/* Eine feste Szene: Wüste am Tag. Kein Dunkelmodus, das Bedienfeld ist ohnehin dunkel. */
:root {
  color-scheme: light;
  --gold: #f2c548; --gold-hi: #fff1b0; --gold-lo: #8a5208;
  --ink: #2a1606;
  --text: #f6e8c6; --muted: #c9b48c;
  --panel: #2a1d14; --panel-hi: #3d2b1d;
  --g: clamp(4px, 1.4vw, 8px);
  /* Slotgröße: Breite oder Höhe begrenzt, je nachdem was knapper ist */
  --s: min(17.5vw, 94px, calc((100dvh - 400px) / 4.6));
  --u: calc(var(--s) + var(--g));
  --spin-scale: 1;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Cinzel", Georgia, serif; color: var(--text);
  background: #e9c88f;
  -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; }

.logo {
  font-family: "Cinzel Decorative", "Cinzel", serif; font-weight: 700; margin: 0; letter-spacing: .04em;
  font-size: clamp(30px, 7vw, 50px); 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 #5a3608) drop-shadow(0 0 10px rgba(255,255,255,.35));
}
.logo-small { font-size: clamp(18px, 4.6vw, 28px); text-align: left; }

/* ---------- Anmeldung ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px;
  background: linear-gradient(180deg, #5e9fd6 0%, #a9d1ee 55%, #f3d9a4 56%, #d9a865 100%); }
.login-card { width: min(380px, 100%); text-align: center; padding: 28px 22px; border-radius: 18px;
  background: linear-gradient(180deg, var(--panel-hi), var(--panel)); border: 2px solid rgba(242,197,72,.55);
  box-shadow: 0 20px 60px rgba(42,22,6,.45); }
.login-icon svg { width: 90px; height: 90px; filter: drop-shadow(0 0 16px rgba(242,197,72,.6)); }
.login-sub { color: var(--muted); margin: 8px 0 20px; }
#login-form { display: grid; gap: 12px; }
#pin { font: inherit; font-size: 22px; text-align: center; letter-spacing: .4em; padding: 12px; border-radius: 10px;
  background: #1a120c; color: var(--text); border: 1px solid #5b4430; }
#pin:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.login-error { color: #ffb199; min-height: 1.2em; margin: 0; font-size: 14px; }

/* ---------- Aufbau ---------- */
.game { min-height: 100dvh; display: flex; flex-direction: column; }
.scene { position: relative; flex: 1; min-height: calc(var(--u) * 4 + var(--s) + 130px); overflow: hidden;
  display: flex; flex-direction: column; }

/* Himmel */
.sky { position: absolute; inset: 0;
  background: linear-gradient(180deg, #4f93d1 0%, #86bde6 45%, #cfe6f2 78%, #f6e3b8 100%); }
.sun { position: absolute; top: 6%; left: 12%; width: 54px; height: 54px; border-radius: 50%;
  background: radial-gradient(circle, #fffbe6 0 40%, #ffe08a 60%, rgba(255,224,138,0) 72%);
  box-shadow: 0 0 60px 30px rgba(255,236,170,.55); }
.cloud { position: absolute; width: 150px; height: 60px; animation: cloud linear infinite; opacity: .95; }
.c1 { top: 13%; width: 160px; animation-duration: 95s; animation-delay: -20s; }
.c2 { top: 7%; width: 120px; animation-duration: 120s; animation-delay: -70s; }
.c3 { top: 26%; width: 100px; animation-duration: 80s; animation-delay: -45s; opacity: .85; }
.c4 { top: 34%; width: 130px; animation-duration: 140s; animation-delay: -110s; opacity: .8; }
@keyframes cloud { from { transform: translateX(-200px); } to { transform: translateX(calc(100vw + 40px)); } }
.dune-far { position: absolute; left: -10%; right: -10%; bottom: 46px; height: 70px;
  background: radial-gradient(ellipse 40% 100% at 20% 100%, #e7c486 0 60%, transparent 61%),
              radial-gradient(ellipse 50% 100% at 80% 100%, #dfb877 0 60%, transparent 61%); }

/* Kopfzeile */
.top { position: relative; z-index: 3; width: min(1000px, 100%); margin: 0 auto; display: flex; justify-content: space-between; align-items: center;
  padding: max(8px, env(safe-area-inset-top)) 12px 0 16px; }
.menu { display: flex; gap: 2px; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px;
  background: rgba(42,22,6,.28); border: 1px solid rgba(255,255,255,.18); backdrop-filter: blur(4px); }
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: #fff6dc; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#btn-sound.off .wave { display: none; }
#btn-sound.off svg { opacity: .6; }

/* ---------- Pyramide ---------- */
.pyramid-wrap { position: relative; z-index: 3; margin-top: auto; display: flex; justify-content: center; }
.pyramid { position: relative; z-index: 2; width: calc(var(--u) * 4 + var(--s)); height: calc(var(--u) * 4 + var(--s)); margin-bottom: 26px; }
.pyramid-body { position: absolute; inset: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(90deg, rgba(255,240,200,.28) 0 50%, rgba(80,40,10,.22) 50% 100%),
    repeating-linear-gradient(180deg, transparent 0 calc(var(--u) - 2px), rgba(110,70,30,.45) calc(var(--u) - 2px) var(--u)),
    linear-gradient(180deg, #fff1b0 0, #f2c548 calc(var(--s) * 1.2), #c8891c calc(var(--s) * 2 + var(--g) * 1.5),
      #e2b878 calc(var(--s) * 2 + var(--g) * 1.5 + 1px), #d4a462 60%, #b98647 100%);
  filter: drop-shadow(0 6px 12px rgba(90,50,10,.35)); }
.pyramid.summit .pyramid-body { animation: summit 1.2s ease-in-out 3; }
@keyframes summit { 50% { filter: drop-shadow(0 0 40px #fff1b0) brightness(1.25); } }

.rows { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column-reverse; gap: var(--g); align-items: center; }
.row { position: relative; display: flex; gap: var(--g); }
.row-label { position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); white-space: nowrap;
  font-size: clamp(10px, 2.6vw, 13px); padding: 3px 8px; border-radius: 999px; color: #fff6dc;
  background: rgba(42,22,6,.55); border: 1px solid rgba(242,197,72,.5); }
.row-label b { color: var(--gold-hi); }
.row.active .row-label { background: linear-gradient(180deg, #fff1b0, #f2c548); color: var(--ink); border-color: #8a5208; }
.row.active .row-label b { color: var(--ink); }

.slot { position: relative; width: var(--s); height: var(--s); border-radius: 7px; overflow: hidden;
  background: linear-gradient(180deg, #e9d5a8, #f8ecd0 50%, #d7bc87);
  box-shadow: inset 0 0 0 2px #6b4a2a, inset 0 6px 10px -6px rgba(0,0,0,.55), inset 0 -6px 10px -6px rgba(0,0,0,.45), 0 2px 0 rgba(255,255,255,.3);
  transition: filter .4s, box-shadow .4s; }
.strip { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.cell { height: var(--s); display: grid; place-items: center; }
.cell svg { width: 84%; height: 84%; filter: drop-shadow(0 2px 2px rgba(42,22,6,.4)); }
.slot.spinning .strip { filter: blur(1.2px); }
.slot.landed { animation: land .22s ease-out; }
@keyframes land { 40% { transform: translateY(3px); } }

/* Zustände der Ebenen */
/* Versiegelte Ebenen: Steinplatte mit goldenem Siegel, Symbol nur schwach erahnbar */
.row.locked .slot { background: linear-gradient(160deg, #c9a46a, #a37b47 60%, #8c6638);
  box-shadow: inset 0 0 0 2px #6b4a2a, inset 0 2px 0 rgba(255,240,200,.35), inset 0 -3px 6px rgba(60,30,5,.35); }
.row.locked .cell svg { opacity: .09; filter: grayscale(1); }
.row.locked .slot::after { content: ""; position: absolute; inset: 30%; border-radius: 50%;
  border: 2px solid #f2c548; box-shadow: 0 0 0 3px rgba(107,74,42,.6), inset 0 0 0 4px rgba(242,197,72,.25), 0 0 10px rgba(255,236,150,.35);
  background: radial-gradient(circle, #f2c548 0 18%, transparent 20%); }
.row.done .slot { filter: brightness(.82) saturate(.75); }
.row.active .slot { box-shadow: inset 0 0 0 2px #8a5208, 0 0 0 2px var(--gold), 0 0 18px rgba(255,236,150,.9); animation: glow 1.6s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: inset 0 0 0 2px #8a5208, 0 0 0 2px var(--gold-hi), 0 0 28px rgba(255,236,150,1); } }
.slot.hit::before { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit;
  background: radial-gradient(circle, rgba(255,230,120,.65), transparent 70%); animation: pulse .8s ease-in-out infinite alternate; }
.slot.hit svg { animation: dance .8s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@keyframes dance { to { transform: scale(1.1) rotate(-3deg); } }
.row.failed .slot { animation: shake .45s; filter: grayscale(.8) brightness(.7); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* Topf wandert sichtbar nach oben */
.pot-fly { position: absolute; z-index: 5; pointer-events: none; padding: 4px 10px; border-radius: 999px;
  font-weight: 700; color: var(--ink); background: linear-gradient(180deg, #fff1b0, #f2c548); border: 1px solid #8a5208;
  box-shadow: 0 0 18px rgba(255,236,150,.9); transition: transform .8s cubic-bezier(.3,.7,.3,1), opacity .3s .7s; }

/* Palmen */
.palm { position: absolute; bottom: 22px; width: calc(var(--s) * 1.1); height: calc(var(--s) * 1.5); z-index: 1; }
.palm-l { left: max(2%, calc(50% - var(--u) * 2 - var(--s) * 1.5)); }
.palm-r { right: max(4%, calc(50% - var(--u) * 2 - var(--s) * 1.4)); }
.palm-r2 { right: max(-1%, calc(50% - var(--u) * 2 - var(--s) * 2)); width: calc(var(--s) * .8); height: calc(var(--s) * 1.1); }
.palm .fronds { transform-origin: 62px 54px; animation: sway 4s ease-in-out infinite alternate; }
.palm-r .fronds { animation-delay: -1.3s; } .palm-r2 .fronds { animation-delay: -2.6s; }
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(4deg); } }

/* Sand im Wind */
.ground { position: absolute; left: 0; right: 0; bottom: 0; height: 52px; z-index: 2; overflow: hidden;
  background: linear-gradient(180deg, #ecca8c, #d9ab68 60%, #c89654); }
.ground::before { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(170deg, transparent 0 14px, rgba(255,255,255,.12) 14px 15px); }
.wind { position: absolute; left: -40%; width: 40%; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(255,248,225,.85), transparent); animation: wind linear infinite; }
.w1 { top: 10px; animation-duration: 3.2s; }
.w2 { top: 26px; animation-duration: 4.1s; animation-delay: -1.5s; width: 30%; }
.w3 { top: 40px; animation-duration: 2.7s; animation-delay: -.7s; width: 50%; }
@keyframes wind { to { left: 110%; } }
.ground::after { content: ""; position: absolute; inset: 0; opacity: .7;
  background-image: radial-gradient(1.4px 1.4px at 10% 30%, #fff3d0, transparent), radial-gradient(1px 1px at 40% 60%, #fff3d0, transparent),
    radial-gradient(1.2px 1.2px at 70% 20%, #fff3d0, transparent), radial-gradient(1px 1px at 85% 75%, #fff3d0, transparent);
  background-size: 180px 52px; animation: grains 2.4s linear infinite; }
@keyframes grains { to { background-position: 180px -6px; } }

/* Sandsturm über die ganze Szene */
.storm { position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(100deg, rgba(226,190,132,0) 0 12px, rgba(226,190,132,.75) 12px 15px, rgba(226,190,132,0) 15px 30px),
              radial-gradient(ellipse at 50% 60%, rgba(214,170,100,.85), rgba(214,170,100,.15) 75%); }
.storm.on { animation: storm 1.4s ease-in-out forwards; }
@keyframes storm { 0% { opacity: 0; transform: translateX(-40%); } 35%, 65% { opacity: 1; } 100% { opacity: 0; transform: translateX(40%); } }

/* ---------- Bedienfeld ---------- */
.panel { position: relative; z-index: 4; width: min(740px, calc(100% - 20px)); margin: -10px auto max(10px, env(safe-area-inset-bottom)); padding: 12px 14px 10px;
  border-radius: 16px; background: linear-gradient(180deg, var(--panel-hi), var(--panel));
  border: 2px solid rgba(242,197,72,.55); box-shadow: 0 -6px 24px rgba(42,22,6,.35); display: grid; gap: 10px; }
.panel-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.purse, .pot { display: flex; align-items: center; gap: 8px; }
.purse small, .pot small { display: block; font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.purse b, .pot b { font-size: 21px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.pot { flex-direction: column; align-items: flex-end; gap: 0; text-align: right; }
.pot b { font-size: 24px; text-shadow: 0 0 12px rgba(242,197,72,.6); }
.pot.bump b, .purse.bump b { animation: bump .45s; }
@keyframes bump { 50% { transform: scale(1.2); color: #fff; } }
.coin { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1b0, #f2c548 45%, #8a5208);
  box-shadow: 0 0 0 2px #5a3608 inset; }
.message { margin: 0; min-height: 2.6em; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: clamp(13px, 3.5vw, 15px); line-height: 1.3; }
.message b { color: var(--gold-hi); }

.ctl-idle { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.bet { display: flex; align-items: center; gap: 6px; }
.bet-value { display: grid; text-align: center; min-width: 48px; }
.bet-value small { font-size: 10px; color: var(--muted); }
.bet-value b { font-size: 20px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.round-btn { width: 36px; height: 36px; border-radius: 50%; font-size: 20px; line-height: 1;
  background: linear-gradient(180deg, #4a3624, #2a1d14); border: 1px solid rgba(242,197,72,.5); color: var(--gold); }
.spin { width: 92px; height: 92px; 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 6px rgba(242,197,72,.55), 0 8px 24px rgba(242,160,60,.35), inset 0 -6px 12px rgba(90,54,8,.7);
  font-weight: 700; color: var(--ink); font-size: 16px; letter-spacing: .05em; transition: transform .12s; }
.spin:not(:disabled):active { transform: scale(.94); }
.spin.busy { animation: busy 1s linear infinite; }
@keyframes busy { 50% { box-shadow: 0 0 0 4px #2a1606, 0 0 0 6px var(--gold-hi), 0 8px 30px rgba(255,236,150,.8), inset 0 -6px 12px rgba(90,54,8,.7); } }
.pill { justify-self: end; min-width: 76px; padding: 8px 12px; border-radius: 999px; font-size: 13px;
  background: #1a120c; border: 1px solid #5b4430; color: var(--muted); }
.pill[aria-pressed="true"] { color: var(--ink); background: linear-gradient(180deg, #fff1b0, #f2c548); border-color: var(--gold); font-weight: 700; }
.ctl-ready { display: flex; justify-content: center; }
.spin-climb { width: auto; height: 60px; padding: 0 30px; border-radius: 999px; }

.next-info { margin: 0 0 8px; text-align: center; font-size: 13px; color: var(--muted); }
.next-info b { color: var(--gold-hi); }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.choice { display: grid; gap: 2px; padding: 10px 6px; border-radius: 12px; border: 1px solid; text-align: center; }
.choice b { font-size: clamp(12px, 3.3vw, 14px); }
.choice small { font-family: Georgia, serif; font-size: 12px; opacity: .9; }
.c-take { background: linear-gradient(180deg, #3f6b3a, #24411f); border-color: #7fb06f; color: #eaf7de; }
.c-half { background: linear-gradient(180deg, #4a3624, #2a1d14); border-color: var(--gold); color: var(--gold-hi); }
.c-all { background: linear-gradient(180deg, #ff8a5c, #c8361b 55%, #6e140a); border-color: #ffb08a; color: #fff1d6;
  box-shadow: 0 0 16px rgba(200,54,27,.5); }

.btn { padding: 11px 20px; border-radius: 10px; border: 1px solid transparent; font-weight: 700; letter-spacing: .03em; }
.btn-gold { color: var(--ink); background: linear-gradient(180deg, #fff1b0, #f2c548 50%, #c8891c); border-color: #8a5208; }
.refill { justify-self: center; }
.fine { margin: 0; text-align: center; color: var(--muted); font-size: 10px; opacity: .75; }

/* ---------- 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, var(--panel-hi), var(--panel)); border: 2px solid rgba(242,197,72,.55);
  box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.dlg::backdrop { background: rgba(42,22,6,.55); 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; }
.rules { font-family: Georgia, serif; font-size: 14px; line-height: 1.5; }
.rules p { margin: 8px 0; } .rules ul { margin: 4px 0 8px; padding-left: 20px; }
.rules b { color: var(--gold-hi); }
.paytable { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; margin: 8px 0; }
.pay { display: flex; align-items: center; gap: 8px; padding: 5px; border-radius: 10px; background: rgba(0,0,0,.25); font-size: 13px; }
.pay svg { width: 44px; height: 44px; flex: none; background: linear-gradient(180deg, #e9d5a8, #d7bc87); border-radius: 7px; padding: 2px; }
.pay span { color: var(--muted); } .pay b { color: var(--gold-hi); }
.levels { display: grid; gap: 6px; margin: 10px 0; }
.lvl { display: grid; grid-template-columns: 76px 1fr; gap: 8px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(0,0,0,.25); }
.lvl strong { color: var(--gold); font-family: "Cinzel", serif; font-size: 13px; }
.lvl small { display: block; 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: 46px 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; }
.history .lost { color: #ff9a7a; }

/* Münzregen */
.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); } }

@media (min-width: 700px) { :root { --s: min(94px, calc((100dvh - 380px) / 4.6)); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
