/* Paint the locked checking state from the first frame, instead of
   hiding the whole editor while auth and Daily queries complete. The final
   playable/finished state is still decided by the server, not browser storage. */
html.crilo-daily-pending #drawPanel{
  visibility:visible!important;
  pointer-events:none!important;
  background:#eff0f2!important;
  border-color:#dfe2e6!important;
}
html[data-theme="dark"].crilo-daily-pending #drawPanel{
  background:#292d35!important;
  border-color:#414952!important;
}
html.crilo-daily-pending #drawPanel .draw-actions{
  opacity:.42!important;
  filter:grayscale(.7);
}
html.crilo-daily-pending #drawPanel :is(#drawRecentColors,#drawRecentSwatches,.recent-colors,.recent-color-swatches){
  visibility:hidden!important;
}
html.crilo-daily-pending #drawPanel :is(#drawPanelTitle,#drawPanelDescription,#drawSafetyNote,.draw-complete-note){
  visibility:hidden!important;
}
html.crilo-daily-pending #drawPanel>div:first-child{
  position:relative;
}
html.crilo-daily-pending #drawPanel>div:first-child::after{
  content:"Checking your Daily…";
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#69717e;
  font-size:13px;
  font-weight:750;
  line-height:1.4;
  text-align:center;
  pointer-events:none;
}
html[data-theme="dark"].crilo-daily-pending #drawPanel>div:first-child::after{color:#bac1cd}

/* Crilo Daily drawing state.
   Intentionally no decorative borders or accent lines anywhere on the site.
   A completed run quietly dims the editor while leaving its controls visible. */
#drawPanel{position:relative}
#drawPanel .draw-finished-overlay{display:none!important}
#drawPanel.daily-finished{
  background:#eff0f2!important;
  border-color:#dfe2e6!important;
  opacity:1!important;
  color:#626975;
}
/* Keep the live region available to screen readers; the visual panel itself
   contains no completion message. The run-complete section explains the state. */
/* The compact lock notice sits ABOVE the gray wash, not on top of the
   buttons. The original aria-live description is visually hidden, never
   removed from assistive technology. */
#drawPanel .draw-complete-note{display:none}
#drawPanel.daily-finished>div:first-child{
  opacity:1!important;
  position:relative;z-index:4;
  min-height:54px;
  display:flex;align-items:center;justify-content:center;
}
#drawPanel.daily-finished #drawPanelTitle,
#drawPanel.daily-finished #drawPanelDescription,
#drawPanel.daily-finished #drawSafetyNote{
  position:absolute!important;
  width:1px!important;height:1px!important;
  padding:0!important;margin:-1px!important;
  overflow:hidden!important;
  clip:rect(0,0,0,0)!important;
  white-space:nowrap!important;border:0!important;
}
#drawPanel.daily-finished .draw-complete-note{
  display:flex;align-items:center;justify-content:center;
  gap:10px;width:min(100%,450px);margin:auto;
  color:#6f515b;text-align:left;line-height:1.3;
}
#drawPanel.daily-finished .draw-complete-symbol{
  display:grid;place-items:center;flex:0 0 27px;
  width:27px;height:27px;margin:0;
  border-radius:9px;background:#d4e6dd;color:#406a56;
  font-size:15px;font-weight:900;
}
#drawPanel.daily-finished .draw-complete-copy{
  display:flex;flex-direction:column;align-items:flex-start;
  gap:2px;min-width:0;max-width:100%;
}
#drawPanel.daily-finished .draw-complete-copy strong{
  font-size:clamp(13px,1.3vw,15px);
  line-height:1.3;font-weight:850;letter-spacing:-.01em;
  color:#74535e;
}
#drawPanel.daily-finished .draw-complete-copy small{
  display:block;font-size:11.5px;line-height:1.45;
  color:#6e737c;font-weight:600;
}
#drawPanel.daily-finished .draw-actions,
#drawPanel.daily-finished .recent-colors{opacity:.92}
#drawPanel.daily-finished :is(button,select,input):disabled{cursor:not-allowed}
/* Neither Pen nor Fill should retain a black "selected" appearance. */
#drawPanel.daily-finished .drawing-tool,
#drawPanel.daily-finished .drawing-tool.active{
  background:#f2f3f5!important;
  color:#747c87!important;
  border-color:#d5d9df!important;
  box-shadow:none!important;
}
/* One translucent gray layer, no text, icons, or decorative lines. */
#drawPanel.daily-finished::after{
  content:"";
  position:absolute;
  inset:1px;
  z-index:3;
  border-radius:17px;
  background:rgba(215,219,225,.43);
  pointer-events:none;
}
body.wheel-run-active #drawPanel.daily-finished{
  display:flex!important;
  visibility:visible!important;
  opacity:1!important;
  pointer-events:none;
}
#drawPanel.draw-unavailable{opacity:1!important;background:#f5f5f7}
html[data-theme="dark"] #drawPanel.daily-finished{
  background:#292d35!important;
  border-color:#414952!important;
  color:#d4d8df;
}
html[data-theme="dark"] #drawPanel.daily-finished .drawing-tool,
html[data-theme="dark"] #drawPanel.daily-finished .drawing-tool.active{
  background:#353941!important;
  color:#a9b1bd!important;
  border-color:#505864!important;
  box-shadow:none!important;
}
html[data-theme="dark"] #drawPanel.daily-finished .draw-complete-note{color:#e5cbd2}
html[data-theme="dark"] #drawPanel.daily-finished .draw-complete-copy strong{color:#dcb4c0}
html[data-theme="dark"] #drawPanel.daily-finished .draw-complete-copy small{color:#b9c0ca}
html[data-theme="dark"] #drawPanel.daily-finished .draw-complete-symbol{
  background:#354e47;color:#c0decb;
}
html[data-theme="dark"] #drawPanel.daily-finished::after{
  background:rgba(55,60,70,.39);
}
html[data-theme="dark"] #drawPanel.draw-unavailable{background:#292d35}
@media(max-width:600px){
  #drawPanel.daily-finished::after{border-radius:17px}
  #drawPanel.daily-finished>div:first-child{min-height:52px}
  #drawPanel.daily-finished .draw-complete-note{
    max-width:100%;gap:8px;padding:0 2px;
  }
  #drawPanel.daily-finished .draw-complete-copy strong{font-size:13px}
  #drawPanel.daily-finished .draw-complete-copy small{font-size:11px}
}

