/* ==========================================================================
   14 Days of Christmas • Split-Screen Asymmetric Bento Advent Calendar
   Left 1/3: Deep Teal Sidebar with Bold Serif Title & Botanical Foliage
   Right 2/3: Deep Pine 5x4 Asymmetric Bento Grid (14 doors, zero scroll on laptop)
   Inside Modal Card: Clean Sans-Serif (Inter) on Warm Parchment Cream
   ========================================================================== */

:root {
  --bg-teal: #053B3E;
  --bg-pine: #06381C;
  --tile-sage: #93BD8B;
  --tile-sage-stripe: #85B17D;
  --tile-red: #C8373B;
  --tile-cream: #FBF4D8;
  --tile-cream-dot: #EFE1B3;
  --tile-green: #097A3E;
  --accent-gold: #F8B324;
  --cream-card: #FBF4DC;
  --ink-dark: #1F1B18;
  --ink-muted: #5C5349;
  --card-red: #A31D24;
  --ok-green: #18794E;
  --ok-bg: #E7F6EE;
  --err-red: #B42318;
  --err-bg: #FDECEB;
}

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

body {
  min-height: 100vh;
  background-color: var(--bg-pine);
  color: #FFFFFF;
  font-family: 'Cormorant Garamond', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Split Layout: 1/3 Left Sidebar + 2/3 Right Grid (Single Laptop Screen)
   ========================================================================== */
.page-shell {
  display: grid;
  grid-template-columns: 33.333% 66.667%;
  height: 100vh;
  overflow: hidden;
}

/* Left 1/3 Teal Sidebar ("Christmas Wrap Up" Vintage Brush Script + Snow) */
.hero-sidebar {
  position: relative;
  background: radial-gradient(circle at 50% 44%, #074C50 0%, var(--bg-teal) 72%);
  height: 100%;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 2px solid rgba(255, 255, 255, 0.06);
}

.snow-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.snow-drift-slow {
  animation: gentleSnowFloat 9s ease-in-out infinite alternate;
}

@keyframes gentleSnowFloat {
  0% { transform: translateY(-6px); }
  100% { transform: translateY(8px); }
}

.botanical {
  position: absolute;
  width: clamp(210px, 23vw, 300px);
  height: auto;
  pointer-events: none;
  opacity: 0.96;
  z-index: 1;
}

.botanical-top-right {
  top: -14px;
  right: -14px;
}

.botanical-bottom-left {
  bottom: -14px;
  left: -14px;
}

.title-cluster {
  position: relative;
  width: 100%;
  text-align: center;
  z-index: 2;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.title-emblem-top {
  width: clamp(140px, 14vw, 195px);
  height: auto;
  margin-bottom: 4px;
}

.main-title {
  font-family: 'Yellowtail', 'Cormorant Garamond', cursive;
  font-weight: 400;
  color: #FBF4D8;
  -webkit-text-stroke: 1.1px #FBF4D8;
  line-height: 0.94;
  letter-spacing: 0.005em;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: rotate(-5deg);
  text-shadow: 0 5px 18px rgba(0, 0, 0, 0.28);
  padding: 4px 0 8px;
}

.script-line {
  display: block;
  white-space: nowrap;
}

.script-line-1 {
  font-size: clamp(3.9rem, 6.4vw, 6.7rem);
}

.script-line-2 {
  font-size: clamp(4.1rem, 6.7vw, 7rem);
  margin-top: -0.08em;
}

.title-footer-ornament {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.swash-gift-svg {
  width: clamp(190px, 19vw, 255px);
  height: auto;
}

.subtitle-caption {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: clamp(0.72rem, 0.95vw, 0.88rem);
  font-weight: 700;
  letter-spacing: 0.22em;
  color: #FBF4D8;
  opacity: 0.92;
  text-transform: uppercase;
}

/* ==========================================================================
   Right 2/3 Pine Section & Asymmetric 5x4 Bento Grid (Fits 100vh without scroll)
   ========================================================================== */
.calendar-section {
  background-color: var(--bg-pine);
  height: 100%;
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.notice-banner {
  background: var(--cream-card);
  color: var(--ink-dark);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  padding: 24px 28px;
  border-radius: 16px;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}

.notice-banner h2 {
  font-size: 1.2rem;
  color: var(--card-red);
  margin-bottom: 8px;
}

.notice-banner p {
  font-size: 0.95rem;
  line-height: 1.5;
}

.notice-banner code {
  background: rgba(0, 0, 0, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* 5 columns x 4 rows = 20 grid cells for 14 asymmetric doors (zero gaps, zero scroll) */
.bento-grid {
  width: 100%;
  height: 100%;
  max-width: 1060px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.door-tile {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  border-radius: 18px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  text-align: left;
  font-family: 'Cormorant Garamond', Georgia, serif;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.door-tile:hover:not(.is-locked) {
  transform: translateY(-3px);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.38);
}

.door-tile:focus-visible {
  outline: 3px solid var(--accent-gold);
  outline-offset: 2px;
}

/* Alternating Festive Tile Themes */
.theme-sage {
  background: repeating-linear-gradient(
    90deg,
    var(--tile-sage) 0px,
    var(--tile-sage) 8px,
    var(--tile-sage-stripe) 8px,
    var(--tile-sage-stripe) 16px
  );
  color: #0B3B1E;
}

.theme-red {
  background-color: var(--tile-red);
  color: #FFFDF7;
}

.theme-cream {
  background-color: var(--tile-cream);
  background-image: radial-gradient(var(--tile-cream-dot) 2.2px, transparent 2.2px);
  background-size: 14px 14px;
  color: #0B3B1E;
}

.theme-green {
  background-color: var(--tile-green);
  color: #FFFDF7;
}

.theme-sage-solid {
  background-color: var(--tile-sage);
  color: #0B3B1E;
}

/* Decorative SVG Motifs inside tiles */
.door-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.door-top-row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
}

.door-number {
  font-size: clamp(2rem, 3.1vw, 3.1rem);
  font-weight: 700;
  line-height: 0.85;
}

.door-tile.is-wide .door-number,
.door-tile.is-tall .door-number {
  font-size: clamp(2.3rem, 3.5vw, 3.5rem);
}

.door-date {
  position: relative;
  z-index: 2;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.88;
  background: rgba(0, 0, 0, 0.16);
  padding: 3px 8px;
  border-radius: 999px;
  align-self: flex-start;
}

.theme-cream .door-date,
.theme-sage .door-date,
.theme-sage-solid .door-date {
  background: rgba(11, 59, 30, 0.12);
}


/* Smart number & badge placement so numbers never overlap tile illustrations */
.door-tile.pos-top-right .door-top-row {
  flex-direction: row-reverse;
}

.door-tile.pos-bottom-left .door-top-row {
  order: 2;
  align-items: flex-end;
}

.door-tile.pos-bottom-left .door-date {
  order: 1;
}

/* Status Badges (Done, Locked) */
.status-pill {
  position: relative;
  z-index: 2;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-done {
  background: #14532D;
  color: #ECFDF5;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

.status-lock {
  background: rgba(0, 0, 0, 0.28);
  color: #FFFDF7;
}

.door-tile.is-today {
  box-shadow: 0 0 0 3px var(--accent-gold), 0 0 24px rgba(248, 179, 36, 0.6);
}

.door-tile.is-locked {
  cursor: not-allowed;
  filter: brightness(0.72) saturate(0.75);
}

.door-tile.shake {
  animation: tileShake 0.35s ease;
}

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

/* ==========================================================================
   Centered Pop-Up Modal Card (Clean Sans-Serif Typography)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 24, 15, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  background-color: var(--cream-card);
  color: var(--ink-dark);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border-radius: 22px;
  padding: 30px 34px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  border: 3px solid #164A2C;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background-color: var(--card-red);
  color: #FFFFFF;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.modal-close:hover {
  background-color: #84151B;
  transform: scale(1.06);
}

.modal-header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(31, 27, 24, 0.12);
}

.modal-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--card-red);
  letter-spacing: -0.02em;
}

.modal-subtitle {
  font-size: 0.92rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.topic-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
}

.pill-vocab {
  background-color: #E3EFE5;
  color: #134E2B;
}

.pill-grammar {
  background-color: #F7E4E5;
  color: #8F1920;
}

/* Questions List inside Modal */
.questions-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.question-block {
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(31, 27, 24, 0.1);
  border-radius: 14px;
  padding: 14px 16px;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.question-block.is-correct {
  background: var(--ok-bg);
  border-color: var(--ok-green);
}

.question-block.is-wrong {
  background: var(--err-bg);
  border-color: var(--err-red);
}

.question-prompt {
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-dark);
}

.q-num {
  font-weight: 700;
  margin-right: 4px;
}

/* Multiple Choice Options */
.mc-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.mc-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(31, 27, 24, 0.18);
  background: #FFFFFF;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.mc-option:hover {
  border-color: #164A2C;
}

.mc-option input[type="radio"] {
  accent-color: var(--card-red);
  width: 15px;
  height: 15px;
}

.fill-sentence {
  margin-top: 6px;
  font-size: 0.96rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink-dark);
}

/* Text Input for Fill-in-the-blank & Transformation */
.text-input {
  width: 100%;
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1.5px solid rgba(31, 27, 24, 0.28);
  background: #FFFFFF;
  font-family: inherit;
  font-size: 0.94rem;
  color: var(--ink-dark);
}

.text-input:focus {
  outline: none;
  border-color: #164A2C;
  box-shadow: 0 0 0 3px rgba(22, 74, 44, 0.15);
}

.transform-source {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--card-red);
  background: rgba(163, 29, 36, 0.06);
  border-radius: 0 8px 8px 0;
  font-size: 0.9rem;
  color: var(--ink-dark);
}

.transform-frame {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.94rem;
}

.transform-frame .text-input {
  margin-top: 0;
  flex: 1;
  min-width: 190px;
}

/* Feedback & Explanations */
.item-feedback {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(31, 27, 24, 0.16);
  font-size: 0.86rem;
  line-height: 1.45;
}

.feedback-status {
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.is-correct .feedback-status {
  color: var(--ok-green);
}

.is-wrong .feedback-status {
  color: var(--err-red);
}

.score-banner {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
  background: #164A2C;
  color: #FFFDF7;
}

.modal-footer {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.btn-primary {
  background-color: var(--card-red);
  color: #FFFFFF;
  border: none;
  border-radius: 12px;
  padding: 12px 28px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(163, 29, 36, 0.28);
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover {
  background-color: #84151B;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #FFFFFF;
  color: var(--ink-dark);
  border: 1.5px solid rgba(31, 27, 24, 0.25);
  border-radius: 12px;
  padding: 11px 22px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary:hover {
  background-color: #F3ECE0;
}

/* ==========================================================================
   Discreet Tutor Preview Pill inside Sidebar (?preview=tutor)
   ========================================================================== */
.tutor-bar {
  position: relative;
  z-index: 3;
  margin-top: 18px;
  background: rgba(3, 28, 29, 0.88);
  color: #D1E7DD;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.75rem;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}

.tutor-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.tutor-link,
.tutor-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 0.74rem;
  text-decoration: none;
  cursor: pointer;
}

.tutor-link.active {
  background: var(--accent-gold);
  color: #1F1B18;
  font-weight: 700;
  border-color: var(--accent-gold);
}

.tutor-btn-muted {
  opacity: 0.8;
}

/* ==========================================================================
   Responsive Adjustments (Tablets & Mobile)
   ========================================================================== */
@media (max-width: 980px) {
  .page-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .hero-sidebar {
    padding: 36px 20px;
    border-right: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.06);
  }
  .calendar-section {
    padding: 22px 18px 36px;
    overflow: visible;
  }
  .bento-grid {
    height: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto;
  }
  .door-tile {
    grid-column: auto !important;
    grid-row: auto !important;
    aspect-ratio: 1 / 1.05;
  }
}

@media (max-width: 560px) {
  .bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .modal-card {
    padding: 22px 18px 20px;
  }
  .mc-options {
    grid-template-columns: 1fr;
  }
}
