/* ==========================================================================
   Cookie Clash – Basis, Typografie, Buttons, Formulare
   ========================================================================== */

:root {
  --cream: #fff6e5;
  --paper: #fffdf8;
  --ink: #3d2a1b;
  --ink-2: #6e5541;
  --ink-3: #9a8068;
  --line: #ead7bd;
  --line-strong: #ddc3a1;
  --choco: #5c3a21;
  --choco-deep: #3f2714;
  --caramel: #e39b3a;
  --caramel-deep: #bd7824;
  --gold: #f6c453;
  --you: #109c87;
  --you-dark: #0a7c6b;
  --you-soft: #d9f4ed;
  --rival: #ef6b4c;
  --rival-dark: #c34c31;
  --rival-soft: #ffe4dc;
  --shadow: 0 18px 40px rgba(92, 58, 33, 0.14);
  --shadow-soft: 0 8px 20px rgba(92, 58, 33, 0.1);
  --radius: 26px;
  --font-display: "Fredoka", "Trebuchet MS", sans-serif;
  --font-body: "Nunito", "Segoe UI", sans-serif;
  --cookie-size: clamp(200px, 36vh, 330px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--cream);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

p,
h1,
h2,
h3 {
  margin-top: 0;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(233, 162, 59, 0.35);
}

/* --------------------------------------------------------------------------
   Hintergrund
   -------------------------------------------------------------------------- */

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 6% -4%, rgba(255, 227, 169, 0.7), transparent 62%),
    radial-gradient(800px 700px at 102% 16%, rgba(255, 214, 195, 0.62), transparent 58%),
    linear-gradient(180deg, #fff9ee 0%, #fdf0db 100%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  pointer-events: none;
}

.bg-glow-a {
  width: 42vw;
  height: 42vw;
  top: -14vw;
  right: 8vw;
  background: #ffd28a;
}

.bg-glow-b {
  width: 34vw;
  height: 34vw;
  bottom: -16vw;
  left: -8vw;
  background: #ffb99f;
}

.bg-dots {
  position: absolute;
  inset: 0;
  opacity: 0.4;
  background-image: radial-gradient(rgba(140, 95, 50, 0.17) 0.8px, transparent 0.8px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 25%, transparent 82%);
  mask-image: radial-gradient(ellipse at center, #000 25%, transparent 82%);
}

/* --------------------------------------------------------------------------
   Grundbausteine
   -------------------------------------------------------------------------- */

.screen {
  display: none;
  min-height: 100svh;
}

.screen.is-active {
  display: flex;
  animation: screen-in 0.4s ease both;
}

.panel {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--caramel-deep);
  font-size: 0.71rem;
  font-weight: 900;
  letter-spacing: 0.17em;
  line-height: 1.2;
  text-transform: uppercase;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--you);
  animation: pulse-dot 2.2s ease-out infinite;
}

.muted {
  color: var(--ink-3);
}

.small {
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.97rem;
  font-weight: 900;
  letter-spacing: 0.005em;
  line-height: 1.1;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.995);
}

.btn:focus-visible {
  outline: 3px solid rgba(227, 155, 58, 0.55);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.48;
  box-shadow: none;
  cursor: not-allowed;
}

.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.btn-lg {
  min-height: 57px;
  padding: 0 24px;
  border-radius: 16px;
  font-size: 1.02rem;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  color: #fff8ec;
  background: linear-gradient(180deg, #764b2a 0%, #513017 100%);
  box-shadow:
    0 10px 20px rgba(71, 40, 17, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
  box-shadow:
    0 14px 26px rgba(71, 40, 17, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-dark {
  color: #fff6e5;
  background: #4a2d18;
  box-shadow: 0 8px 16px rgba(74, 45, 24, 0.2);
}

.btn-soft {
  background: #f4e7d3;
  box-shadow: inset 0 0 0 1px rgba(160, 112, 60, 0.14);
}

.btn-soft:hover:not(:disabled) {
  background: #efddc3;
}

.btn-danger {
  color: #fff;
  background: linear-gradient(180deg, #e9694c 0%, #c94d33 100%);
  box-shadow: 0 8px 18px rgba(180, 65, 40, 0.28);
}

.btn-arrow {
  transition: transform 0.2s ease;
}

.btn:hover .btn-arrow {
  transform: translateX(3px);
}

.btn.is-busy {
  pointer-events: none;
  opacity: 0.72;
}

.btn.is-busy .btn-arrow {
  display: none;
}

.btn.is-busy::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 1px solid rgba(160, 112, 60, 0.16);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.68);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.icon-btn:hover {
  background: var(--paper);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.icon-btn:active {
  transform: translateY(1px);
}

.icon-btn:focus-visible {
  outline: 3px solid rgba(227, 155, 58, 0.55);
  outline-offset: 2px;
}

.icon-btn svg {
  width: 21px;
  height: 21px;
}

.sound-off {
  display: none;
}

body.is-muted .sound-on {
  display: none;
}

body.is-muted .sound-off {
  display: block;
}

/* --------------------------------------------------------------------------
   Formulare
   -------------------------------------------------------------------------- */

.field {
  display: block;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-2);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: #fffbf2;
  font-size: 16px;
  font-weight: 700;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.field input::placeholder {
  color: #b9a48d;
  font-weight: 600;
}

.field input:hover {
  border-color: var(--line-strong);
}

.field input:focus {
  border-color: var(--caramel);
  background: #fffdf7;
  box-shadow: 0 0 0 4px rgba(233, 162, 59, 0.18);
}

.field.has-error input {
  border-color: var(--rival);
  box-shadow: 0 0 0 4px rgba(239, 107, 76, 0.14);
  animation: nudge 0.3s ease;
}

.field-code input {
  padding-left: calc(16px + 0.55em);
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.55em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--ink-3);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.or::before,
.or::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

/* --------------------------------------------------------------------------
   Marke
   -------------------------------------------------------------------------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand-cookie {
  position: relative;
  width: 29px;
  height: 29px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 27%, #efc486 0%, #cf934b 56%, #a9692f 100%);
  box-shadow:
    inset 0 -2px 4px rgba(80, 45, 15, 0.35),
    0 2px 6px rgba(80, 45, 15, 0.2);
}

.brand-cookie::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #4b2b14;
  box-shadow:
    9px -2px 0 -0.5px #4b2b14,
    3px 9px 0 -0.5px #4b2b14,
    12px 11px 0 -0.8px #4b2b14;
}

.mini-brand-cookie {
  position: relative;
  width: 31px;
  height: 31px;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 27%, #efc486 0%, #cf934b 56%, #a9692f 100%);
  box-shadow:
    inset 0 -2px 4px rgba(80, 45, 15, 0.35),
    0 2px 6px rgba(80, 45, 15, 0.18);
}

.mini-brand-cookie::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #4b2b14;
  box-shadow:
    9px -2px 0 -0.5px #4b2b14,
    3px 9px 0 -0.5px #4b2b14,
    12px 11px 0 -0.8px #4b2b14;
}

/* --------------------------------------------------------------------------
   Gemeinsame Animationen
   -------------------------------------------------------------------------- */

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 156, 135, 0.45);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(16, 156, 135, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 156, 135, 0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes nudge {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
