[hidden] {
  display: none !important;
}
.game-shell {
  --panel-height: 250px;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  height: calc(var(--base-height) + var(--share-height));
}
.game-shell[data-state="done"] {
  --share-height: var(--panel-height);
}
.share-panel {
  position: relative;
  min-height: var(--panel-height);
  height: auto;
  display: grid;
  grid-template-columns: 104px minmax(0, 620px);
  justify-content: center;
  gap: 16px 30px;
  align-items: center;
  padding: 30px 36px;
  background:
    radial-gradient(ellipse at 96% 0%, #c8d9ff66, transparent 48%),
    radial-gradient(ellipse at 0% 100%, #c9f36a40, transparent 45%), #f0f1e7;
  border-top: 1px solid #19231f12;
}
.share-panel img {
  grid-row: 1 / 3;
  display: block;
  width: 104px;
  height: 185px;
  object-fit: cover;
  border: 5px solid var(--paper);
  border-radius: 12px;
  box-shadow:
    5px 6px 0 #c8d9ff,
    0 12px 28px #19231f16;
}
.share-panel.share-placeholder {
  visibility: hidden;
  min-height: 0;
  pointer-events: none;
}
#share-dialog {
  color: var(--text);
  background: #fffdf7;
  border: 1px solid #19231f22;
  border-radius: 22px;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 30px;
  box-shadow: 0 24px 90px #19231f40;
  overflow: auto;
}
#share-dialog::backdrop {
  background: #19231f88;
  backdrop-filter: blur(5px);
}
#share-dialog h2 {
  font-size: 26px;
  max-width: 90%;
  margin: 0 0 12px;
}
#share-dialog p {
  font-size: 13px;
  line-height: 1.6;
}
.dialog-close {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 22px;
  padding: 5px 10px;
}
.challenge-text {
  background: #f6f5ee;
  border-radius: 12px;
  padding: 14px;
}
.share-destinations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.share-destinations a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px 8px;
  min-height: 48px;
  border: 1px solid #19231f24;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.share-destinations a:hover {
  background: #c8d9ff;
}
#share-dialog .instagram-note {
  font-size: 12px;
  color: var(--muted);
}
#copy-challenge {
  background: #c9f36a;
  width: 100%;
}
#challenge-link {
  display: block;
  margin-top: 12px;
  width: 100%;
  resize: none;
  padding: 10px;
  background: #f6f5ee;
  border: 1px solid #19231f22;
  border-radius: 8px;
  font: 12px/1.5 system-ui;
  color: inherit;
}
.share-panel img:not([src]) {
  visibility: hidden;
}
.share-copy h2 {
  font-family: inherit;
  font-size: clamp(23px, 2.3vw, 32px);
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.8px;
  max-width: 620px;
  text-wrap: balance;
}
.share-copy h2 strong {
  display: block;
  width: fit-content;
  margin-top: 12px;
  padding: 3px 9px 5px;
  background: var(--secondary);
  border-radius: 8px;
  font: inherit;
  font-size: 20px;
  letter-spacing: 0;
}
.share-copy #share-status:empty {
  display: none;
}
.share-copy p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}
.share-copy #share-status {
  font-size: 11px;
  margin-top: 6px;
  max-width: 650px;
}
#leaderboard-offer {
  position: absolute;
  inset: auto;
  top: 50%;
  left: 50%;
  z-index: 20;
  width: min(440px, calc(100% - 28px));
  max-height: calc(100% - 24px);
  margin: 0;
  padding: 26px;
  overflow-y: auto;
  transform: translate(-50%, -50%);
  border: 1px solid #19231f25;
  border-radius: 22px;
  background: var(--paper);
  color: var(--text);
  box-shadow: 0 24px 70px #19231f38;
}
#leaderboard-offer[open] {
  display: grid;
  gap: 12px;
}
#leaderboard-offer::backdrop {
  background: transparent;
}
.leaderboard-popup-close {
  position: absolute;
  top: 9px;
  right: 9px;
  min-width: 38px;
  min-height: 38px;
  padding: 4px;
  border: 0;
  background: transparent;
  font-size: 24px;
}
.leaderboard-message {
  margin: 0;
  padding-right: 24px;
  color: var(--text);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.45;
}
#leaderboard-name-form {
  display: grid;
  gap: 8px;
}
#leaderboard-name-form label {
  font-size: 12px;
  font-weight: 700;
}
.leaderboard-name-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
#leaderboard-name {
  flex: 1 1 150px;
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #19231f2b;
  border-radius: 11px;
  background: var(--paper);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.leaderboard-name-actions button {
  min-height: 42px;
  padding: 9px 12px;
  font-size: 12px;
}
.leaderboard-name-actions button[type="submit"] {
  background: var(--primary);
  border-color: var(--text);
}
#leaderboard-name-status {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.share-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  max-width: 100%;
}
#share-result {
  background: var(--primary);
  border: 1px solid var(--text);
  box-shadow: 3px 3px 0 var(--text);
}
#share-result:hover {
  background: #bce55d;
}
#share-result:active {
  box-shadow: 1px 1px 0 var(--text);
  transform: translate(2px, 2px);
}
.share-actions button {
  font-size: 14px;
  font-weight: 750;
  min-height: 48px;
  padding: 12px 21px;
  border-radius: 14px;
}
.game-shell:fullscreen,
.game-shell.expanded {
  height: 100dvh;
}
@media (min-width: 1700px) {
  .game-shell {
    --base-height: calc(100dvh - 270px);
  }
}
@media (max-width: 700px) {
  .game-shell {
    --base-height: clamp(430px, calc(100svh - 230px), 700px);
    --panel-height: 240px;
  }
  .share-panel {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 22px 20px;
    padding: 24px 20px;
  }
  .share-panel img {
    grid-row: 1;
    width: 76px;
    height: 135px;
    border-width: 4px;
    align-self: center;
  }
  .share-copy h2 {
    font-size: 23px;
    letter-spacing: -0.6px;
  }
  .share-copy p {
    font-size: 11px;
  }
  .share-copy #share-status {
    font-size: 10px;
    line-height: 1.45;
  }
  .share-actions {
    grid-column: 1 / -1;
    justify-content: center;
    gap: 12px;
  }
  .share-actions button {
    padding: 11px 16px;
    font-size: 13px;
  }
}
.game-shell:fullscreen .share-panel,
.game-shell.expanded .share-panel {
  min-height: 0;
  max-height: 42dvh;
  overflow-y: auto;
}
@media (max-height: 600px) {
  :fullscreen .share-panel,
  .expanded .share-panel {
    height: auto;
    min-height: 62px;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }
  :fullscreen .share-panel img,
  .expanded .share-panel img,
  :fullscreen .share-copy h2,
  .expanded .share-copy h2,
  :fullscreen .share-copy > p:not(#share-status),
  .expanded .share-copy > p:not(#share-status) {
    display: none;
  }
  :fullscreen .share-actions,
  .expanded .share-actions {
    flex-wrap: wrap;
  }
  :fullscreen .share-actions button,
  .expanded .share-actions button {
    white-space: nowrap;
  }
}

.best-mobile-label,
.quick-share-mobile {
  display: none;
}

.best-desktop-label,
.quick-share-desktop {
  display: inline;
}

#mobile-result-reaction {
  display: none;
}

