/* Sharing: the picture preview, the Share button on Today's hero, the challenge banner and You vs friend. */

/* ---------- the picture preview (over everything, the dock included) ---------- */
.shx { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: max(12px, env(safe-area-inset-top, 0px)) 12px max(12px, env(safe-area-inset-bottom, 0px)); background: rgb(12 14 24 / .62); animation: shxin .18s both; }
html.shx-on, html.shx-on body { overflow: hidden; }
.shx-box { position: relative; width: min(100%, 440px); max-height: 100%; overflow: auto; overscroll-behavior: contain; display: grid; gap: 12px; justify-items: center; padding: 18px 16px 16px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 18px 50px rgb(0 0 0 / .3); }
.shx-box:focus { outline: none; }
.shx-box > .eyebrow { justify-self: start; padding-right: 48px; }
.shx-x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: color-mix(in srgb, var(--fg) 8%, transparent); color: var(--fg); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.shx-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; width: 100%; padding: 4px; border-radius: 999px; background: var(--sunk); }
.shx-seg button { min-height: 44px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-family: var(--font-ui); font-weight: 700; font-size: .95rem; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.shx-seg button small { font-weight: 500; font-size: .78rem; opacity: .8; }
.shx-seg button.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-1); }
.shx-prev { display: grid; place-items: center; width: 100%; height: min(52vh, 52dvh, 500px); min-height: 220px; border-radius: 14px; background: var(--sunk); overflow: hidden; }
.shx-prev { position: relative; }
.shx-prev img { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); object-fit: contain; display: block; filter: drop-shadow(0 4px 12px rgb(0 0 0 / .18)); }
.shx-prev.square { height: min(52vh, 52dvh, 400px); }
.shx-wait { color: var(--muted); font-family: var(--font-ui); }
.shx-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.shx-acts button { min-height: 48px; width: 100%; justify-self: stretch; justify-content: center; display: inline-flex; align-items: center; }
.shx-msg { margin: 0; min-height: 1.2em; text-align: center; }
@media (max-height: 640px) { .shx-prev { height: 44vh; min-height: 180px; } }
@keyframes shxin { from { opacity: 0; } }

/* ---------- Today: Share, over the painting, across from the streak ---------- */
.hero .hshare { position: absolute; top: 10px; left: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px 0 12px; border-radius: 999px; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--fg); font-family: var(--font-ui); font-weight: 700; font-size: .92rem; box-shadow: var(--shadow-1); }
.hero .hshare svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hero:not(:has(.art)) .hshare { position: static; justify-self: end; margin: 10px 10px 0 0; }

/* ---------- a game's result sheet: Share, Share image, Challenge a friend ---------- */
.gsheet .gshares { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(100%, 420px); justify-self: center; }
.gsheet .gshares.one { grid-template-columns: 1fr; width: min(100%, 300px); }
.gsheet .gshares .gshare { width: 100%; justify-self: stretch; }
.gsheet .gshares > button { justify-content: center; min-height: 50px; display: inline-flex; align-items: center; gap: 8px; }
.gsheet .gshares .ghost.big { font-weight: 700; font-size: 1rem; padding: 10px 12px; }
.gsheet .gshares .gchal { grid-column: 1 / -1; min-height: 46px; font-weight: 700; }
.game .gdone .gbtns > button { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 360px) { .gsheet .gshares { grid-template-columns: 1fr; } }

/* the challenge panel: an optional first name, then Send */
.chpanel { grid-column: 1 / -1; display: grid; gap: 6px; padding: 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); text-align: left; }
.chpanel label { font-family: var(--font-ui); font-weight: 700; font-size: .92rem; }
.chpanel .chrow { display: flex; gap: 8px; flex-wrap: wrap; }
.chpanel input { flex: 1 1 140px; min-width: 0; min-height: 46px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: inherit; font-family: var(--font-ui); font-size: 1rem; }
.chpanel .chrow .qnext { min-height: 46px; flex: 0 0 auto; }
.chpanel p { margin: 0; font-size: .85rem; }
.chpanel .sharebox { margin-top: 4px; }

