/* Saudi Redline visual module. All rules are scoped to scene-/fingerprint names.
   Main page controls host placement and readable content above these canvases. */
.scene-host {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
  isolation: isolate;
  contain: layout paint;
  background: radial-gradient(ellipse at 62% 35%, rgba(66, 86, 48, .2), transparent 58%), #03130d;
}
.scene-host[data-scene="flag"],
.scene-host[data-scene="landscape"] {
  position: absolute;
  inset: 0;
  min-height: 0;
  pointer-events: none;
}
.scene-host[data-scene="flag"] {
  background: radial-gradient(ellipse at 51% 39%, #184831 0, #062519 36%, #020d09 82%);
}
.scene-host[data-scene="tree"] {
  min-height: var(--scene-tree-min-height, 560px);
  height: clamp(560px, 76vh, 840px);
  touch-action: pan-y pinch-zoom;
  background: radial-gradient(ellipse at 54% 26%, rgba(179, 139, 61, .17), transparent 42%),
    radial-gradient(ellipse at 45% 76%, rgba(39, 125, 72, .18), transparent 58%), #03130d;
}
.scene-host[data-scene="tree"]::before {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: -12% 0 0;
  z-index: 0;
  opacity: .75;
  background: linear-gradient(112deg, transparent 25%, rgba(207, 177, 103, .035) 29%, transparent 35%),
    linear-gradient(73deg, transparent 66%, rgba(207, 177, 103, .04) 70%, transparent 77%);
}
.scene-canvas,
.scene-fallback {
  position: absolute;
  display: block;
  width: 100%;
  height: 100%;
  inset: 0;
  pointer-events: none;
}
.scene-canvas {
  z-index: 1;
  opacity: 0;
  transition: opacity .45s ease;
}
.scene-fallback {
  z-index: 0;
  opacity: 1;
  transition: opacity .45s ease;
}
.scene-webgl > .scene-canvas { opacity: 1; }
.scene-webgl > .scene-fallback { opacity: 0; }
.scene-light > .scene-canvas { display: none; }
.scene-light > .scene-fallback { opacity: 1; }
.scene-flag-image {
  position: absolute;
  width: min(67%, 820px);
  height: auto;
  right: 17%;
  top: 50%;
  transform: translateY(-55%) rotate(-2deg);
  transform-origin: right center;
  border-radius: 1px;
  box-shadow: -20px 24px 70px rgba(0, 0, 0, .35), 0 0 90px rgba(27, 126, 78, .18);
}
.scene-flag-pole {
  position: absolute;
  width: 4px;
  height: min(76%, 730px);
  right: calc(17% - 3px);
  top: 14%;
  background: linear-gradient(90deg, #625537, #eed9a1 55%, #665b42);
  border-radius: 2px;
  box-shadow: 0 0 15px rgba(227, 203, 133, .15);
}
.scene-flag-pole::before {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d6c188;
  left: -2.5px;
  top: -7px;
}
.scene-tree-silhouette {
  display: block;
  width: var(--scene-tree-visual-width, 100%);
  height: 100%;
  margin-inline: auto;
  filter: drop-shadow(0 0 12px rgba(122, 153, 64, .13));
}
.scene-fallback-tree::after {
  content: "";
  position: absolute;
  width: 68%;
  left: 16%;
  bottom: 4%;
  height: 5%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(90, 123, 66, .24), transparent 70%);
}
.scene-fallback-landscape {
  overflow: hidden;
  background: radial-gradient(ellipse at 66% 13%, rgba(187, 146, 79, .22), transparent 43%),
    linear-gradient(#061b11, #173d28 54%, #091b13);
}
.scene-dune {
  position: absolute;
  display: block;
  width: 145%;
  height: 46%;
  bottom: -9%;
  left: -20%;
  border-radius: 52% 48% 0 0;
  background: linear-gradient(175deg, #3b5130, #061910 65%);
  border-top: 1px solid rgba(184, 160, 104, .32);
  transform: rotate(-9deg);
  box-shadow: 0 -12px 40px rgba(209, 169, 89, .035);
}
.scene-dune-0 { bottom: 8%; left: -11%; transform: rotate(9deg); opacity: .58; }
.scene-dune-1 { bottom: -1%; left: -32%; transform: rotate(-8deg); opacity: .85; }
.scene-dune-2 { bottom: -17%; left: -5%; transform: rotate(8deg); background: linear-gradient(180deg, #263e28, #03110b 70%); }
.scene-art-label {
  position: absolute;
  bottom: 14px;
  left: 18px;
  z-index: 2;
  pointer-events: none;
  color: rgba(237, 222, 187, .48);
  font-family: inherit;
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: .04em;
}
.fingerprint-layer {
  position: absolute;
  z-index: 3;
  top: 10%;
  bottom: 30%;
  left: 50%;
  width: var(--fingerprint-width, 86%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(var(--fingerprint-columns, 8), minmax(0, 1fr));
  grid-template-rows: repeat(var(--fingerprint-rows, 5), minmax(48px, 1fr));
  align-items: center;
  justify-items: center;
  direction: ltr;
  pointer-events: none;
}
.fingerprint-button {
  --fingerprint-color: #efcf8f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  margin: 0;
  border: 1px solid rgba(229, 199, 133, .19);
  border-radius: 50%;
  outline: none;
  background: radial-gradient(circle, rgba(217, 179, 93, .14), rgba(3, 25, 15, .56) 74%);
  color: var(--fingerprint-color);
  box-shadow: 0 0 17px rgba(220, 178, 85, .15), inset 0 0 14px rgba(184, 145, 60, .06);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: auto;
  touch-action: pan-y pinch-zoom;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .2s, background .2s, box-shadow .2s;
  animation: fingerprint-glimmer 5s ease-in-out var(--fingerprint-delay, 0s) infinite;
}
.fingerprint-button svg {
  width: 26px;
  height: 26px;
  display: block;
  stroke: currentColor;
  stroke-width: 1.12;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px rgba(239, 207, 143, .28));
}
.fingerprint-button:focus-visible {
  outline: 2px solid #ffdfa0;
  outline-offset: 4px;
  background: #173b26;
  border-color: #ffdfa0;
  animation: none;
  box-shadow: 0 0 25px rgba(232, 191, 96, .5);
}
@media (hover: hover) {
  .fingerprint-button:hover {
    border-color: rgba(255, 220, 153, .85);
    background: rgba(52, 68, 32, .8);
    box-shadow: 0 0 25px rgba(232, 191, 96, .35);
  }
}
.fingerprint-button:active { background: #234c32; }
.fingerprint-pending {
  --fingerprint-color: #c4f0d6;
  border: 1.5px dashed rgba(179, 228, 200, .8);
  background: rgba(4, 30, 20, .76);
  box-shadow: 0 0 14px rgba(97, 181, 135, .13);
  animation: none;
}
.fingerprint-pending::after {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  right: 3px;
  background: #c7efd8;
  box-shadow: 0 0 7px rgba(199, 239, 216, .7);
}
@keyframes fingerprint-glimmer {
  0%, 100% { box-shadow: 0 0 14px rgba(220, 178, 85, .12), inset 0 0 14px rgba(184, 145, 60, .06); }
  50% { box-shadow: 0 0 22px rgba(220, 178, 85, .24), inset 0 0 14px rgba(184, 145, 60, .1); }
}
.scene-light .fingerprint-button,
.scene-reduced .fingerprint-button { animation: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.scene-reduced .scene-canvas,
.scene-reduced .scene-fallback,
.scene-light .scene-canvas,
.scene-light .scene-fallback { transition: none; }
@media (max-width: 700px) {
  .scene-host[data-scene="tree"] { height: var(--scene-tree-min-height, 665px); }
  .scene-flag-image { width: 84%; right: 8%; }
  .scene-flag-pole { right: calc(8% - 3px); width: 3px; height: 56%; top: 24%; }
  .scene-tree-silhouette { padding: 2% 1% 0; box-sizing: border-box; }
  .fingerprint-button { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .scene-art-label { left: 12px; bottom: 10px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene-canvas,
  .scene-fallback,
  .fingerprint-button { transition: none; animation: none; }
}

/* Native tree realism. Scope beats legacy late-loaded grid rules without touching them. */
.scene-host.scene-ready[data-scene="tree"] {
  background: radial-gradient(ellipse at 40% 23%, rgba(150,144,126,.13), transparent 60%),
    radial-gradient(ellipse at 50% 94%, rgba(75,69,60,.22), transparent 56%), #141519 !important;
}
html body.national-experience #app .tree-theatre .scene-host.scene-ready[data-scene="tree"] {
  background: radial-gradient(ellipse at 40% 23%, rgba(150,144,126,.13), transparent 60%),
    radial-gradient(ellipse at 50% 94%, rgba(75,69,60,.22), transparent 56%), #141519 !important;
}
.scene-host.scene-ready[data-scene="tree"]::before { opacity: .22; filter: none; }
.scene-host.scene-ready[data-scene="tree"] .fingerprint-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: none;
  display: block;
  direction: ltr;
  pointer-events: none;
}
.scene-host.scene-ready[data-scene="tree"] .fingerprint-button {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 45px;
  height: 45px;
  min-width: 45px;
  min-height: 45px;
  max-width: 45px;
  max-height: 45px;
  box-sizing: border-box;
  color: #dec294;
  border: 1px solid rgba(225,199,149,.55) !important;
  background: radial-gradient(circle, rgba(92,72,45,.88), rgba(30,28,27,.83) 76%) !important;
  box-shadow: 0 2px 7px rgba(0,0,0,.28), inset 0 1px 2px rgba(255,237,197,.10) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  animation: none;
  will-change: auto;
}
.scene-host.scene-ready[data-scene="tree"] .fingerprint-button svg {
  stroke: #e5ca99 !important;
  filter: none;
}
.scene-host.scene-ready[data-scene="tree"][data-tree-kind="voice"] .fingerprint-button {
  border-color: rgba(216,133,147,.65) !important;
  background: radial-gradient(circle, rgba(105,43,55,.86), rgba(36,26,28,.85) 76%) !important;
}
.scene-host.scene-ready[data-scene="tree"][data-tree-kind="voice"] .fingerprint-button svg { stroke: #ecc0c7 !important; }
.scene-host.scene-ready[data-scene="tree"] .fingerprint-pending {
  border-style: dashed !important;
  border-color: #e9d5b1 !important;
}
.scene-host.scene-ready[data-scene="tree"] .fingerprint-pending::after {
  background: #e2bd7d;
  box-shadow: none;
}
.scene-host.scene-ready[data-scene="tree"] .fingerprint-button:focus-visible {
  outline: 2px solid #fff0ce;
  outline-offset: 3px;
}
@media (hover: hover) {
  .scene-host.scene-ready[data-scene="tree"] .fingerprint-button:hover {
    border-color: #fff0ce !important;
    box-shadow: 0 3px 10px rgba(0,0,0,.45), inset 0 0 8px rgba(240,209,154,.15) !important;
  }
}
.scene-host.scene-ready[data-scene="tree"] .scene-tree-silhouette {
  filter: drop-shadow(3px 6px 8px rgba(0,0,0,.4));
  padding: 0;
}
.scene-host.scene-ready[data-scene="tree"] .scene-slot-boughs {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.scene-host.scene-ready[data-scene="tree"] .scene-fallback-tree::after {
  background: radial-gradient(ellipse, rgba(0,0,0,.55), transparent 70%);
  height: 8%;
}
