* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#hint {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(90deg) translateY(-37vmin);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity .4s;
}
#hint.off { opacity: 0; }

/* Quer liegender Button in der Mitte */
#go {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  padding: 0.9rem 2.2rem;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font: 800 1.15rem/1 inherit;
  font-family: inherit;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 0 0 0 rgba(255,255,255,0.6);
  transition: opacity .3s, background .3s;
  touch-action: none;
  z-index: 5;
}
#go:disabled { opacity: 0.35; }
#go.ready { animation: ready 1.4s ease-out infinite; }
#go.hidden { opacity: 0; pointer-events: none; }
#go.shake { animation: shake .4s; }

@keyframes ready {
  0%   { box-shadow: 0 0 0 0 rgba(255,255,255,0.55); }
  100% { box-shadow: 0 0 0 26px rgba(255,255,255,0); }
}
@keyframes shake {
  0%, 100% { transform: translate(-50%, -50%) rotate(90deg); }
  25% { transform: translate(-50%, calc(-50% - 8px)) rotate(90deg); }
  75% { transform: translate(-50%, calc(-50% + 8px)) rotate(90deg); }
}

#info {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  font: italic 600 16px/1 Georgia, serif;
  z-index: 5;
}

#sheet, .overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 10;
  touch-action: auto;
}
#sheet[hidden], .overlay[hidden] { display: none; }
.sheet-card {
  width: 100%; max-width: 460px; max-height: 88vh; overflow: auto;
  background: #141414;
  border-radius: 20px 20px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  -webkit-user-select: text; user-select: text;
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; font-size: 1.3rem; }
#close { background: none; border: 0; color: #fff; font-size: 2rem; line-height: 1; width: 40px; }
.sheet-card h3 {
  margin: 20px 0 8px;
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.5);
}
.sheet-card ol { padding-left: 1.2rem; line-height: 1.55; color: rgba(255,255,255,0.85); font-size: 0.95rem; }
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08);
}
.row select { background: #222; color: #fff; border: 1px solid #333; border-radius: 8px; padding: 6px 8px; max-width: 60%; }
.row input[type=checkbox] { width: 22px; height: 22px; accent-color: #34c759; }
.account {
  width: 100%; padding: 14px; border-radius: 12px; border: 0;
  background: #fff; color: #000; font-weight: 700; font-size: 1rem; opacity: 0.4;
}
.muted { margin-top: 8px; font-size: 0.85rem; color: rgba(255,255,255,0.5); line-height: 1.4; }

/* Zwischen den Runden: deutlich zeigen, wie viele Finger fehlen */
#hint.big {
  /* neben dem drehenden Ring in der Mitte */
  transform: translate(-50%, -50%) rotate(90deg) translateY(-37vmin);
  font-size: 1.35rem; font-weight: 700; color: #fff;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.45; } }

/* Gruppen-Modus: "Gruppe 1 / 2" bzw. "Finale" auf der anderen Seite des Rings */
#phase {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(90deg) translateY(37vmin);
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.85);
  white-space: nowrap;
  pointer-events: none;
}
#phase[hidden] { display: none; }

/* Startbildschirm: ein Tippen schaltet auf dem iPhone den Ton frei */
#splash {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 45%, #1a1030 0%, #000 70%);
  transition: opacity .4s;
}
#splash.gone { opacity: 0; pointer-events: none; }
#splash[hidden] { display: none; }
#splash .mark {
  width: 132px; height: 132px; border-radius: 30px;
  box-shadow: 0 0 60px rgba(255,31,45,0.45);
  animation: pop 2.4s ease-in-out infinite;
}
@keyframes pop { 50% { transform: scale(1.06); } }
#splash .logo {
  font-size: 3rem; font-weight: 900; letter-spacing: 0.02em;
  background: linear-gradient(90deg, #2ea8ff, #bf5af2, #ff5ec4);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#splash .tap {
  padding: 14px 30px; border-radius: 999px; background: #fff; color: #000;
  font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  animation: ready 1.4s ease-out infinite;
}
#splash .small { color: rgba(255,255,255,0.5); font-size: 0.9rem; }
.test {
  width: 100%; margin-top: 14px; padding: 12px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.3); background: transparent; color: #fff; font-weight: 700; font-size: 1rem;
}

/* ---------- Konto ---------- */
#savechip {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  padding: 10px 16px; border-radius: 999px; border: 0;
  background: #fff; color: #000; font-weight: 800; font-size: 0.9rem;
  box-shadow: 0 0 24px rgba(255,255,255,0.35);
  z-index: 6;
  animation: ready 1.6s ease-out infinite;
}
#savechip[hidden] { display: none; }

