/* Globe Game — end-of-round result sheet + challenge banner (owner: Viral).
   Uses only theme variables from css/style.css so it follows light and dark themes. */

.challenge-banner {
  margin: 0 0 10px; padding: 9px 12px; border-radius: var(--radius-sm, 10px);
  background: var(--hover); border: 1px dashed var(--accent);
  font-size: .9rem; font-weight: 600; line-height: 1.35; color: var(--text);
}

dialog.result-modal { max-width: min(460px, calc(100vw - 24px)); }
/* No opacity fade (a half-transparent card shows the game through it in light theme) and no transform
   (it would shrink tap targets and boxes while animating): a clip-path reveal only. */
dialog.result-modal[open] { animation: sheetPop .2s ease; }
@keyframes sheetPop { from { clip-path: inset(3% 3% round 22px); } to { clip-path: inset(0 round 22px); } }
.result-card { padding: 20px 20px 18px; }
.result-kicker {
  margin: 0 0 4px; padding-right: 40px;
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--success);
}
.result-modal[data-outcome="lost"] .result-kicker { color: var(--danger); }
.result-card h2.result-title {
  display: flex; align-items: center; gap: 10px; margin: 0 0 4px; padding-right: 40px;
  font-size: 1.3rem; line-height: 1.25; letter-spacing: -0.01em;
}
.result-flag {
  flex: none; width: 34px; height: 24px; object-fit: cover; border-radius: 4px;
  box-shadow: 0 0 0 1px var(--panel-border);
}
.result-flag[hidden] { display: none; }
.result-sub { margin: 0 0 12px; color: var(--muted); font-size: .9rem; line-height: 1.4; }

.share-preview {
  margin: 0 0 12px; padding: 10px 12px; max-height: 9.5em; overflow: auto;
  border-radius: 12px; background: var(--field); border: 1px solid var(--field-border);
  font: 500 .86rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-word; color: var(--text);
}

.share-row { display: flex; gap: 8px; margin-bottom: 8px; }
.share-row .btn { flex: 1; height: 44px; justify-content: center; }
.share-row .btn[hidden] { display: none; }

.share-channels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 6px; }
.share-channels .ch {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; padding: 6px 2px; border-radius: 12px;
  background: var(--hover); border: 1px solid var(--panel-border);
  color: var(--text); text-decoration: none; font-size: 1.05rem; font-weight: 800; line-height: 1;
}
.share-channels .ch b { font-weight: 800; }
.share-channels .ch span { font-size: .66rem; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.share-channels .ch:hover, .share-channels .ch:focus-visible { border-color: var(--accent); }
.share-status { margin: 4px 0 8px; font-size: .85rem; font-weight: 600; color: var(--success); text-align: center; }
.share-status[hidden] { display: none; }

.challenge-box {
  display: flex; align-items: center; gap: 12px; margin: 10px 0 12px; padding: 10px 12px;
  border-radius: 14px; border: 1px dashed var(--accent); background: var(--hover);
}
.challenge-box[hidden] { display: none; }
.challenge-box > div { flex: 1; min-width: 0; }
.challenge-box b { display: block; font-size: .95rem; }
.challenge-box small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.challenge-box .btn { flex: none; height: 40px; padding: 0 14px; }

.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.result-stats > div { text-align: center; padding: 7px 0; border-radius: 10px; background: var(--hover); }
.result-stats b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.result-stats b i { font-style: normal; font-size: .9em; margin-left: 2px; }
.result-stats span { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.result-stats .sandbox-msg { grid-column: 1 / -1; margin: 0; font-size: .85rem; color: var(--muted); text-align: center; }

.result-dist { margin: 4px 0 10px; }
.result-dist[hidden] { display: none; }
.rd-title { margin: 0 0 4px; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.rd-row { display: grid; grid-template-columns: 38px 1fr; gap: 6px; align-items: center; margin: 2px 0; font-size: .74rem; }
.rd-row > span { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rd-row i {
  display: block; width: var(--w); min-width: 18px; height: 15px; border-radius: 4px;
  background: color-mix(in srgb, var(--muted) 45%, transparent); text-align: right; font-style: normal;
}
.rd-row i b { padding: 0 5px; font-size: .68rem; line-height: 15px; color: var(--text); }
.rd-row.hl i { background: var(--success); }
.rd-row.hl i b { color: var(--accent-ink); }

.comeback {
  margin: 10px 0 12px; padding: 12px; border-radius: 14px; text-align: center;
  background: var(--hover); border: 1px solid var(--panel-border);
}
.comeback[hidden] { display: none; }
.comeback-time { margin: 0; font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.comeback-streak { margin: 4px 0 8px; font-size: .88rem; color: var(--muted); }
.comeback-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.install-hint { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }
.install-hint[hidden] { display: none; }

.result-card .btn.small { height: 40px; min-width: 40px; padding: 0 12px; font-size: .84rem; }
.result-card .close-btn { width: 40px; height: 40px; }
.result-card .btn[hidden] { display: none; }
.result-next { display: flex; flex-direction: column; gap: 8px; }
.result-next .btn.wide { height: 46px; font-size: 1rem; justify-content: center; }
.cross-links { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.cross-links .btn[hidden] { display: none; }

/* Mobile: bottom sheet. Nothing is cut off: the sheet scrolls inside the dynamic viewport. */
@media (max-width: 600px) {
  dialog.result-modal {
    margin: auto 0 0; max-width: 100vw; width: 100vw;
    max-height: calc(100dvh - 16px);
  }
  dialog.result-modal[open] { animation: sheetUp .22s ease; }
  .result-card {
    border-radius: 22px 22px 0 0; border-bottom: 0;
    padding: 18px 16px max(16px, env(safe-area-inset-bottom));
  }
  .result-card::before {
    content: ''; display: block; width: 40px; height: 4px; margin: -8px auto 10px;
    border-radius: 2px; background: var(--panel-border);
  }
  .result-card h2.result-title { font-size: 1.18rem; }
  .share-channels { gap: 4px; }
  .share-channels .ch { min-height: 48px; }
  .result-card .btn.small { height: 44px; }
  .result-card .close-btn { width: 44px; height: 44px; }
  .challenge-box .btn { height: 44px; }
}
/* Reveals upward from the bottom edge via clip-path; layout boxes never move or shrink while animating. */
@keyframes sheetUp { from { clip-path: inset(8% 0 0 0 round 22px 22px 0 0); } to { clip-path: inset(0 round 22px 22px 0 0); } }
@media (prefers-reduced-motion: reduce) { dialog.result-modal[open] { animation: none; } }
