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

:root {
  --bg-start: #e8f4f8;
  --bg-end: #fdf2f4;
  --card-bg: #ffffff;
  --accent: #f8bbd0;
  --accent-strong: #f48fb1;
  --text: #4a4a4a;
  --text-light: #888;
  --border: #f0e6e8;
  --shadow: rgba(0, 0, 0, 0.06);
  --gold: #ffd54f;
  --green-pastel: #c8e6c9;
  --blue-pastel: #bbdefb;
}

html, body {
  font-family: 'Nunito', sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-start) 0%, var(--bg-end) 100%);
  background-attachment: fixed;
}

.hidden {
  display: none !important;
}

/* Snowflakes */
.snowflake {
  position: fixed;
  top: -10px;
  color: #a8cce0;
  opacity: 0.9;
  pointer-events: none;
  z-index: 0;
  animation: fall linear infinite;
  text-shadow: 0 0 5px rgba(160, 200, 230, 0.6);
}
@keyframes fall {
  0% { transform: translateY(0) translateX(0) rotate(0deg); }
  100% { transform: translateY(110vh) translateX(20px) rotate(360deg); }
}

/* Login */
.screen {
  min-height: 100vh;
  width: 100%;
}

#login-screen,
#login-screen-admin {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-card {
  background: var(--card-bg);
  padding: 2rem 1.25rem;
  border-radius: 24px;
  box-shadow: 0 12px 40px var(--shadow);
  text-align: center;
  max-width: 360px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.login-emoji {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.login-card h1 {
  font-size: 1.6rem;
  color: var(--accent-strong);
  margin-bottom: 0.25rem;
}

.login-sub {
  color: var(--text-light);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: none;
  background: var(--blue-pastel);
  color: #1565c0;
  padding: 0.85rem 1.2rem;
  border-radius: 14px;
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(21,101,192,0.12);
  width: 100%;
  max-width: 280px;
}

.google-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(21,101,192,0.18);
}

.google-icon {
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.google-icon svg {
  width: 100%;
  height: 100%;
}

/* Header */
.app-header {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.app-header h1 {
  font-size: 1.15rem;
  color: var(--accent-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.header-link {
  text-decoration: none;
  color: #1565c0;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: var(--blue-pastel);
  transition: background 0.15s;
  white-space: nowrap;
}

.header-link:hover {
  background: #90caf9;
}

.logout-btn {
  border: none;
  background: transparent;
  color: var(--text-light);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  font-size: 0.8rem;
  transition: background 0.15s;
  white-space: nowrap;
}

.logout-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Calendar */
.calendar-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: 0.75rem;
  position: relative;
  z-index: 1;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
}

.day-card {
  aspect-ratio: 1;
  background: var(--card-bg);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  box-shadow: 0 3px 10px var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 2px solid transparent;
  overflow: hidden;
  min-height: 60px;
}

.day-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.4), rgba(255,255,255,0));
  pointer-events: none;
}

.day-card:hover:not(.locked) {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.day-card.locked {
  background: #f9f9fb;
  cursor: not-allowed;
  opacity: 0.6;
}

.day-card.special {
  border-color: var(--gold);
  animation: goldGlow 2s infinite alternate;
}

@keyframes goldGlow {
  from { box-shadow: 0 0 4px rgba(255, 213, 79, 0.35); }
  to { box-shadow: 0 0 14px rgba(255, 213, 79, 0.6), 0 0 6px rgba(255, 213, 79, 0.4); }
}

.day-number {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  z-index: 1;
}

.day-card.special .day-number::after {
  content: " ✨";
}

.lock-icon {
  font-size: 0.8rem;
  margin-top: 0.15rem;
  z-index: 1;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(80, 60, 80, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(6px);
  padding: 0;
}

.modal-content {
  background: var(--card-bg);
  border-radius: 24px 24px 0 0;
  padding: 1.25rem;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.1);
  animation: slideUp 0.3s ease-out;
}

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

@keyframes popIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.close-btn {
  position: absolute;
  top: 0.6rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s;
  z-index: 2;
}

.close-btn:hover {
  background: var(--border);
  color: var(--text);
}

.modal-content h2 {
  font-size: 1.25rem;
  color: var(--accent-strong);
  margin-bottom: 0.6rem;
  padding-right: 2.5rem;
}

.day-message {
  color: var(--text);
  line-height: 1.7;
  font-size: 0.95rem;
  white-space: pre-wrap;
  margin-bottom: 1rem;
  word-break: break-word;
}

.day-media {
  margin-top: 0.5rem;
}

.day-media img,
.day-media video {
  max-width: 100%;
  border-radius: 14px;
  display: block;
}

.day-media audio {
  width: 100%;
  display: block;
}

/* Admin */
.admin-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 0.75rem;
  position: relative;
  z-index: 1;
}

