  .lottery-standalone { margin: 0; background: #e9decf; }
  #lottery-preview { position: relative; height: 100vh; height: 100dvh; }
  .lottery-root, .lottery-root *, .lottery-root *::before, .lottery-root *::after { box-sizing: border-box; }
  .lottery-root [hidden] { display: none !important; }
  .lottery-root {
    --lottery-script: "Kaiti SC", "STKaiti", "KaiTi", "Microsoft YaHei", serif;
    --lottery-ink: #433023;
    display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; height: 100%;
    min-height: 0; overflow: hidden; color: var(--lottery-ink); font: 16px/1.45 system-ui, sans-serif;
  }
  .lottery-viewport {
    position: relative; min-width: 0; min-height: 0; overflow: hidden;
    background: radial-gradient(ellipse at center, #e6dbc9 5%, #f0e7db 100%);
  }
  .lottery-stage {
    position: absolute; top: 50%; left: 50%; width: 1600px; height: 900px;
    overflow: hidden; isolation: isolate; transform-origin: center;
    background-color: #eee2d2; background-position: center; background-size: cover;
    font-family: var(--lottery-script); -webkit-user-select: none; user-select: none;
  }
  .lottery-stage img { pointer-events: none; user-select: none; }
  .lottery-title, .lottery-hint, .lottery-streamer, .lottery-bank, .lottery-win, .lottery-next { position: absolute; }
  .lottery-title, .lottery-hint { margin: 0; z-index: 4; white-space: pre-wrap; }
  .lottery-title { font: 700 55px/1.24 var(--lottery-script); letter-spacing: .02em; }
  .lottery-hint { font: 700 31px/1.38 var(--lottery-script); color: #684636; }
  .lottery-streamer { z-index: 5; height: auto; filter: drop-shadow(1px 4px 2px #6652283b); }
  .lottery-bank { transform-origin: top left; }
  .lottery-bank-content, .lottery-ticket-image { display: block; position: absolute; inset: 0; width: 100%; height: 100%; }
  .lottery-ticket-image {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10.5%, #000 89%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 10.5%, #000 89%, transparent),
      linear-gradient(0deg, transparent, #000 3.8%, #000 98.3%, transparent);
    mask-composite: intersect;
  }
  .lottery-patch, .lottery-outline { position: absolute; transform-origin: center; }
  .lottery-patch { isolation: isolate; }
  .lottery-blessing, .lottery-coating, .lottery-completion-shine {
    position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  }
  .lottery-blessing {
    background-color: #fff4e2;
    background-image: linear-gradient(#a8805724 1px, transparent 1px), linear-gradient(90deg, #a8805724 1px, transparent 1px);
    background-size: 17px 17px;
  }
  .lottery-blessing-text {
    position: absolute; left: 15px; right: 15px; top: 50%;
    font-family: var(--lottery-script); font-weight: 700; line-height: 1.20;
    white-space: pre-wrap; overflow-wrap: anywhere; transform: translateY(-50%);
  }
  .lottery-coating {
    z-index: 2; touch-action: none; cursor: crosshair; -webkit-tap-highlight-color: transparent;
  }
  .lottery-coating[data-holding] { cursor: grabbing; }
  .lottery-coating:focus-visible { outline: 3px solid #fff4cf; outline-offset: -7px; }
  .lottery-root:not([data-phase="WAIT_SCRATCH"]) .lottery-coating,
  .lottery-patch[data-completed] .lottery-coating { pointer-events: none; }
  .lottery-completion-shine {
    pointer-events: none; background: #fff9df; opacity: 0; mix-blend-mode: screen;
  }
  .lottery-outline {
    z-index: 6; pointer-events: none; overflow: visible;
    color: #653337;
  }
  .lottery-outline path { fill: none; stroke: #fcebac; stroke-width: 3; stroke-dasharray: 8 5; filter: drop-shadow(0 0 2px #682634); }
  .lottery-hand {
    display: block; position: absolute; z-index: 7; width: 72px; height: 77px; transform-origin: 30% 18%;
    filter: drop-shadow(3px 5px 2px #2a231d55); animation: lottery-point 2s ease-in-out infinite;
  }
  @keyframes lottery-point {
    0%,100% { transform: translate(-3px, 1px) rotate(-12deg); }
    46% { transform: translate(20px, -7px) rotate(-4deg); }
  }
  .lottery-win { z-index: 8; width: 380px; transform: translate(-50%,-50%) rotate(var(--lottery-win-angle)) scale(var(--lottery-win-scale)); }
  .lottery-win-paper {
    padding: 21px 22px 23px; text-align: center; color: #fff9ef;
    background: linear-gradient(121deg, #211e1c, #141313 52%, #201e1d);
    clip-path: polygon(0 .8%,99.5% 0,100% 98.8%,.3% 100%);
    white-space: pre-wrap;
  }
  .lottery-win { filter: drop-shadow(4px 12px 10px #361e2159); }
  .lottery-win-title {
    font: 800 63px/1.14 "Microsoft YaHei", "PingFang SC", sans-serif;
    letter-spacing: .015em; margin: 0 0 8px;
  }
  .lottery-win-subtitle { margin: 0; font: 700 24px/1.35 "Microsoft YaHei", "PingFang SC", sans-serif; letter-spacing: .015em; }
  .lottery-next {
    z-index: 9; transform: translate(-100%,-50%) rotate(-2.5deg);
    width: max-content; max-width: 620px;
    border: 1px solid #a27b523d; border-radius: 4px 3px 6px 4px;
    background: linear-gradient(165deg,#fff9e9,#f1e4cf);
    padding: 10px 18px 11px; box-shadow: 1px 5px 7px #66443240;
    font: 700 31px/1.28 var(--lottery-script); color: #593728;
    white-space: pre-wrap; cursor: pointer; touch-action: manipulation;
    transition: transform .16s ease, box-shadow .16s ease;
  }
  .lottery-next:hover:not(:disabled) { transform: translate(-100%,-57%) rotate(-1deg); box-shadow: 1px 7px 10px #66443246; }
  .lottery-next:active:not(:disabled) { transform: translate(-100%,-44%) rotate(-1.5deg) scale(.973); }
  .lottery-next:focus-visible { outline: 3px dashed #8e4634; outline-offset: 5px; }
  .lottery-next:disabled { cursor: default; }
  .lottery-root[data-slot-handoff] :is(.lottery-bank-content,.lottery-win-paper,.lottery-title,.lottery-next) { visibility: hidden; }
  .lottery-sr { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

  .lottery-root[data-debug] { grid-template-columns: minmax(0,1fr) minmax(300px, 352px); }
  .lottery-debug {
    overflow: auto; min-width: 0; min-height: 0; padding: 15px;
    background: #fbf4e8; border-left: 1px solid #d7c4ae; font: 14px/1.4 system-ui,sans-serif;
  }
  .lottery-debug h2 { font-size: 20px; margin: 0 0 10px; }
  .lottery-debug h3 { margin: 8px 0 5px; font-size: 14px; }
  .lottery-debug details { border-top: 1px solid #dfcfbd; padding: 8px 0; }
  .lottery-debug summary { cursor: pointer; font-weight: 650; }
  .lottery-debug label { min-width: 0; }
  .lottery-debug button, .lottery-debug input:not([type="checkbox"]):not([type="file"]), .lottery-debug textarea {
    color: inherit; background: #fffaf2; border: 1px solid #c9b8a1; border-radius: 4px; padding: 4px 7px; font: inherit;
  }
  .lottery-debug input[type="file"] { width: 100%; }
  .lottery-debug textarea { display: block; width: 100%; margin-top: 3px; resize: vertical; }
  .lottery-debug button { cursor: pointer; min-height: 30px; }
  .lottery-debug button:hover { background: #f1e5d1; }
  .lottery-debug-row { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 6px 0; }
  .lottery-debug-field { display: block; margin: 7px 0; }
  .lottery-debug-number { display: grid; grid-template-columns: minmax(0,1fr) 90px; align-items: center; gap: 7px; margin: 5px 0; }
  .lottery-debug-note { margin: 8px 0; color: #6b4d37; overflow-wrap: anywhere; font-size: 13px; }
  .lottery-debug-note[data-error] { color: #9b322d; }
  @media (max-width: 680px) and (orientation: portrait) {
    .lottery-root[data-debug] { grid-template-columns: 1fr; grid-template-rows: minmax(175px, 38%) minmax(0,1fr); }
    .lottery-debug { border-left: none; border-top: 1px solid #d7c4ae; }
  }
  @media (prefers-reduced-motion: reduce) {
    .lottery-hand { animation: none; }
    .lottery-next { transition: none; }
  }