/* Play-only score: slightly more compact, steady digits. Score rarity and
   final-spin celebration remain unchanged; no infinite bobbing animation. */
#wheelScorePanel .wheel-score-amount{
 font-size:clamp(35px,4.3vw,49px);
 padding:6px 15px 8px;
 line-height:1.14;
}
@media(max-width:700px){
 #wheelScorePanel .wheel-score-amount{
  font-size:clamp(31px,7.5vw,43px);
  padding:5px 12px 7px;
 }
}

/* Give the wheel, score and completed-run actions a more compact vertical
   rhythm on desktops without touching pixel studio, game logic, or the
   canvas dimensions while a spin is in progress. */
@media(min-width:701px){
  .hero{padding-top:clamp(24px,3.5vh,40px)}
  .hero .sub{margin-bottom:16px}
  .hero #drawPanel{margin:16px auto 18px;gap:11px;padding:12px 16px}
  .hero .wheel-hud{margin:6px auto 4px}
  .hero .wheel-hud .wheel-counts{margin:10px auto 7px}
  .hero .wheel-score{gap:2px}
  .hero .message{margin-top:5px;min-height:18px}
  .hero #playedPanel{margin-top:11px;padding:15px 18px}
  .hero #result{margin-top:15px;padding-top:17px}
}
@media(max-width:700px){
  .hero #drawPanel{margin:17px auto 22px}
  .hero .wheel-hud .wheel-counts{margin:11px auto 10px}
  .hero #playedPanel{margin-top:13px}
}


