/* THE DASHBOARD: the launcher's cards in the brand look (Figma "App – Dashboard
   (Desktop 1440)", file uZpMgPTPMLayr8Ut9jablT). Tokens, the text styles, the
   notebook background, the icon buttons, tags, the card and the footer are
   web/shared/ (loaded before style.css); the App Header and the app's footer
   are style.css, shared with Edit. This file is only the dashboard's own
   layout, scoped to `body.dashboard:not(.world)` where an open app could
   inherit it. */

/* THE PAGE: the notebook (index.html gives #launcher `.notebook`) from the top
   of the screen to its bottom, the footer last. */
body.dashboard:not(.world) #launcher { display: flex; flex-direction: column; min-height: 100dvh; }

/* THE ACCOUNT MENU: the round button and its panel; `.account` only holds it
   or the Log in button (app/account-menu.mjs). Edit's bar shows the same. */
.account { display: contents; }
.menu-pop { position: relative; }
.menu-pop > summary { list-style: none; cursor: pointer; }
.menu-pop > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 0.5rem); z-index: 5; display: flex; flex-direction: column; min-width: 12.5rem; padding: 0.5rem; background: var(--background); border: var(--line) solid var(--primary); border-radius: 1rem; box-shadow: var(--shadow); }
.menu-panel :is(a, button) { display: block; width: 100%; padding: 0.75rem 0.875rem; border: 0; border-radius: 0.625rem; background: none; color: var(--primary); font: 500 var(--size-body)/1 var(--font); text-align: left; text-decoration: none; cursor: pointer; }
.menu-panel :is(a, button):hover { background: var(--border); }
.menu-panel [hidden] { display: none; }
/* Nothing to open: logged out with the gate closed, every entry (Settings, Log out, the page's own) is hidden (account-menu.mjs). */
.menu-pop:not(:has(.menu-panel > :not([hidden]))) { display: none; }

/* THE TITLE ROW: "YOUR GAMES" over "Dashboard" (the H2 text style) and the
   filters (shared `.tag` buttons, app/app-filter.mjs), the round Sync,
   Import and New app buttons at the right, on the filters' baseline. */
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding-block: 1.875rem 2.5rem; }
.title-row .heading { display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.title-row .kicker { margin: 0; opacity: 0.7; text-transform: uppercase; }
.title-row h1 { margin: 0; }
.title-row .filters { display: flex; flex-wrap: wrap; gap: 0.5rem; padding-top: 0.75rem; }
/* `.tag` sets display, which would show a filter the page does not offer. */
.title-row .filters .tag[hidden] { display: none; }
.title-actions { display: flex; align-items: center; gap: 0.75rem; }
/* `.icon-button` sets display, which would show a button the page hides. */
.icon-button[hidden] { display: none; }
/* The sync runs: the control spins and waits (a run says nothing when it ends). */
#sync-now[aria-busy="true"] { cursor: progress; opacity: 0.6; }
#sync-now[aria-busy="true"] .glyph { animation: sync-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { #sync-now[aria-busy="true"] .glyph { animation: none; } }
.title-actions .sync-status-text { white-space: normal; max-width: 32ch; }

/* THE LOGGED-OUT CARD: a `.card` above the apps; `hidden` must win over `.card`'s
   own display where one is set, and the card's gap to the grid is the grid's. */
#logged-out { display: flex; flex-direction: column; align-items: flex-start; gap: 0.75rem; margin: 0 0 1.25rem; padding: 1.5rem; }
#logged-out[hidden] { display: none; }
#logged-out :is(h2, p) { margin: 0; }
#logged-out h2 { font: 500 var(--size-lead)/1.12 var(--font); letter-spacing: -0.03em; }
#logged-out p { font: 500 var(--size-body)/1.4 var(--font); }

/* THE CARDS: a grid of App Cards, every row as tall as the tallest card, so
   the cards line up. A column is at least a fifth of the window (260px on a
   small one), so a wide screen shows bigger cards, not more of them: four
   columns at the design's 1440px; one on a phone (`min(100%, …)`). */
body.dashboard:not(.world) main.launcher { flex: 1; }
#worlds {
  list-style: none; margin: 0; padding: 0 0 1.875rem; display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(16.25rem, 20vw)), 1fr)); grid-auto-rows: 1fr;
}
/* THE APP CARD (Figma "App Card"): the shared `.game` card, 480px high in the
   design, its picture 200px. */
