/* The tree tab's look. Classes are santa-tree-*; colours are the --santa-* tokens of public/theme.css.
   The tab is a full-screen box (its root) with one canvas filling it and a DOM overlay inside its content box, which stops above the
   bottom bar (padding-bottom: --santa-nav-space) and below the top inset (padding-top: --santa-top). The overlay itself lets
   touches through to the canvas except on its buttons and sheets. Premium, not a casino: glass panels, one gold accent, no glow
   on everything. */

.santa-tree {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  padding: var(--santa-top, 0px) 0 var(--santa-nav-space, 64px);
  overflow: hidden;
  background: #050a1a;
  color: var(--santa-ivory, #f7e9c9);
  font-family: var(--santa-font, system-ui, sans-serif);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.santa-tree[hidden] { display: none; }

.santa-tree-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
.santa-tree-canvas:active { cursor: grabbing; }

.santa-tree-host { position: relative; width: 100%; height: 100%; pointer-events: none; }
.santa-tree-ui { position: relative; width: 100%; height: 100%; pointer-events: none; }

/* The counter, the bar and the star's line. */
.santa-tree-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 16px 4px;
  text-align: center;
}
.santa-tree-counter { margin: 0; line-height: 1.2; }
.santa-tree-gifts {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--santa-gold, #ffd16b);
  text-shadow: 0 1px 12px rgba(255, 209, 107, 0.28);
}
.santa-tree-counter-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--santa-ivory, #f7e9c9);
  opacity: 0.86;
}
.santa-tree-bar {
  width: min(100%, 340px);
  height: 5px;
  margin: 8px auto 0;
  border-radius: 99px;
  background: rgba(247, 233, 201, 0.14);
  overflow: hidden;
}
.santa-tree-bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, #e2aa3f, #ffd16b 60%, #fff0b8);
  box-shadow: 0 0 10px rgba(255, 209, 107, 0.45);
  transition: width 0.6s ease;
}
.santa-tree-star-line {
  margin: 7px 0 0;
  font-size: 12.5px;
  line-height: 1.3;
  color: var(--santa-ivory, #f7e9c9);
  opacity: 0.78;
}
.santa-tree-top[data-star="unlocked"] .santa-tree-star-line,
.santa-tree-top[data-star="celebration"] .santa-tree-star-line { color: var(--santa-gold, #ffd16b); opacity: 1; }

/* Buttons: one gold primary, glass ghosts. */
.santa-tree-btn {
  pointer-events: auto;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 23px;
  border: 1px solid var(--santa-line, rgba(255, 209, 107, 0.16));
  font: 700 15px/1 var(--santa-font, system-ui, sans-serif);
  letter-spacing: 0.01em;
  cursor: pointer;
  color: var(--santa-ivory, #f7e9c9);
  background: rgba(16, 29, 60, 0.74);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.santa-tree-btn:active { transform: scale(0.97); }
.santa-tree-btn:disabled { opacity: 0.45; cursor: default; transform: none; }
.santa-tree-btn--primary {
  color: #2a1a00;
  border-color: rgba(255, 240, 184, 0.6);
  background: linear-gradient(180deg, #ffe596, #ffd16b 55%, #e5ae45);
  box-shadow: 0 6px 22px rgba(255, 209, 107, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.santa-tree-actions {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.santa-tree-zoom {
  position: absolute;
  right: 12px;
  bottom: 84px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.santa-tree-round {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--santa-line, rgba(255, 209, 107, 0.16));
  font: 600 24px/1 var(--santa-font, system-ui, sans-serif);
  color: var(--santa-gold, #ffd16b);
  background: rgba(16, 29, 60, 0.74);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  cursor: pointer;
}
.santa-tree-round:active { transform: scale(0.94); }
.santa-tree-round:disabled { opacity: 0.35; cursor: default; transform: none; }

/* A sheet over the bottom (the card, the hanging) takes the place of the buttons. */
.santa-tree-ui[data-sheet] .santa-tree-actions,
.santa-tree-ui[data-sheet] .santa-tree-zoom,
.santa-tree-ui[data-sheet] .santa-tree-hint { display: none; }

.santa-tree-hint {
  pointer-events: auto;
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 74px;
  margin: 0 auto;
  max-width: 420px;
  padding: 11px 16px;
  border-radius: 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  background: rgba(22, 38, 74, 0.9);
  border: 1px solid var(--santa-line, rgba(255, 209, 107, 0.16));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  animation: santa-tree-rise 0.22s ease-out;
}

.santa-tree-loading {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--santa-ivory, #f7e9c9);
  opacity: 0.8;
  animation: santa-tree-pulse 1.6s ease-in-out infinite;
}
.santa-tree-failed {
  pointer-events: auto;
  position: absolute;
  left: 24px;
  right: 24px;
  top: 40%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  font-size: 15px;
}
.santa-tree-failed p { margin: 0; }

/* The card of an ornament and the hanging panel. */
.santa-tree-card,
.santa-tree-sheet {
  pointer-events: auto;
  position: absolute;
  left: 12px;
  right: 12px;
  margin: 0 auto;
  max-width: 480px;
  box-sizing: border-box;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(var(--rarity-rgb, 255, 209, 107), 0.34);
  background: linear-gradient(180deg, rgba(27, 46, 88, 0.94), rgba(14, 25, 52, 0.96));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  animation: santa-tree-rise 0.24s ease-out;
}
.santa-tree-card { bottom: 12px; }
.santa-tree-sheet { top: 96px; max-height: calc(100% - 108px); overflow-y: auto; }

.santa-tree-card[data-rarity="common"] { --rarity-rgb: 207, 214, 228; }
.santa-tree-card[data-rarity="rare"] { --rarity-rgb: 111, 180, 255; }
.santa-tree-card[data-rarity="epic"] { --rarity-rgb: 185, 140, 255; }
.santa-tree-card[data-rarity="legendary"] { --rarity-rgb: 255, 209, 107; }
.santa-tree-card[data-rarity="mythic"] { --rarity-rgb: 127, 240, 255; }

.santa-tree-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--santa-line, rgba(255, 209, 107, 0.16));
  background: rgba(255, 255, 255, 0.06);
  color: var(--santa-ivory, #f7e9c9);
  font: 400 22px/1 var(--santa-font, system-ui, sans-serif);
  cursor: pointer;
}

.santa-tree-card-head { display: flex; align-items: center; gap: 14px; padding-right: 36px; }
.santa-tree-art { width: 64px; height: 64px; flex: none; }
.santa-tree-card-who { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.santa-tree-card-name {
  margin: 0;
  max-width: 100%;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--santa-ivory, #f7e9c9);
}
.santa-tree-card-skin { margin: 0; font-size: 13px; color: var(--santa-dim, #9aa6c2); }
.santa-tree-rarity {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgb(var(--rarity-rgb, 255, 209, 107));
  background: rgba(var(--rarity-rgb, 255, 209, 107), 0.12);
  border: 1px solid rgba(var(--rarity-rgb, 255, 209, 107), 0.4);
}
.santa-tree-card-wish {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.4;
  font-style: italic;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
  background: rgba(0, 0, 0, 0.22);
  border-left: 3px solid rgba(var(--rarity-rgb, 255, 209, 107), 0.7);
}
.santa-tree-card-wish--empty { font-style: normal; color: var(--santa-dim, #9aa6c2); }
.santa-tree-card-own { margin: 12px 0 0; font-size: 13px; font-weight: 700; color: var(--santa-gold, #ffd16b); }
.santa-tree-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.santa-tree-card-actions .santa-tree-btn { flex: 1 1 auto; min-height: 42px; font-size: 14px; }

.santa-tree-card--loading { min-height: 150px; }
.santa-tree-skeleton {
  height: 96px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  animation: santa-tree-shimmer 1.3s linear infinite;
}

.santa-tree-hang-title { margin: 0; font-size: 20px; font-weight: 800; color: var(--santa-gold, #ffd16b); padding-right: 8px; }
.santa-tree-hang-sub { margin: 14px 0 8px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--santa-dim, #9aa6c2); }
.santa-tree-skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.santa-tree-skin {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px 6px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--santa-ivory, #f7e9c9);
  font: inherit;
  cursor: pointer;
}
.santa-tree-skin[aria-checked="true"] {
  border-color: var(--santa-gold, #ffd16b);
  background: rgba(255, 209, 107, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 209, 107, 0.25), 0 6px 18px rgba(255, 209, 107, 0.12);
}
.santa-tree-skin:disabled { opacity: 0.6; cursor: default; }
.santa-tree-skin-name { font-size: 11px; line-height: 1.2; text-align: center; opacity: 0.9; }

.santa-tree-wish { display: block; margin-top: 14px; }
.santa-tree-wish-label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--santa-dim, #9aa6c2); }
.santa-tree-wish-input {
  width: 100%;
  box-sizing: border-box;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--santa-line, rgba(255, 209, 107, 0.16));
  background: rgba(0, 0, 0, 0.28);
  color: var(--santa-ivory, #f7e9c9);
  font: 500 16px/1 var(--santa-font, system-ui, sans-serif);
  user-select: text;
  -webkit-user-select: text;
}
.santa-tree-wish-input:focus { outline: none; border-color: rgba(255, 209, 107, 0.7); }
.santa-tree-wish-input::placeholder { color: rgba(154, 166, 194, 0.8); }
.santa-tree-wish-count { display: block; margin-top: 6px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--santa-dim, #9aa6c2); }
.santa-tree-wish-count[data-over="true"] { color: var(--santa-red, #d94143); font-weight: 700; }
.santa-tree-hang-problem { margin: 6px 0 0; font-size: 13px; color: #ff8a8c; }
.santa-tree-hang-actions { display: flex; gap: 8px; margin-top: 16px; }
.santa-tree-hang-actions .santa-tree-btn { flex: 1 1 0; }
.santa-tree-hang[data-busy="true"] { opacity: 0.85; }

.santa-tree button:focus-visible { outline: 2px solid var(--santa-gold, #ffd16b); outline-offset: 2px; }

@keyframes santa-tree-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes santa-tree-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}
@keyframes santa-tree-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .santa-tree-card, .santa-tree-sheet, .santa-tree-hint, .santa-tree-loading, .santa-tree-skeleton { animation: none; }
  .santa-tree-bar-fill, .santa-tree-btn { transition: none; }
}