/* One calm confirmation, not a second score and countdown. */
#playedPanel{max-width:770px;align-items:center;justify-content:flex-start;gap:12px 15px;padding:14px 19px;margin-top:11px;text-align:left}
#playedPanel .played-check{align-self:center;flex:0 0 40px;width:40px;height:40px}
#playedPanel .played-completion-copy{flex:1 1 260px;min-width:0;text-align:left}
#playedPanel .played-completion-copy>strong{display:block;font-size:17px;letter-spacing:-.025em}
#playedPanel .played-completion-copy>#playedText{display:block;margin-top:3px;font-size:12px;line-height:1.4;color:var(--muted,#777)}
#playedPanel>a.small-btn,#playedPanel .crilo-share-trigger{margin:0;white-space:nowrap}
#ownerRunControls .owner-complete-recap{
 display:flex;align-items:center;flex-wrap:wrap;gap:6px 13px;margin-top:9px;
 font-size:12px;line-height:1.3;color:var(--muted,#777);
 font-variant-numeric:tabular-nums;
}
#ownerRunControls .owner-complete-recap>strong{
 color:var(--text,#15171c);font-weight:900;letter-spacing:0
}
#ownerRunControls .owner-complete-recap>span{margin:0;font-size:12px;color:var(--muted,#777)}
#result .result-next-daily{
 display:flex;align-items:center;justify-content:center;gap:8px;
 margin:10px auto 7px;padding:7px 12px;
 width:fit-content;max-width:100%;border-radius:999px;
 background:var(--soft,#f7f7f7);border:1px solid var(--line,#e7e7e7);
 color:var(--muted,#777);font-size:11px;font-weight:800
}
#result .result-next-daily strong{font-size:12px;font-weight:900;
 font-variant-numeric:tabular-nums;color:var(--text,#15171c)}
@media(max-width:700px){
 #playedPanel{padding:13px 14px;gap:9px 12px}
 #playedPanel .played-completion-copy{flex:1 1 calc(100% - 57px)}
 #playedPanel>a.small-btn,#playedPanel .crilo-share-trigger{flex:1 1 130px;text-align:center}
}
/* Compact Drawing Studio: short text, fixed one-row tools and a reserved five-color slot. */
.hero #drawPanel:not(.draw-unavailable) {
  display:grid!important;
  grid-template-columns:minmax(210px,220px) minmax(0,1fr);
  grid-template-rows:auto;
  align-items:center;
  width:min(980px,100%);
  max-width:980px;
  box-sizing:border-box;
  column-gap:10px!important;
  row-gap:0!important;
  padding:7px 12px!important;
  margin:10px auto 12px!important;
}
.hero #drawPanel:not(.draw-unavailable)>div:first-child {
  grid-column:1;
  grid-row:1;
  min-width:0;
  min-height:0;
  position:relative;
  align-self:center;
  text-align:left;
  justify-content:flex-start;
}
#drawPanel:not(.daily-finished) #drawPanelTitle {
  font-size:13px;
  line-height:1.18;
  font-weight:900;
  letter-spacing:-.02em;
  color:var(--text,#202127);
}
#drawPanel:not(.daily-finished) #drawPanelDescription {
  display:block;
  font-size:10.5px;
  line-height:1.25;
  margin-top:3px;
  color:var(--muted,#747881);
}
#drawPanel:not(.daily-finished) #drawSafetyNote {
  display:block;
  font-size:9.1px;
  line-height:1.2;
  margin-top:3px;
  font-weight:600;
  color:#916c73;
  white-space:nowrap;
}
/* Allow wrapping on especially narrow screens rather than overflow. */
@media (max-width:360px) {
  #drawPanel:not(.daily-finished) #drawSafetyNote {white-space:normal}
}
.hero #drawPanel:not(.draw-unavailable)>.draw-actions {
  grid-column:2;
  grid-row:1;
  width:100%;
  min-width:0;
  display:flex!important;
  flex-direction:column;
  flex-wrap:nowrap;
  align-items:stretch;
  justify-content:center;
  gap:3px!important;
}
#drawPanel:not(.draw-unavailable) .draw-toolbar-main {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:nowrap;
  gap:4px;
  width:100%;
  min-width:0;
}
#drawPanel:not(.draw-unavailable) .draw-toolbar-row {
  /* Both DOM wrappers flatten into a single row, without touching listeners. */
  display:contents!important;
}
#drawPanel:not(.draw-unavailable) .draw-tool-group {
  display:inline-flex;
  align-items:center;
  flex:0 0 auto;
  gap:3px;
}
#drawPanel:not(.draw-unavailable) .draw-actions .small-btn {
  min-height:30px;
  padding:5px 5px;
  font-size:10.3px;
  line-height:1.2;
  border-radius:9px;
  white-space:nowrap;
  flex:0 0 auto;
}
#drawPanel:not(.draw-unavailable) .draw-actions #drawMode {
  display:inline-block!important;
  width:122px;
  max-width:100%;
  min-height:30px;
  padding:5px 4px;
  font-size:10.3px;
  line-height:1.2;
  border-radius:9px;
  flex:0 0 122px;
}
#drawPanel:not(.draw-unavailable) .draw-actions .native-paint-picker {
  display:inline-flex!important;
  min-height:30px;
  padding:2px 4px;
  gap:3px;
  font-size:10.3px;
  border-radius:9px;
  flex:0 0 auto;
}
#drawPanel:not(.draw-unavailable) .draw-actions .native-paint-picker>span {
  font-size:10.3px;
}
#drawPanel:not(.draw-unavailable) .draw-actions .drawing-color-value {
  width:24px!important;
  min-width:24px!important;
  height:24px!important;
  padding:1px!important;
}
/* A permanent, fixed-width home for exactly five recent swatches.
   Its width and height never depend on whether colors were painted. */
