.santa-main {
  padding-bottom: 48px;
}

.santa-game {
  --santa-navy: #142a47;
  --santa-blue: #1d4568;
  --santa-red: #b83232;
  --santa-gold: #d7a33b;
  --santa-cream: #fffaf0;
  max-width: 1080px;
  margin: 24px auto 60px;
  color: var(--santa-navy);
}

.santa-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.santa-kicker {
  display: inline-block;
  color: #8b5a27;
  font: 800 0.74rem/1.3 'Source Sans 3', sans-serif;
  letter-spacing: 0.13em;
}

.santa-heading h1,
.santa-leaderboard h2 {
  margin: 5px 0 8px;
  color: var(--santa-navy);
  font-family: 'Lora', Georgia, serif;
  font-weight: 800;
}

.santa-heading h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.1;
}

.santa-heading p {
  max-width: 660px;
  margin: 0;
  color: #535c65;
  font: 600 1rem/1.6 'Source Sans 3', sans-serif;
}

.santa-back-link {
  display: inline-flex;
  min-height: 42px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid #d2c2a8;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--santa-navy);
  font: 700 0.9rem 'Source Sans 3', sans-serif;
  text-decoration: none;
}

.santa-back-link:hover,
.santa-back-link:focus-visible {
  border-color: var(--santa-red);
  color: var(--santa-red);
}

.santa-hud {
  position: absolute;
  z-index: 5;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto auto;
  gap: 6px;
  padding: 7px 10px 8px;
  border-bottom: 3px solid #d6aa59;
  background: rgba(8, 24, 45, 0.9);
  box-shadow: 0 4px 0 rgba(7, 18, 33, 0.38);
}

.santa-hud__item {
  display: flex;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 12px;
  border: 2px solid #a87f3c;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(38, 63, 85, 0.97), rgba(17, 36, 59, 0.97));
  box-shadow: inset 0 0 0 1px rgba(255, 242, 197, 0.12), 0 2px 0 rgba(4, 14, 27, 0.6);
}

.santa-hud__item > span {
  color: #e2c47c;
  font: 800 0.72rem 'Courier New', monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.santa-hud__item strong {
  color: #fff4d2;
  font: 800 1.12rem/1 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
  text-shadow: 2px 2px 0 #152c43;
  white-space: nowrap;
}

.santa-hud__item--gifts strong {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3em;
  font-size: 1.55rem;
}

.santa-hud__item--gifts [data-santa-gift-count] {
  font-size: 1.02rem;
}

.santa-shield-indicator {
  display: inline-grid;
  width: 0.95em;
  height: 1em;
  flex: 0 0 0.95em;
  place-items: center;
  color: #8d9aac;
  transition: color 0.15s ease, filter 0.15s ease;
}

.santa-shield-indicator svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.santa-shield-indicator.is-active {
  color: #ffd45c;
  filter: drop-shadow(0 0 5px rgba(255, 212, 92, 0.7));
}

.santa-shield-indicator.is-active svg {
  fill: currentColor;
}

.santa-hud__item--lives strong {
  display: inline-flex;
  align-items: center;
  gap: 0.06em;
  color: #ff3b30;
  font-size: 1.55rem;
  line-height: 1;
  letter-spacing: 0.1em;
  text-shadow: 2px 2px 0 #67252d, 0 0 8px rgba(255, 59, 48, 0.55);
}

.santa-life-heart {
  display: inline-grid;
  width: 0.95em;
  height: 1em;
  flex: 0 0 0.95em;
  place-items: center;
}

.santa-life-heart svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: currentColor;
}

.santa-life-heart.is-empty svg {
  fill: none;
}

.santa-life-heart.is-empty path {
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.santa-hud__item--lives.is-hit {
  animation: santa-hud-jolt 0.72s steps(2, end);
}

.santa-hud__item--gifts.is-hit {
  animation: santa-hud-jolt 0.72s steps(2, end);
}

.santa-hud__item--lives.is-hit strong {
  animation: santa-heart-flash 0.72s steps(2, end);
}

.santa-sound-toggle {
  display: grid;
  width: 48px;
  min-height: 46px;
  place-items: center;
  padding: 6px;
  border: 2px solid #a87f3c;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(38, 63, 85, 0.97), rgba(17, 36, 59, 0.97));
  box-shadow: inset 0 0 0 1px rgba(255, 242, 197, 0.12), 0 2px 0 rgba(4, 14, 27, 0.6);
  color: #ffe69a;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.santa-sound-toggle:hover {
  background: #355575;
  color: #fff7db;
}

.santa-sound-toggle[aria-pressed="true"] {
  border-color: #ff3b30;
  color: #ff3b30;
}

.santa-sound-toggle svg {
  display: block;
  width: 24px;
  height: 24px;
  overflow: visible;
}

.santa-sound-toggle [data-santa-sound-icon="off"] {
  stroke: currentColor;
  stroke-width: 4.5;
  filter: drop-shadow(0 0 2px rgba(255, 250, 240, 0.85));
}

.santa-sound-toggle:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid #fff0a5;
  outline-offset: 2px;
}

