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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--ink-primary);
  background: radial-gradient(circle at 18% 0%, #fffaf2 0%, var(--bg-parchment) 55%, var(--bg-warm) 100%);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.ambient-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.36;
}

.ambient-glow--left {
  top: -180px;
  left: -140px;
  background: radial-gradient(circle, rgba(207, 150, 53, 0.45), transparent 70%);
}

.ambient-glow--right {
  bottom: -200px;
  right: -120px;
  background: radial-gradient(circle, rgba(25, 84, 62, 0.32), transparent 70%);
}

.ambient-glow--crimson {
  top: 22%;
  right: -200px;
  width: 440px;
  height: 440px;
  opacity: 0.22;
  background: radial-gradient(circle, rgba(192, 47, 40, 0.42), transparent 70%);
}

/* Festive Christmas string lights along top edge */
.holiday-lights {
  position: relative;
  z-index: 12;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 0 18px;
  height: 22px;
  pointer-events: none;
  overflow: hidden;
}

.holiday-lights::before {
  content: '';
  position: absolute;
  top: -8px;
  left: -20px;
  right: -20px;
  height: 16px;
  border-bottom: 2px solid #2b4a3c;
  border-radius: 50%;
  opacity: 0.65;
}

.light-bulb {
  position: relative;
  margin-top: 7px;
  width: 10px;
  height: 14px;
  border-radius: 45% 45% 50% 50% / 35% 35% 65% 65%;
  animation: bulbTwinkle 2.8s ease-in-out infinite;
}

.light-bulb::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 2px;
  width: 6px;
  height: 5px;
  border-radius: 2px;
  background: #2f4b3e;
}

.light-bulb--red {
  background: #e23b32;
  box-shadow: 0 0 10px rgba(226, 59, 50, 0.72), 0 2px 6px rgba(226, 59, 50, 0.4);
  animation-delay: 0s;
}

.light-bulb--green {
  background: #259b62;
  box-shadow: 0 0 10px rgba(37, 155, 98, 0.72), 0 2px 6px rgba(37, 155, 98, 0.4);
  animation-delay: 0.7s;
}

.light-bulb--gold {
  background: #f2b738;
  box-shadow: 0 0 11px rgba(242, 183, 56, 0.8), 0 2px 6px rgba(242, 183, 56, 0.45);
  animation-delay: 1.4s;
}

.light-bulb--warm {
  background: #fff3cc;
  box-shadow: 0 0 11px rgba(255, 240, 185, 0.9), 0 2px 6px rgba(242, 183, 56, 0.4);
  animation-delay: 2.1s;
}

@keyframes bulbTwinkle {
  0%, 100% {
    opacity: 1;
    filter: brightness(1.06);
  }
  50% {
    opacity: 0.56;
    filter: brightness(0.84);
  }
}

/* Traffic light corner status indicator */
.conn-pill {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 9px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(36, 29, 23, 0.14);
  backdrop-filter: blur(10px);
  cursor: default;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  outline: none;
}

.conn-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}

.conn-dot--green {
  background: var(--status-green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2), 0 0 8px rgba(22, 163, 74, 0.55);
}

.conn-dot--amber {
  background: var(--status-amber);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2), 0 0 8px rgba(217, 119, 6, 0.45);
}

.conn-dot--red {
  background: var(--status-red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2), 0 0 8px rgba(220, 38, 38, 0.5);
}

.conn-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: min(268px, calc(100vw - 32px));
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 42px rgba(24, 18, 12, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  text-align: left;
  z-index: 90;
}

.conn-pill:hover .conn-popover,
.conn-pill:focus .conn-popover,
.conn-pill:focus-within .conn-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.conn-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
}

.conn-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-warm);
  color: var(--ink-secondary);
}

.conn-details {
  margin: 0;
  display: grid;
  gap: 5px;
  font-size: 12px;
}

.conn-details > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.conn-details dt {
  color: var(--ink-muted);
}

.conn-details dd {
  margin: 0;
  font-weight: 600;
  color: var(--ink-primary);
  text-align: right;
}

.conn-hint {
  margin: 10px 0 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border-soft);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ink-secondary);
}

/* Header */
.top-bar {
  position: relative;
  z-index: 10;
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 22px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  font-size: 31px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(25, 84, 62, 0.2));
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.38rem;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--pine);
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-main {
  position: relative;
  z-index: 5;
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 22px 72px;
}