/* the banner over a game opened from a friend's link */
.game .chbanner { display: flex; align-items: center; gap: 10px; margin: 4px 0 8px; padding: 8px 6px 8px 14px; border-radius: 14px; font-family: var(--font-ui); font-size: .95rem; line-height: 1.3;
  background: color-mix(in srgb, var(--gold-bright) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold-bright) 45%, var(--line)); color: var(--fg); }
.game .chbanner.old { background: var(--surface); border-color: var(--line); color: var(--muted); }
.game .chbanner > span:not(.chico) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.game .chbanner .chico { color: var(--gold); flex: none; display: grid; }
.game .chbanner .chico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.game .chbanner .chx { flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.4rem; cursor: pointer; }

/* You vs friend */
.vs { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: var(--bg); border: 1px solid var(--line); }
.vs .vsgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vs .vsc { display: grid; gap: 6px; justify-items: center; align-content: start; padding: 10px 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; text-align: center; font-family: var(--font-ui); }
.vs .vsc.lead { border-color: color-mix(in srgb, var(--gold-bright) 70%, var(--line)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--gold-bright) 40%, transparent); }
.vs .vsc b { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs .vsc > span { color: var(--muted); font-size: .9rem; }
.vs .vsv { margin: 0; text-align: center; font-family: var(--font-body); font-style: italic; }
.mgrid { display: grid; gap: 3px; justify-items: center; }
.mgrid .mrow { display: flex; gap: 3px; }
/* the same marks as the picture: filled (right), ringed (close), faint (missed); never colour alone */
.mgrid i { --a: var(--lapis); width: 16px; height: 16px; border-radius: 4px; display: grid; place-items: center; font-style: normal; font-size: 0; background: color-mix(in srgb, var(--fg) 10%, transparent); }
.mgrid i.hit { background: var(--a); }
.mgrid i.star { background: var(--gold-bright); }
.mgrid i.near { background: color-mix(in srgb, var(--a) 18%, var(--surface)); box-shadow: inset 0 0 0 2.5px var(--a); }
.mgrid i.low { background: color-mix(in srgb, var(--a) 22%, var(--surface)); }
.mgrid i.g1 { background: color-mix(in srgb, var(--a) 25%, var(--surface)); }
.mgrid i.g2 { background: color-mix(in srgb, var(--a) 50%, var(--surface)); }
.mgrid i.g3 { background: color-mix(in srgb, var(--a) 75%, var(--surface)); }
.mgrid i.g4 { background: var(--a); }
.mgrid i[class^="g"]::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: .7; box-shadow: var(--dots); }
.mgrid i.g1 { color: var(--fg); --dots: none; }
.mgrid i.g2 { color: var(--fg); --dots: -6px 0 0 currentColor; }
.mgrid i.g3 { color: var(--surface); --dots: -6px 0 0 currentColor, 6px 0 0 currentColor; }
.mgrid i.g4 { color: var(--surface); --dots: -5px -5px 0 currentColor, 5px -5px 0 currentColor, 0 5px 0 currentColor; }
.vs .mgrid i:has(+ i), .vs .mgrid i { flex: none; }
.vs .mgrid i { font-size: 0; }
.vs .mrow i.hit, .vs .mrow i.near, .vs .mrow i.low, .vs .mrow i.miss { font-size: 0; }
/* tap: the round's points are the result itself */
.vs .mgrid i:not(:empty) { width: auto; min-width: 38px; height: 22px; padding: 0 4px; font-size: .72rem; font-weight: 700; color: var(--fg); }
.vs .mgrid i.hit:not(:empty) { color: var(--surface); }

@media (prefers-reduced-motion: reduce) { .shx { animation: none; } }