.santa-audio {
  display: none;
}

.santa-sound-status {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 12px;
  left: 12px;
  width: fit-content;
  max-width: calc(100% - 24px);
  margin: 0 auto;
  padding: 6px 10px;
  border: 1px solid #db776d;
  border-radius: 4px;
  background: rgba(15, 32, 52, 0.94);
  color: #fff2dd;
  font: 700 0.82rem/1.35 'Source Sans 3', sans-serif;
  text-align: center;
}

.santa-sound-status:empty {
  display: none;
}

@keyframes santa-hud-jolt {
  0%,
  100% {
    transform: translateX(0);
    border-color: #a87f3c;
  }

  14% {
    transform: translateX(-6px);
    border-color: #ff6c5e;
    filter: brightness(1.65);
  }

  30% {
    transform: translateX(5px);
  }

  48% {
    transform: translateX(-3px);
    background: #732f3a;
  }

  68% {
    transform: translateX(2px);
  }
}

@keyframes santa-heart-flash {
  0%,
  100% {
    transform: scale(1);
  }

  16% {
    color: #fff1a8;
    transform: scale(1.22);
  }

  48% {
    color: #ff3b30;
    transform: scale(0.92);
  }
}

.santa-stage {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 5px solid #182e4a;
  border-radius: 11px;
  background: #0c1d3e;
  box-shadow: 0 12px 28px rgba(24, 37, 51, 0.2);
}

.santa-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.santa-overlay {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 21, 43, 0.58);
  backdrop-filter: blur(2px);
}

.santa-overlay__card {
  width: min(100%, 440px);
  max-height: 100%;
  overflow: auto;
  padding: clamp(18px, 3vw, 28px);
  border: 3px solid #c79a4c;
  border-radius: 8px;
  background: var(--santa-cream);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  text-align: center;
}

.santa-overlay__kicker {
  color: #8b5a27;
  font: 800 0.72rem 'Source Sans 3', sans-serif;
  letter-spacing: 0.12em;
}

.santa-overlay__card h2 {
  margin: 6px 0 8px;
  color: var(--santa-navy);
  font: 800 clamp(1.35rem, 3vw, 1.8rem)/1.2 'Lora', Georgia, serif;
}

