/* ==========================================================================
   Cookie Clash – Spielbildschirm
   ========================================================================== */

.screen-game {
  align-items: stretch;
  justify-content: center;
  height: 100svh;
  padding: clamp(9px, 1.6vw, 18px);
  overflow: hidden;
}

.game-shell {
  display: flex;
  flex-direction: column;
  width: min(1120px, 100%);
  height: 100%;
  min-height: 0;
}

/* --------------------------------------------------------------------------
   Kopfzeile
   -------------------------------------------------------------------------- */

.game-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: none;
  padding: 0 2px;
}

.game-bar .icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.game-bar-center {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.room-chip {
  padding: 6px 11px;
  border: 1px solid rgba(160, 112, 60, 0.16);
  border-radius: 999px;
  color: var(--ink-2);
  background: rgba(255, 253, 247, 0.68);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.room-chip b {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.12em;
}

.game-timer {
  min-width: 84px;
  padding: 5px 11px;
  border: 1px solid rgba(160, 112, 60, 0.16);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.68);
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Punktestand
   -------------------------------------------------------------------------- */

.hud {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: clamp(10px, 2vw, 26px);
  flex: none;
  margin: clamp(8px, 1.6vh, 16px) 2px clamp(7px, 1.4vh, 13px);
}

.hud-side {
  min-width: 0;
}

.hud-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.hud-label {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud-score {
  flex: none;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
  will-change: transform;
}

.hud-you .hud-score {
  color: var(--you-dark);
}

.hud-rival .hud-score {
  color: var(--rival-dark);
}

.hud-rival .hud-top {
  flex-direction: row;
}

.hud-bar {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(160, 112, 60, 0.14);
  box-shadow: inset 0 1px 2px rgba(90, 50, 20, 0.11);
}

.hud-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.14s ease-out;
}

.hud-you .hud-bar i {
  background: linear-gradient(90deg, #27bda5 0%, #0d8b78 100%);
  box-shadow: 0 0 12px rgba(16, 156, 135, 0.35);
}

.hud-rival .hud-bar i {
  background: linear-gradient(90deg, #f58a6d 0%, #e35c3d 100%);
  box-shadow: 0 0 12px rgba(239, 107, 76, 0.28);
}

.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 1px;
}

.hud-target-label {
  color: var(--ink-3);
  font-size: 0.56rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hud-target {
  color: var(--caramel-deep);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}

/* --------------------------------------------------------------------------
   Bühne
   -------------------------------------------------------------------------- */

.stage {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 32px;
  background:
    radial-gradient(75% 65% at 50% 48%, #fffaf0 0%, #fff4df 55%, #f9e7c9 100%);
  box-shadow:
    inset 0 1px 0 #fff,
    0 18px 44px rgba(92, 58, 33, 0.1);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(139, 94, 50, 0.14) 0.8px, transparent 0.8px);
  background-size: 20px 20px;
  opacity: 0.4;
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, transparent 28%, #000 92%);
  mask-image: radial-gradient(ellipse at 50% 50%, transparent 28%, #000 92%);
}

.stage-spot {
  position: absolute;
  width: min(55vw, 540px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 162, 59, 0.17), transparent 66%);
  filter: blur(10px);
  pointer-events: none;
  transition: background 0.4s ease;
}

.stage-crumb {
  position: absolute;
  width: 10px;
  height: 8px;
  border-radius: 50% 40% 55% 45%;
  background: #c48f52;
  opacity: 0.25;
  pointer-events: none;
}

.sc-a {
  top: 26%;
  left: 9%;
  transform: rotate(24deg) scale(0.9);
}

.sc-b {
  right: 12%;
  bottom: 24%;
  transform: rotate(-18deg) scale(0.65);
}

.sc-c {
  bottom: 17%;
  left: 19%;
  transform: rotate(58deg) scale(0.5);
}

.sc-d {
  top: 19%;
  right: 29%;
  transform: rotate(9deg) scale(0.4);
}

/* --------------------------------------------------------------------------
   Klick-Keks
   -------------------------------------------------------------------------- */

.cookie--play {
  position: relative;
  z-index: 3;
  width: var(--cookie-size);
  height: var(--cookie-size);
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform 0.1s cubic-bezier(0.3, 1.6, 0.4, 1),
    box-shadow 0.25s ease,
    filter 0.15s ease;
}

.cookie--play:hover {
  filter: brightness(1.025);
  transform: translateY(-2px);
}

.cookie--play:active,
.cookie--play.is-pressed {
  transform: scale(0.955);
  transition-duration: 0.06s;
}

.cookie--play:focus-visible {
  outline: 3px solid rgba(227, 155, 58, 0.6);
  outline-offset: 8px;
}

.stage.is-frenzy .cookie--play {
  box-shadow:
    inset 0 -16px 28px rgba(94, 48, 14, 0.32),
    inset 0 12px 26px rgba(255, 228, 175, 0.42),
    0 0 0 9px rgba(246, 196, 83, 0.16),
    0 0 55px rgba(246, 196, 83, 0.55),
    0 26px 55px rgba(90, 50, 20, 0.2);
}

.stage.is-frenzy .stage-spot {
  background: radial-gradient(circle, rgba(255, 190, 60, 0.38), transparent 65%);
}

.stage-hint {
  position: absolute;
  bottom: clamp(12px, 2.2vh, 20px);
  left: 50%;
  z-index: 2;
  margin: 0;
  padding: 6px 13px;
  border: 1px solid rgba(160, 112, 60, 0.12);
  border-radius: 999px;
  color: var(--ink-3);
  background: rgba(255, 251, 242, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Effekte
   -------------------------------------------------------------------------- */

.float-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  pointer-events: none;
}

.float-text {
  position: absolute;
  color: var(--you-dark);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.float-text.is-frenzy {
  color: var(--caramel-deep);
  font-size: 1.7rem;
}

.float-text.is-bonus {
  color: var(--caramel-deep);
}

.float-crumb {
  position: absolute;
  width: 7px;
  height: 6px;
  border-radius: 50% 40% 55% 45%;
  background: #b97d3f;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.click-ring {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 251, 238, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: click-ring 0.45s ease-out forwards;
}

@keyframes click-ring {
  from {
    opacity: 0.8;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.4);
  }
}

/* --------------------------------------------------------------------------
   Gegner-Mini
   -------------------------------------------------------------------------- */

.opponent-mini {
  position: absolute;
  top: clamp(11px, 2vw, 20px);
  right: clamp(11px, 2vw, 22px);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.mini-ring {
  --p: 0;
  width: 63px;
  height: 63px;
  padding: 4px;
  border-radius: 50%;
  background: conic-gradient(var(--rival) calc(var(--p) * 1%), rgba(160, 112, 60, 0.15) 0);
  transition: background 0.2s linear;
}

.mini-cookie {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 33% 28%, #e8ba7d 0%, #c98d48 60%, #a76a30 100%);
  box-shadow:
    0 0 0 3px #fff8ec,
    inset 0 -3px 6px rgba(90, 45, 15, 0.3);
}

.mini-cookie .chip {
  background: #4b2b14;
}

.mini-name {
  max-width: 84px;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.opponent-mini.is-poked .mini-cookie {
  animation: mini-poke 0.32s cubic-bezier(0.3, 1.5, 0.4, 1);
}

@keyframes mini-poke {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(0.9) rotate(-4deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

/* --------------------------------------------------------------------------
   Combo
   -------------------------------------------------------------------------- */

.combo {
  position: absolute;
  top: 10%;
  left: 50%;
  z-index: 5;
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 6px 13px;
  border: 1px solid rgba(233, 162, 59, 0.36);
  border-radius: 999px;
  background: rgba(255, 251, 242, 0.9);
  box-shadow: 0 8px 20px rgba(150, 100, 40, 0.14);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -6px) scale(0.9);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.combo.is-on {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.combo span {
  color: var(--ink-3);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.combo b {
  color: var(--caramel-deep);
  font-family: var(--font-display);
  font-size: 1.13rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Goldrausch
   -------------------------------------------------------------------------- */

.frenzy {
  position: absolute;
  top: clamp(11px, 2vw, 20px);
  left: clamp(11px, 2vw, 22px);
  z-index: 6;
  min-width: 145px;
  padding: 9px 13px 11px;
  border-radius: 14px;
  color: #fff5de;
  background: linear-gradient(140deg, #6b4426, #482a15);
  box-shadow:
    0 10px 24px rgba(80, 45, 15, 0.26),
    inset 0 1px 0 rgba(255, 236, 190, 0.15);
  animation: pop-in 0.25s ease both;
}

.frenzy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 13px;
}

.frenzy-label {
  color: #ffd88a;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.frenzy-mult {
  color: #ffd56f;
  font-family: var(--font-display);
  font-size: 1.14rem;
  font-weight: 600;
}

.frenzy-bar {
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.15);
}

.frenzy-bar i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd76b, #f0a537);
  transition: width 0.1s linear;
}

/* --------------------------------------------------------------------------
   Goldener Keks
   -------------------------------------------------------------------------- */

.golden-layer {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
}

.golden-cookie {
  position: absolute;
  width: 68px;
  height: 68px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 27%, #fff4b7 0%, #f6c453 45%, #d99b2b 80%, #b87a16 100%);
  box-shadow:
    0 0 0 6px rgba(246, 196, 83, 0.17),
    0 0 30px rgba(246, 196, 83, 0.62),
    inset 0 -8px 13px rgba(150, 95, 10, 0.32);
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  animation:
    golden-in 0.32s cubic-bezier(0.2, 1.5, 0.4, 1) both,
    golden-glow 1.25s ease-in-out 0.32s infinite;
}

.golden-cookie::before {
  content: "";
  position: absolute;
  top: 27%;
  left: 29%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 249, 205, 0.92);
  box-shadow:
    22px 8px 0 -2px rgba(255, 249, 205, 0.92),
    8px 28px 0 -2px rgba(255, 249, 205, 0.92),
    32px 32px 0 -3px rgba(255, 249, 205, 0.92);
}

.golden-cookie::after {
  content: "✦";
  position: absolute;
  top: -19px;
  right: -13px;
  color: #e7a62c;
  font-size: 20px;
  line-height: 1;
  animation: twinkle 1.1s ease-in-out infinite;
}

.golden-cookie:focus-visible {
  outline: 3px solid var(--caramel-deep);
  outline-offset: 4px;
}

.golden-cookie.is-fading {
  animation: golden-out 0.45s ease forwards;
  pointer-events: none;
}

@keyframes golden-in {
  from {
    opacity: 0;
    transform: scale(0.25) rotate(-30deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes golden-out {
  to {
    opacity: 0;
    transform: scale(0.55);
  }
}

@keyframes golden-glow {
  0%,
  100% {
    box-shadow:
      0 0 0 6px rgba(246, 196, 83, 0.17),
      0 0 26px rgba(246, 196, 83, 0.5),
      inset 0 -8px 13px rgba(150, 95, 10, 0.32);
  }
  50% {
    box-shadow:
      0 0 0 10px rgba(246, 196, 83, 0.08),
      0 0 40px rgba(246, 196, 83, 0.8),
      inset 0 -8px 13px rgba(150, 95, 10, 0.32);
  }
}

/* --------------------------------------------------------------------------
   Countdown
   -------------------------------------------------------------------------- */

.countdown {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: rgba(255, 247, 233, 0.63);
  backdrop-filter: blur(7px);
}

.countdown-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.countdown-kicker {
  color: var(--caramel-deep);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.countdown-num {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(6rem, 18vw, 11rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.95;
  text-shadow: 0 6px 0 rgba(255, 255, 255, 0.65);
}

.countdown-num.tick {
  animation: count-pop 0.62s cubic-bezier(0.2, 1.45, 0.4, 1) both;
}

.countdown-sub {
  color: var(--ink-3);
  font-size: 0.86rem;
  font-weight: 800;
}

.countdown.is-go .countdown-num {
  color: var(--you-dark);
}

@keyframes count-pop {
  0% {
    opacity: 0;
    transform: scale(0.55) rotate(-4deg);
  }
  45% {
    opacity: 1;
    transform: scale(1.08) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

/* --------------------------------------------------------------------------
   Fußzeile
   -------------------------------------------------------------------------- */

.game-foot {
  flex: none;
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 0.73rem;
  font-weight: 600;
  text-align: center;
}

.game-foot b {
  color: var(--caramel-deep);
  font-weight: 900;
}

/* --------------------------------------------------------------------------
   Responsiv
   -------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .stage {
    border-radius: 25px;
  }

  .hud {
    gap: 8px;
    margin-top: 7px;
  }

  .hud-label {
    font-size: 0.64rem;
  }

  .hud-score {
    font-size: 1.5rem;
  }

  .hud-target {
    font-size: 1.15rem;
  }

  .hud-target-label {
    font-size: 0.5rem;
  }

  .mini-ring {
    width: 55px;
    height: 55px;
  }

  .frenzy {
    min-width: 125px;
    padding: 8px 11px 10px;
  }

  .frenzy-label {
    font-size: 0.57rem;
  }

  .frenzy-mult {
    font-size: 1rem;
  }

  .combo {
    top: 8%;
  }

  .golden-cookie {
    width: 60px;
    height: 60px;
  }

  .game-foot {
    font-size: 0.67rem;
    margin-top: 6px;
  }

  .room-chip {
    padding: 5px 9px;
    font-size: 0.67rem;
  }

  .game-timer {
    min-width: 74px;
    padding: 4px 9px;
    font-size: 0.95rem;
  }
}

@media (max-width: 560px) {
  .screen-game {
    padding: 8px;
  }

  .game-bar .icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .game-bar .icon-btn svg {
    width: 19px;
    height: 19px;
  }

  .game-bar-center {
    gap: 5px;
  }

  .room-chip {
    padding: 5px 8px;
    font-size: 0.62rem;
  }

  .game-timer {
    min-width: 68px;
    font-size: 0.88rem;
  }

  .hud {
    margin-bottom: 6px;
  }

  .hud-label {
    font-size: 0.58rem;
  }

  .hud-score {
    font-size: 1.35rem;
  }

  .hud-target {
    font-size: 1rem;
  }

  .hud-target-label {
    display: none;
  }

  .hud-bar {
    height: 9px;
  }

  .stage-hint {
    bottom: 10px;
    padding: 5px 10px;
    font-size: 0.68rem;
  }

  .combo {
    top: auto;
    bottom: 43px;
    left: 11px;
    transform: translateY(6px) scale(0.9);
  }

  .combo.is-on {
    transform: translateY(0) scale(1);
  }

  .frenzy {
    min-width: 112px;
  }

  .opponent-mini {
    gap: 2px;
  }

  .mini-ring {
    width: 48px;
    height: 48px;
    padding: 3px;
  }

  .mini-name {
    max-width: 66px;
    font-size: 0.55rem;
  }

  .stage-crumb {
    display: none;
  }

  .game-foot {
    display: none;
  }

  .result-stats {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-height: 640px) {
  .game-foot,
  .stage-hint {
    display: none;
  }

  .hud {
    margin-top: 5px;
    margin-bottom: 5px;
  }

  .hud-score {
    font-size: 1.3rem;
  }

  .stage {
    border-radius: 22px;
  }

  .countdown-num {
    font-size: clamp(4.5rem, 16vh, 7rem);
  }

  .combo {
    bottom: 12px;
  }
}
