html[data-brand] {
  --aq-wide-motion: url('/brand/council-ruby-wide-loop-slow.webp');
  --aq-wide-still: url('/brand/council-ruby-wide-still.webp');
  --aq-portrait-motion: url('/brand/council-ruby-portrait-loop-slow.webp');
  --aq-portrait-still: url('/brand/council-ruby-portrait-still.webp');
  --aq-primary-art: url('/brand/groom-dusk-button-primary.webp');
  --aq-secondary-art: url('/brand/groom-dusk-button-secondary.webp');
  --aq-primary-fill: #edb397;
  --aq-secondary-fill: #4a0b16;
  --aq-primary-ink: #3d0d16;
  --aq-secondary-ink: #fff0d7;
  --aq-outline: #ffd297;
}

html[data-brand="clean"] {
  --aq-wide-motion: url('/brand/council-pearl-wide-loop-slow.webp');
  --aq-wide-still: url('/brand/council-pearl-wide-still.webp');
  --aq-portrait-motion: url('/brand/council-pearl-portrait-loop-slow.webp');
  --aq-portrait-still: url('/brand/council-pearl-portrait-still.webp');
  --aq-primary-art: url('/brand/groom-pearl-button-primary.webp');
  --aq-secondary-art: url('/brand/groom-pearl-button-secondary.webp');
  --aq-primary-fill: #f1b0bd;
  --aq-secondary-fill: #fff0df;
  --aq-primary-ink: #501927;
  --aq-secondary-ink: #54232a;
  --aq-outline: #6c293a;
}

.aq-frame-art {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
  background-image:
    var(--aq-frame-motion, var(--aq-wide-motion)),
    var(--aq-frame-still, var(--aq-wide-still));
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

html[data-brand] body #gameScreen .atelier-game :is(#doneBtn,#passBtn).aq-cta,
html[data-brand] body .room-panel[data-status="playing"] .room-answer-actions > button.aq-cta {
  min-height: var(--aq-button-height, 44px) !important;
  position: relative;
  border: 1px solid transparent !important;
  border-radius: 100vmax !important;
  background: var(--aq-button-fill) padding-box !important;
  color: var(--aq-button-ink) !important;
  /* Stretch only the middle so the gold caps stay round on longer labels. */
  border-image-source: var(--aq-button-art) !important;
  border-image-slice: 0 17% fill !important;
  border-image-width: 0 calc(var(--aq-button-height, 44px) * .57) !important;
  border-image-repeat: stretch !important;
  box-shadow: 0 3px 12px #33131c30 !important;
  text-shadow: none !important;
  text-transform: none !important;
  font-weight: 700 !important;
  -webkit-tap-highlight-color: transparent;
}

.aq-cta.aq-primary {
  --aq-button-art: var(--aq-primary-art);
  --aq-button-fill: var(--aq-primary-fill);
  --aq-button-ink: var(--aq-primary-ink);
}

.aq-cta.aq-secondary {
  --aq-button-art: var(--aq-secondary-art);
  --aq-button-fill: var(--aq-secondary-fill);
  --aq-button-ink: var(--aq-secondary-ink);
}

html[data-brand] body #gameScreen .atelier-game :is(#doneBtn,#passBtn).aq-cta:focus-visible,
html[data-brand] body .room-panel[data-status="playing"] .room-answer-actions > button.aq-cta:focus-visible {
  outline: 2px solid var(--aq-outline) !important;
  outline-offset: 3px;
}

.aq-cta::after {
  content: "";
  position: absolute;
  inset: 3px 6% auto;
  height: 4px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 19%, #fff7dfd9 49%, transparent 76%) -110% center / 45% 100% no-repeat;
  opacity: 0;
}

@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .aq-cta:hover:not(:disabled)::after {
    animation: aq-button-gleam .85s ease-out;
  }
}

@media (prefers-reduced-motion:no-preference) {
  .aq-cta:focus-visible:not(:disabled)::after {
    animation: aq-button-gleam .85s ease-out;
  }
}

@keyframes aq-button-gleam {
  0% { background-position: -80% center; opacity: 0; }
  24% { opacity: .85; }
  77% { opacity: .65; }
  100% { background-position: 180% center; opacity: 0; }
}

