/* Off the Map (public/off-the-map.js). A sheet of map paper (or, in Place It, a blank map) beside the
   place's name and the drawing tools; then the real outline with everyone's laid over it, the Best
   Disaster cards and the winner. Every screen fits the window (style.css caps the match area):
   sheets are the largest squares that fit, and the vote's cards are sized to the space. */
.om { --om-red: #e0472a; display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; }
.om > * { flex: none; }
.om .gd-bar { flex-wrap: nowrap; margin-bottom: .85rem; }
.om .gd-bar .gd-hint { min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.om .gd-kicker.om-place-tag { background: #9ed65a; }

/* ---- The stage: the sheet, and beside it the prompt and tools. ---- */
.om-stage { display: flex; justify-content: center; gap: 1.3rem; flex: 0 1 auto; height: clamp(17rem, 62vh, 32rem); min-height: 0; }
.om-easel { display: grid; place-items: center; flex: 0 1 var(--sheet, 60%); min-width: 0; min-height: 0; padding: 4px 10px 10px 4px; }
.om-frame { position: relative; filter: drop-shadow(5px 5px 0 var(--gd-ink)); }
.om-sheet { display: block; width: 100%; height: 100%; overflow: hidden; user-select: none; -webkit-user-select: none; }
.om-input { cursor: crosshair; touch-action: none; }
.is-locked .om-input, .is-full .om-input { cursor: default; }
.om-paper { fill: #fffdf8; }
.om-grid { stroke: #1b114012; stroke-width: 2; }
.om-water { fill: #cfe8f3; }
.om-land { fill: #f3e8c9; stroke: #9c8a62; stroke-width: 1.5px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.om-lake { fill: #cfe8f3; stroke: #9c8a62; stroke-width: 1px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.om-border { fill: none; stroke: #7d6f52; stroke-width: 1.5px; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.om-edge { fill: none; stroke: var(--gd-ink); stroke-width: 3px; vector-effect: non-scaling-stroke; }
/* Your drawing as you make it. */
.om-mine polygon { fill: #ff7a5926; stroke: var(--om-red); stroke-width: 3.5px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.om-pen { fill: none; stroke: var(--om-red); stroke-width: 3.5px; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.om-closing { stroke: var(--om-red); stroke-width: 2px; stroke-dasharray: 4 5; opacity: .6; vector-effect: non-scaling-stroke; }
.is-locked .om-mine polygon { fill: #1b11401a; stroke: var(--gd-ink); }
/* The real outline, and everyone's laid over it. */
.om-real polygon { fill: #1b114026; stroke: var(--gd-ink); stroke-width: 3px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.om-real.is-faint polygon { fill: #1b114014; stroke: #1b114066; stroke-width: 2px; }
.om-theirs polygon { fill: none; stroke: var(--c, var(--om-red)); stroke-width: 3.5px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.om-theirs.is-mine polygon { stroke-width: 5px; }
.om-real, .om-theirs { opacity: 0; transition: opacity .45s ease-out; }
.om-real.is-in, .om-theirs.is-in { opacity: 1; }
.om-overlay .om-theirs polygon { filter: drop-shadow(0 0 1.5px #fffdf8); }

/* The side: the place, the tips and the tools. */
.om-side { display: flex; flex-direction: column; flex: 0 0 clamp(15rem, 30%, 21rem); gap: .7rem; min-width: 0; min-height: 0; }
.om-side > * { flex: none; }
.om-prompt {
  display: grid; justify-items: start; gap: .2rem; padding: .6rem .9rem .75rem; color: var(--gd-ink); background: var(--gd-paper);
  border: 3px solid var(--gd-ink); border-radius: 14px; box-shadow: 4px 4px 0 var(--gd-ink); rotate: -.8deg;
}
.om-prompt-label { color: var(--gd-muted); font: 800 .7rem/1.1 var(--font); letter-spacing: .08em; text-transform: uppercase; }
.om-prompt-name { max-width: 100%; font: 800 clamp(1.6rem, 3vw, 2.3rem)/1.2 var(--font); letter-spacing: -.03em; overflow-wrap: anywhere; }
.om-chip {
  padding: .08rem .5rem .12rem; background: #cfe8f3; border: 2px solid var(--gd-ink); border-radius: 999px;
  font: 800 .68rem/1.1 var(--font); letter-spacing: .07em; text-transform: uppercase;
}
.om-tip { margin: 0; color: var(--muted); font-weight: 650; }
.om-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.om .om-tool {
  min-height: 2.6rem; padding: .2rem .95rem; color: var(--gd-ink); background: var(--gd-paper); border: 2.5px solid var(--gd-ink);
  border-radius: 999px; box-shadow: 2px 2px 0 var(--gd-ink); font: 800 .92rem/1 var(--font);
}
.om .om-tool:disabled { opacity: .45; box-shadow: none; }
.om .om-lock { margin-left: auto; min-height: 2.9rem; padding-inline: 1.5rem; font-size: 1.02rem; }
.om-note { margin: 0; color: var(--muted); font-weight: 750; }
.om-note:empty { display: none; }
.om-credit { margin: auto 0 0; }

/* ---- Stage 2: the overlay's list. ---- */
.om-rows { display: grid; align-content: start; gap: .4rem; flex: 0 1 auto; min-height: 0; margin: 0; padding: 0 4px 4px 0; overflow: hidden; list-style: none; }
.om-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .5rem; min-width: 0; padding: .26rem .6rem .26rem .3rem;
  color: var(--gd-ink); background: var(--gd-paper); border: 2.5px solid var(--gd-ink); border-left: 7px solid var(--c); border-radius: 12px;
  box-shadow: 3px 3px 0 var(--gd-ink); opacity: 0; translate: 14px 0; transition: opacity .3s, translate .4s cubic-bezier(.2, 1.4, .4, 1);
}
.om-row.is-in { opacity: 1; translate: none; }
.om-row.is-mine { background: #fff1c9; }
.om-row .sb-face { width: 1.8rem; height: 1.8rem; border-width: 2px; font-size: .7rem; }
.om-row-text { display: grid; min-width: 0; }
.om-row-name, .om-row-match { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.om-row-name { font: 800 .95rem/1.15 var(--font); }
.om-row-match { color: var(--gd-muted); font-size: .78rem; font-weight: 700; }
.om-row-points { font: 800 1.05rem/1 var(--font); font-variant-numeric: tabular-nums; }
.om-empty { color: var(--muted); font-weight: 700; }
.om-many .om-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem .4rem; }
.om-many .om-row { gap: .35rem; padding-right: .4rem; }
.om-many .om-row .sb-face { width: 1.5rem; height: 1.5rem; }
.om-many .om-row-name { font-size: .84rem; }
.om-many .om-row-points { font-size: .9rem; }
.om-many .om-row-word { display: none; }
.om-overlay > .gd-you { margin-top: .7rem; opacity: 0; translate: 0 -6px; transition: opacity .4s, translate .4s; }
.om .gd-hint.om-score {
  flex: none; margin-left: auto; padding: .1rem .6rem .14rem; color: var(--gd-ink); background: #fffaf3; border: 2px solid var(--gd-ink);
  border-radius: 999px; font-weight: 800;
}
.om .gd-hint.om-score.good { background: #e8f8c8; }
@media (min-width: 46.01rem) { .om-overlay > .gd-you { display: none; } }
@media (max-width: 46rem) { .om .om-score { display: none; } }
.om-overlay.is-scored > .gd-you { opacity: 1; translate: none; }
.om-overlay > .gd-you:empty { display: none; }

/* ---- Stage 3: Best Disaster cards, sized to the space by the script. ---- */
.om-cards {
  display: grid; grid-template-columns: repeat(var(--cols, 4), var(--card, 8rem)); justify-content: center; align-content: center; gap: 10px;
  flex: 0 1 auto; height: clamp(16rem, 60vh, 31rem); min-height: 0; overflow: hidden;
}
.om-card {
  display: grid; gap: 4px; width: var(--card, 8rem); min-height: 0; margin: 0; padding: 0; color: inherit; background: none; border: 0; box-shadow: none;
  font: inherit; cursor: pointer;
}
.om-card .om-small { width: var(--card, 8rem); height: var(--card, 8rem); border-radius: 12px; transition: translate .2s, filter .2s; }
.om-card:not(:disabled):hover .om-small { translate: 0 -3px; filter: drop-shadow(4px 5px 0 var(--gd-ink)); }
.om-card-label { display: flex; align-items: baseline; justify-content: space-between; gap: .3rem; min-width: 0; height: 22px; font-weight: 800; }
.om-card-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text, inherit); font-size: .88rem; }
.om-card-name::before { content: ""; display: inline-block; width: .6rem; height: .6rem; margin-right: .3rem; background: var(--c); border: 2px solid var(--gd-ink); border-radius: 50%; }
.om-card-match { flex: none; color: var(--muted); font-size: .8rem; }
.om-cards.is-tight .om-card-match { display: none; }
.om-cards.is-tight .om-card-name { font-size: .8rem; }
.om-card:disabled { cursor: default; }
.om-card.is-mine { opacity: .55; }
.om-card.is-picked .om-small { outline: 4px solid var(--gd-butter); outline-offset: 2px; }
.om-vote > .om-note { margin-top: .6rem; text-align: center; }

/* ---- Stage 4: the Best Disaster. ---- */
.om-winners { display: flex; justify-content: center; align-items: center; gap: 24px; flex: 0 1 auto; height: clamp(16rem, 60vh, 31rem); min-height: 0; }
.om-winner { display: grid; justify-items: center; gap: .5rem; margin: 0; opacity: 0; scale: .85; transition: opacity .4s, scale .6s cubic-bezier(.2, 1.4, .4, 1); }
.is-in .om-winner { opacity: 1; scale: 1; }
.om-winner-frame { position: relative; filter: drop-shadow(5px 5px 0 var(--gd-ink)); }
.om-big { width: var(--card, 18rem); height: var(--card, 18rem); }
.om-ribbon {
  position: absolute; left: 50%; top: -.6rem; translate: -50% 0; padding: .2rem .8rem .26rem; color: var(--gd-ink); background: var(--gd-butter);
  border: 3px solid var(--gd-ink); border-radius: 9px; rotate: -4deg; white-space: nowrap; font: 800 .9rem/1.1 var(--font); letter-spacing: .06em; text-transform: uppercase;
}
.om-winner-caption { display: flex; align-items: center; gap: .5rem; font-weight: 750; }
.om-winner-caption strong { font: 800 1.1rem/1.1 var(--font); }
.om-winner-caption span:last-child { color: var(--muted); }
.om-winner-caption .sb-face { width: 2rem; height: 2rem; }

/* ---- Laptop heights. ---- */
@media (min-width: 46.01rem) and (max-height: 50rem) {
  .om .gd-bar { margin-bottom: .6rem; }
  .om-stage { height: clamp(15rem, 60vh, 28rem); gap: 1.1rem; }
  .om-side { gap: .55rem; }
  .om-cards, .om-winners { height: clamp(14rem, 58vh, 27rem); }
  .om-overlay > .gd-you { margin-top: .5rem; }
}
@media (min-width: 46.01rem) and (max-height: 38rem) {
  .om-stage { height: clamp(13rem, 58vh, 22rem); }
  .om-cards, .om-winners { height: clamp(12rem, 56vh, 21rem); }
  .om-tip, .om-credit { display: none; }
  .om-prompt { padding-block: .4rem .5rem; }
  .om-prompt-label { display: none; }
  .om-row { padding-block: .16rem; }
  .om-row .sb-face { width: 1.45rem; height: 1.45rem; }
  .om-row-match { display: none; }
}

/* ---- A phone (either way up): the round fills the screen. ---- */
@media (max-width: 46rem), (max-height: 30rem) {
  .om { flex: 1 1 0; }
  .om .gd-bar { margin-bottom: .5rem; }
  .om .gd-bar .gd-hint { font-size: .84rem; }
  .om-stage, .om-cards, .om-winners { flex: 1 1 0; height: auto; }
  .om-tip, .om-credit, .om-prompt-label { display: none; }
  .om .om-tool { min-height: 2.5rem; padding-inline: .8rem; font-size: .86rem; }
  .om .om-lock { min-height: 2.6rem; padding-inline: 1.1rem; font-size: .95rem; }
}
/* Upright: the name, the sheet, then the tools, in one column. */
@media (max-width: 46rem) and (min-height: 30.01rem) {
  .om-stage { flex-direction: column; gap: .5rem; }
  .om-side { display: contents; }
  .om-prompt { order: 1; grid-auto-flow: column; justify-content: start; align-items: center; gap: .6rem; padding: .35rem .75rem .45rem; rotate: 0deg; }
  .om-prompt-name { font-size: 1.5rem; }
  .om-easel { order: 2; flex: 1 1 0; padding: 3px 8px 8px 3px; }
  .om-tools { order: 3; flex-wrap: nowrap; }
  .om-note { order: 4; font-size: .86rem; text-align: center; }
  .om-rows { order: 3; display: flex; flex-wrap: wrap; gap: .3rem; overflow: visible; }
  .om-row { gap: .25rem; padding: .08rem .4rem .08rem .15rem; border-width: 2px; border-left-width: 5px; box-shadow: 2px 2px 0 var(--gd-ink); }
  .om-row .sb-face { width: 1.2rem; height: 1.2rem; border-width: 1.5px; }
  .om-row-text { display: flex; align-items: baseline; gap: .3rem; }
  .om-row-match { display: none; }
  .om-row-name { max-width: 4.6rem; font-size: .76rem; }
  .om-row-points { font-size: .78rem; }
  /* Your chip says your match, so the overlay's own line steps aside for the sheet. */
  .om-row.is-mine .om-row-match { display: inline; font-size: .72rem; }
  .om-row.is-mine .om-row-word { display: none; }
  .om-overlay > .gd-you { display: none; }
  .om-winner-caption { flex-wrap: wrap; justify-content: center; }
}
.om-sideways-only { display: none; }
/* Sideways: the sheet on the left, the rest beside it. */
@media (max-height: 30rem) {
  :is(.om-draw, .om-overlay) > .gd-bar { display: none; }
  .om .om-sideways-only { display: grid; }
  .om-vote > .om-note { margin-top: .3rem; }
  .om-stage { gap: .8rem; }
  .om-side { flex: 1 1 0; min-width: 13rem; gap: .45rem; }
  .om-easel { padding: 3px 8px 8px 3px; }
  .om-prompt { padding: .3rem .65rem .4rem; rotate: 0deg; }
  .om-prompt-name { font-size: 1.3rem; }
  .om-rows { grid-template-columns: repeat(auto-fill, minmax(7.4rem, 1fr)); gap: .3rem; }
  .om-row { padding: .08rem .4rem .08rem .15rem; gap: .3rem; border-width: 2px; border-left-width: 5px; box-shadow: 2px 2px 0 var(--gd-ink); }
  .om-row .sb-face { width: 1.2rem; height: 1.2rem; }
  .om-row-match { display: none; }
  .om-row-name { font-size: .8rem; }
  .om-row-points { font-size: .8rem; }
  .om-overlay > .gd-you { display: none; }
}
