:root {
  --text: #f7efe5;
  --text-dim: rgba(247, 239, 229, 0.68);
  --text-faint: rgba(247, 239, 229, 0.44);
  --bg: #050607;
  --panel: rgba(9, 13, 16, 0.72);
  --panel-strong: rgba(8, 10, 12, 0.88);
  --line: rgba(247, 239, 229, 0.16);
  --line-strong: rgba(247, 239, 229, 0.32);
  --danger: #d9483b;
  --danger-hot: #ff6a55;
  --rain: #81a8b8;
  --gold: #d6b36b;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.52);
  --font-ui: "Source Sans 3", Arial, sans-serif;
  --font-title: "Cinzel", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(129, 168, 184, 0.18), transparent 40%),
    var(--bg);
  isolation: isolate;
}

.app-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.12;
  mix-blend-mode: screen;
  background:
    repeating-linear-gradient(100deg, transparent 0 18px, rgba(255, 255, 255, 0.025) 19px 20px),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.entry-screen,
.result-screen {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(34px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg);
}

.entry-background-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.76;
  filter: contrast(1.08) brightness(0.7) saturate(0.72);
  pointer-events: none;
}

.entry-screen::before,
.result-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 6, 7, 0.34) 0%, rgba(5, 6, 7, 0.08) 28%, rgba(5, 6, 7, 0.8) 72%, #050607 100%),
    radial-gradient(circle at 18% 18%, rgba(217, 72, 59, 0.16), transparent 36%),
    radial-gradient(circle at 82% 10%, rgba(129, 168, 184, 0.14), transparent 34%);
}

.entry-screen::after,
.result-screen::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: calc(16px + env(safe-area-inset-top));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 0;
  border: 1px solid rgba(247, 239, 229, 0.1);
  pointer-events: none;
}

.entry-copy,
.entry-energy-bar,
.commerce-bar,
.route-picker,
.entry-actions,
.result-screen > * {
  position: relative;
  z-index: 1;
}

.commerce-bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 7px;
  margin: 0;
  pointer-events: none;
}