@media (prefers-reduced-motion:reduce) {
  .aq-frame-art {
    background-image: var(--aq-frame-still, var(--aq-wide-still));
  }
}

/* The new question artwork uses the existing local game surface and controls. */
html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) {
  --aq-local-pane: #24090ed6;
  --aq-local-ink: #fff0d7;
  --aq-local-muted: #f3cca7;
  --aq-local-outline: #c58c5f80;
  width: 100%;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-brand="clean"] #gameScreen .atelier-game:has(#card > .aq-frame-art) {
  --aq-local-pane: #fff2e1e8;
  --aq-local-ink: #551a29;
  --aq-local-muted: #643b31;
  --aq-local-outline: #a4643b6b;
}

html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) .game-head {
  padding: 6px clamp(10px, 2vw, 22px) !important;
  border: 1px solid var(--aq-local-outline) !important;
  border-radius: 18px;
  background: var(--aq-local-pane);
  color: var(--aq-local-ink);
}

html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) :is(#turnName, #councilHint) {
  color: var(--aq-local-ink) !important;
}

html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) #councilHint:not(:empty) {
  padding: 4px 9px;
  border-radius: 12px;
  background: var(--aq-local-pane);
}

html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) .card-stage {
  min-width: 0;
  align-items: center;
}

html[data-brand] #gameScreen .atelier-game #card:has(> .aq-frame-art) {
  position: relative;
  isolation: isolate;
  flex: 0 1 auto;
  width: min(100%, 880px) !important;
  height: min(100%, 53dvh) !important;
  min-height: 0 !important;
  margin-inline: auto;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#gameScreen #card > .aq-frame-art {
  z-index: -1;
}

html[data-brand] #gameScreen .atelier-game #card:has(> .aq-frame-art) .card-inner {
  position: relative;
  box-sizing: border-box;
  flex: 1 1 0;
  width: 100%;
  align-self: stretch;
  justify-content: safe center !important;
  padding: clamp(13px, 3.4dvh, 38px) clamp(20px, 7vw, 80px) !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-brand] #gameScreen .atelier-game #card:has(> .aq-frame-art) #cardCategory {
  color: var(--aq-local-muted) !important;
}

html[data-brand] #gameScreen .atelier-game #card:has(> .aq-frame-art) #cardPrompt {
  color: var(--aq-local-ink) !important;
  font-weight: 600 !important;
  text-shadow: none !important;
}

html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) .controls {
  width: min(100%, 660px);
  align-self: center;
}

html[data-brand] #gameScreen .atelier-game :is(#doneBtn, #passBtn).aq-cta {
  min-width: 0;
  text-transform: none;
  overflow-wrap: anywhere;
}

html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) .c-vote-person[aria-pressed="true"] {
  border-color: #f4c978 !important;
  box-shadow: 0 0 0 1px #ffda92, 0 0 12px #dc994352 !important;
}

html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) #councilChoices .portrait-viewport {
  height: 100%;
  aspect-ratio: auto;
}

@media (min-width: 1000px) and (min-height: 551px) {
  html[data-brand] #gameScreen .atelier-game[data-atelier-kind="vote"]:has(#card > .aq-frame-art) {
    display: grid !important;
    grid-template: auto minmax(0, 1fr) / minmax(0, 1.12fr) minmax(0, 1fr);
    column-gap: clamp(14px, 2.5vw, 32px) !important;
  }

  #gameScreen .atelier-game[data-atelier-kind="vote"]:has(#card > .aq-frame-art) > .atelier-game-header {
    grid-column: 1 / -1;
  }

  #gameScreen .atelier-game[data-atelier-kind="vote"]:has(#card > .aq-frame-art) > .card-stage {
    grid-column: 1;
  }

  #gameScreen .atelier-game[data-atelier-kind="vote"]:has(#card > .aq-frame-art) > .atelier-game-footer {
    grid-column: 2;
    align-self: center;
    min-width: 0;
  }

  html[data-brand] #gameScreen .atelier-game[data-atelier-kind="vote"] #card:has(> .aq-frame-art) {
    height: min(100%, 46dvh) !important;
  }

  html[data-brand] #gameScreen .atelier-game[data-atelier-kind="vote"] #card:has(> .aq-frame-art) .card-inner {
    padding-inline: clamp(22px, 3.4vw, 53px) !important;
  }
}

