/* ===========================
   GRUNDLAGEN & TYPO
=========================== */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

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

body {
  background: 
    radial-gradient(ellipse at top, rgba(10, 15, 25, 0.9) 0%, rgba(5, 7, 11, 1) 70%),
    linear-gradient(180deg, #020305 0%, #0a0d15 100%);
  background-attachment: fixed;
  color: #c4b5a0;
  font-family: 'Crimson Text', serif;
  font-size: 18px;
  line-height: 1.7;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
  min-height: 100vh;
}

/* Noise texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

.container {
  max-width: 850px;
  width: 100%;
  position: relative;
  z-index: 2;
}

/* ===========================
   TYPOGRAFIE
=========================== */
h1, h2 {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  color: #d4af37;
  font-size: 2.5rem;
  text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
  margin-bottom: 0.5rem;
}

h2 {
  color: #b89968;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.header-subtitle {
  font-family: 'Crimson Text', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: #8a7a65;
  letter-spacing: 0.15em;
  margin-top: -0.5rem;
}

.eyebrow {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6d5d4b;
  margin-bottom: 0.5rem;
}

/* ===========================
   HEADER
=========================== */
header {
  background: 
    linear-gradient(135deg, rgba(20, 25, 35, 0.95) 0%, rgba(15, 18, 28, 0.98) 100%);
  padding: 2rem;
  border-radius: 0;
  margin-bottom: 2rem;
  position: relative;
  border: 1px solid rgba(180, 153, 104, 0.2);
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  text-align: center;
}

.header-ornament {
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(212, 175, 55, 0.3) 20%, 
    rgba(212, 175, 55, 0.6) 50%, 
    rgba(212, 175, 55, 0.3) 80%, 
    transparent 100%);
  margin: 1.5rem auto;
  max-width: 60%;
}

.header-ornament.bottom {
  margin-top: 2rem;
  margin-bottom: 0;
}

/* ===========================
   CODE PROGRESS
=========================== */
.code-progress {
  margin-top: 2rem;
  padding: 1.2rem 1.5rem;
  border-top: 1px solid rgba(212, 175, 55, 0.25);
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  background: rgba(10, 12, 18, 0.35);
}

.code-slots {
  margin-top: 0.5rem;
}

.code-label {
  text-transform: uppercase;
}

.code-slots, .final-code {
  display: flex;
  gap: 0.5rem;
}

.code-slot, .final-code-digit {
  width: 3rem;
  height: 3rem;
  background: rgba(10, 12, 18, 0.6);
  border: 2px solid rgba(180, 153, 104, 0.4);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #d4af37;
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
  box-shadow: 
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 15px rgba(212, 175, 55, 0.1);
  transition: all 0.3s ease;
}

.code-slot:has(.slot-inner:not(:empty)),
.final-code-digit:has(.digit-inner:not(:empty)) {
  border-color: rgba(212, 175, 55, 0.8);
  box-shadow: 
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 25px rgba(212, 175, 55, 0.4);
}