.santa-character-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.santa-character-option {
  display: flex;
  min-width: 0;
  min-height: 82px;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border: 2px solid #ddc9aa;
  border-radius: 8px;
  background: #fffdf8;
  color: var(--santa-navy);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.santa-character-option:hover:not(:disabled) {
  border-color: var(--santa-red);
  background: #fff8f1;
}

.santa-character-option.is-selected {
  border-color: var(--santa-red);
  background: #fff2ec;
  box-shadow: inset 0 0 0 1px rgba(184, 50, 50, 0.12);
}

.santa-character-option:focus-visible {
  outline: 3px solid #e6b447;
  outline-offset: 2px;
}

.santa-character-option:disabled {
  cursor: wait;
  opacity: 0.7;
}

.santa-character-option img {
  display: block;
  width: 60px;
  height: 70px;
  flex: 0 0 60px;
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
}

.santa-character-option__copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.santa-character-option__copy strong {
  color: var(--santa-navy);
  font: 800 0.84rem/1.2 'Lora', Georgia, serif;
}

.santa-character-option__copy small {
  color: #64666a;
  font: 700 0.7rem/1.2 'Source Sans 3', sans-serif;
}

.santa-overlay__card > p {
  margin: 0 0 18px;
  color: #535c65;
  font: 600 0.95rem/1.5 'Source Sans 3', sans-serif;
}

.santa-button,
.santa-pause-button {
  min-height: 44px;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font: 800 0.95rem 'Source Sans 3', sans-serif;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.santa-button {
  padding: 10px 18px;
}

.santa-button--primary {
  background: var(--santa-red);
  color: #fff;
}

.santa-button--primary:hover:not(:disabled) {
  background: #972b2b;
  transform: translateY(-1px);
}

.santa-button--secondary {
  border-color: #b7c5d0;
  background: #edf3f7;
  color: var(--santa-navy);
}

.santa-button--secondary:hover {
  background: #dce8f0;
}

.santa-button:disabled,
.santa-pause-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.santa-score-form {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  text-align: left;
}

.santa-score-form label {
  color: var(--santa-navy);
  font: 800 0.9rem 'Source Sans 3', sans-serif;
}

.santa-score-form__row {
  display: flex;
  gap: 8px;
}

.santa-score-form input {
  min-width: 0;
  flex: 1;
  padding: 9px 11px;
  border: 1px solid #b9b5ad;
  border-radius: 5px;
  background: #fff;
  color: #202c38;
  font: 600 1rem 'Source Sans 3', sans-serif;
}

.santa-score-form input:focus-visible,
.santa-button:focus-visible,
.santa-pause-button:focus-visible,
.santa-touch-controls button:focus-visible,
.santa-back-link:focus-visible {
  outline: 3px solid #e6b447;
  outline-offset: 2px;
}

.santa-score-form__status {
  min-height: 1.35em;
  margin: 0;
  color: #8c2828;
  font: 700 0.86rem/1.35 'Source Sans 3', sans-serif;
}

.santa-save-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 20px;
  margin-top: 14px;
  padding: clamp(16px, 3vw, 24px);
  border: 1px solid #decfb7;
  border-radius: 9px;
  background: #fffaf0;
  box-shadow: 0 5px 16px rgba(48, 41, 28, 0.07);
}

.santa-save-panel__copy h2 {
  margin: 5px 0;
  color: var(--santa-navy);
  font: 800 1.35rem/1.2 'Lora', Georgia, serif;
}

.santa-save-panel__copy p {
  margin: 0;
  color: #535c65;
  font: 600 0.92rem/1.5 'Source Sans 3', sans-serif;
}

.santa-controls {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin: 12px 0 28px;
}

.santa-touch-controls {
  display: none;
  align-items: center;
  gap: 7px;
}

.santa-controls__label {
  margin-right: 3px;
  color: #5a6066;
  font: 700 0.85rem 'Source Sans 3', sans-serif;
}

.santa-touch-controls button {
  width: 43px;
  height: 40px;
  border: 1px solid #b8c5cf;
  border-radius: 6px;
  background: #f4f8fa;
  color: var(--santa-navy);
  cursor: pointer;
  font: 800 1.25rem/1 'Source Sans 3', sans-serif;
}

.santa-touch-controls button:hover:not(:disabled) {
  border-color: var(--santa-blue);
  background: #e5eef5;
}

.santa-pause-button {
  display: grid;
  width: 48px;
  min-height: 46px;
  place-items: center;
  padding: 6px;
  border: 2px solid #a87f3c;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(38, 63, 85, 0.97), rgba(17, 36, 59, 0.97));
  box-shadow: inset 0 0 0 1px rgba(255, 242, 197, 0.12), 0 2px 0 rgba(4, 14, 27, 0.6);
  color: #ffe69a;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.santa-pause-button:hover:not(:disabled) {
  background: #355575;
  color: #fff7db;
}

.santa-pause-button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid #fff0a5;
  outline-offset: 2px;
}

.santa-pause-button svg {
  display: block;
  width: 24px;
  height: 24px;
}

.santa-controls__hint {
  margin: 0;
  color: #5c6268;
  font: 600 0.85rem/1.6 'Source Sans 3', sans-serif;
  text-align: right;
}

.santa-controls__hint kbd {
  padding: 2px 5px;
  border: 1px solid #d5ccbd;
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fffdf8;
  color: #303842;
  font: 700 0.78rem 'Source Sans 3', sans-serif;
}

.santa-live-status {
  min-height: 1px;
  margin: 0;
}

.santa-leaderboard {
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid #decfb7;
  border-radius: 10px;
  background: var(--santa-cream);
  box-shadow: 0 5px 16px rgba(48, 41, 28, 0.07);
}

.santa-leaderboard__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.santa-leaderboard h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 1.8rem);
}

.santa-leaderboard__heading > p {
  margin: 0 0 3px;
  color: #63676c;
  font: 600 0.92rem 'Source Sans 3', sans-serif;
}

.santa-table-wrap {
  overflow-x: auto;
}

.santa-score-table {
  width: 100%;
  border-collapse: collapse;
  color: #253447;
  font: 600 0.96rem 'Source Sans 3', sans-serif;
  text-align: left;
}

.santa-score-table th,
.santa-score-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5dac8;
}