#drawPanel:not(.draw-unavailable) .draw-toolbar-main .recent-colors {
  position:static;
  box-sizing:border-box;
  display:flex!important;
  flex:0 0 86px;
  width:86px;
  min-width:86px;
  max-width:86px;
  min-height:30px;
  height:30px;
  padding:0 0 0 3px;
  margin:0;
  align-items:center;
  justify-content:flex-end;
  border-left:1px solid var(--line,#e6e1e7);
  overflow:visible;
  visibility:visible;
}
#drawPanel:not(.draw-unavailable) .draw-toolbar-main .recent-colors>strong {
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
}
#drawPanel:not(.draw-unavailable) .draw-toolbar-main .recent-color-swatches {
  box-sizing:content-box;
  display:flex;
  flex:0 0 82px;
  width:82px;
  max-width:82px;
  min-width:82px;
  min-height:14px;
  height:14px;
  padding:0;
  margin:0;
  gap:3px;
  align-items:center;
  justify-content:flex-start;
  flex-wrap:nowrap;
  overflow:visible;
}
#drawPanel:not(.draw-unavailable) .draw-toolbar-main .recent-color-swatch,
#drawPanel:not(.draw-unavailable) .draw-toolbar-main .recent-color-empty-slot {
  box-sizing:border-box;
  display:block;
  width:14px;
  min-width:14px;
  height:14px;
  flex:0 0 14px;
  border-radius:50%;
  margin:0;
}
#drawPanel:not(.draw-unavailable) .draw-toolbar-main .recent-color-swatch {
  border:1px solid #9a8d9d;
  box-shadow:none;
}
#drawPanel:not(.draw-unavailable) .draw-toolbar-main .recent-color-empty-slot {
  border:1px solid #e5dfe5;
  background:rgba(153,143,153,.06);
}
html[data-theme="dark"] #drawPanel:not(.draw-unavailable) .draw-toolbar-main .recent-color-empty-slot {
  border-color:#4a4652;
  background:rgba(255,255,255,.045);
}
/* Active and completed states keep the identical geometry. */
.hero #drawPanel:not(.daily-finished):not(.locked-panel):not(.draw-unavailable) {
  background:#fffdfb;
  border-color:#e8e2e5;
  box-shadow:0 3px 13px rgba(33,28,37,.035);
}
/* Preserve the same slot width when the drawing tools become locked. */
#drawPanel.locked-panel .recent-colors {visibility:hidden!important}
.hero #drawPanel.locked-panel:not(.draw-unavailable) {
  display:grid!important;
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto;
}
#drawPanel.locked-panel:not(.daily-finished) {
  background:#eff0f2;
  border-color:#dfe2e6;
}
#drawPanel.locked-panel:not(.daily-finished) .drawing-tool,
#drawPanel.locked-panel:not(.daily-finished) .drawing-tool.active {
  background:#f2f3f5!important;
  color:#747c87!important;
  border-color:#d5d9df!important;
  box-shadow:none!important;
}
#drawPanel.locked-panel:not(.daily-finished) .draw-actions {opacity:.8}
#drawPanel.locked-panel :is(button,select,input):disabled {cursor:not-allowed}
#drawPanel.daily-finished .draw-actions {opacity:.92}
#drawPanel.daily-finished .draw-actions .native-paint-picker {opacity:.82}
#drawPanel.daily-finished .draw-complete-note {
  justify-content:flex-start;
  gap:7px;
  width:100%;
  margin:0;
}
#drawPanel.daily-finished .draw-complete-symbol {
  flex:0 0 24px;
  width:24px;
  height:24px;
  border-radius:8px;
}
#drawPanel.daily-finished .draw-complete-copy strong {
  font-size:12.5px;
  line-height:1.22;
}
#drawPanel.daily-finished .draw-complete-copy small {
  font-size:10.5px;
  line-height:1.35;
}
#drawPanel.daily-finished .draw-actions #clearDrawing {
  display:inline-flex!important;
  align-items:center;
  justify-content:center;
}
#drawPanel:not(.locked-panel):not(.draw-unavailable) .draw-actions .small-btn:not(.active):not(:disabled):hover {
  background:#faf7ff;
  border-color:#bfb3d5;
}
#drawPanel:not(.draw-unavailable) .draw-actions :is(button,select,input):focus-visible {
  outline:2px solid #a48fcf;
  outline-offset:2px;
}
html[data-theme="dark"] .hero #drawPanel:not(.daily-finished):not(.locked-panel):not(.draw-unavailable) {
  background:#292b32;
  border-color:#454652;
  box-shadow:none;
}
html[data-theme="dark"] #drawPanel:not(.daily-finished) #drawSafetyNote {color:#c29da5}
html[data-theme="dark"] #drawPanel.locked-panel:not(.daily-finished) {
  background:#292d35;
  border-color:#414952;
}
html[data-theme="dark"] #drawPanel.locked-panel:not(.daily-finished) .drawing-tool {
  background:#353941!important;
  color:#a9b1bd!important;
  border-color:#505864!important;
}
html[data-theme="dark"] #drawPanel:not(.locked-panel):not(.draw-unavailable) .draw-actions .small-btn:not(.active):not(:disabled):hover {
  background:#353341;
  border-color:#756784;
}
#playedPanel>a.small-btn {
  color:#592d88;
  font-weight:850;
  min-height:39px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}