#account .tabs { display: flex; gap: 6px; background: #222; padding: 4px; border-radius: 12px; margin-bottom: 12px; }
#account .tabs button { flex: 1; padding: 10px; border: 0; border-radius: 9px; background: transparent; color: rgba(255,255,255,0.6); font-weight: 700; font-size: 0.95rem; }
#account .tabs button.on { background: #fff; color: #000; }
#account .field { display: block; margin: 10px 0; }
#account .field span { display: block; font-size: 0.8rem; color: rgba(255,255,255,0.55); margin-bottom: 5px; }
#account input {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #333; background: #1f1f1f; color: #fff;
  font-size: 16px; /* verhindert iOS-Zoom */
}
#account input:focus { outline: none; border-color: #bf5af2; }
#account button {
  padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.25);
  background: transparent; color: #fff; font-weight: 700; font-size: 0.95rem;
}
#account button.primary { width: 100%; border: 0; background: #fff; color: #000; margin-top: 6px; }
#account button.danger { border-color: rgba(255,31,45,0.6); color: #ff5a64; }
#account button:disabled { opacity: 0.5; }
#account .err { color: #ff5a64; font-size: 0.9rem; margin: 8px 0; }
#account .hello { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#account .tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#account .tile { background: #1f1f1f; border-radius: 12px; padding: 12px 8px; text-align: center; min-width: 0; }
#account .tile b { display: block; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#account .tile span { font-size: 0.72rem; color: rgba(255,255,255,0.55); }
#account .games { list-style: none; }
#account .game { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
#account .game.editing { display: block; }
#account .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: 0 0 10px currentColor; }
#account .gmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#account .gmain span { font-size: 0.8rem; color: rgba(255,255,255,0.5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#account .amount { white-space: nowrap; }
#account .edit-head { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: rgba(255,255,255,0.6); }
#account .row-btns { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
#account .row-btns button { flex: 1; }
#account .row-btns button.primary { flex: 2; margin-top: 0; }
#account .manage form { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 8px; margin-top: 12px; }
#account .manage > button { width: 100%; margin-top: 14px; }
#account .manage button.danger { width: 100%; margin-top: 6px; }
#account .ok { color: #33e07a; font-size: 0.9rem; margin: 8px 0; }
#account button.link { width: 100%; border: 0; margin-top: 8px; color: rgba(255,255,255,0.65); font-weight: 600; }
#account a, .legal a { color: #bf9bff; }
.legal { margin-top: 22px; display: flex; gap: 18px; font-size: 0.85rem; }

/* Sound- & Look-Pakete */
.packs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pack {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 14px; border-radius: 14px; border: 2px solid transparent; color: #fff; min-width: 0;
}
.pack.on { border-color: #fff; box-shadow: 0 0 18px rgba(255,255,255,0.25); }
.pack .pk-emoji { font-size: 1.6rem; line-height: 1.2; }
.pack b { font-size: 1rem; }
.pack small { font-size: 0.75rem; color: rgba(255,255,255,0.65); line-height: 1.3; }

/* ---------- Rechnung & Teilen ---------- */
#endbtn {
  position: fixed;
  left: calc(16px + env(safe-area-inset-left));
  bottom: calc(16px + env(safe-area-inset-bottom));
  padding: 12px 18px; border-radius: 999px; border: 0;
  background: #fff; color: #000; font-weight: 800; font-size: 0.95rem;
  box-shadow: 0 0 26px rgba(255,255,255,0.4);
  z-index: 6; animation: ready 1.6s ease-out infinite;
}
#endbtn[hidden] { display: none; }
.end-form { display: grid; gap: 10px; margin-top: 12px; }
.end-row { display: grid; grid-template-columns: 1fr 96px; gap: 10px; }
.end-field { display: block; min-width: 0; }
.end-field > span:first-child { display: block; font-size: 0.8rem; color: rgba(255,255,255,0.55); margin-bottom: 5px; }
.end-field input {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #333; background: #1f1f1f; color: #fff; font-size: 16px;
}
.end-field input:focus { outline: none; border-color: #bf5af2; }
.end-name-row { display: flex; align-items: center; gap: 10px; }
#end-dot { width: 22px; height: 22px; border-radius: 50%; flex: none; box-shadow: 0 0 12px currentColor; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #222; padding: 4px; border-radius: 12px; }
.seg button { padding: 10px 4px; border: 0; border-radius: 9px; background: transparent; color: rgba(255,255,255,0.65); font-weight: 700; font-size: 0.8rem; }
.seg button.on { background: #fff; color: #000; }
.end-result { font-weight: 700; min-height: 1.4em; }
.end-preview { display: block; width: 46%; max-width: 220px; aspect-ratio: 9 / 16; height: auto; margin: 14px auto; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.big-btn { width: 100%; padding: 15px; border: 0; border-radius: 14px; background: linear-gradient(90deg,#2ea8ff,#bf5af2,#ff5ec4); color: #fff; font-weight: 800; font-size: 1rem; }
.ghost-btn { width: 100%; margin-top: 8px; padding: 12px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.25); background: transparent; color: #fff; font-weight: 700; }
.end-fallback { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; font-size: 0.9rem; }
.end-fallback[hidden] { display: none; }
.end-fallback a { color: #bf9bff; font-weight: 700; }
.linkish { background: none; border: 0; color: #bf9bff; font: inherit; font-weight: 700; padding: 0; text-decoration: underline; }
.promo { margin-top: 20px; padding: 14px; border-radius: 14px; background: #101a0c; border: 1px solid rgba(109,148,80,0.4); position: relative; }
.promo b { font-size: 1rem; }
.promo p { font-size: 0.88rem; color: rgba(255,255,255,0.75); margin: 4px 0 6px; }
.promo a { color: #a8d983; font-weight: 700; font-size: 0.9rem; }
.promo-tag { position: absolute; top: 10px; right: 12px; font-size: 0.65rem; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.4); }