.tile.game { position: relative; min-width: 0; min-height: 30rem; }
/* `.game`'s `display: flex` outranks the browser's own `[hidden]` rule: a card
   the chosen filter leaves out, or a hidden app (sync-run.mjs `isHidden`),
   would still show (launcher.mjs `markTiles`). */
.tile.game[hidden] { display: none; }
.tile.game:not(.skeleton) { cursor: pointer; }
.tile .thumb-link { display: block; flex: none; height: 12.5rem; overflow: hidden; background: var(--secondary); color: var(--primary); text-decoration: none; }
.tile img.preview { display: block; width: 100%; height: 100%; object-fit: cover; }
/* No picture yet: the design's "( )" on Secondary, in the H2 text style (launcher.mjs). */
.tile .thumb-empty { display: flex; align-items: center; justify-content: center; height: 100%; }
.tile .thumb-empty::before { content: "( )"; }
/* The body: its tags (the Status Tag, Not in your account yet), the name (H3)
   and where it opens, close together; the round buttons at the card's foot.
   A long name or line ends in "…" after two lines. */
.tile .body { flex: 1; gap: 0.25rem; min-width: 0; }
.tile .tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.tile .tags:not(:empty) { margin-bottom: 0.375rem; }
.tile .tags .tag { margin: 0; }
.tile a.open, .tile .meta {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  margin: 0; overflow-wrap: anywhere;
}
.tile a.open { flex: none; color: var(--primary); text-decoration: none; }
.tile a.open:hover { text-decoration: underline; text-underline-offset: 0.12em; }
.tile .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: auto; padding-top: 1rem; }
/* The app syncing now spins in its card's top left (the "…" holds the right). */
.tile[data-syncing]::after { content: ""; position: absolute; top: 0.75rem; left: 0.75rem; width: 1.125rem; height: 1.125rem; border: 0.125rem solid var(--primary); border-top-color: transparent; border-radius: 50%; background: var(--background); animation: sync-spin 1s linear infinite; }
@media (prefers-reduced-motion: reduce) { .tile[data-syncing]::after { animation: none; } }

/* The skeleton: the cards' own shape (picture, title, line, three round
   buttons) in the quiet fill, a light sweeping over it, until the first
   listing arrives. */
.tile.skeleton { pointer-events: none; }
.tile.skeleton .sk { border-radius: 0.5rem; background: linear-gradient(90deg, var(--border) 30%, color-mix(in srgb, var(--white) 50%, transparent) 50%, var(--border) 70%) 0 0 / 220% 100%; animation: sk-sweep 1.4s linear infinite; }
.tile.skeleton .sk.thumb { flex: none; height: 12.5rem; border-radius: 0; }
.tile.skeleton .sk.title-line { height: 2.125rem; width: 60%; }
.tile.skeleton .sk.meta-line { height: 1rem; width: 38%; margin-top: 0.25rem; }
.tile.skeleton .sk.pill { width: 2.75rem; height: 2.75rem; border-radius: 62.4375rem; }
@keyframes sk-sweep { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .tile.skeleton .sk { animation: none; } }

/* The "…" sits at the card's top right, over the picture, on the page's own
   colour so it reads on any picture; its menu opens downward, inside the card. */
