:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  background: #102d25;
  color: #26352e;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

.santa-page {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, #0b241fde, #0b241f51 52%, #0b241f9e),
    url("../study/assets/gameSecretSanta.jpg") center 48% / cover no-repeat,
    #102d25;
}

.santa {
  --santa-panel-background: #fffcf4;
  width: min(100% - 2rem, 35rem);
  margin-inline: auto;
  padding-block: clamp(2.5rem, 8vw, 5rem);
}

.santa-language {
  position: absolute;
  top: .7rem;
  right: clamp(.75rem, 3vw, 2rem);
}

.santa-language::after {
  position: absolute;
  top: .82rem;
  right: .8rem;
  width: .42rem;
  height: .42rem;
  transform: rotate(45deg);
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  color: #fff6eb;
  pointer-events: none;
  content: "";
}

.santa-language select {
  appearance: none;
  min-height: 2.2rem;
  padding: .35rem 1.85rem .35rem .7rem;
  border: 1px solid #dcc493;
  border-radius: .55rem;
  background: #102d25;
  color: #fff6eb;
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}

.santa-header {
  margin-bottom: 1.8rem;
  color: #fff6eb;
  text-align: center;
  text-shadow: 0 2px 15px #0b241f;
}

.santa h1 {
  margin: 0;
  font-family: Georgia, serif;
  line-height: 1.1;
}

