:root {
  color-scheme: dark;
  --background: #191a1b;
  --panel: #222426;
  --door: #26282b;
  --line: #454747;
  --text: #f7f4eb;
  --muted: #bdbdb7;
  --yellow: #ffda4f;
  --yellow-soft: #c3ae63;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  min-width: 240px;
  min-height: 100vh;
  background: radial-gradient(ellipse at 82% 0%, #302c21 0%, transparent 36%), var(--background);
  color: var(--text);
}

button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 4px; }

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: .55rem;
  padding-bottom: .45rem;
  border-bottom: 2px solid var(--yellow);
  color: var(--yellow);
  font-size: .85rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.brand strong {
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: .06em;
}

h1 {
  margin: .8rem 0 0;
  font-size: clamp(2rem, 5.2vw, 4.2rem);
  font-weight: 760;
  letter-spacing: -.055em;
  line-height: 1.02;
}

.login-layout {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: clamp(1rem, 6vw, 3rem);
}

.login-panel {
  width: min(100%, 29rem);
  padding: clamp(1.25rem, 6vw, 2.85rem);
  border: 1px solid var(--line);
  border-top: 3px solid var(--yellow);
  border-radius: .8rem;
  background: var(--panel);
  box-shadow: 0 1.6rem 5rem #0005;
}

.login-panel h1 { font-size: clamp(2rem, 7vw, 3.35rem); }
.login-panel form { display: grid; gap: .65rem; margin-top: 2rem; }
.login-panel label { font-size: .9rem; font-weight: 650; }
.login-panel label:not(:first-child) { margin-top: .5rem; }

.login-panel input {
  min-width: 0;
  min-height: 3.1rem;
  padding: .65rem .8rem;
  border: 1px solid #676866;
  border-radius: .35rem;
  color: var(--text);
  background: #191a1b;
}

.primary, .close {
  min-height: 2.75rem;
  padding: .65rem 1rem;
  border: 1px solid transparent;
  border-radius: .35rem;
  background: var(--yellow);
  color: #201c10;
  font-weight: 750;
}

.primary { margin-top: .7rem; }
.primary:hover, .close:hover { background: #ffe580; }
.form-error, .calendar-error { margin: .3rem 0; color: #ffc0a3; }

.calendar-layout {
  width: min(100%, 78rem);
  margin-inline: auto;
  padding: clamp(1rem, 4vw, 3.25rem);
}

.calendar-header {
  padding: .75rem 0 clamp(1.25rem, 4vw, 2.5rem);
}

.mobile-break { display: none; }

.door-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: clamp(.55rem, 1.55vw, 1.05rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.door {
  position: relative;
  display: grid;
  align-content: space-between;
  justify-items: start;
  gap: .5rem;
  width: 100%;
  min-height: clamp(6.3rem, 10.2vw, 8.7rem);
  padding: clamp(.65rem, 1.45vw, 1rem);
  border: 1px solid #71643a;
  border-radius: .42rem;
  background: linear-gradient(140deg, #363222, var(--door) 70%);
  box-shadow: inset 3px 0 #b5994f;
  text-align: left;
  color: var(--yellow);
}

.door::after {
  position: absolute;
  top: 45%;
  right: .6rem;
  width: .3rem;
  height: .75rem;
  border-radius: .2rem;
  background: currentColor;
  opacity: .48;
  content: "";
}

.door:enabled:hover {
  border-color: var(--yellow);
  background: #3a3423;
}

.door:disabled {
  border-color: #3d3f40;
  background: #212325;
  box-shadow: inset 3px 0 #3f3e39;
  color: var(--yellow-soft);
  cursor: default;
}

.door.today {
  border-color: var(--yellow);
  background: linear-gradient(125deg, #4c4023, #312a1d);
  box-shadow: inset 4px 0 var(--yellow);
}

.door-number {
  font-size: clamp(1.7rem, 4vw, 3.25rem);
  font-weight: 740;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.055em;
  line-height: 1;
}

.door-hint {
  font-size: clamp(.69rem, 1.35vw, .86rem);
  font-weight: 600;
  color: var(--text);
}

.door:disabled .door-hint { color: var(--muted); }
.door.today .door-hint { color: var(--yellow); }

dialog {
  width: min(40rem, calc(100% - 1.6rem));
  max-width: none;
  max-height: calc(100% - 1.6rem);
  max-height: calc(100dvh - 1.6rem);
  margin: auto;
  padding: 0;
  overflow: visible;
  border: 1px solid #736336;
  border-radius: .65rem;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1.5rem 5rem #0009;
}

dialog::backdrop { background: #0c0d0edb; }
body:has(dialog[open]) { overflow: hidden; }

.dialog-frame {
  position: relative;
  display: flex;
  min-height: min(17rem, calc(100dvh - 1.6rem));
  max-height: calc(100dvh - 1.6rem);
  flex-direction: column;
  perspective: 80rem;
}

.dialog-bar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .8rem clamp(.85rem, 4vw, 1.8rem);
  border-bottom: 1px solid var(--line);
}

.dialog-bar h2 {
  margin: 0;
  color: var(--yellow);
  font-size: clamp(1rem, 4vw, 1.4rem);
}

.close { font-size: .9rem; }

.scroll-frame {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(1rem, 5vw, 2.15rem);
}

.scroll-frame:focus-visible { outline-offset: -4px; }
.saying { overflow-wrap: break-word; }
.saying p {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 2rem);
  line-height: 1.45;
}

.saying.christmas p { font-size: clamp(1rem, 4vw, 1.22rem); line-height: 1.6; }
.saying.christmas p + p { margin-top: .9rem; }
.saying.christmas p:first-child { font-size: clamp(1.3rem, 5vw, 1.8rem); font-weight: 750; }
.saying.christmas p:last-child { font-weight: 700; }

.door-swing {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: none;
  place-items: center;
  border: 1px solid var(--yellow);
  border-radius: .6rem;
  background: linear-gradient(125deg, #534521, #302a1e);
  box-shadow: inset 6px 0 var(--yellow);
  color: var(--yellow);
  font-size: clamp(2.5rem, 12vw, 6rem);
  font-weight: 780;
  transform-origin: left center;
  pointer-events: none;
}

dialog[open] .door-swing {
  display: grid;
  animation: swing-open .55s cubic-bezier(.3, .05, .23, 1) both;
}

@keyframes swing-open {
  0% { transform: rotateY(0); opacity: 1; visibility: visible; }
  80% { opacity: 1; }
  100% { transform: rotateY(-100deg); opacity: 0; visibility: hidden; }
}

@media (max-width: 53rem) {
  .door-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 32rem) {
  .mobile-break { display: initial; }
  .door-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 20rem) {
  .door-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  dialog[open] .door-swing { display: none; }
}