.subtitle-mobile {
  display: none;
}

/* Mobile square game: give the drawing arena the space and attention. */
@media (max-width: 700px) {
  .site-game-content {
    padding: 10px 14px 0;
  }

  .heading {
    display: block;
    margin-bottom: 9px;
    padding: 0 2px;
  }

  .heading .eyebrow {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .heading h1 {
    max-width: 100%;
    font-size: clamp(25px, 7.6vw, 30px);
    line-height: 1.08;
    letter-spacing: -1.2px;
    text-wrap: balance;
  }

  .heading .title-dot {
    width: 8px;
    height: 8px;
    margin-left: 6px;
  }

  .heading .subtitle {
    max-width: none;
    margin-top: 5px;
    font-size: 13px;
    line-height: 1.4;
  }

  .heading .subtitle-desktop {
    display: none;
  }

  .heading .subtitle-mobile {
    display: block;
  }

  .game-shell {
    --panel-height: 220px;
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto auto auto;
    border-radius: 18px;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    row-gap: 0;
    min-height: 48px;
    padding: 5px 9px;
  }

  .toolbar::before {
    display: none;
    content: none;
  }

  .best {
    grid-column: 1;
    grid-row: 1;
    gap: 5px;
    font-size: 11px;
  }

  .best-desktop-label {
    display: none;
  }

  .best-mobile-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
  }

  .best-mobile-label > span {
    font-size: 12px;
  }

  .best strong {
    font-size: 13px;
  }

  .toolbar #fullscreen {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 8px;
    border-radius: 10px;
  }

  #fullscreen-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .toolbar .result-reaction {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .arena {
    width: auto;
    height: auto;
    min-height: min(86vw, 360px);
    aspect-ratio: 1 / 1;
    margin: 0 5px;
    border-radius: 13px;
    background-color: #f5f7ef;
    box-shadow: inset 0 0 0 1px rgba(25, 35, 31, .13);
  }

  .readout {
    width: min(calc(100% - 24px), 390px);
    height: 116px;
    overflow: visible;
    z-index: 2;
  }

  .game-shell[data-state="idle"] #score-label {
    bottom: calc(50% + 22px);
    font-size: 13px;
    letter-spacing: 0;
  }

  .game-shell[data-state="done"] #score {
    font-size: clamp(54px, 15vw, 62px);
    letter-spacing: -3px;
  }

  .game-shell[data-state="done"] #score-label {
    bottom: calc(50% + 43px);
    font-size: 8px;
  }

  .mobile-result-reaction {
    position: absolute;
    top: calc(50% + 43px);
    left: 50%;
    display: block;
    width: min(calc(100vw - 52px), 370px);
    transform: translateX(-50%);
    color: var(--text);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.32;
    text-align: center;
    text-wrap: balance;
  }

  .mobile-result-reaction[hidden],
  .game-shell:not([data-state="done"]) .mobile-result-reaction {
    display: none;
  }

  #mobile-result-reaction:not([hidden]) {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
    line-height: 1.32;
  }

  .game-shell:not([data-state="done"]) .game-bottom {
    display: none;
  }

  .game-shell[data-state="done"] .game-bottom {
    display: flex;
    min-height: 0;
    padding: 11px 10px;
    gap: 9px;
  }

  .game-shell[data-state="done"] #reset,
  .game-shell[data-state="done"] .quick-share {
    flex: 1 1 0;
    width: 50%;
    max-width: none;
    min-width: 0;
    min-height: 48px;
    padding: 10px 8px;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
  }

  .game-shell[data-state="done"] #reset {
    border-radius: 12px;
  }

  .quick-share-mobile {
    display: inline;
  }

  .quick-share-desktop {
    display: none;
  }

  .game-shell:fullscreen,
  .game-shell.expanded {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }

  .game-shell:fullscreen .arena,
  .game-shell.expanded .arena {
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
  }
}
@media (max-width: 900px) and (min-width: 701px) {
  .share-actions {
    max-width: 300px;
  }
  .game-shell {
    --panel-height: 250px;
  }
}

