/* The surrounding site follows its saved palette. The cabinet, controls and foil use
   the separate machine finish on #lottery-hall, so their artwork stays intact. */
body.jelly-site :is(.lottery-page, .lottery-operator) {
  --lottery-site-panel: linear-gradient(155deg, var(--paper), color-mix(in srgb, var(--paper) 69%, var(--soft)));
  --lottery-site-rim: color-mix(in srgb, var(--line) 86%, var(--accent));
  --lottery-site-field-edge: color-mix(in srgb, var(--line) 44%, var(--accent));
  --lottery-site-button: linear-gradient(180deg, color-mix(in srgb, var(--accent) 89%, white), var(--accent));
  --lottery-site-button-ink: #fff;
  --lottery-site-danger: #872f55;
  --lottery-site-danger-paper: #f9e5ee;
  --lottery-site-danger-edge: #d79cb7;
  --lottery-site-success: #245740;
  --lottery-site-success-paper: #e2f5eb;
  --lottery-site-success-edge: #8cbaaa;
}

html[data-theme="dark"] body.jelly-site :is(.lottery-page, .lottery-operator) {
  --lottery-site-button: linear-gradient(180deg, color-mix(in srgb, var(--accent) 80%, white), var(--accent));
  --lottery-site-button-ink: #241733;
  --lottery-site-danger: #ffc4d9;
  --lottery-site-danger-paper: #4b2940;
  --lottery-site-danger-edge: #a96f8b;
  --lottery-site-success: #b6f0d3;
  --lottery-site-success-paper: #263c37;
  --lottery-site-success-edge: #699a8a;
}

/* Hall and prize information. Keep the existing areas, tabs and hit targets. */
body.jelly-site :is(.lottery-page .hall-header h1, .lottery-inbox h1, .lottery-redeem-page h1, .lottery-operator h1) {
  color: var(--text);
  font-family: inherit;
  font-size: var(--heading-size);
}

body.jelly-site .lottery-page :is(.hall-outline, .prize-detail-frame .dialog-close) {
  color: var(--accent);
  border-color: var(--lottery-site-rim);
  background: var(--lottery-site-panel);
}

body.jelly-site .lottery-page .hall-outline:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--soft);
}

body.jelly-site .lottery-page :is(.hall-outline, .gallery-item, .lottery-link, .pool-main-action):focus-visible {
  outline-color: var(--focus);
}

body.jelly-site #lottery-hall :is(.pool-lane, .lottery-rail) {
  border-color: var(--lottery-site-rim);
  background: var(--lottery-site-panel);
  color: var(--text);
  box-shadow: var(--shell-shadow);
}

body.jelly-site #lottery-hall .pool-gallery-lane {
  --pool-ink: var(--text);
  --gallery-ink: var(--text);
  --gallery-muted: var(--muted);
  --gallery-line: var(--line);
}

body.jelly-site #lottery-hall :is(.lane-rule, .pool-status, .credit, .stock-count, .lottery-muted,
  .lottery-rail-heading p, .lottery-prize p) {
  color: var(--muted);
}

body.jelly-site #lottery-hall :is(.lottery-rail-heading h2, .lottery-prize h3, .prize-list summary) {
  color: var(--text);
}

body.jelly-site #lottery-hall :is(.lottery-prize, .prize-list, .gallery-media, .prize-detail-actions) {
  border-color: var(--line);
}

body.jelly-site #lottery-hall .prize-list summary::marker { color: var(--accent); }

body.jelly-site #lottery-hall :is(.pool-lane .lottery-ticket, .lottery-rail .lottery-ticket,
  .gallery-quantity, .lottery-prize-thumb, .lottery-last, .daily-status, .lottery-rail .lottery-notice) {
  color: var(--accent);
  background: var(--soft);
  border-color: var(--lottery-site-rim);
}

body.jelly-site #lottery-hall .gallery-item {
  background: var(--paper);
  border-color: var(--line);
}

body.jelly-site #lottery-hall .gallery-item:hover { border-color: var(--accent); }

body.jelly-site #lottery-hall :is(.prize-detail, .draw-dialog:not([data-outcome="win"])) {
  background: var(--paper);
  color: var(--text);
  border-color: var(--lottery-site-rim);
}

