/**
 * Shared kiosk game layout – all games (Candy, Simon, Memory).
 * Uses --kiosk-* tokens from simon.css (:root).
 */

/* Shared HUD / chrome */
.logo,
#countdown,
#score {
  pointer-events: none;
}

#closegame {
  pointer-events: auto;
}

/* Ocean background (all game pages) */
#oceanContainer {
  position: fixed !important;
  inset: 0;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 1;
  pointer-events: none;
  background: #00a5ff;
}

/* Candy board area */
.game-stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
}

.game-stage #game_div {
  position: relative;
  width: calc(var(--kiosk-game-board) * var(--game-board-scale, 1));
  height: calc(var(--kiosk-game-board) * var(--game-board-scale, 1));
  max-width: calc(100vw - 2 * var(--logo-inset-left, 24px));
  max-height: calc(100vh - 2 * var(--logo-inset-left, 24px));
  touch-action: none;
  pointer-events: auto;
}

.game-stage #gameBoard {
  position: absolute;
  inset: 0;
  z-index: 10;
  margin: 0;
  pointer-events: auto;
  touch-action: none;
}

.game-stage #gameBoard img {
  touch-action: none;
  -webkit-user-drag: none;
  user-select: none;
}

.game-stage #canvas {
  position: relative;
  z-index: 50;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.7;
  pointer-events: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

body.candy-dragging {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

body.candy-dragging #gameBoard img.candy-drag-active {
  z-index: 60;
}

body.candy-dragging #closegame {
  pointer-events: none;
}

/* Memory board */
#memory-wrap {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--kiosk-game-board) * var(--game-board-scale, 1));
  max-width: calc(100vw - 2 * var(--logo-inset-left));
  z-index: 20;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#memory-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 1.2vmin, 12px);
  touch-action: none;
}

.memory-card {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid #ffffff;
  border-radius: clamp(8px, 1.2vmin, 10px);
  background: #00a5ff;
  cursor: pointer;
  overflow: hidden;
  /* none: kein Pinch/Zoom/Scroll, Multi-Touch bleibt bei uns kontrollierbar */
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  padding: 0;
  font: inherit;
  color: inherit;
}

.memory-card img {
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}

.memory-card-front,
.memory-card-back {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
}

.memory-card-front {
  font-family: var(--font-family-heading);
  font-size: clamp(28px, 5vmin, 48px);
  font-weight: normal;
  color: #ffffff;
  opacity: 1;
}

.memory-card-back {
  opacity: 0;
  background: #ffffff;
}

.memory-card-back img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.memory-card.open .memory-card-front,
.memory-card.matched .memory-card-front {
  opacity: 0;
  pointer-events: none;
}

.memory-card.open .memory-card-back,
.memory-card.matched .memory-card-back {
  opacity: 1;
}

.memory-card.matched {
  border-color: #ffffff;
  opacity: 0.85;
}

/* Simon playfield */
.wrapper {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  top: auto;
  left: auto;
  transform: none;
  z-index: 2;
  border-radius: 0;
  pointer-events: none;
}

.wrapper .simon,
.wrapper .color-part {
  pointer-events: auto;
}

/* Game-over overlay */
#result_container.container {
  z-index: 50;
}

.hidegame {
  display: none !important;
}

/* Ausgabe screen */
.ausgabe-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: clamp(16px, 2.5vmin, 24px);
}

.ausgabe-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: min(96vw, calc(var(--kiosk-content-width) + 200px));
  margin: 0 auto;
  text-align: center;
  color: #ffffff;
}

.ausgabe-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: min(96vw, calc(var(--kiosk-content-width) + 200px));
  margin: 0 auto;
}

.ausgabe-bottle-wrap {
  position: relative;
  width: min(28vmin, 320px);
  height: min(38vmin, 560px);
  margin: 0 auto clamp(20px, 3vmin, 32px);
  flex-shrink: 0;
}