.entry-energy-bar {
  position: absolute;
  top: calc(26px + env(safe-area-inset-top));
  right: 26px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  appearance: none;
  padding: 6px 12px;
  color: #fff4dc;
  background:
    linear-gradient(180deg, rgba(26, 20, 22, 0.86), rgba(8, 10, 12, 0.72)),
    radial-gradient(circle at 20% 0%, rgba(255, 122, 98, 0.28), transparent 60%);
  border: 1px solid rgba(255, 221, 148, 0.32);
  border-radius: 999px;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.entry-energy-bar:hover,
.entry-energy-bar:focus-visible {
  border-color: rgba(255, 221, 148, 0.58);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.44),
    0 0 0 3px rgba(255, 221, 148, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.entry-energy-bar[data-state="full"] {
  background:
    linear-gradient(180deg, rgba(22, 28, 24, 0.88), rgba(8, 12, 10, 0.74)),
    radial-gradient(circle at 20% 0%, rgba(134, 245, 203, 0.22), transparent 62%);
  border-color: rgba(134, 245, 203, 0.26);
}

.energy-icon {
  content: "";
  width: 9px;
  height: 14px;
  flex: 0 0 auto;
  background: linear-gradient(180deg, #ffe49a, #ff6a55);
  clip-path: polygon(62% 0, 24% 47%, 52% 47%, 38% 100%, 78% 38%, 50% 38%);
  filter: drop-shadow(0 0 8px rgba(255, 106, 85, 0.5));
}

.entry-energy-bar[data-state="full"] .energy-icon {
  background: linear-gradient(180deg, #d9ffe8, #86f5cb);
  filter: drop-shadow(0 0 8px rgba(134, 245, 203, 0.42));
}

.energy-count {
  font-size: 12px;
  line-height: 1;
}

.energy-countdown {
  min-width: 39px;
  padding-left: 7px;
  border-left: 1px solid rgba(255, 244, 220, 0.2);
  color: rgba(255, 244, 220, 0.78);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.commerce-balance {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  color: rgba(247, 239, 229, 0.78);
  background: rgba(8, 10, 12, 0.54);
  border: 1px solid rgba(247, 239, 229, 0.12);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
}

.commerce-balance[data-type="energy"]::before {
  content: "";
  width: 7px;
  height: 11px;
  margin-right: 6px;
  background: linear-gradient(180deg, #ffe49a, #ff6a55);
  clip-path: polygon(62% 0, 24% 47%, 52% 47%, 38% 100%, 78% 38%, 50% 38%);
}

.commerce-balance[data-type="gems"]::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-right: 6px;
  background: url("../assets/gifts/gift-orb.svg") center / contain no-repeat;
}

.entry-copy {
  width: min(100%, 350px);
  margin: 9vh auto 0;
  text-align: center;
  animation: rise-in 760ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.subtitle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
}

.subtitle::before,
.subtitle::after {
  content: "";
  width: 24px;
  height: 1px;
  background: currentColor;
  opacity: 0.58;
}

h1,
h2 {
  margin: 0;
  color: #fff8ee;
  font-family: var(--font-title);
  font-size: clamp(34px, 10.5vw, 52px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.02em;
  text-shadow:
    0 3px 16px rgba(0, 0, 0, 0.86),
    0 0 34px rgba(217, 72, 59, 0.2);
}

h3 {
  margin: 24px 0 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.description {
  margin: 16px auto 0;
  max-width: 25em;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.75;
  font-weight: 600;
}

.route-picker {
  display: grid;
  gap: 10px;
  margin-top: auto;
  margin-bottom: 20px;
  animation: rise-in 720ms 120ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.entry-actions,
.result-actions {
  display: grid;
  gap: 13px;
  animation: rise-in 720ms 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.warmup-status {
  min-height: 22px;
  margin: 0;
  color: var(--text-faint);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.warmup-status[data-ready="true"] {
  color: rgba(214, 179, 107, 0.86);
}

.route-option,
.primary-button,
.secondary-button,
.choice-button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.primary-button {
  width: 100%;
  color: #1b0907;
  background:
    linear-gradient(180deg, #ff7a62 0%, var(--danger) 100%);
  border-color: rgba(255, 130, 104, 0.68);
  box-shadow: 0 16px 42px rgba(217, 72, 59, 0.28);
  font-weight: 900;
  letter-spacing: 0.2em;
}

.primary-button:hover:not(:disabled),
.primary-button:focus-visible:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 18px 48px rgba(217, 72, 59, 0.4);
}

.primary-button:disabled {
  color: rgba(247, 239, 229, 0.34);
  background: rgba(247, 239, 229, 0.08);
  border-color: rgba(247, 239, 229, 0.08);
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-button,
.route-option {
  width: 100%;
  color: var(--text-dim);
  background: rgba(247, 239, 229, 0.045);
}

.route-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  text-align: left;
}

.route-option span {
  min-width: 0;
}

.route-option strong {
  color: var(--gold);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.route-option.locked {
  color: var(--text-faint);
  border-style: dashed;
}

.secondary-button:hover,
.route-option:hover,
.route-option.selected {
  color: var(--text);
  border-color: rgba(214, 179, 107, 0.58);
  background: rgba(214, 179, 107, 0.1);
}

.commerce-modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: end center;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(5, 6, 7, 0.08), rgba(5, 6, 7, 0.76)),
    rgba(5, 6, 7, 0.38);
  backdrop-filter: blur(6px);
}

.commerce-dialog {
  width: min(100%, 372px);
  display: grid;
  gap: 13px;
  padding: 18px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(16, 19, 21, 0.96), rgba(7, 8, 10, 0.98)),
    radial-gradient(circle at 50% 0%, rgba(214, 179, 107, 0.12), transparent 58%);
  border: 1px solid rgba(247, 239, 229, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: rise-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.commerce-dialog h2 {
  margin: 0;
  font-family: var(--font-title);
  font-size: 24px;
  line-height: 1.12;
}

.commerce-dialog p {
  margin: 0;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.commerce-actions {
  display: grid;
  gap: 9px;
}

.commerce-action {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 900;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.commerce-action-primary {
  color: #1b0907;
  background: linear-gradient(180deg, #ff7a62 0%, var(--danger) 100%);
  border-color: rgba(255, 130, 104, 0.68);
}

.commerce-action-secondary {
  color: var(--text);
  background: rgba(214, 179, 107, 0.1);
  border-color: rgba(214, 179, 107, 0.34);
}

.commerce-action-ghost {
  color: var(--text-dim);
  background: transparent;
}

.commerce-action:hover,
.commerce-action:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 106, 85, 0.62);
}

.inline-retry-button {
  min-height: 0;
  margin-left: 10px;
  padding: 4px 10px;
  color: var(--gold);
  background: transparent;
  border: 1px solid rgba(214, 179, 107, 0.42);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
}

.player-screen {
  position: relative;
  height: 100svh;
  overflow: hidden;
  background: var(--bg);
}

.player-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 6, 7, 0.5) 0%, transparent 18%, transparent 62%, rgba(5, 6, 7, 0.72) 100%),
    radial-gradient(circle at 50% 104%, rgba(217, 72, 59, 0.17), transparent 36%);
}

.player-video,
video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--bg);
  filter: contrast(1.06) brightness(0.92) saturate(0.86);
}

.player-video {
  position: absolute;
  inset: 0;
  transform: scale(1);
  will-change: filter, transform;
  transition:
    filter 560ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 620ms cubic-bezier(0.16, 1, 0.3, 1);
}

.preloaded-video {
  visibility: hidden;
  pointer-events: none;
}

.player-screen.scene-blur-out .player-video:not(.preloaded-video),
.player-screen.scene-blur-in .player-video:not(.preloaded-video) {
  filter: contrast(1.16) brightness(0.72) saturate(0.78) blur(22px);
  transform: scale(1.038);
}

.player-screen.scene-blur-in.scene-blur-clear .player-video:not(.preloaded-video) {
  filter: contrast(1.06) brightness(0.92) saturate(0.86);
  transform: scale(1);
}

.player-screen.scene-transition-out[data-transition-mode="blur_bridge"] .player-video:not(.preloaded-video),
.player-screen.scene-transition-in[data-transition-mode="blur_bridge"] .player-video:not(.preloaded-video) {
  filter: contrast(1.16) brightness(0.72) saturate(0.78) blur(22px);
  transform: scale(1.038);
}

.player-screen.scene-transition-in.scene-transition-clear[data-transition-mode="blur_bridge"] .player-video:not(.preloaded-video),
.player-screen.scene-transition-in[data-transition-mode="push_zoom"] .player-video:not(.preloaded-video),
.player-screen.scene-transition-in[data-transition-mode="whip_pan"] .player-video:not(.preloaded-video),
.player-screen.scene-transition-in[data-transition-mode="glitch"] .player-video:not(.preloaded-video) {
  filter: contrast(1.06) brightness(0.92) saturate(0.86);
  opacity: 1;
  transform: scale(1);
}

.player-screen.scene-transition-out[data-transition-mode="push_zoom"] .player-video:not(.preloaded-video) {
  filter: blur(30px) brightness(0.5);
  opacity: 0;
  transform: scale(1.15);
}

.player-screen.scene-transition-out[data-transition-mode="whip_pan"] .player-video:not(.preloaded-video) {
  filter: blur(18px) brightness(0.72);
  opacity: 0.12;
  transform: translateX(-38%) scale(1.08);
}

.player-screen.scene-transition-out[data-transition-mode="whip_pan"][data-transition-direction="left"] .player-video:not(.preloaded-video) {
  transform: translateX(38%) scale(1.08);
}

.player-screen.scene-transition-out[data-transition-mode="glitch"] .player-video:not(.preloaded-video) {
  filter: saturate(1.8) contrast(1.25) hue-rotate(-12deg);
  transform: translateX(-2%) scale(1.02);
}

.metric-hud {
  position: absolute;
  z-index: 2;
  top: calc(14px + env(safe-area-inset-top));
  left: 14px;
  right: auto;
  width: auto;
  min-width: 132px;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.metric-item {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(247, 239, 229, 0.12);
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(10, 13, 16, 0.72), rgba(10, 13, 16, 0.48));
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(10px);
}

.metric-label {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.metric-value {
  color: var(--gold);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.metric-icon {
  position: relative;
  width: 22px;
  height: 22px;
  display: inline-block;
  flex: 0 0 auto;
}

.metric-icon-heart::before,
.metric-icon-heart::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 18px;
  top: 2px;
  left: 10px;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, var(--danger-hot), var(--danger));
  transform: rotate(-45deg);
  transform-origin: 0 100%;
  box-shadow: 0 0 14px rgba(217, 72, 59, 0.44);
}

.metric-icon-heart::after {
  left: -2px;
  transform: rotate(45deg);
  transform-origin: 100% 100%;
}

.metric-icon-spark::before {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
  box-shadow: 0 0 14px rgba(214, 179, 107, 0.45);
}

.metric-toast {
  position: absolute;
  z-index: 5;
  top: calc(62px + env(safe-area-inset-top));
  right: 14px;
  max-width: calc(100% - 178px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  font-size: 13px;
  font-weight: 800;
}

.metric-toast-card {
  width: max-content;
  max-width: min(312px, calc(100vw - 28px));
  min-height: 54px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  color: var(--text);
  background: rgba(8, 10, 12, 0.86);
  border: 1px solid rgba(255, 106, 85, 0.3);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
}

.metric-toast-card.secondary {
  opacity: 0.9;
  transform: scale(0.96);
  transform-origin: top right;
}

.metric-toast-avatar {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff8ee;
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 248, 230, 0.9) 0 16%, transparent 17%),
    linear-gradient(160deg, rgba(143, 169, 183, 0.92), rgba(35, 43, 47, 0.96));
  background-position: center;
  background-size: cover;
  border: 1px solid rgba(247, 239, 229, 0.28);
  border-radius: 50%;
  font-size: 15px;
  font-weight: 900;
}

.metric-toast-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.metric-toast-name,
.metric-toast-relation {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-toast-name {
  font-size: 13px;
  font-weight: 900;
}

.metric-toast-relation {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-toast-delta {
  color: var(--danger-hot);
  font-size: 17px;
  line-height: 1;
}

.metric-toast-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.metric-toast-item .metric-icon {
  width: 18px;
  height: 18px;
}

.metric-toast-item .metric-icon-heart::before,
.metric-toast-item .metric-icon-heart::after {
  width: 10px;
  height: 15px;
  top: 2px;
}

.metric-toast-item .metric-icon-heart::before {
  left: 8px;
}

.metric-toast.pop {
  animation: metric-pop 4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.gift-button {
  position: absolute;
  z-index: 8;
  right: 16px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  width: 56px;
  height: 56px;
  min-height: 0;
  padding: 0;
  color: transparent;
  background: rgba(12, 12, 18, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  cursor: pointer;
  font-size: 0;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  transition:
    bottom 260ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.gift-button::before {
  content: "";
  position: absolute;
  inset: 12px;
  background: url("../assets/gifts/gift-orb.svg") center / contain no-repeat;
  filter: brightness(1.4) saturate(0.8);
}

.gift-button::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 10px;
  height: 10px;
  background: #ff5f5f;
  border: 1px solid rgba(255, 200, 200, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 95, 95, 0.5);
}

.gift-button.choice-lift {
  bottom: calc(292px + env(safe-area-inset-bottom));
}

.gift-button.open.choice-lift {
  bottom: calc(464px + env(safe-area-inset-bottom));
}

.gift-button.open {
  transform: translateY(-2px) scale(1.04);
  background: rgba(20, 20, 30, 0.88);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 20px rgba(255, 255, 255, 0.06);
}

.gift-button:hover,
.gift-button:focus-visible {
  transform: translateY(-1px);
  background: rgba(20, 20, 30, 0.85);
}

.gift-button.open:hover,
.gift-button.open:focus-visible {
  transform: translateY(-2px) scale(1.04);
}

.gift-tray {
  position: absolute;
  z-index: 7;
  left: 12px;
  right: 12px;
  bottom: calc(96px + env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
  padding: 12px 12px 14px;
  color: var(--text);
  background: rgba(12, 12, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow:
    0 14px 44px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  animation: gift-tray-in 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: bottom 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.gift-tray.choice-lift {
  bottom: calc(292px + env(safe-area-inset-bottom));
}

.gift-tray.result-surface {
  bottom: calc(96px + env(safe-area-inset-bottom));
}

.gift-tray-header {
  min-height: 22px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

.gift-tray-header > span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.gift-resource {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.gift-resource strong {
  flex: 0 0 auto;
  color: rgba(247, 239, 229, 0.76);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.gift-ad-button {
  flex: 0 0 auto;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px 3px 8px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 180ms ease, border-color 180ms ease;
}

.gift-ad-icon {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: grid;
  place-items: center;
  background: rgba(255, 100, 80, 0.6);
  border: 1px solid rgba(255, 130, 110, 0.4);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 100, 80, 0.25);
}

.gift-ad-icon::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 2px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid #ffffff;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.24));
}

.gift-ad-reward {
  flex: 0 0 auto;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  text-transform: none;
  white-space: nowrap;
}

.gift-ad-button:disabled {
  color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
  cursor: wait;
}

.gift-ad-button:disabled .gift-ad-icon {
  opacity: 0.4;
  filter: grayscale(0.5);
}

.gift-ad-button:disabled .gift-ad-reward {
  color: rgba(255, 255, 255, 0.35);
}

.gift-tray-close {
  width: 26px;
  height: 26px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 180ms ease, color 180ms ease;
}

.gift-tray-close:hover,
.gift-tray-close:focus-visible {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.gift-tray-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 1px 1px 4px;
  scrollbar-width: none;
  touch-action: manipulation;
}

.gift-card {
  min-height: 92px;
  display: grid;
  grid-template-rows: 40px auto auto auto;
  justify-items: center;
  gap: 2px;
  padding: 6px 4px 7px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  cursor: pointer;
  scroll-snap-align: start;
  user-select: none;
  transition:
    transform 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.gift-card.ready {
  border-color: rgba(255, 255, 255, 0.18);
}

.gift-card:hover,
.gift-card:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.gift-icon-wrap {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.38));
}

.gift-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.gift-name,
.gift-meta,
.gift-cost {
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gift-name {
  min-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
  white-space: normal;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.gift-meta {
  color: rgba(255, 200, 160, 0.85);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
}

.gift-cost {
  color: rgba(255, 255, 255, 0.6);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.1;
}

.gift-card.need-ad .gift-cost {
  color: rgba(247, 239, 229, 0.48);
}

.status-layer,
.transition-layer {
  position: absolute;
  z-index: 6;
  left: 50%;
  max-width: calc(100% - 36px);
  padding: 10px 14px;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid rgba(214, 179, 107, 0.22);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
  animation: fade-in 220ms ease both;
}

.status-layer {
  top: calc(72px + env(safe-area-inset-top));
}

.transition-layer {
  bottom: calc(112px + env(safe-area-inset-bottom));
  color: var(--text-dim);
}

.transition-layer[data-mode="quick_dip"],
.transition-layer[data-mode="fade_black"],
.transition-layer[data-mode="flash_white"],
.transition-layer[data-mode="dip_color"],
.transition-layer[data-mode="blur_bridge"],
.transition-layer[data-mode="text_black"],
.transition-layer[data-mode="text_dim"],
.transition-layer[data-mode="vignette"],
.transition-layer[data-mode="object_wipe"],
.transition-layer[data-mode="whip_pan"],
.transition-layer[data-mode="glitch"],
.transition-layer[data-mode="push_zoom"] {
  inset: 0;
  left: 0;
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  transform: none;
}

.transition-layer[data-mode="quick_dip"] {
  background: rgba(0, 0, 0, 0.82);
  animation: transition-layer-in var(--scene-transition-out-ms, 110ms) ease-in-out both;
}

.transition-layer[data-mode="fade_black"] {
  background: #000;
  animation: transition-layer-in var(--scene-transition-out-ms, 280ms) ease-in-out both;
}

.transition-layer[data-mode="flash_white"] {
  background: #fff;
  animation: transition-layer-in var(--scene-transition-out-ms, 110ms) ease-out both;
}

.transition-layer[data-mode="dip_color"] {
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 128, 96, 0.22), transparent 38%),
    linear-gradient(180deg, var(--scene-transition-color, #8d1616), #060607);
  animation: transition-layer-in var(--scene-transition-out-ms, 130ms) ease-in-out both;
}

.transition-layer[data-mode="vignette"] {
  background: radial-gradient(circle at 50% 44%, transparent 0 20%, rgba(0, 0, 0, 0.54) 56%, #000 100%);
  animation: vignette-in var(--scene-transition-out-ms, 310ms) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.transition-layer[data-mode="blur_bridge"] {
  background:
    radial-gradient(circle at 50% 44%, rgba(214, 179, 107, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(3, 4, 5, 0.08), rgba(3, 4, 5, 0.36));
  animation: blur-bridge-in var(--scene-transition-out-ms, 450ms) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.transition-layer[data-mode="blur_bridge"]::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(255, 248, 238, 0.035), transparent),
    radial-gradient(circle at 50% 50%, transparent 0 46%, rgba(3, 4, 5, 0.2) 78%);
  opacity: 0.62;
}

.transition-layer[data-mode="text_black"],
.transition-layer[data-mode="text_dim"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px;
  color: #fff;
  white-space: pre-line;
  animation: transition-layer-in var(--scene-transition-out-ms, 400ms) ease-in-out both;
}

.transition-layer[data-mode="text_black"] {
  background: #000;
}

.transition-layer[data-mode="text_dim"] {
  background: rgba(0, 0, 0, 0.58);
}

.transition-title {
  color: rgba(255, 248, 238, 0.54);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
  line-height: 1.3;
  text-transform: uppercase;
}

.transition-body {
  max-width: 78%;
  color: #fff8ee;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.5;
  text-shadow: 0 10px 34px rgba(0, 0, 0, 0.48);
}

.transition-layer[data-mode="object_wipe"] {
  opacity: 1;
  background:
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12) 10%, transparent 18%),
    linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, #050506 18%, #050506 82%, rgba(0, 0, 0, 0) 100%);
  animation: object-wipe-left var(--scene-transition-total-ms, 320ms) cubic-bezier(0.76, 0, 0.24, 1) both;
}

.transition-layer[data-mode="whip_pan"] {
  background:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(255, 255, 255, 0.07) 23px 25px, transparent 26px 48px),
    linear-gradient(90deg, transparent, rgba(232, 184, 109, 0.12), transparent);
  mix-blend-mode: screen;
  animation: motion-streaks var(--scene-transition-total-ms, 320ms) ease-out both;
}

.transition-layer[data-mode="glitch"] {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 5px),
    linear-gradient(90deg, rgba(255, 0, 76, 0.18), rgba(0, 214, 255, 0.18));
  mix-blend-mode: screen;
  animation: glitch-overlay var(--scene-transition-total-ms, 340ms) steps(2, end) both;
}

.transition-layer[data-mode="glitch"]::before,
.transition-layer[data-mode="glitch"]::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: inherit;
}

.transition-layer[data-mode="glitch"]::before {
  animation: glitch-slice-a var(--scene-transition-total-ms, 340ms) steps(2, end) both;
}

.transition-layer[data-mode="glitch"]::after {
  animation: glitch-slice-b var(--scene-transition-total-ms, 340ms) steps(2, end) both;
}

.transition-layer[data-mode="push_zoom"] {
  background: radial-gradient(circle at 50% 50%, rgba(232, 184, 109, 0.14), rgba(0, 0, 0, 0.48));
  animation: transition-layer-in var(--scene-transition-out-ms, 300ms) ease-in both;
}

.player-screen.scene-transition-clear .transition-layer[data-mode="quick_dip"],
.player-screen.scene-transition-clear .transition-layer[data-mode="fade_black"],
.player-screen.scene-transition-clear .transition-layer[data-mode="flash_white"],
.player-screen.scene-transition-clear .transition-layer[data-mode="dip_color"],
.player-screen.scene-transition-clear .transition-layer[data-mode="text_black"],
.player-screen.scene-transition-clear .transition-layer[data-mode="text_dim"],
.player-screen.scene-transition-clear .transition-layer[data-mode="push_zoom"] {
  animation: transition-layer-out var(--scene-transition-in-ms, 110ms) ease-in-out both;
}

.player-screen.scene-transition-clear .transition-layer[data-mode="vignette"] {
  animation: vignette-out var(--scene-transition-in-ms, 310ms) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.player-screen.scene-transition-clear .transition-layer[data-mode="blur_bridge"] {
  animation: blur-bridge-out var(--scene-transition-in-ms, 450ms) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.text-layer {
  position: absolute;
  z-index: 3;
  left: 22px;
  right: 22px;
  bottom: calc(26px + env(safe-area-inset-bottom));
  min-height: 0;
  white-space: pre-line;
  color: #fff8ee;
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.62;
  text-align: center;
  text-shadow:
    0 2px 20px rgba(0, 0, 0, 0.92),
    0 1px 3px rgba(0, 0, 0, 0.9);
}

.choice-overlay {
  position: absolute;
  z-index: 4;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(247, 239, 229, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(14, 18, 20, 0.78), rgba(5, 6, 7, 0.94)),
    radial-gradient(circle at 50% 0%, rgba(217, 72, 59, 0.16), transparent 60%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  animation: choice-in 240ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.choice-overlay[data-choice-layout="stacked"],
.choice-overlay[data-choice-layout="triple-stacked"] {
  grid-template-columns: minmax(0, 1fr);
}

.choice-overlay[data-choice-layout] .choice-panel-header {
  grid-column: 1 / -1;
}

.choice-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 22px;
}

.choice-prompt,
.choice-timer {
  margin: 0;
  font-size: 12px;
  font-weight: 900;
}

.choice-prompt {
  color: var(--gold);
  letter-spacing: 0.18em;
}

.choice-timer {
  min-width: 42px;
  color: var(--danger-hot);
  text-align: right;
}

.choice-button {
  position: relative;
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  overflow: hidden;
  color: var(--text);
  background: rgba(247, 239, 229, 0.06);
  border-color: rgba(247, 239, 229, 0.16);
  isolation: isolate;
  text-align: left;
}

.choice-button i {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(214, 179, 107, 0.7);
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(5, 6, 7, 0.9);
}

.choice-button span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.choice-button.locked {
  color: var(--text-faint);
  background: rgba(247, 239, 229, 0.035);
  border-style: dashed;
}

.choice-button.locked i {
  border-color: rgba(247, 239, 229, 0.28);
}

.choice-requirement {
  grid-column: 2;
  margin-top: -4px;
  color: rgba(214, 179, 107, 0.82);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.choice-button:active,
.choice-button:hover:not(:disabled),
.choice-button:focus-visible:not(:disabled) {
  color: #fff8ee;
  border-color: rgba(255, 106, 85, 0.68);
  background: rgba(217, 72, 59, 0.18);
  transform: translateY(-1px);
}

.choice-button:active i,
.choice-button:hover:not(:disabled) i,
.choice-button:focus-visible:not(:disabled) i {
  background: var(--danger-hot);
}

.choice-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.result-screen {
  justify-content: flex-start;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(217, 72, 59, 0.16), transparent 44%),
    var(--bg);
  overflow: hidden;
  scrollbar-width: none;
}

.result-screen::-webkit-scrollbar {
  display: none;
}

.result-screen .subtitle {
  margin-top: auto;
}

.result-screen h2 {
  font-size: clamp(38px, 11vw, 52px);
}

.ending-progress {
  width: fit-content;
  margin: 2px 0 0;
  padding: 6px 10px;
  color: var(--gold);
  background: rgba(214, 179, 107, 0.1);
  border: 1px solid rgba(214, 179, 107, 0.22);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.metric-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 18px;
  margin: 8px 0 0;
  padding: 14px;
  border: 1px solid rgba(247, 239, 229, 0.12);
  border-radius: 8px;
  background: rgba(247, 239, 229, 0.05);
}

.metric-list dt {
  color: var(--text-dim);
  font-size: 13px;
}

.metric-list dd {
  margin: 0;
  color: var(--gold);
  font-weight: 900;
}

.choice-history {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.75;
}

.choice-history li {
  position: relative;
  padding-left: 18px;
}

.choice-history li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.82em;
  width: 8px;
  height: 1px;
  background: var(--danger-hot);
}

.debug-panel {
  position: fixed;
  left: 50%;
  top: max(8px, env(safe-area-inset-top));
  z-index: 9999;
  width: min(430px, calc(100vw - 16px));
  max-height: min(52vh, 520px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px;
  color: #edf5f1;
  background:
    linear-gradient(180deg, rgba(7, 15, 15, 0.94), rgba(2, 5, 5, 0.94)),
    rgba(2, 5, 5, 0.92);
  border: 1px solid rgba(134, 245, 203, 0.22);
  border-radius: 8px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.64), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  font-family: "Source Sans 3", system-ui, sans-serif;
}

.debug-panel.collapsed {
  grid-template-rows: auto;
  max-height: none;
}

.debug-panel.collapsed .debug-meters,
.debug-panel.collapsed .debug-scheduler,
.debug-panel.collapsed .debug-resource-list,
.debug-panel.collapsed .debug-event-log {
  display: none;
}

.debug-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.debug-panel-header strong {
  display: block;
  color: #f7efe5;
  font-size: 13px;
  line-height: 1.05;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.debug-panel-header span {
  display: block;
  margin-top: 3px;
  color: rgba(237, 245, 241, 0.62);
  font-size: 11px;
  font-weight: 700;
}

.debug-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.debug-actions button {
  min-width: 44px;
  min-height: 28px;
  padding: 0 8px;
  color: #dffaf0;
  background: rgba(134, 245, 203, 0.09);
  border: 1px solid rgba(134, 245, 203, 0.22);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}

.debug-meters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.debug-meter {
  min-width: 0;
  padding: 7px 8px;
  background: rgba(247, 239, 229, 0.05);
  border: 1px solid rgba(247, 239, 229, 0.09);
  border-radius: 6px;
}

.debug-meter span {
  display: block;
  color: rgba(237, 245, 241, 0.52);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.debug-meter strong {
  display: block;
  overflow: hidden;
  color: #86f5cb;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-scheduler {
  display: grid;
  gap: 6px;
  padding: 8px;
  background: rgba(134, 245, 203, 0.06);
  border: 1px solid rgba(134, 245, 203, 0.13);
  border-radius: 6px;
}

.debug-scheduler-row {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.debug-scheduler-row strong {
  overflow: hidden;
  color: #86f5cb;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-scheduler-row span {
  overflow: hidden;
  color: rgba(237, 245, 241, 0.62);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-queue {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.debug-queue span {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  padding: 3px 6px;
  color: rgba(247, 239, 229, 0.76);
  background: rgba(247, 239, 229, 0.06);
  border: 1px solid rgba(247, 239, 229, 0.08);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-resource-list {
  display: grid;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.debug-resource {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 8px;
  background: rgba(247, 239, 229, 0.045);
  border: 1px solid rgba(247, 239, 229, 0.08);
  border-left: 3px solid rgba(134, 245, 203, 0.42);
  border-radius: 6px;
}

.debug-resource.debug-buffering,
.debug-resource.debug-error {
  border-left-color: #d9483b;
}

.debug-resource.debug-paused,
.debug-resource.debug-cancelled {
  border-left-color: rgba(237, 245, 241, 0.34);
}

.debug-resource.debug-playing {
  border-left-color: #86f5cb;
}

.debug-resource.debug-ready {
  border-left-color: #d6b36b;
}

.debug-resource-title,
.debug-resource-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.debug-resource-title strong {
  overflow: hidden;
  color: #f7efe5;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-resource-title span {
  flex: 0 0 auto;
  color: rgba(237, 245, 241, 0.56);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.debug-progress {
  height: 5px;
  overflow: hidden;
  background: rgba(237, 245, 241, 0.1);
  border-radius: 999px;
}

.debug-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #86f5cb, #d6b36b);
  border-radius: inherit;
  transition: width 220ms linear;
}

.debug-resource-meta {
  color: rgba(237, 245, 241, 0.72);
  font-size: 11px;
  font-weight: 800;
}

.debug-detail,
.debug-empty {
  overflow: hidden;
  margin: 0;
  color: rgba(237, 245, 241, 0.48);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-event-log {
  display: grid;
  gap: 6px;
  min-height: 0;
  padding-top: 2px;
  border-top: 1px solid rgba(247, 239, 229, 0.08);
}

.debug-event-log > strong {
  color: rgba(237, 245, 241, 0.62);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.debug-event-log ol {
  display: grid;
  gap: 3px;
  max-height: 96px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.debug-event-log li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 6px;
  color: rgba(237, 245, 241, 0.56);
  font-size: 10px;
  line-height: 1.2;
}

.debug-event-log li span {
  color: rgba(134, 245, 203, 0.68);
  font-weight: 900;
}

.debug-event-log li strong {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes transition-layer-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes transition-layer-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes vignette-in {
  from {
    opacity: 0;
    transform: scale(1.24);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes vignette-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.24);
  }
}

@keyframes blur-bridge-in {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

@keyframes blur-bridge-out {
  from {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
  to {
    opacity: 0;
    backdrop-filter: blur(0);
  }
}

@keyframes object-wipe-left {
  0% {
    transform: translateX(-130%);
  }
  44%,
  56% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(130%);
  }
}

@keyframes motion-streaks {
  0% {
    opacity: 0;
    transform: skewX(-12deg) translateX(-16%);
  }
  18%,
  72% {
    opacity: 0.72;
  }
  100% {
    opacity: 0;
    transform: skewX(-12deg) translateX(14%);
  }
}

@keyframes glitch-overlay {
  0%,
  100% {
    opacity: 0;
    transform: translateX(0);
  }
  12% {
    opacity: 0.78;
    transform: translateX(-2%);
  }
  24% {
    opacity: 0.34;
    transform: translateX(2%);
  }
  40% {
    opacity: 0.82;
    transform: translateX(-1%);
  }
  56% {
    opacity: 0.24;
    transform: translateX(1%);
  }
  72% {
    opacity: 0.64;
    transform: translateX(-3%);
  }
}

@keyframes glitch-slice-a {
  0%,
  100% {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
    transform: translateX(0);
  }
  18% {
    opacity: 0.65;
    clip-path: inset(18% 0 62% 0);
    transform: translateX(4%);
  }
  48% {
    opacity: 0.5;
    clip-path: inset(52% 0 30% 0);
    transform: translateX(-3%);
  }
}

@keyframes glitch-slice-b {
  0%,
  100% {
    opacity: 0;
    clip-path: inset(100% 0 0 0);
    transform: translateX(0);
  }
  28% {
    opacity: 0.55;
    clip-path: inset(66% 0 18% 0);
    transform: translateX(-5%);
  }
  64% {
    opacity: 0.45;
    clip-path: inset(28% 0 50% 0);
    transform: translateX(3%);
  }
}

@keyframes choice-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gift-tray-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes metric-pop {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.94);
  }
  10%,
  82% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

@media (min-width: 640px) {
  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  body {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    background:
      radial-gradient(circle at 30% 20%, rgba(129, 168, 184, 0.1), transparent 28%),
      radial-gradient(circle at 70% 80%, rgba(217, 72, 59, 0.12), transparent 30%),
      #020303;
  }

  .app-shell {
    width: min(414px, calc((100vh - 64px) * 0.462));
    height: min(896px, calc(100vh - 64px));
    min-height: 0;
    aspect-ratio: 414 / 896;
    border: 1px solid rgba(247, 239, 229, 0.16);
    border-radius: 22px;
    box-shadow:
      0 42px 120px rgba(0, 0, 0, 0.78),
      0 0 0 9px #08090a,
      0 0 0 10px rgba(247, 239, 229, 0.08);
  }

  .entry-screen,
  .result-screen,
  .player-screen {
    width: 100%;
    height: 100%;
    min-height: 0;
  }
}