/* ===========================
   CARDS
=========================== */
.card {
  background: 
    linear-gradient(135deg, rgba(20, 25, 35, 0.9) 0%, rgba(15, 18, 28, 0.95) 100%);
  padding: 2.5rem;
  border-radius: 0;
  position: relative;
  border: 1px solid rgba(180, 153, 104, 0.2);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.card-glow {
  position: absolute;
  inset: -1px;
  background: linear-gradient(135deg, 
    rgba(212, 175, 55, 0.1) 0%, 
    transparent 40%, 
    transparent 60%, 
    rgba(212, 175, 55, 0.05) 100%);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.card:hover .card-glow {
  opacity: 1;
}

.card-glow.final {
  background: radial-gradient(ellipse at center, 
    rgba(212, 175, 55, 0.2) 0%, 
    transparent 70%);
  opacity: 0.6;
}

/* ===========================
   SCREENS
=========================== */
.screen {
  display: none;
  animation: fadeIn 0.5s ease;
}

.screen.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   TEXT STYLES
=========================== */
p {
  margin-bottom: 1rem;
}

.muted {
  color: #6d5d4b;
  font-size: 0.9rem;
}

.warning-text {
  color: #b89968;
  font-style: italic;
  padding: 1rem;
  background: rgba(180, 153, 104, 0.05);
  border-left: 2px solid rgba(212, 175, 55, 0.3);
  margin: 1.5rem 0;
}

.ritual-note {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.revelation-text {
  font-style: italic;
  color: #b89968;
  font-size: 1.1rem;
  text-align: center;
  padding: 2rem 1rem;
  background: rgba(212, 175, 55, 0.03);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  margin: 2rem 0;
}

/* ===========================
   BUTTONS
=========================== */
.btn-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

button {
  background: rgba(30, 35, 45, 0.8);
  color: #c4b5a0;
  border: 1px solid rgba(180, 153, 104, 0.3);
  padding: 0.75rem 1.5rem;
  border-radius: 2px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, 
    rgba(212, 175, 55, 0) 0%, 
    rgba(212, 175, 55, 0.1) 50%, 
    rgba(212, 175, 55, 0) 100%);
  transform: translateX(-100%);
  transition: transform 0.4s ease;
}

button.primary {
  background: linear-gradient(135deg, #d4af37 0%, #b89968 100%);
  color: #0a0d15;
  border-color: #d4af37;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(1);
}

/* ===========================
   BUTTON HOVER (nur Desktop)
=========================== */
@media (hover: hover) and (pointer: fine) {
  button:hover:enabled {
    border-color: rgba(212, 175, 55, 0.6);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.2);
    transform: translateY(-2px);
  }

  button:hover:enabled::before {
    transform: translateX(100%);
  }

  button.primary:hover:enabled {
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.5);
    filter: brightness(1.1);
  }

  button:active:enabled {
    transform: translateY(0);
  }
}

/* ===========================
   AUDIO TOGGLE
=========================== */
.audio-toggle {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(10, 12, 18, 0.8);
  color: #d4af37;
  border: 1px solid rgba(180, 153, 104, 0.4);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.audio-toggle.muted {
  color: #4a4a4a;
  opacity: 0.5;
}

.audio-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.3);
}

/* ===========================
   INPUT
=========================== */
/* === WÜRFEL-EINGABE ALS RITUAL === */
.inline-input {
  margin: 2.5rem auto 1.5rem;
  padding: 1.5rem;
  border: 1px solid rgba(180, 153, 104, 0.3);
  background: rgba(10, 12, 18, 0.5);
  box-shadow:
    inset 0 0 20px rgba(0,0,0,0.6),
    0 0 30px rgba(212, 175, 55, 0.08);
}

input[type="number"] {
  background: rgba(10, 12, 18, 0.6);
  border: 2px solid rgba(180, 153, 104, 0.4);
  border-radius: 4px;
  color: #d4af37;
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  width: 4rem;
  height: 4rem;
  padding: 0;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

input[type="number"]:focus {
  outline: none;
  border-color: rgba(212, 175, 55, 0.8);
  box-shadow: 
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 20px rgba(212, 175, 55, 0.3);
}

input[type="number"]::placeholder {
  color: rgba(180, 153, 104, 0.3);
}

/* Remove spinner arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
}

/* ===========================
   FEEDBACK
=========================== */
.feedback {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: 4px;
  font-family: 'Crimson Text', serif;
  font-style: italic;
  text-align: center;
  min-height: 1rem;
  transition: all 0.3s ease;
}

.feedback.error {
  color: #d4af37;
  background: rgba(180, 100, 80, 0.1);
  border: 1px solid rgba(180, 100, 80, 0.3);
}

.feedback.success {
  color: #d4af37;
  background: rgba(180, 153, 104, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.1);
}

/* ===========================
   RÄTSEL
=========================== */
.scene-visual {
  width: 100%;
  margin: 2rem 0;
  position: relative;
}

.image-frame {
  position: relative;
  border: 1px solid rgba(180, 153, 104, 0.3);
  border-radius: 0;
  overflow: hidden;
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(0, 0, 0, 0.3);
}

.image-frame img {
  width: 100%;
  height: auto;
  display: block;
  filter: sepia(0.15) contrast(1.1);
}

.image-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, 
    transparent 30%, 
    rgba(5, 7, 11, 0.4) 80%, 
    rgba(5, 7, 11, 0.7) 100%);
  pointer-events: none;
}