body.jelly-site #lottery-hall .prize-detail-copy p { color: var(--muted); }
body.jelly-site #lottery-hall .draw-dialog:not([data-outcome="win"]) :is(#draw-empty-title, .dialog-close) {
  color: var(--text);
}
body.jelly-site #lottery-hall .draw-dialog:not([data-outcome="win"]) .draw-description { color: var(--muted); }
body.jelly-site #lottery-hall .draw-dialog:not([data-outcome="win"]) .draw-kicker { color: var(--accent); }
body.jelly-site #lottery-hall .draw-dialog:not([data-outcome="win"]) .dialog-close {
  background: var(--soft);
  border-color: var(--line);
}

/* The schedule has high-contrast text over the existing moving gel decoration. */
html[data-theme="dark"] body.jelly-site #lottery-hall .gallery-ticket {
  --jelly-ink: var(--text);
  --jelly-muted: var(--muted);
  border-color: var(--lottery-site-rim);
  background:
    radial-gradient(ellipse at 87% 92%, #583b77, transparent 73%),
    linear-gradient(148deg, var(--soft), var(--paper));
  box-shadow: inset 0 1px #f2d4ff46, inset 0 0 0 3px #f0c6ff14, 0 6px 15px #130b24a1;
}

html[data-theme="dark"] body.jelly-site #lottery-hall .jelly-decoration { opacity: .32; }
html[data-theme="dark"] body.jelly-site #lottery-hall .gallery-ticket #pool-schedule { color: var(--text); }

html[data-theme="dark"] body.jelly-site #lottery-hall .gallery-ticket :is(.pool-badge, .gallery-countdown) {
  background: var(--paper);
  border-color: var(--line);
  box-shadow: inset 0 1px #ffefff24;
  color: var(--accent);
}

html[data-theme="dark"] body.jelly-site #lottery-hall .gallery-ticket .gallery-countdown strong { color: var(--text); }

body.jelly-site #lottery-hall .gallery-ticket .gallery-countdown[data-urgent="true"] {
  background: var(--lottery-site-danger-paper);
  border-color: var(--lottery-site-danger-edge);
}
body.jelly-site #lottery-hall .gallery-ticket .gallery-countdown[data-urgent="true"] strong {
  color: var(--lottery-site-danger);
}

/* The same shell reaches the standalone pages and their native hall dialog. */
body.jelly-site :is(.lottery-inbox, .lottery-redeem-page) {
  --lottery-canvas: var(--page);
  --lottery-paper: var(--paper);
  --lottery-ink: var(--text);
  --lottery-muted: var(--muted);
  --lottery-line: var(--line);
  --lottery-accent: var(--accent);
  --lottery-soft: var(--soft);
  color: var(--text);
}

body.jelly-site .lottery-page .lottery-link { color: var(--accent); }

body.jelly-site :is(.lottery-inbox .lottery-mail, .lottery-redeem-page .lottery-redeem-card) {
  border-color: var(--lottery-site-rim);
  border-radius: 16px;
  background: var(--lottery-site-panel);
  box-shadow: var(--shell-shadow);
}

body.jelly-site .lottery-inbox .lottery-mail h2 { color: var(--text); }

/* The shell keeps this data attribute while dialogue rendering changes its ID per step. */
body.jelly-site [data-lottery-dialog-shell] {
  --redeem-ink: var(--text);
  --redeem-muted: var(--muted);
  --redeem-outline: var(--focus);
  background: var(--lottery-site-panel);
  border-color: var(--lottery-site-rim);
  box-shadow: 0 25px 65px #1a0d3280, inset 0 1px color-mix(in srgb, var(--line), var(--paper));
  scrollbar-color: var(--line) transparent;
}

body.jelly-site [data-lottery-dialog-shell] .dialog-close {
  color: var(--accent);
  border-color: var(--lottery-site-rim);
  background: var(--lottery-site-panel);
  box-shadow: inset 0 1px color-mix(in srgb, var(--line), var(--paper));
}

body.jelly-site [data-lottery-dialog-shell] :is(.jelly-dialog-notice, .jelly-mail, .jelly-inbox-messages > p, code) {
  color: var(--text);
  background: var(--soft);
  border-color: var(--line);
  box-shadow: none;
}

body.jelly-site [data-lottery-dialog-shell] .jelly-mail time { color: var(--muted); }