/* Buttons & Inputs */
button {
  font-family: inherit;
  cursor: pointer;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.94rem;
  transition: transform 0.12s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.primary-btn:active,
.secondary-btn:active {
  transform: translateY(1px);
}

.primary-btn:disabled,
.secondary-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

.primary-btn {
  border: none;
  padding: 12px 18px;
  color: #fff;
  box-shadow: 0 6px 16px rgba(36, 29, 23, 0.14);
}

.primary-btn--crimson {
  background: linear-gradient(180deg, #cf3c35, var(--crimson));
}

.primary-btn--crimson:hover:not(:disabled) {
  background: linear-gradient(180deg, #d9463f, var(--crimson-dark));
}

.primary-btn--pine {
  background: linear-gradient(180deg, #21664c, var(--pine));
}

.primary-btn--pine:hover:not(:disabled) {
  background: linear-gradient(180deg, #287659, var(--pine-dark));
}

.secondary-btn {
  border: 1px solid var(--border-strong);
  background: var(--surface-card);
  color: var(--ink-primary);
  padding: 10px 14px;
}

.secondary-btn:hover:not(:disabled) {
  background: var(--bg-parchment);
}

.ghost-btn {
  border: 1px solid var(--border-soft);
  background: rgba(255, 253, 248, 0.78);
  color: var(--ink-secondary);
  padding: 8px 13px;
  font-size: 0.86rem;
}

.ghost-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--ink-primary);
}

.icon-btn {
  border: 1px solid var(--border-soft);
  background: rgba(255, 253, 248, 0.85);
  color: var(--ink-primary);
  padding: 7px 11px;
  font-size: 0.86rem;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.field small {
  font-weight: 400;
  color: var(--ink-muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.96rem;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid rgba(207, 150, 53, 0.4);
  border-color: var(--gold);
}

/* Landing */
.landing-shell {
  display: grid;
  gap: 22px;
}

.landing-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(170px, 220px) 1fr;
  gap: 26px;
  align-items: center;
  padding: 22px 26px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(248, 239, 222, 0.88));
  border: 1px solid rgba(192, 47, 40, 0.16);
  border-top: 3px solid var(--crimson);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(8px);
}

.eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pine);
  background: var(--pine-soft);
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.hero-copy h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
  line-height: 1.15;
}

.hero-copy p {
  margin: 0;
  color: var(--ink-secondary);
  line-height: 1.6;
  max-width: 60ch;
}

/* Festive Daily Task & Christmas Countdown card */
.holiday-banner-slot:empty {
  display: none;
}

.holiday-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 18px 22px;
  background: linear-gradient(125deg, rgba(255, 252, 244, 0.98) 0%, rgba(252, 241, 224, 0.95) 60%, rgba(245, 234, 218, 0.95) 100%);
  border: 1px solid rgba(25, 84, 62, 0.22);
  border-left: 5px solid var(--pine);
}

.holiday-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: repeating-linear-gradient(
    90deg,
    var(--crimson) 0 18px,
    var(--gold) 18px 28px,
    var(--pine) 28px 46px,
    var(--gold) 46px 56px
  );
  opacity: 0.78;
}

.holiday-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.holiday-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.holiday-end-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(192, 47, 40, 0.1);
  border: 1px solid rgba(192, 47, 40, 0.22);
  color: var(--crimson-dark);
  font-size: 0.84rem;
  font-weight: 600;
}

.holiday-mono-clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}

.holiday-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.18rem;
  color: var(--ink-primary);
}

.holiday-desc {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--ink-secondary);
}

.holiday-subtle-note {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pine);
}

.countdown-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(60px, 1fr));
  gap: 8px;
}

.countdown-box {
  display: grid;
  justify-items: center;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid rgba(207, 150, 53, 0.35);
  box-shadow: 0 3px 10px rgba(45, 31, 18, 0.06);
}

.countdown-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  line-height: 1.1;
  color: var(--crimson-dark);
}

.countdown-unit {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.landing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
}

.entry-card {
  display: grid;
  gap: 14px;
  align-content: start;
}

.entry-card--host {
  border-top: 3px solid var(--pine);
}

.entry-card--guest {
  border-top: 3px solid var(--gold);
}

.entry-card h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.entry-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.card-tag {
  justify-self: start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
}

.card-tag--pine {
  background: var(--pine-soft);
  color: var(--pine);
}

.card-tag--crimson {
  background: var(--crimson-soft);
  color: var(--crimson-dark);
}

.card-tag--gold {
  background: var(--gold-soft);
  color: #7d5613;
}

/* Room Workspace */
.room-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.stage-column {
  display: grid;
  gap: 20px;
}

.paper-slot,
.jar-slot {
  width: 100%;
}

.lobby-column {
  display: grid;
  gap: 16px;
}

/* Modal & Toast */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(24, 18, 12, 0.48);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(490px, 100%);
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-top: 3px solid var(--crimson);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 24px 56px rgba(18, 12, 6, 0.28);
  display: grid;
  gap: 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
}

.modal-body {
  display: grid;
  gap: 12px;
  font-size: 0.93rem;
  color: var(--ink-secondary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.toast-rack {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #241b15;
  color: #fffaf0;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.87rem;
  font-weight: 500;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(207, 150, 53, 0.38);
  animation: toastIn 0.2s ease;
}

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

/* Utility badges & lobby pieces */
.room-code-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #fff8ea, #f7ead0);
  border: 1px dashed var(--gold);
}

.room-code-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--crimson-dark);
}

.roster-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow-y: auto;
}

.roster-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-parchment);
  border: 1px solid var(--border-soft);
  font-size: 0.9rem;
}

.roster-person {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.roster-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.roster-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-muted);
}

.mini-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--pine-soft);
  color: var(--pine);
}

.mini-pill--warn {
  background: rgba(217, 119, 6, 0.15);
  color: #92400e;
}

.mini-pill--danger {
  background: rgba(220, 38, 38, 0.12);
  color: var(--crimson-dark);
  border: none;
  padding: 3px 8px;
}

.qr-wrap {
  display: grid;
  place-items: center;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
}

.code-box {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #faf6ee;
  word-break: break-all;
}

.claim-shell {
  max-width: 580px;
  margin: 24px auto;
}

@media (max-width: 880px) {
  .landing-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero-jar-preview {
    margin: 0 auto;
  }
  .hero-copy p {
    margin: 0 auto;
  }
  .room-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .hide-sm {
    display: none;
  }
  .top-bar {
    padding: 10px 14px 8px;
  }
  .app-main {
    padding: 8px 14px 72px;
  }
  .countdown-grid {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .light-bulb {
    animation: none !important;
  }
}