#playedPanel .crilo-share-trigger {min-height:39px}
html[data-theme="dark"] #playedPanel>a.small-btn {color:#c7a9e9}

/* Laptop and narrower desktop windows: keep the copy to the LEFT.
   The old 840px breakpoint stacked the editor even when the tools fit. */
@media (min-width:781px) and (max-width:900px) {
  .hero #drawPanel:not(.draw-unavailable) {
    grid-template-columns:minmax(150px,175px) minmax(0,1fr);
    column-gap:8px!important;
  }
  #drawPanel:not(.draw-unavailable) .draw-toolbar-main {
    gap:2px;
    justify-content:flex-end;
  }
  #drawPanel:not(.draw-unavailable) .draw-tool-group {gap:2px}
  #drawPanel:not(.draw-unavailable) .draw-actions .small-btn {
    padding:5px 4px;
    font-size:10px;
  }
  #drawPanel:not(.draw-unavailable) .draw-actions #drawMode {
    flex:0 0 112px;
    width:112px;
    font-size:10px;
  }
  #drawPanel:not(.draw-unavailable) .draw-actions .native-paint-picker {
    padding:2px 3px;
  }
}
/* Stack only when the viewport truly cannot hold the two columns.
   At small sizes controls can wrap without being cut off. */
@media (max-width:780px) {
  .hero #drawPanel:not(.draw-unavailable) {
    grid-template-columns:minmax(0,1fr);
    grid-template-rows:auto auto;
    row-gap:6px!important;
  }
  .hero #drawPanel:not(.draw-unavailable)>div:first-child {
    grid-column:1;
    grid-row:1;
    width:100%;
    text-align:left;
  }
  .hero #drawPanel:not(.draw-unavailable)>.draw-actions {
    grid-column:1;
    grid-row:2;
    align-items:stretch;
    flex-wrap:nowrap;
  }
  #drawPanel:not(.draw-unavailable) .draw-toolbar-main {
    justify-content:flex-start;
    flex-wrap:wrap;
    gap:5px;
  }
}
@media (max-width:600px) {
  .hero #drawPanel:not(.draw-unavailable) {padding:8px 10px!important}
  #drawPanel:not(.draw-unavailable) .draw-actions #drawMode {
    font-size:16px;
    min-height:34px;
    width:155px;
    flex:0 0 155px;
  }
}
@media (max-width:400px) {
  #drawPanel:not(.draw-unavailable) .draw-actions .small-btn {
    font-size:10px;
    min-height:30px;
    padding:5px 4px;
  }
  #drawPanel:not(.draw-unavailable) .draw-tool-group {gap:3px}
}
