/* Soft cross-fade between pages (Chrome, Safari 18.2+; others just navigate). Off for reduced motion. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Components shared by every page (home and games). Game themes set the variables. */
/* buttons */
.btn { font: 700 1rem var(--font-body); border: 0; border-radius: 999px; padding: 9px 20px; color: #fff; background: var(--accent, #ff5d73); cursor: pointer;  }
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px currentColor; }
.btn:disabled { opacity: .6; cursor: wait; }

/* account dialog */
.auth-dialog { border: 0; border-radius: var(--radius); padding: 24px 28px; width: min(380px, 92vw); box-shadow: 0 20px 60px rgba(0,0,0,.35); font-family: var(--font-body); color: var(--ink); }
.auth-dialog::backdrop { background: rgba(30,20,60,.5); }
.auth-dialog h2 { font-family: var(--font-head); margin: 0 0 12px; }
.auth-dialog label { display: block; font-weight: 700; margin-bottom: 10px; }
.auth-dialog input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font: inherit; border: 2px solid #d9d2ea; border-radius: 12px; }
.auth-dialog input:focus { outline: 3px solid var(--accent-2); border-color: transparent; }
.auth-err { color: #c0213a; min-height: 1.2em; margin: 4px 0; font-weight: 700; }
.auth-actions { display: flex; gap: 10px; }
.auth-switch { margin: 14px 0 0; font-size: .9rem; }

/* challenge modal */
.bgc-modal { border: 0; padding: 0; border-radius: var(--radius, 16px); width: min(560px, 94vw); max-height: 90vh; overflow: auto;
  background: var(--surface, #fff); color: var(--ink, #2a2140); font-family: var(--font-body, inherit); box-shadow: 0 24px 70px rgba(0,0,0,.45); }
.bgc-modal::backdrop { background: rgba(10,10,20,.6); }
.bgc-modal[open] { display: block; }
.m-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px; background: var(--head-bg, var(--accent, #ff5d73)); color: var(--head-ink, #fff); }
.m-kicker { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.m-title { margin: 2px 0 0; font-family: var(--font-head, inherit); font-size: 1.5rem; line-height: 1.2; }
.m-close { border: 0; background: transparent; color: inherit; font-size: 2rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.m-body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.m-detail:empty { display: none; }
.m-extra { display: flex; flex-direction: column; gap: 12px; }
.m-extra[hidden], .m-hint[hidden] { display: none; }
.m-extra label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .9rem; }
.m-extra input, .m-extra textarea { font: 400 1rem var(--font-body, inherit); padding: 9px 12px; border: 2px solid var(--line, #d9d2ea); border-radius: 10px; background: #fff; color: #2a2140; }
.m-extra input[type=date] { align-self: flex-start; }
.m-extra textarea { resize: vertical; }
.m-foot { display: flex; align-items: center; gap: 14px; }
.m-foot[hidden], .m-where:empty { display: none; }
.m-saved { font-size: .85rem; color: var(--done, #43c59e); font-weight: 700; }
.m-hint, .m-where { margin: 0; font-size: .85rem; opacity: .7; }
.m-where { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.m-where p { margin: 0; }

/* session dialog: achievement checklist, delete button, links from a challenge to its sessions */
.s-pick { display: flex; flex-direction: column; gap: 10px; }
.s-group { margin: 0; padding: 8px 12px 10px; border: 2px solid var(--line, #d9d2ea); border-radius: 10px; }
.s-group legend { padding: 0 6px; font-weight: 700; font-size: .85rem; }
.s-item { display: flex; align-items: baseline; gap: 8px; padding: 4px 0; cursor: pointer; }
.s-item input { flex: none; width: 18px; height: 18px; accent-color: var(--done, #43c59e); }
.s-item small { margin-left: auto; padding-left: 8px; white-space: nowrap; opacity: .65; }
.m-delete { margin-left: auto; font: 700 .9rem var(--font-body, inherit); padding: 8px 16px; border-radius: 999px; cursor: pointer; border: 2px solid #c0213a; background: transparent; color: #c0213a; }
.m-delete[hidden] { display: none; }
.m-linked { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.m-linked li { display: flex; align-items: baseline; gap: 10px; }
.m-linked span { white-space: pre-wrap; }
.m-todo { margin: 0 0 12px; }
.m-note-view { margin: 0 0 14px; white-space: pre-wrap; }
.m-ach { margin: 6px 0 0; padding-left: 1.2em; }
.m-link { font: 700 .9rem var(--font-body, inherit); padding: 4px 12px; border-radius: 999px; cursor: pointer; border: 2px solid var(--done, #43c59e); background: transparent; color: inherit; }

/* photos */
.m-photos { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.m-photos[hidden], .m-add[hidden] { display: none; }
.m-label { font-weight: 700; font-size: .9rem; }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; width: 100%; }
.m-grid:empty { display: none; }
.m-grid figure { position: relative; margin: 0; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #0001; }
.m-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.m-rm { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0; }
.m-add { cursor: pointer; }
.m-add.busy { opacity: .6; pointer-events: none; }
.m-perr { margin: 0; color: #c0213a; font-weight: 700; font-size: .85rem; }
.m-perr:empty { display: none; }
.m-view { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }

/* photo lightbox */
.bgc-lightbox { border: 0; padding: 0; background: transparent; width: 100vw; height: 100vh; max-width: none; max-height: none; overflow: hidden; }
.bgc-lightbox[open] { display: flex; align-items: center; justify-content: center; }
.bgc-lightbox::backdrop { background: rgba(8, 8, 14, .92); }
.lb-img { max-width: min(92vw, 1400px); max-height: 86vh; object-fit: contain; border-radius: 10px; background: #000; }
.lb-close, .lb-nav { position: absolute; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; line-height: 1; padding: 0; }
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .3); }
.lb-close { top: 16px; right: 16px; width: 44px; height: 44px; font-size: 1.8rem; }
.lb-nav { top: 50%; width: 48px; height: 48px; margin-top: -24px; font-size: 2.2rem; padding-bottom: 4px; }
.lb-nav[hidden] { display: none; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-count { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #fff; font: 700 .9rem system-ui, sans-serif; opacity: .85; }
@media (max-width: 560px) { .lb-prev { left: 6px; } .lb-next { right: 6px; } }