.score-distribution-mobile {
  display: none;
}

@media (max-width: 700px) {
  .score-distribution-scroll {
    display: none;
  }

  .score-distribution-mobile {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    gap: clamp(0px, .5vw, 3px);
    width: calc(100% + 16px);
    height: 158px;
    margin-inline: -8px;
    padding-top: 8px;
  }

  .square-guide-card { gap: 20px; padding: 18px; }
  .square-guide-intro h2 { font-size: 22px; }
  .square-guide-intro p { font-size: 13px; }
  .square-guide-steps { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .square-guide-steps li { padding: 12px 13px; }
  .square-guide-faq { padding-top: 18px; }
  .square-guide-faq-list { grid-template-columns: minmax(0, 1fr); }

  .distribution-mobile-column {
    display: grid;
    grid-template-rows: 16px minmax(0, 1fr) 20px;
    justify-items: center;
    min-width: 0;
  }

  .distribution-mobile-value {
    max-width: 100%;
    overflow: visible;
    color: var(--muted);
    font-size: clamp(7px, 2.25vw, 9px);
    font-variant-numeric: tabular-nums;
    line-height: 1;
    white-space: nowrap;
  }

  .distribution-mobile-track {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(to top,
      transparent 24.5%, #19231f14 25%, transparent 25.5%,
      transparent 49.5%, #19231f14 50%, transparent 50.5%,
      transparent 74.5%, #19231f14 75%, transparent 75.5%);
  }

  .distribution-mobile-bar {
    display: block;
    width: min(72%, 17px);
    height: var(--bar-height);
    border-radius: 4px 4px 0 0;
    background: var(--primary);
  }

  .distribution-mobile-bar.has-value {
    min-height: 2px;
  }

  .distribution-mobile-bar.distribution-bar-perfect {
    background: var(--accent);
  }

  .distribution-mobile-range {
    align-self: end;
    max-width: 100%;
    color: var(--muted);
    font-size: clamp(7px, 2.3vw, 9px);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.35px;
    line-height: 1;
    white-space: nowrap;
  }
}