.ausgabe-bottle {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.ausgabe-bottle.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.ausgabe-pickup-hint {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.ausgabe-pickup-hint.is-hidden {
  display: none;
}

.ausgabe-pickup-arrow-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.ausgabe-pickup-hint.is-visible .ausgabe-pickup-arrow-img {
  animation:
    ausgabe-pickup-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both,
    ausgabe-pickup-nudge 2.2s ease-in-out 0.45s infinite;
}

@keyframes ausgabe-pickup-in {
  0% {
    opacity: 0;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes ausgabe-pickup-nudge {
  0%, 100% {
    transform: translate(2px, -2px);
  }
  50% {
    transform: translate(-5px, 4px);
  }
}

.ausgabe-status-slot.is-hidden {
  visibility: hidden;
  min-height: 0;
  margin: 0;
  height: 0;
  overflow: hidden;
}

.ausgabe-status-slot,
.ausgabe-spinner-slot {
  width: 100%;
  flex-shrink: 0;
}

.ausgabe-status-slot {
  width: 100%;
  min-height: clamp(4rem, 10vmin, 6rem);
  margin: 0 0 clamp(14px, 2vmin, 20px);
  text-align: center;
}

.ausgabe-spinner-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(44px, 6vmin, 52px);
  margin: 0 0 clamp(14px, 2vmin, 18px);
}

.ausgabe-spinner {
  width: clamp(44px, 6vmin, 52px);
  height: clamp(44px, 6vmin, 52px);
  margin: 0;
  border: 5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: ausgabe-spin 0.9s linear infinite;
}

.ausgabe-spinner.is-hidden {
  visibility: hidden;
  opacity: 0;
  animation: none;
}

@keyframes ausgabe-spin {
  to { transform: rotate(360deg); }
}

.ausgabe-status {
  display: inline-block;
  margin: 0;
  padding: 0;
  max-width: 100%;
  text-align: center;
  font-family: var(--font-family-heading);
  font-size: clamp(48px, 8.5vmin, 104px);
  font-weight: normal;
  font-synthesis: none;
  line-height: 0.95;
  letter-spacing: var(--letter-spacing-heading);
  text-transform: uppercase;
  white-space: nowrap;
}

.ausgabe-status.is-slam {
  animation: ausgabeStatusSlam 0.45s cubic-bezier(0.12, 0.85, 0.28, 1.15) both;
}

@keyframes ausgabeStatusSlam {
  0% {
    opacity: 0;
    transform: scale(1.12);
  }
  60% {
    opacity: 1;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

.ausgabe-log-wrap {
  width: var(--kiosk-content-width);
  max-width: 92vw;
  margin: 0 auto;
  text-align: left;
}

.ausgabe-log-wrap.is-hidden {
  display: none;
}

.grand-prize-modal {
  --grand-prize-modal-width: min(92vw, 560px);
  --grand-prize-qr-width: min(36vmin, 220px);
  --grand-prize-side-pad: clamp(20px, 3.5vmin, 36px);
  --grand-prize-copy-gap: clamp(14px, 2.2vmin, 20px);
  --grand-prize-qr-gap: clamp(10px, 1.6vmin, 14px);
  --grand-prize-modal-height: min(92vh, 760px);
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  box-sizing: border-box;
  width: var(--grand-prize-modal-width);
  max-width: 92vw;
  height: auto;
  max-height: var(--grand-prize-modal-height);
  overflow: hidden;
  padding:
    clamp(16px, 2.8vmin, 28px)
    var(--grand-prize-side-pad)
    clamp(20px, 3.2vmin, 28px);
  border-radius: 16px;
  text-align: center;
  color: #ffffff;
  background: #00a5ff;
  border: 3px solid #ffffff;
  box-shadow: 4px 4px 0 rgba(0, 74, 153, 0.4);
}

.grand-prize-modal .grand-prize-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.grand-prize-modal .grand-prize-footer {
  width: 100%;
  padding-top: var(--grand-prize-qr-gap);
}

.grand-prize-modal .grand-prize-sub {
  display: none !important;
}

.grand-prize-modal .grand-prize-copy {
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 var(--grand-prize-qr-gap);
  padding: 0 clamp(8px, 2vw, 16px);
  flex-shrink: 0;
}

.grand-prize-modal .grand-prize-prize {
  box-sizing: border-box;
  width: 100%;
  margin: 0 0 clamp(8px, 1.4vmin, 12px);
  padding: 0;
  font-family: var(--font-family-heading);
  font-size: clamp(28px, 5.5vmin, 40px);
  font-weight: normal;
  font-synthesis: none;
  line-height: 1.2;
  letter-spacing: var(--letter-spacing-heading);
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 40, 100, 0.25) !important;
}

.grand-prize-modal .grand-prize-draw {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--font-family-text);
  font-size: clamp(20px, 3.6vmin, 28px);
  font-weight: normal;
  font-synthesis: none;
  line-height: 1.35;
  text-align: center;
  opacity: 0.92;
}

.grand-prize-modal .grand-prize-qr-wrap {
  flex: 0 0 auto;
  position: relative;
  width: 180px;
  height: 180px;
  max-width: 70vw;
  max-height: 70vw;
  margin: 12px auto;
  padding: 0;
  line-height: 0;
  overflow: hidden;
  border-radius: 0;
  background: #ffffff;
  border: none !important;
  outline: none;
  box-shadow: none;
}

.grand-prize-modal .grand-prize-qr-wrap.is-hidden {
  display: none;
}

.grand-prize-modal .grand-prize-qr,
.grand-prize-modal img.grand-prize-qr {
  position: static !important;
  display: block !important;
  box-sizing: border-box;
  width: 180px !important;
  height: 180px !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  background: #ffffff !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  left: auto !important;
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  -webkit-transform: none !important;
  float: none !important;
}

.grand-prize-modal .grand-prize-countdown {
  width: 100%;
  max-width: 100%;
  margin: 0 0 clamp(8px, 1.4vmin, 12px);
  font-family: var(--font-family-text);
  font-size: clamp(16px, 2.8vmin, 24px);
  font-weight: normal;
  font-synthesis: none;
  opacity: 0.92;
  white-space: nowrap;
}

.grand-prize-skip {
  appearance: none;
  box-sizing: border-box;
  min-height: clamp(44px, 6.5vmin, 56px);
  width: min(var(--grand-prize-qr-width), 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vmin, 24px);
  display: block;
  border: none;
  border-radius: 10px;
  font-family: var(--font-family-text-medium);
  font-size: clamp(16px, 2.8vmin, 22px);
  font-weight: normal;
  font-synthesis: none;
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  color: #00a5ff !important;
  background: #ffffff !important;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
  border-bottom: 3px solid rgba(0, 74, 153, 0.35);
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.ausgabe-log-title {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: var(--letter-spacing-label);
  text-transform: uppercase;
  opacity: 0.9;
  color: #ffffff;
}

.ausgabe-log {
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 10px;
  min-height: 140px;
  max-height: min(22vmin, 220px);
  overflow: auto;
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.22);
  white-space: pre-wrap;
  word-break: break-word;
}

.ausgabe-log:empty::before {
  content: "Warte auf Schnittstelle …";
  opacity: 0.65;
}

.ausgabe-content.is-error .ausgabe-status {
  color: #ffe0e0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: clamp(1.75rem, 5vmin, 3.6rem);
  line-height: 1.05;
}

.ausgabe-content.is-dimmed,
.container.is-dimmed,
#result_container.is-dimmed {
  /* Kein filter:blur – GPU-Compositing auf Kiosk-Playern zerstört benachbarte QR-Bitmaps. */
  opacity: 0.35;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.grand-prize-popup {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.grand-prize-popup.is-visible {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.grand-prize-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 60, 120, 0.42);
}

/* Nur Opacity – kein scale/transform: Kiosk-WebViews verzerren sonst QR-Bitmaps. */
.grand-prize-popup.is-visible .grand-prize-modal {
  animation: grandPrizePop 0.35s ease-out both;
}

@keyframes grandPrizePop {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

.grand-prize-modal .grand-prize-title {
  box-sizing: border-box;
  margin: 0 0 var(--grand-prize-copy-gap);
  width: 100%;
  max-width: 100%;
  padding: 0;
  flex-shrink: 0;
  font-family: var(--font-family-heading);
  font-size: clamp(40px, 10vmin, 64px);
  font-weight: normal;
  font-synthesis: none;
  line-height: 1;
  letter-spacing: var(--letter-spacing-heading);
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow:
    0 0 14px rgba(255, 255, 255, 0.3),
    0 3px 0 #004a99 !important;
}

.grand-prize-skip:active,
.grand-prize-skip.focus-touch-pressed {
  transform: translateY(2px);
  border-bottom-width: 1px;
  background: #e8f7ff !important;
}

@media (max-height: 860px) {
  .grand-prize-modal {
    --grand-prize-qr-width: min(30vmin, 180px);
    --grand-prize-copy-gap: clamp(10px, 1.8vmin, 16px);
    --grand-prize-modal-height: min(94vh, 720px);
  }

  .grand-prize-modal .grand-prize-title {
    font-size: clamp(34px, 8.5vmin, 52px);
  }

  .grand-prize-modal .grand-prize-prize {
    font-size: clamp(22px, 4.2vmin, 30px);
  }

  .grand-prize-modal .grand-prize-draw {
    font-size: clamp(16px, 3vmin, 22px);
  }
}