.days-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.day-item {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 0.9rem 1rem;
  box-shadow: 0 4px 16px var(--shadow);
}

.day-summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.day-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--blue-pastel);
  color: #1565c0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.day-title-preview {
  flex: 1;
  font-weight: 700;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.95rem;
}

.day-meta {
  font-size: 0.75rem;
  color: var(--text-light);
  background: #f5f5f7;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  white-space: nowrap;
}

.toggle-btn {
  border: none;
  background: var(--green-pastel);
  color: #2e7d32;
  padding: 0.45rem 0.9rem;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  transition: transform 0.1s;
}

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

.day-form {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  animation: fadeIn 0.25s ease;
}

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

.day-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.85rem;
  color: var(--text-light);
  font-weight: 700;
}

.day-form input[type="text"],
.day-form textarea,
.day-form select {
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: #fafafa;
  transition: border-color 0.15s;
}

.day-form input[type="text"]:focus,
.day-form textarea:focus,
.day-form select:focus {
  outline: none;
  border-color: var(--accent-strong);
  background: #fff;
}

.day-form input[type="file"] {
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.save-btn {
  border: none;
  background: var(--accent-strong);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  font-size: 1rem;
  align-self: stretch;
  transition: transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(244,143,177,0.35);
}

.save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(244,143,177,0.45);
}

.save-status {
  font-size: 0.85rem;
  font-weight: 700;
}

.current-file {
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.current-file a {
  color: #1565c0;
  word-break: break-all;
}

.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 2rem 1rem;
}

/* Desktop improvements */
@media (min-width: 640px) {
  .login-card {
    padding: 2.5rem;
    border-radius: 28px;
  }

  .login-emoji {
    font-size: 3.5rem;
  }

  .login-card h1 {
    font-size: 1.8rem;
  }

  .login-sub {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .google-btn {
    width: auto;
    max-width: none;
  }

  .header-content {
    padding: 1rem;
    gap: 1rem;
  }

  .app-header h1 {
    font-size: 1.4rem;
  }

  .header-link,
  .logout-btn {
    font-size: 0.9rem;
    padding: 0.5rem 0.8rem;
  }

  .calendar-wrapper {
    padding: 1.5rem 1rem;
  }

  .calendar-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
  }

  .day-card {
    border-radius: 20px;
    box-shadow: 0 6px 18px var(--shadow);
    min-height: auto;
  }

  .day-card:hover:not(.locked) {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 14px 32px rgba(0,0,0,0.1);
  }

  .day-number {
    font-size: 1.8rem;
  }

  .lock-icon {
    font-size: 1rem;
    margin-top: 0.3rem;
  }

  .modal {
    align-items: center;
    padding: 1rem;
  }

  .modal-content {
    border-radius: 28px;
    padding: 2rem;
    max-width: 620px;
    max-height: 90vh;
    box-shadow: 0 24px 70px rgba(0,0,0,0.12);
    animation: popIn 0.3s ease-out;
  }

  .close-btn {
    top: 1rem;
    right: 1.2rem;
    font-size: 1.8rem;
  }

  .modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
  }

  .day-message {
    font-size: 1.05rem;
  }

  .admin-wrapper {
    padding: 1.5rem 1rem 3rem;
  }

  .day-item {
    padding: 1.1rem 1.3rem;
    border-radius: 20px;
  }

  .day-badge {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .day-title-preview {
    font-size: 1rem;
    min-width: 120px;
  }

  .day-meta {
    font-size: 0.85rem;
    padding: 0.25rem 0.6rem;
  }

  .toggle-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .day-form {
    margin-top: 1rem;
    gap: 0.9rem;
    padding-top: 1rem;
  }

  .day-form label {
    font-size: 0.88rem;
    gap: 0.35rem;
  }

  .day-form input[type="text"],
  .day-form textarea,
  .day-form select {
    padding: 0.65rem 0.8rem;
  }

  .save-btn {
    padding: 0.8rem 1.2rem;
    align-self: flex-start;
  }

  .empty-state {
    padding: 3rem 1rem;
  }
}