.riddle-inscription {
  background: rgba(10, 12, 18, 0.4);
  border-left: 3px solid rgba(212, 175, 55, 0.4);
  padding: 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.8;
  color: #b89968;
}

.riddle-text {
  color: #b89968;
  font-style: italic;
  line-height: 1.8;
}

/* ===========================
   CHOICE BUTTONS
=========================== */
.choice-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
}

.choice-btn {
  width: 100%;
  padding: 1rem 1.5rem;
  text-align: left;
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0.02em;
}

/* ===========================
   FINAL CODE
=========================== */
.final-code {
  justify-content: center;
  margin: 3rem 0;
}

.final-code-digit {
  width: 4rem;
  height: 4rem;
  font-size: 2rem;
  animation: revealDigit 0.6s ease forwards;
}

@keyframes revealDigit {
  from {
    opacity: 0;
    transform: scale(0.5) rotateY(180deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotateY(0deg);
  }
}

/* ===========================
   FOOTER
=========================== */
footer {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem 1rem;
  border-top: 1px solid rgba(180, 153, 104, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.footer-text {
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #6d5d4b;
}

.footer-ornament {
  width: 3rem;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(180, 153, 104, 0.4) 50%, 
    transparent 100%);
}

/* ===========================
   WÜRFEL OVERLAY
=========================== */
#dice-overlay {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: transparent;
  z-index: 999;
  pointer-events: none;
}

.scene {
  width: 80px;
  height: 80px;
  perspective: 800px;
}

.cube {
  width: 80px;
  height: 80px;
  position: relative;
  transform-style: preserve-3d;
  /* NEU: weiche Dreh-Animation für den Würfel */
  transition: transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}

.face {
  position: absolute;
  width: 80px;
  height: 80px;
  background: #d4af37;
  border-radius: 12px;
  box-shadow:
    inset 0 0 0 2px #000,
    inset 0 6px 8px rgba(255,255,255,0.25),
    inset 0 -6px 10px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: #000;
}

.one   { transform: rotateY(0deg)   translateZ(40px); }
.two   { transform: rotateY(90deg)  translateZ(40px); }
.three { transform: rotateY(180deg) translateZ(40px); }
.four  { transform: rotateY(-90deg) translateZ(40px); }
.five  { transform: rotateX(90deg)  translateZ(40px); }
.six   { transform: rotateX(-90deg) translateZ(40px); }

/* ===========================
   BRIEF OVERLAY
=========================== */
#letter-overlay {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  overflow-y: auto;
  padding: 1.5rem;
  background: rgba(5, 7, 11, 0.85);
  z-index: 1000;
}

.letter {
  width: min(90vw, 720px);
  padding: 2.5rem 3rem;
  background:
    radial-gradient(circle at top, rgba(212,175,55,0.15), transparent 60%),
    linear-gradient(135deg, #1a1d26, #11131a);
  border: 1px solid rgba(212,175,55,0.4);
  box-shadow:
    0 0 40px rgba(0,0,0,0.8),
    inset 0 0 30px rgba(212,175,55,0.1);
  color: #c4b5a0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}


.letter-header {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.15em;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #d4af37;
  margin-bottom: 1.5rem;
}

.letter-body {
  font-style: italic;
  line-height: 1.8;
  font-size: 1.05rem;
  overflow-y: auto;
  padding-right: 0.5rem;
  margin-bottom: 1.5rem;
}

.letter-body .digit {
  font-family: 'Cinzel', serif;
  font-size: 2rem;
  display: block;
  text-align: center;
  margin: 1.5rem 0;
  color: #d4af37;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.letter-footer {
  margin-top: 2rem;
  text-align: center;
  flex-shrink: 0;
}


/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 768px) {
  body {
    padding: 1rem;
    font-size: 16px;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .card {
    padding: 1.5rem;
  }

  .code-slot, .final-code-digit {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.3rem;
  }

  input[type="number"] {
    width: 3.5rem;
    height: 3.5rem;
    font-size: 1.8rem;
  }

  .inline-input {
    flex-direction: column;
  }

  button {
    font-size: 0.8rem;
    padding: 0.65rem 1.2rem;
  }
}