@media (max-width: 560px) and (min-height: 740px) and (orientation: portrait) {
  html[data-brand] #gameScreen .atelier-game #card:has(> .aq-frame-art) {
    --aq-frame-motion: var(--aq-portrait-motion);
    --aq-frame-still: var(--aq-portrait-still);
    height: min(100%, 54dvh) !important;
  }

  html[data-brand] #gameScreen .atelier-game #card:has(> .aq-frame-art) .card-inner {
    padding-block: clamp(29px, 7dvh, 63px) !important;
  }
}

@media (max-width: 760px) {
  html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) {
    padding-inline: clamp(4px, 2vw, 14px) !important;
  }
}

@media (max-height: 550px) and (orientation: landscape) {
  html[data-brand] #gameScreen .atelier-game:has(#card > .aq-frame-art) {
    display: grid !important;
    grid-template: auto minmax(0, 1fr) / minmax(0, 1fr) minmax(0, 1fr) !important;
    padding: 4px 8px !important;
    gap: 5px clamp(8px, 2vw, 20px) !important;
  }

  #gameScreen .atelier-game:has(#card > .aq-frame-art) > .salon-local-brand {
    display: none !important;
  }

  #gameScreen .atelier-game:has(#card > .aq-frame-art) > .atelier-game-header {
    grid-area: 1 / 1 !important;
  }

  #gameScreen .atelier-game:has(#card > .aq-frame-art) > .card-stage {
    grid-area: 2 / 1 !important;
  }

  #gameScreen .atelier-game:has(#card > .aq-frame-art) > .atelier-game-footer {
    grid-area: 1 / 2 / 3 !important;
    align-self: center;
    min-width: 0;
    max-height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
  }

  html[data-brand] #gameScreen .atelier-game #card:has(> .aq-frame-art) {
    height: min(100%, 60dvh) !important;
  }

  html[data-brand] #gameScreen .atelier-game #card:has(> .aq-frame-art) .card-inner {
    padding: clamp(10px, 3dvh, 18px) clamp(18px, 3vw, 36px) !important;
  }
}

/* Online questions only. Lobby, access notices, dossiers and results use their own layouts. */
.room-panel[data-status="playing"]:has(.room-question > .aq-frame-art) {
  overflow-y: auto !important;
}

.room-panel[data-status="playing"]:has(.room-question > .aq-frame-art) .room-shell {
  height: auto;
  min-height: 100%;
}

.room-panel[data-status="playing"] #roomBody:has(.room-question > .aq-frame-art) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "progress progress"
    "play play"
    "status help";
  column-gap: clamp(4px, 2vw, 14px);
}

.room-panel[data-status="playing"] #roomBody:has(.aq-frame-art) > .room-progress {
  grid-area: progress;
}

.room-panel[data-status="playing"] #roomBody:has(.aq-frame-art) > .atelier-help {
  grid-area: help;
  position: static;
  align-self: end;
  margin: 0;
  padding-inline: 10px;
  border: 1px solid var(--salon-line);
  border-radius: 999px;
  background: var(--salon-card);
  color: var(--salon-ink);
}

.room-panel[data-status="playing"] #roomBody:has(.aq-frame-art) > :is(.room-host-actions, .room-host-note) {
  grid-area: status;
  align-self: end;
  min-width: 0;
}

.room-panel[data-status="playing"] #roomBody:has(.aq-frame-art) > .room-host-note {
  padding: 6px;
}

.room-panel[data-status="playing"] #roomBody:has(.aq-frame-art) .room-auto-next {
  margin: 0;
  line-height: 1.3;
}

