:root {
  color-scheme: light;
  --paper: #f7f1e7;
  --cream: #fff9eb;
  --ink: #20352e;
  --muted: #565347;
  --pine: #203931;
  --gold: #efc079;
  --berry: #843641;
  --body: system-ui, sans-serif;
  --display: Georgia, 'Times New Roman', serif;
  font: 1rem/1.5 var(--body);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
body:has(#welcome:not([hidden])) {
  background: radial-gradient(ellipse at 10% 12%, #31483b, #182d27 64%);
}
body:has(dialog[open]) { overflow: hidden; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; width: 100%; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid #aa502e; outline-offset: 4px; }

.page { max-width: 83rem; margin-inline: auto; padding: 2rem clamp(1rem, 3vw, 3rem); }
.page:has(#welcome:not([hidden])) {
  display: grid;
  align-items: center;
  min-height: 100svh;
}
.welcome {
  display: grid;
  grid-template-columns: minmax(20rem, .63fr) minmax(0, 1fr);
  min-height: 35rem;
  overflow: hidden;
  background: var(--cream);
  border: 1px solid #d5b987;
  border-radius: 1.3rem;
  box-shadow: 0 1.4rem 5rem #091a1599;
}
.welcome-content { display: grid; align-items: center; padding: clamp(2rem, 5vw, 4.5rem); }
.welcome-inner { width: 100%; max-width: 26rem; margin-inline: auto; }
.welcome-image { position: relative; }
.welcome-image img {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: cover;
  object-position: 55% center;
}
.welcome h1, .calendar-header h1, .message-inner h2 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: -.045em;
  line-height: .99;
}
.welcome h1 { font-size: clamp(3rem, 5vw, 5.25rem); }
.festive-mark {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  margin-bottom: 1.25rem;
  border: 1px solid #d9bf92;
  border-radius: 50%;
  color: #854627;
  font-size: 1.4rem;
  line-height: 1;
}
.welcome-intro { max-width: 27ch; margin-top: 1.15rem; color: var(--muted); }
#login, #load-error, #loading, noscript .notice { margin-top: 1.75rem; }
html:has(noscript .notice) #loading { display: none; }
#login { display: grid; gap: .55rem; }
#login label { font-size: .9rem; font-weight: 650; }
#password {
  width: 100%;
  min-height: 3.15rem;
  padding: .65rem .85rem;
  border: 1px solid #9a8b73;
  border-radius: .45rem;
  background: #fffcf5;
  color: var(--ink);
}
#password[aria-invalid="true"] { border-color: var(--berry); }
.notice { color: var(--muted); }
#login-error, #load-error-text { color: #812d38; }
#login-error:empty { display: none; }
.action {
  min-height: 3.15rem;
  padding: .65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: .45rem;
  background: var(--pine);
  color: var(--cream);
  font-weight: 650;
}
#login .action, #retry { width: 100%; margin-top: .35rem; }
.action:hover:not(:disabled) { background: #335347; }
.action:disabled { opacity: .7; }

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-block: .4rem 1.25rem;
}
.calendar-header h1 { font-size: clamp(2.7rem, 5.5vw, 5.1rem); }
.calendar-header h1:focus { outline: 0; }
.calendar-tools { display: flex; flex: none; flex-wrap: wrap; gap: .45rem; }
.calendar-tool {
  flex: none;
  min-height: 2.75rem;
  padding: .38rem .8rem;
  border: 1px solid #a7987d;
  border-radius: 2rem;
  background: var(--cream);
  color: var(--ink);
}
.calendar-tool:hover { border-color: var(--ink); }
.sound { width: 2.75rem; padding: 0; font-size: 1.3rem; }
.sound span { position: relative; }
.sound[aria-pressed="false"] span::after {
  position: absolute;
  inset: 52% -.13rem auto;
  border-top: 2px solid currentColor;
  transform: rotate(-45deg);
  content: '';
}
.sound[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: var(--cream); }
.calendar-error { color: #812d38; }
.calendar-error:empty { display: none; }
#calendar-error { margin-block: 0 .75rem; }
.scene {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 1rem;
  background: #213831;
  box-shadow: 0 .7rem 2rem #4f342033;
}
.scene-image { height: auto; }
.door {
  display: grid;
  place-items: center;
  width: clamp(2.75rem, 4.1vw, 3.4rem);
  height: clamp(2.75rem, 4.1vw, 3.4rem);
  padding: 0;
  border: 1px solid #ffdb9a;
  border-radius: .6rem;
  background: #67232c;
  color: #fff3da;
  font: 700 1.35rem / 1 var(--display);
  box-shadow: 0 2px 6px #160e0a9c;
}
.door:disabled {
  border-color: #e0c495a8;
  background: #272b25dc;
  color: #f7e9cf;
}
.door.opened:not(:disabled) { background: #f5dfb2; color: #243b30; border-color: #e4ad55; }
.door:not(:disabled):hover { background: #9a3f45; }
.door.opened:not(:disabled):hover { background: #fff4d8; }
.door:focus-visible { z-index: 1; outline-color: #ffe6aa; box-shadow: 0 0 0 6px #242b23; }
.door-check {
  position: absolute;
  right: -.23rem;
  bottom: -.23rem;
  display: grid;
  width: 1.13rem;
  height: 1.13rem;
  place-items: center;
  border: 1px solid var(--cream);
  border-radius: 50%;
  background: var(--pine);
  color: var(--cream);
  font: 700 .66rem / 1 var(--body);
}
dialog {
  width: min(29rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: .65rem;
  border: 1px solid #b68b51;
  border-radius: 1rem;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 1rem 5rem #130b0899;
}
dialog::backdrop { background: #151f1bd4; }
.message-inner {
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: clamp(1.35rem, 6vw, 2.8rem);
  border: 1px solid #d9bf92;
  border-radius: .55rem;
  text-align: center;
}
.message-inner .festive-mark { margin-bottom: 0; }
.message-inner h2 { font-size: clamp(2.25rem, 7vw, 3.45rem); }
.message-inner p { font: 1.3rem/1.43 var(--display); overflow-wrap: anywhere; }
.message-inner .calendar-error { font: 1rem/1.5 var(--body); }
.dialog-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: .55rem; margin-top: .4rem; }
.action.undo-completion { background: #854627; }
.action.undo-completion:hover:not(:disabled) { background: #6d381f; }
.secondary-action { border-color: #a7987d; background: transparent; color: var(--ink); }
.secondary-action:hover:not(:disabled) { background: var(--paper); }
.action[aria-disabled="true"] { opacity: .7; cursor: default; }
.wish-list-panel {
  display: grid;
  gap: 1rem;
  padding: clamp(.85rem, 3vw, 2rem);
  border: 1px solid #d9bf92;
  border-radius: 1rem;
  background: var(--cream);
}
.wish-list-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.wish-list-panel h2 { font: 400 clamp(1.65rem, 5vw, 3rem)/1.1 var(--display); }
.wish-list-panel table { width: 100%; border-collapse: collapse; }
.wish-list-panel th, .wish-list-panel td {
  padding: .5rem .3rem;
  border-bottom: 1px solid #dfcfb4;
  text-align: left;
  vertical-align: top;
}
.wish-list-panel td:nth-child(2) { overflow-wrap: anywhere; }
.wish-list-panel :is(th, td):last-child { width: 1%; text-align: center; }
.wish-list-check {
  display: inline-grid;
  width: 1.25rem;
  height: 1.25rem;
  place-items: center;
  border-radius: 50%;
  background: var(--pine);
  color: var(--cream);
  font-size: .8rem;
  font-weight: 700;
}

@media (min-width: 761px) and (pointer: fine) {
  .doors { position: absolute; inset: 0; }
  .door { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); }
  .door[data-day="1"] { --x: 61%; --y: 24%; }
  .door[data-day="2"] { --x: 19%; --y: 35%; }
  .door[data-day="3"] { --x: 74%; --y: 70%; }
  .door[data-day="4"] { --x: 55%; --y: 52%; }
  .door[data-day="5"] { --x: 8%; --y: 27%; }
  .door[data-day="6"] { --x: 88%; --y: 47%; }
  .door[data-day="7"] { --x: 35%; --y: 44%; }
  .door[data-day="8"] { --x: 41%; --y: 17%; }
  .door[data-day="9"] { --x: 68%; --y: 32%; }
  .door[data-day="10"] { --x: 50%; --y: 35%; }
  .door[data-day="11"] { --x: 31%; --y: 73%; }
  .door[data-day="12"] { --x: 90%; --y: 75%; }
  .door[data-day="13"] { --x: 15%; --y: 16%; }
  .door[data-day="14"] { --x: 69%; --y: 48%; }
  .door[data-day="15"] { --x: 59%; --y: 72%; }
  .door[data-day="16"] { --x: 90%; --y: 26%; }
  .door[data-day="17"] { --x: 12%; --y: 67%; }
  .door[data-day="18"] { --x: 37%; --y: 31%; }
  .door[data-day="19"] { --x: 43%; --y: 64%; }
  .door[data-day="20"] { --x: 81%; --y: 59%; }
  .door[data-day="21"] { --x: 22%; --y: 54%; }
  .door[data-day="22"] { --x: 54%; --y: 17%; }
  .door[data-day="23"] { --x: 70%; --y: 86%; }
  .door[data-day="24"] { --x: 61%; --y: 7%; }
}

@media (max-width: 760px), (pointer: coarse), (pointer: none) {
  .page { padding-block: 1.15rem; }
  .welcome { grid-template-columns: 1fr; min-height: 0; }
  .welcome h1 { font-size: clamp(2.65rem, 9.5vw, 4.2rem); }
  .welcome h1 br { display: none; }
  .welcome-content { padding: clamp(1.25rem, 6vw, 2rem); }
  .welcome-image { order: -1; height: clamp(10rem, 43vw, 17rem); }
  .welcome-image img { object-position: center 54%; }
  .welcome-intro { max-width: 33ch; margin-top: .7rem; }
  .welcome .festive-mark { display: none; }
  #login, #load-error { margin-top: 1.15rem; }
  .calendar-header { align-items: center; flex-wrap: wrap; gap: .55rem; }
  .calendar-tools { margin-left: auto; }
  .calendar-header h1 { font-size: clamp(2.05rem, 7vw, 3.6rem); }
  .scene-image { height: clamp(8.5rem, 34vw, 19rem); object-fit: cover; object-position: center 55%; }
  .doors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; padding: .85rem; }
  .door { position: relative; width: 100%; height: clamp(2.9rem, 12vw, 4.4rem); }
}
