:root {
  --bg-page: #F5F5F7;
  --surface-card: #FFFFFF;
  --surface-locked: rgba(255, 255, 255, 0.72);
  --text-primary: #1D1D1F;
  --text-secondary: #86868B;
  --accent-gold: #B8924A;
  --accent-gold-soft: rgba(184, 146, 74, 0.14);
  --border-subtle: rgba(0, 0, 0, 0.06);
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.035), 0 1px 3px rgba(0, 0, 0, 0.02);
  --shadow-card-hover: 0 14px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-modal: 0 24px 60px rgba(0, 0, 0, 0.18);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  padding: env(safe-area-inset-top) 20px calc(48px + env(safe-area-inset-bottom));
}

.app-container {
  max-width: 960px;
  margin: 0 auto;
}

/* Header */
.header {
  text-align: center;
  padding: 52px 0 40px;
}

.eyebrow {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.title {
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Grid */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

@media (max-width: 860px) {
  .calendar-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
  }
}

@media (max-width: 520px) {
  .calendar-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
  .header {
    padding: 36px 0 28px;
  }
}

/* Türchen-Kachel */
.door {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 22px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  transition: transform 0.35s var(--spring), box-shadow 0.35s var(--spring), border-color 0.3s ease;
}

.door:hover {
  transform: translateY(-3px) scale(1.015);
  box-shadow: var(--shadow-card-hover);
}

.door:active {
  transform: scale(0.97);
}

.door-number {
  position: relative;
  z-index: 2;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  transition: color 0.3s ease;
}

/* Status: Gesperrt */
.door.is-locked {
  background: var(--surface-locked);
  box-shadow: none;
  color: var(--text-secondary);
}

.door.is-locked:hover {
  transform: none;
  box-shadow: none;
}

.door-lock-icon {
  position: absolute;
  bottom: 12px;
  opacity: 0.42;
  z-index: 2;
}

/* Status: Heute verfügbar (noch ungeöffnet) */
.door.is-today {
  border: 1.5px solid var(--accent-gold);
  box-shadow: 0 8px 26px var(--accent-gold-soft);
}

.door.is-today::after {
  content: "";
  position: absolute;
  bottom: 12px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent-gold);
  z-index: 2;
}

/* Status: Bereits geöffnet (Foto-Vorschau) */
.door.is-opened {
  border-color: transparent;
  color: #FFFFFF;
}

.door.is-opened .door-number {
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.door-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  filter: brightness(0.72);
  transition: transform 0.5s var(--spring), filter 0.3s ease;
}

.door.is-opened:hover .door-bg {
  transform: scale(1.06);
  filter: brightness(0.8);
}

/* Shake Animation */
@keyframes appleShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.door.shake {
  animation: appleShake 0.36s ease;
}

/* Modal / Sheet */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(29, 29, 31, 0.38);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s var(--spring);
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: 90dvh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  box-shadow: var(--shadow-modal);
  padding: 16px 16px 28px;
  transform: scale(0.93) translateY(14px);
  transition: transform 0.4s var(--spring);
}

.modal-backdrop.is-open .modal-sheet {
  transform: scale(1) translateY(0);
}

.close-btn {
  position: absolute;
  top: 26px;
  right: 26px;
  z-index: 10;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(29, 29, 31, 0.52);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.close-btn:hover {
  background: rgba(29, 29, 31, 0.75);
  transform: scale(1.06);
}

.modal-image-wrapper {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: #EAEAEF;
  margin-bottom: 20px;
}

.modal-image-wrapper img {
  display: block;
  width: 100%;
  max-height: 52vh;
  object-fit: cover;
}

.modal-content {
  padding: 0 10px;
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.modal-day-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-gold);
  background: var(--accent-gold-soft);
  padding: 4px 10px;
  border-radius: 999px;
}

.modal-tag {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.modal-tag:empty {
  display: none;
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.modal-text {
  font-size: 16px;
  line-height: 1.55;
  color: #3A3A3C;
  white-space: pre-line;
}

.modal-link {
  display: inline-block;
  margin-top: 18px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text-primary);
  color: #FFFFFF;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.modal-link:hover {
  opacity: 0.85;
}

.hidden {
  display: none !important;
}

/* Toast Pill */
.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  background: rgba(29, 29, 31, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
  border-radius: 999px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.16);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.3s var(--spring);
  white-space: nowrap;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}