body.jelly-site :is([data-lottery-dialog-shell] .jelly-account-field input,
  [data-lottery-dialog-shell]#redeem-demo .jelly-redeem-form :is(input, textarea),
  .lottery-redeem-page .lottery-field :is(input, textarea),
  .lottery-operator :is(.operator-form input:not([type="checkbox"]), .operator-form textarea, .operator-filter select)) {
  color: var(--text);
  background: var(--paper);
  border-color: var(--lottery-site-field-edge);
  box-shadow: inset 0 1px 3px color-mix(in srgb, var(--line) 53%, transparent);
}

body.jelly-site :is([data-lottery-dialog-shell], .lottery-redeem-page, .lottery-operator) :is(input, textarea)::placeholder {
  color: var(--muted);
  opacity: 1;
}

body.jelly-site :is([data-lottery-dialog-shell] .jelly-account-field input,
  [data-lottery-dialog-shell]#redeem-demo .jelly-redeem-form :is(input, textarea),
  .lottery-redeem-page .lottery-field :is(input, textarea),
  .lottery-operator :is(.operator-form input, .operator-form textarea, .operator-filter select)):focus {
  outline-color: var(--focus);
}

body.jelly-site .lottery-page .lottery-form-error {
  color: var(--lottery-site-danger);
  background: var(--lottery-site-danger-paper);
}

body.jelly-site [data-lottery-dialog-shell] :is(.jelly-redeem-error, .jelly-dialog-request-error, .errorlist),
body.jelly-site [data-lottery-dialog-shell]#redeem-demo .jelly-redeem-error,
body.jelly-site .lottery-operator .operator-form .errorlist {
  color: var(--lottery-site-danger);
}

body.jelly-site [data-lottery-dialog-shell]#redeem-demo .jelly-redeem-form input[aria-invalid="true"] {
  border-color: var(--lottery-site-danger-edge);
}

body.jelly-site [data-lottery-dialog-shell]#redeem-demo[data-phase="shipping"] .jelly-dialog-notice,
body.jelly-site .lottery-redeem-page[data-step="done"] .lottery-award-status {
  color: var(--lottery-site-success);
  background: var(--lottery-site-success-paper);
  border-color: var(--lottery-site-success-edge);
}

body.jelly-site [data-lottery-dialog-shell]#redeem-demo[data-phase="shipping"] .jelly-dialog-notice::before {
  border-color: var(--lottery-site-success);
}

/* Shared application actions exclude the cabinet deck and the gold foil result control. */
body.jelly-site :is(.lottery-inbox .lottery-action, .lottery-redeem-page .lottery-action,
  [data-lottery-dialog-shell] .jelly-primary, #lottery-hall .pool-main-action:not(:disabled), #daily-login,
  .lottery-operator button.operator-primary, .lottery-operator .operator-tabs [aria-current="page"]) {
  color: var(--lottery-site-button-ink);
  background: var(--lottery-site-button);
  border-color: var(--accent);
  text-shadow: none;
}

body.jelly-site :is(.lottery-inbox .lottery-action, .lottery-redeem-page .lottery-action,
  [data-lottery-dialog-shell] .jelly-primary, #lottery-hall .pool-main-action:not(:disabled), #daily-login):hover {
  color: var(--lottery-site-button-ink);
  filter: brightness(1.04);
}

body.jelly-site #lottery-hall .pool-main-action:disabled {
  color: var(--muted);
  background: var(--soft);
  border-color: var(--line);
}

/* The staff pages keep their existing tables and forms, including mobile scrolling. */
body.jelly-site .lottery-operator {
  --operator-paper: var(--paper);
  --operator-ink: var(--text);
  --operator-muted: var(--muted);
  --operator-edge: var(--line);
  --operator-accent: var(--accent);
}

body.jelly-site .lottery-operator .operator-tabs { background-color: var(--soft); }

body.jelly-site .lottery-operator :is(.operator-card, .operator-tabs) {
  border-color: var(--lottery-site-rim);
  box-shadow: var(--shell-shadow);
}

body.jelly-site .lottery-operator .operator-card { background: var(--lottery-site-panel); }

body.jelly-site .lottery-operator :is(.operator-prizes li img, button:not(.operator-primary)) {
  background: var(--soft);
}

body.jelly-site .lottery-operator :focus-visible { outline-color: var(--focus); }