.tile > .more { position: absolute; top: 0.6875rem; right: 0.6875rem; z-index: 3; }
.more > summary { list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.tile .more[open] > summary { background: var(--border); }
.more-menu { position: absolute; right: 0; top: calc(100% + 0.375rem); z-index: 4; display: flex; flex-direction: column; min-width: 10rem; padding: 0.375rem; background: var(--background); border: var(--line) solid var(--primary); border-radius: 1rem; box-shadow: var(--shadow); }
.more-menu button { padding: 0.625rem 0.75rem; border: 0; border-radius: 0.625rem; background: none; color: var(--primary); font: 500 var(--size-body)/1 var(--font); text-align: left; cursor: pointer; }
.more-menu button:hover { background: var(--border); border: 0; }
.more-menu button.danger { color: var(--danger); }

/* Notices, on the page */
body.dashboard:not(.world) .notice { color: var(--primary); }
body.dashboard:not(.world) .error { color: var(--danger); }

body.dashboard:not(.world) :is(.button, .icon-button, summary):focus-visible,
body.dashboard:not(.world) :is(.tile a.open, .menu-panel :is(a, button), .more-menu button):focus-visible { outline: 0.125rem solid var(--primary); outline-offset: 0.1875rem; }

/* THE SETTINGS DIALOG (index.html, app/settings-dialog.mjs): over the
   dashboard and an open app alike, so nothing here is scoped to the page; its
   form is the shared `.brand-form` (web/shared/forms.css). Taller than the
   window, it scrolls inside, its heading staying on top. */
dialog.settings-dialog { width: calc(100% - 2rem); max-width: 40rem; max-height: calc(100dvh - 2rem); padding: 0 1.5rem 1.5rem; overflow: auto; background: var(--page); color: var(--primary); font-family: var(--font); border: var(--card-border) solid var(--primary); border-radius: var(--radius); }
dialog.settings-dialog::backdrop { background: var(--scrim); }
.settings-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 0 -1.5rem 0.5rem; padding: 1.25rem 1.5rem 0.75rem; background: var(--page); }
.settings-head h2 { margin: 0; font: 500 var(--size-lead)/1.12 var(--font); letter-spacing: -0.03em; }
.settings-head-actions { display: flex; align-items: center; gap: 0.75rem; }
.settings-head #save-state { font: 500 var(--size-body)/1 var(--font); }
.settings-head .button:focus-visible { outline: 0.125rem solid var(--primary); outline-offset: 0.1875rem; }
.settings-head .icon-button { font: 500 var(--size-lead)/1 var(--font); }
.settings-head .icon-button:focus-visible { outline: 0.125rem solid var(--primary); outline-offset: 0.1875rem; }
dialog.settings-dialog :is(.notice, .status) { color: var(--primary); }
dialog.settings-dialog .error { color: var(--danger); }

/* A PHONE */
@media (max-width: 600px) {
  dialog.settings-dialog { padding: 0 1rem 1rem; }
  .settings-head { margin-inline: -1rem; padding-inline: 1rem; }
  .settings-head-actions { gap: 0.5rem; }
  /* "Dashboard" beside the two or three round buttons does not fit a phone,
     so the buttons wrap onto a line of their own, left under it, instead of
     sliding over it (the heading takes the whole line). */
  .title-row { flex-wrap: wrap; padding-block: 1.5rem 1.75rem; }
  .title-row .heading { flex-basis: 100%; }
  /* The sync status line goes under the buttons: before them, its changing
     words ("Syncing…", "Synced 16:33", a reason) would move them each run. */
  .title-actions { flex-wrap: wrap; }
  .title-actions .sync-status { order: 1; flex-basis: 100%; }
  #worlds { gap: 1rem; }
  /* One column: a card is as tall as its content, not the desktop's 480px. */
  .tile.game { min-height: 0; }
}

/* THE REPORT DIALOG (report-flow.mjs): the reasons as one radio group, the note, and what is sent. */
#report-reasons { margin: 0 0 0.75rem; padding: 0; border: 0; }
#report-reasons label { align-items: center; margin: 0; padding: 0.375rem 0; }
#report-reasons input { margin: 0; }
#report-note { display: block; box-sizing: border-box; width: 100%; margin: 0.375rem 0 0.875rem; padding: 0.75rem 1.125rem; border: var(--line) solid var(--primary); border-radius: 1.25rem; background: var(--white); color: var(--primary); font: 500 var(--size-body)/1.3 var(--font); resize: vertical; }
#report-statement { color: var(--muted); }