.room-panel[data-status="playing"] .room-play-grid:has(> .room-question > .aq-frame-art) {
  grid-area: play;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  align-items: center !important;
  gap: clamp(10px, 2dvh, 23px);
  padding: 0 clamp(0px, 1.7vw, 24px) clamp(8px, 1.6dvh, 16px) !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.room-panel[data-status="playing"] .room-question:has(> .aq-frame-art) {
  position: relative;
  isolation: isolate;
  flex: none;
  justify-self: center;
  width: min(100%, 810px, 145dvh);
  aspect-ratio: 968 / 516;
  min-height: min-content !important;
  box-sizing: border-box;
  margin: 0 !important;
  padding: clamp(24px, 5.6vw, 54px) clamp(19px, 6vw, 64px) !important;
  color: var(--salon-ink);
}

.room-panel[data-status="playing"] .room-question:has(> .aq-frame-art) > :not(.aq-frame-art) {
  position: relative;
  z-index: 1;
}

.room-panel[data-status="playing"] .room-question:has(> .aq-frame-art) h2 {
  line-height: 1.04 !important;
  font-size: clamp(24px, 4.6dvh, 52px) !important;
}

.room-panel[data-status="playing"] .room-play-grid:has(.room-answer-instruction) .room-question:has(.aq-frame-art) .salon-question-instruction {
  display: none;
}

.room-panel[data-status="playing"] .room-play-grid:has(.aq-frame-art) > #roomAnswerForms {
  justify-self: center;
  align-self: center;
  max-width: min(100%, 690px) !important;
}

.room-panel[data-status="playing"] .room-play-grid:has(.aq-frame-art) .room-answer-actions {
  grid-template-columns: minmax(0, 1fr) minmax(66px, 28%) !important;
}

.room-panel[data-status="playing"] .room-play-grid:has(.aq-frame-art) .salon-seat {
  width: min(28%, 166px) !important;
}

.room-panel[data-status="playing"] .room-play-grid:has(.aq-frame-art) .salon-seat-photo {
  height: auto !important;
  aspect-ratio: 4 / 5 !important;
}

@media (min-width: 761px) {
  .room-panel[data-status="playing"] .room-play-grid[data-aq-kind="vote"]:has(.aq-frame-art),
  .room-panel[data-status="playing"] .room-play-grid:has(.aq-frame-art):has(.salon-seat-grid) {
    grid-template-columns: minmax(0, 1.04fr) minmax(0, 1fr);
    gap: clamp(12px, 2.7vw, 32px);
  }

  .room-panel[data-status="playing"] .room-play-grid[data-aq-kind="vote"] .room-question:has(.aq-frame-art),
  .room-panel[data-status="playing"] .room-play-grid:has(.salon-seat-grid) .room-question:has(.aq-frame-art) {
    width: 100%;
    padding: clamp(23px, 4vw, 42px) clamp(22px, 4.2vw, 49px) !important;
  }

  .room-panel[data-status="playing"] .room-play-grid[data-aq-kind="vote"] .room-question:has(.aq-frame-art) h2 {
    font-size: clamp(23px, 3.55dvh, 38px) !important;
  }
}

@media (max-width: 760px) {
  .room-panel[data-status="playing"] .room-question:has(.aq-frame-art) {
    width: 100%;
    padding: 25px clamp(19px, 7vw, 32px) !important;
  }

  .room-panel[data-status="playing"] .room-question:has(.aq-frame-art) h2 {
    font-size: clamp(20px, 6.3vw, 35px) !important;
  }

  .room-panel[data-status="playing"] .room-play-grid:has(.aq-frame-art) .salon-seat {
    width: calc((100% - 22px) / 3) !important;
  }
}

@media (max-width: 560px) and (min-height: 740px) and (orientation: portrait) {
  .room-panel[data-status="playing"] .room-play-grid[data-aq-kind="story"] .room-question:has(.aq-frame-art) {
    --aq-frame-motion: var(--aq-portrait-motion);
    --aq-frame-still: var(--aq-portrait-still);
    max-width: 350px;
    aspect-ratio: 662 / 792;
    padding-block: clamp(34px, 7dvh, 61px) !important;
  }
}

@media (min-width: 600px) and (max-height: 520px) {
  .room-panel[data-status="playing"] .room-play-grid:has(.aq-frame-art) {
    grid-template-columns: minmax(0, 1.03fr) minmax(0, 1fr);
    gap: clamp(8px, 2vw, 18px);
  }

  .room-panel[data-status="playing"] .room-question:has(.aq-frame-art) {
    padding: 20px clamp(19px, 4vw, 36px) !important;
  }

  .room-panel[data-status="playing"] .room-question:has(.aq-frame-art) h2 {
    font-size: clamp(23px, 6.2dvh, 33px) !important;
  }

  .room-panel[data-status="playing"] .room-play-grid:has(.aq-frame-art) .salon-seat {
    width: min(29%, 90px) !important;
  }
}