.santa h1 { font-size: clamp(2.9rem, 10vw, 5rem); }
:lang(ja) .santa h1 { font-size: clamp(2rem, 8.5vw, 4.5rem); }
.santa-header p { margin: .65rem 0 0; color: #f2e3c8; }

.santa-gift {
  display: inline-grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin-bottom: 1rem;
  border: 1px solid #e6c88e;
  border-radius: 100%;
  background: #9b2539;
  color: #fff0cf;
}

.santa-gift span {
  position: relative;
  width: 1.4rem;
  height: 1.1rem;
  margin-top: .35rem;
  border: 2px solid currentColor;
  background: linear-gradient(90deg, transparent calc(50% - 1px), currentColor 0 calc(50% + 1px), transparent 0);
}

.santa-gift span::before,
.santa-gift span::after {
  position: absolute;
  top: -.55rem;
  width: .55rem;
  height: .45rem;
  border: 2px solid currentColor;
  content: "";
}

.santa-gift span::before { right: 50%; border-radius: 70% 90% 0 70%; }
.santa-gift span::after { left: 50%; border-radius: 90% 70% 70% 0; }

.santa-panel {
  padding: clamp(1.15rem, 5vw, 2rem);
  border: 1px solid #e6d4ac;
  border-radius: 1.25rem;
  background: var(--santa-panel-background);
  box-shadow: 0 1.1rem 3rem #081f1980;
}

.santa-actions, .santa form { display: grid; gap: .75rem; }
.santa form { margin-top: 1.25rem; }
.santa form { padding-top: 1.2rem; border-top: 1px solid #e4cfc4; }
.santa form label { font-weight: 650; }
.santa form input + label { margin-top: .4rem; }
.santa form input, .santa button, .santa textarea { font: inherit; }

.santa button {
  min-height: 2.85rem;
  padding: .65rem .9rem;
  border: 1px solid transparent;
  border-radius: .6rem;
  background: #9b2539;
  color: #fff;
  font-weight: 660;
  cursor: pointer;
}

.santa button:hover:enabled { background: #73182a; }
.santa button:disabled { background: #eceee9; color: #626b64; cursor: default; }
.santa .santa-secondary { border-color: #95ac9b; background: transparent; color: #21513e; }
.santa .santa-secondary:hover:enabled { background: #e5eee5; }
.santa .santa-copy { min-width: 4.5rem; padding-inline: .65rem; background: #fffcf4; font-size: .9rem; }
.santa-copy-status { margin: 0; color: #21513e; font-size: .9rem; font-weight: 650; text-align: center; }
#show-admin:enabled { border-color: #dba873; background: #fff0de; color: #863813; }
#show-admin:hover:enabled, #show-admin[aria-expanded="true"]:enabled { background: #fbe0c1; }

.santa input, .santa textarea {
  width: 100%;
  min-width: 0;
  min-height: 2.85rem;
  padding: .6rem .7rem;
  border: 1px solid #928980;
  border-radius: .6rem;
  background: #fff;
  color: #26352e;
}

.santa :focus-visible { outline: 3px solid #a04b38; outline-offset: 3px; }
.santa-inline { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.santa-inline button { flex-shrink: 0; }
.santa-photo-picker {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: .75rem;
  min-height: 4.15rem;
  padding: .8rem;
  border: 1px dashed #c99b60;
  border-radius: .65rem;
  background: #fff4e3;
  color: #703421;
}
.santa-photo-picker:hover { background: #ffedcf; }
.santa-photo-picker:focus-within { outline: 3px solid #a04b38; outline-offset: 3px; }
.santa .santa-photo-picker input {
  position: absolute;
  z-index: 1;
  inset: 0;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.santa-photo-picker-icon {
  display: grid;
  place-items: center;
  width: 2.05rem;
  height: 2.05rem;
  border-radius: .55rem;
  background: #edd3ab;
  font-size: 1.3rem;
  line-height: 1;
}
.santa-photo-picker-icon::before { content: "+"; }
.santa-photo-picker-text { display: grid; gap: .15rem; overflow-wrap: anywhere; }
.santa-room { display: grid; gap: .8rem; }
.santa-room-toolbar { display: flex; justify-content: space-between; gap: .65rem; }
.santa-back { justify-self: center; margin-top: .25rem; }
.santa-divider { width: 100%; margin: .25rem 0; border: 0; border-top: 1px solid #e4cfc4; }
.santa-code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .65rem; }
.santa-code-box {
  display: grid;
  gap: .3rem;
  padding: .7rem .85rem;
  border: 1px solid #b3c8b2;
  border-radius: .65rem;
  background: #eaf2e7;
  color: #194232;
}
.santa-code-admin { border-color: #e4bcb7; background: #f8e9e4; color: #771f33; }
.santa-code-box span { font-size: .875rem; font-weight: 650; }
.santa-code-box code {
  font-size: clamp(.95rem, 4vw, 1.25rem);
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.3;
  overflow-wrap: anywhere;
  user-select: all;
}
.santa-room-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.santa-note { color: #515f54; font-size: .9375rem; line-height: 1.45; }
#lobby > .santa-note { margin-bottom: 0; text-align: center; }
.santa-room > .santa-note, .santa form .santa-note { margin: 0; }
.santa .santa-room-form { margin: 0; padding-top: .85rem; }

.santa-methods {
  display: grid;
  gap: .45rem;
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.santa-methods legend { margin-bottom: .5rem; font-weight: 650; }
.santa .santa-method {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .65rem;
  padding: .65rem .75rem;
  border: 1px solid #d3decc;
  border-radius: .55rem;
  background: #f1f5eb;
  cursor: pointer;
}
.santa .santa-method:has(input:checked) { border-color: #7c9a82; background: #e4eee1; }
.santa .santa-method input { width: 1rem; min-height: 0; margin: .22rem 0 0; accent-color: #21513e; }
.santa-method small { display: block; margin-top: .12rem; color: #515f54; font-size: .875rem; font-weight: 400; }
.santa-methods:disabled .santa-method { cursor: default; }

#unwrapping-message {
  position: absolute;
  z-index: 1;
  top: .75rem;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 1.5rem);
  margin: 0;
  padding: .35rem .7rem;
  transform: translateX(-50%);
  border-radius: .45rem;
  background: #fffcf4;
  color: #7c2d3e;
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
}

.santa-photo-frame {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  height: clamp(12rem, 58vw, 18rem);
  overflow: hidden;
  padding: .65rem;
  border: .25rem solid #d9ac6a;
  border-radius: .65rem;
  background: #fff9ed;
  box-shadow: inset 0 0 0 1px #a16a36, 0 .4rem 1rem #61263424;
}

.santa-photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  visibility: hidden;
}

.santa-unwrapped img { visibility: visible; }

.santa-wrapping {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  perspective: 40rem;
  pointer-events: none;
}

.santa-wrap-left, .santa-wrap-right {
  position: relative;
  background:
    linear-gradient(0deg, transparent calc(50% - .42rem), #e9bd72 0 calc(50% + .42rem), transparent 0),
    repeating-linear-gradient(135deg, #861e35 0 1rem, #991f36 1rem 2rem);
}

.santa-wrap-left { transform-origin: left center; }
.santa-wrap-right { transform-origin: right center; }

.santa-wrap-left::after, .santa-wrap-right::after {
  position: absolute;
  inset-block: 0;
  width: .42rem;
  background: #e9bd72;
  content: "";
}

.santa-wrap-left::after { right: 0; }
.santa-wrap-right::after { left: 0; }

.santa-wrap-knot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.2rem;
  height: 1.2rem;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid #f9dca0;
  border-radius: .2rem;
  background: #e9bd72;
  box-shadow: 0 0 .55rem #62243b80;
}

.santa-unwrapped .santa-wrap-left { animation: santa-unfold-left .65s ease-out both; }
.santa-unwrapped .santa-wrap-right { animation: santa-unfold-right .65s ease-out both; }
.santa-unwrapped .santa-wrap-knot { animation: santa-untie .25s ease-out both; }

@keyframes santa-unfold-left {
  to { transform: translateX(-30%) rotateY(-100deg); opacity: 0; }
}

@keyframes santa-unfold-right {
  to { transform: translateX(30%) rotateY(100deg); opacity: 0; }
}

@keyframes santa-untie {
  to { transform: translate(-50%, -75%) rotate(75deg) scale(.55); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .santa-unwrapped .santa-wrapping { visibility: hidden; }
  .santa-unwrapped .santa-wrapping span { animation: none; }
}

.santa-message {
  --bell-red: #ae4a33;
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1rem 0 0;
  padding: .85rem 1rem;
  border: 1px solid #eac7ab;
  border-inline-start: .4rem solid var(--bell-red);
  border-radius: .75rem;
  background: var(--santa-panel-background);
  color: #543624;
  font-weight: 600;
  box-shadow: 0 .5rem 1.4rem #3c211840;
}

.santa-message-loading { border-block-color: #dba980; border-inline-end-color: #dba980; }
.santa-message-emblem {
  display: grid;
  flex: 0 0 1.65rem;
  justify-items: center;
  gap: .5rem;
}

.santa-message-bell {
  position: relative;
  width: .9rem;
  height: .9rem;
  margin-block-end: .22rem;
  border-radius: 55% 55% 0 0;
  background: var(--bell-red);
}

.santa-message-bell::before,
.santa-message-bell::after {
  content: "";
  position: absolute;
}

.santa-message-bell::before {
  inset: auto -.18rem 0;
  height: .22rem;
  border-radius: 1rem;
  background: var(--bell-red);
}

.santa-message-bell::after {
  inset: auto 0 -.22rem;
  width: .24rem;
  height: .18rem;
  margin-inline: auto;
  border-radius: 0 0 50% 50%;
  background: #94611e;
}

.santa-message-motion { display: flex; gap: .22rem; }
.santa-message-motion span {
  width: .4rem;
  height: .4rem;
  border-radius: .13rem;
  background: var(--bell-red);
  animation: santa-message-bounce .9s ease-in-out infinite;
}
.santa-message-motion span:nth-child(2) { animation-delay: .13s; background: #94611e; }
.santa-message-motion span:nth-child(3) { animation-delay: .26s; }

@keyframes santa-message-bounce {
  0%, 65%, 100% { transform: translateY(0) rotate(0); border-radius: .13rem; }
  30% { transform: translateY(-.28rem) rotate(45deg); border-radius: 50%; }
}

@media (prefers-reduced-motion: reduce) {
  .santa-message-motion span { animation: none; }
}

.santa noscript { color: #fff6eb; }