.santa-score-table th {
  color: #62656a;
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.santa-score-table td:first-child {
  width: 48px;
  color: #9a6b27;
  font-weight: 800;
}

.santa-score-table td:nth-child(3),
.santa-score-table td:nth-child(4) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.santa-score-table tbody tr:last-child td {
  border-bottom: 0;
}

.santa-leaderboard__empty,
.santa-leaderboard__status {
  margin: 12px 0 0;
  color: #5d646b;
  font: 600 0.9rem/1.5 'Source Sans 3', sans-serif;
}

.santa-leaderboard__status:empty {
  display: none;
}

[data-santa-game] [hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .santa-heading {
    align-items: flex-start;
  }

  .santa-save-panel {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .santa-controls {
    grid-template-columns: 1fr auto;
  }

  .santa-touch-controls {
    display: flex;
  }

  .santa-controls__hint {
    display: none;
  }
}

@media (max-width: 540px) {
  .santa-heading {
    flex-direction: column;
    gap: 14px;
  }

  .santa-back-link {
    min-height: 38px;
  }

  .santa-hud {
    gap: 3px;
    padding: 5px 5px 6px;
  }

  .santa-hud__item {
    min-height: 42px;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    padding: 3px 2px;
  }

  .santa-hud__item > span {
    font-size: 0.58rem;
    letter-spacing: 0.04em;
  }

  .santa-hud__item strong {
    font-size: 0.92rem;
  }

  .santa-hud__item--lives strong {
    font-size: 1.3rem;
  }

  .santa-hud__item--gifts strong {
    gap: 0.12em;
    font-size: 1.3rem;
  }

  .santa-hud__item--gifts [data-santa-gift-count] {
    font-size: 0.82rem;
  }

  .santa-shield-indicator {
    width: 0.95em;
    height: 1em;
    flex-basis: 0.95em;
  }

  .santa-pause-button {
    width: 36px;
    min-height: 42px;
    padding: 5px 3px;
  }

  .santa-pause-button svg {
    width: 21px;
    height: 21px;
  }

  .santa-sound-toggle {
    width: 36px;
    min-height: 42px;
    padding: 5px 3px;
  }

  .santa-sound-toggle svg {
    width: 21px;
    height: 21px;
  }

  .santa-stage {
    border-width: 3px;
    border-radius: 7px;
  }

  .santa-overlay {
    padding: 8px;
  }

  .santa-overlay__card {
    padding: 12px;
  }

  .santa-character-picker {
    gap: 5px;
    margin-bottom: 8px;
  }

  .santa-character-option {
    min-height: 64px;
    gap: 5px;
    padding: 4px;
    border-radius: 6px;
  }

  .santa-character-option img {
    width: 46px;
    height: 54px;
    flex-basis: 46px;
  }

  .santa-character-option__copy strong {
    font-size: 0.73rem;
  }

  .santa-character-option__copy small {
    font-size: 0.6rem;
  }

  .santa-overlay__card > p {
    margin-bottom: 10px;
    font-size: 0.84rem;
  }

  .santa-score-form__row {
    flex-direction: column;
  }

  .santa-score-form {
    margin-top: 0;
  }

  .santa-controls {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .santa-controls__label {
    display: none;
  }

  .santa-touch-controls button {
    width: 48px;
    height: 42px;
  }

  .santa-controls__hint {
    font-size: 0.78rem;
  }

  .santa-leaderboard__heading {
    display: block;
  }

  .santa-leaderboard__heading > p {
    margin-top: 7px;
  }

  .santa-score-table th,
  .santa-score-table td {
    padding: 9px 7px;
    font-size: 0.86rem;
  }
}

@media (max-width: 380px) {
  .santa-hud {
    gap: 2px;
    padding: 4px 3px 5px;
  }

  .santa-hud__item {
    padding: 2px 1px;
  }

  .santa-hud__item > span {
    font-size: 0.43rem;
    letter-spacing: 0;
  }

  .santa-hud__item strong,
  .santa-hud__item--gifts [data-santa-gift-count] {
    font-size: 0.72rem;
  }

  .santa-hud__item--lives strong,
  .santa-hud__item--gifts strong {
    gap: 0.01em;
    font-size: 1rem;
  }

  .santa-life-heart {
    width: 0.82em;
    flex-basis: 0.82em;
  }

  .santa-hud__item--gifts [data-santa-gift-count] {
    gap: 0.08em;
  }

  .santa-hud__item [data-santa-distance] {
    font-size: 0.6rem;
  }

  .santa-shield-indicator {
    width: 0.82em;
    height: 1em;
    flex-basis: 0.82em;
  }

  .santa-pause-button,
  .santa-sound-toggle {
    width: 30px;
    min-height: 36px;
    padding: 4px 2px;
  }

  .santa-pause-button svg,
  .santa-sound-toggle svg {
    width: 18px;
    height: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .santa-button,
  .santa-character-option {
    transition: none;
  }

  .santa-hud__item--lives.is-hit,
  .santa-hud__item--gifts.is-hit,
  .santa-hud__item--lives.is-hit strong {
    animation: none;
  }
}
