@media screen {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
  }

  .page-shell {
    flex-grow: 1;
  }
}

.room-header-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--hairline-light);
}

.room-title-block h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3.4vw, 2.75rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: #fffdf8;
}

.room-meta-line {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--text-soft);
}

.room-meta-strong {
  color: var(--gold-bright);
  font-weight: 600;
}

.room-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.52fr) minmax(310px, 0.82fr);
  gap: 28px;
  align-items: start;
}

@media (max-width: 1020px) {
  .room-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.board-subfooter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding: 12px 6px 0;
  border-top: 1px solid rgba(252, 235, 192, 0.16);
  font-size: var(--text-sm);
  color: var(--text-soft);
}

.hint-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.hint-inline svg {
  width: 16px;
  height: 16px;
  color: var(--gold);
  flex-shrink: 0;
}

/* Illustrated Nordic Christmas Tree View */
.tree-stage {
  position: relative;
  background:
    radial-gradient(circle at 50% 14%, rgba(240, 194, 91, 0.2), transparent 44%),
    linear-gradient(180deg, var(--bg-felt) 0%, var(--bg-felt-2) 100%);
  border-radius: 24px;
  border: 1px solid var(--felt-border);
  padding: 28px 18px 24px;
  box-shadow: 0 30px 64px -24px rgba(0, 0, 0, 0.78);
  overflow: hidden;
}

.tree-stage::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.5px dashed var(--stitch);
  border-radius: 17px;
  pointer-events: none;
}

.tree-canopy-wrap {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}

.tree-backdrop-svg {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

/* Interactive Tree Ornament Tiers */
.tree-tiers {
  position: relative;
  z-index: 3;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.tree-tier-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.ornament-btn {
  position: relative;
  width: 84px;
  min-height: 78px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 8px;
  color: #fffdf8;
  transition: transform 180ms var(--ease-out);
}

.ornament-btn:hover {
  transform: translateY(-3px);
}

.ornament-hook {
  width: 2px;
  height: 10px;
  background-color: var(--gold);
  margin-bottom: -2px;
}

.ornament-bauble {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 1.5px solid rgba(255, 253, 248, 0.45);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45), inset 0 2px 4px rgba(255, 255, 255, 0.3);
  background: radial-gradient(circle at 32% 28%, #d63b56, #87162a);
}

.ornament-btn.tone-a .ornament-bauble {
  background: radial-gradient(circle at 32% 28%, #247858, #103c2b);
}

.ornament-btn.tone-c .ornament-bauble {
  background: radial-gradient(circle at 32% 28%, #f4d279, #b57c18);
  color: #291a04;
}

.ornament-btn.is-empty .ornament-bauble {
  background: rgba(7, 25, 20, 0.56);
  border: 1.5px dashed rgba(252, 235, 192, 0.52);
  color: var(--gold-bright);
  box-shadow: none;
}

.tree-pine-silhouette {
  position: absolute;
  inset: 56px 0 42px;
  width: 100%;
  height: calc(100% - 98px);
  z-index: 1;
  pointer-events: none;
}

.ornament-btn.is-today .ornament-bauble {
  box-shadow: 0 0 0 2.5px var(--gold), 0 0 22px rgba(240, 194, 91, 0.65);
}

.ornament-num {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
}

.ornament-day-badge {
  position: absolute;
  top: -5px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background-color: #fbf5e8;
  color: #172a21;
  font-family: var(--font-serif);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.ornament-ribbon {
  margin-top: 5px;
  max-width: 82px;
  padding: 2px 6px;
  border-radius: 5px;
  background-color: #fbf5e8;
  color: #172a21;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ornament-btn.is-empty .ornament-ribbon {
  background: transparent;
  color: rgba(251, 247, 238, 0.74);
}

@media (max-width: 560px) {
  .tree-stage { padding: 22px 10px 18px; }
  .tree-tier-row { gap: 6px; }
  .ornament-btn { width: 64px; min-height: 74px; }
  .ornament-bauble { width: 42px; height: 42px; }
  .ornament-ribbon { max-width: 62px; }
}

/* Side Stationery Panel (Owner Dashboard / Friend Welcome) */
.side-sheet {
  position: sticky;
  top: 86px;
  margin-top: 66px;
  background-color: var(--parchment);
  color: var(--ink);
  border-radius: 22px;
  padding: 24px 22px;
  border: 1px solid rgba(240, 194, 91, 0.46);
  box-shadow: 0 28px 58px -24px rgba(0, 0, 0, 0.72);
}

@media (max-width: 1020px) {
  .side-sheet {
    position: static;
    margin-top: 0 !important;
  }
}

.side-sheet h2 {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.18;
  color: var(--ink);
}

.side-sheet p {
  margin-top: 6px;
  font-size: var(--text-base);
  color: var(--ink-muted);
}

.sheet-divider {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--hairline-dark);
}

.action-stack {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.action-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.theme-mini-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 11px;
  background-color: var(--parchment-warm);
  border: 1px solid #dcd1be;
  margin-top: 8px;
}

.theme-mini-btn {
  padding: 7px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
}

.theme-mini-btn.active {
  background-color: #ffffff;
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(23, 42, 33, 0.12);
}

.owner-key-box {
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 11px;
  background-color: var(--parchment-warm);
  border: 1px solid #dcd1be;
  font-size: var(--text-sm);
}

.owner-key-code {
  margin-top: 4px;
  font-weight: 700;
  color: #14533c;
  word-break: break-all;
}

/* Printable QR Poster inside Modal */
.qr-poster-sheet {
  margin-top: 14px;
  padding: 22px 18px;
  border-radius: 16px;
  background-color: #ffffff;
  border: 2px dashed #14533c;
  text-align: center;
}

.qr-poster-sheet h4 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--ink);
}

.qr-matrix-wrap {
  width: 168px;
  height: 168px;
  margin: 14px auto;
  padding: 10px;
  border-radius: 12px;
  background-color: #fbf5e8;
  border: 1px solid #dcd1be;
}

@media print {
  .site-header, .room-header-bar, .room-grid, .site-footer, .modal-close, .no-print {
    display: none !important;
  }
  body { background: #ffffff !important; color: #000000 !important; }
  .modal-backdrop { position: static !important; background: none !important; padding: 0 !important; display: block !important; }
  .modal-paper { box-shadow: none !important; border: 0 !important; max-width: 100% !important; }
}

.room-alert {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background-color: rgba(240, 194, 91, 0.14);
  border: 1px solid rgba(240, 194, 91, 0.4);
  color: var(--text-soft);
  font-size: var(--text-sm);
}

.room-alert strong { color: var(--gold-bright); }

.owner-new-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background-color: var(--crimson);
  color: #fffdf8;
  font-size: 0.78rem;
  font-weight: 700;
}

.notfound-sheet {
  max-width: 560px;
  margin: 24px auto 0;
  background-color: var(--parchment);
  color: var(--ink);
  border-radius: 22px;
  padding: 28px 24px;
  text-align: center;
}

.notfound-sheet h1 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--ink);
}

.notfound-sheet p { margin-top: 8px; color: var(--ink-muted); }
