/* The Match Coder app (coder.html, html.app-coder): its own bar with the app's name and icon, where the tags are
   kept and who is signed in, in place of the Hub's menus, rail and footer. The coder below it is the Hub's own */

html.app-coder .mainnav, html.app-coder .hnav, html.app-coder .hmenu, html.app-coder .rail, html.app-coder #provenance { display: none; }
html.app-coder .app { grid-template-columns: minmax(0, 1fr); }
html.app-coder .content { grid-column: 1; }

.app-bar { gap: 16px; height: 64px; }
.app-brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; font-size: 22px; white-space: nowrap; }
.app-icon { flex: none; width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.app-bar .actions { min-width: 0; }
.app-bar .pill svg, .app-card .pill svg, .app-dialog .pill svg { width: 14px; height: 14px; margin: -2px 6px -2px 0; vertical-align: middle; }
.app-install-btn[hidden] { display: none; }

/* where the tags are: a pill with a dot, green while all is well (and, with the server, sent to the Hub) */
.app-sync { display: inline-flex; align-items: center; gap: 7px; min-width: 0; padding: 7px 12px; border-radius: 999px; background: var(--head); color: var(--ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.app-sync::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--win); box-shadow: 0 0 0 3px color-mix(in srgb, var(--win) 22%, transparent); }
.app-sync:not([data-state="ok"])::before { background: var(--tbp); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tbp) 22%, transparent); }
.app-sync .short { display: none; }

/* the analyst signed in (filled once there are logins) */
.app-user { font-size: 12px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.app-user:empty { display: none; }

/* the match list: the save line on the left, its buttons on the right */
html.app-coder .coder-saveline { justify-content: flex-end; }
html.app-coder .coder-saveline .ok { margin-right: auto; }

/* the cards above the steps: the welcome (moving the tags from the browser) and installing the app */
#app-cards:empty { display: none; }
#app-cards { display: grid; gap: 10px; margin: 0 0 14px; }
.app-card { display: flex; align-items: center; gap: 16px; padding: 14px 18px 14px 14px; border-radius: var(--radius); background: var(--tile); }
.app-card img { flex: none; width: 56px; height: 56px; border-radius: 12px; }
.app-card-text { flex: 1 1 auto; min-width: 0; }
.app-card h3 { margin: 0 0 3px; font-size: 16px; font-weight: 800; font-style: italic; letter-spacing: -0.01em; }
.app-card p { margin: 0; color: var(--ink-2); font-size: 13px; text-wrap: pretty; }
.app-card-actions { display: flex; flex: none; align-items: center; gap: 10px; }
.app-card .pill, .app-dialog .pill { padding: 9px 16px; font-size: 13px; }
.pill.quiet { background: transparent; box-shadow: none; }
.pill.quiet:hover { background: var(--soft); }

/* the dialogs: the steps (numbers, a tick once done), the file picked and what it holds */
.import-dialog.app-dialog { background: var(--page); }
.app-dialog .title { font-size: 19px; }
.app-dialog .title:focus { outline: none; }
.app-dialog .import-form > p { color: var(--ink-2); }
.app-steps { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.app-steps-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.app-steps li { display: grid; grid-template-columns: 26px minmax(0, 1fr); align-items: start; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--card); font-size: 13px; }
.app-steps li > span { display: block; text-wrap: pretty; }
.app-steps li > span > .pill, .app-steps li > span > .app-error { display: flex; width: fit-content; margin-top: 10px; }
.app-steps li > span > .mac-menu { margin-top: 10px; }
.app-step-n { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 12px; font-weight: 800; }
.app-steps li.done .app-step-n { background: var(--lime); color: var(--on-lime); }
.app-key { display: inline-grid; place-items: center; width: 24px; height: 20px; margin: 0 2px; border-radius: 5px; background: var(--tile); vertical-align: middle; }
.app-key svg { width: 13px; height: 13px; }
.app-error { color: var(--red); font-style: normal; font-weight: 700; }
.app-file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--card); font-size: 13px; }
.app-file > svg { flex: none; width: 20px; height: 20px; color: var(--ink-2); }
.app-file > span:first-of-type { display: grid; min-width: 0; }
.app-file b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-file small { color: var(--ink-3); font-size: 11.5px; }
.app-file-n { margin-left: auto; color: var(--ink-2); white-space: nowrap; }
.app-table-wrap { max-height: 220px; overflow: auto; border-radius: var(--radius); background: var(--card); }
.app-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.app-table th { position: sticky; top: 0; padding: 8px 10px; background: var(--card); color: var(--ink-3); font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-align: left; text-transform: uppercase; }
.app-table td { padding: 7px 10px; border-top: 1px solid var(--line); }
.app-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.app-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--tile); color: var(--ink-2); font-size: 11px; font-style: normal; font-weight: 700; white-space: nowrap; }
.app-chip.new { background: var(--lime); color: var(--on-lime); }
.app-note { padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--red) 12%, var(--card)); font-size: 13px; }
.app-who { display: grid; gap: 6px; margin: 0; padding: 12px 14px; border: 0; border-radius: var(--radius); background: var(--card); font-size: 13px; }
.app-who legend { float: left; margin-bottom: 4px; font-weight: 700; }
.app-who label { display: flex; align-items: baseline; gap: 8px; }
.app-who small { color: var(--ink-3); }

/* Safari's File menu, drawn small, to show where Add to Dock is */
.mac-menu { display: grid; width: 220px; overflow: hidden; border-radius: 7px; background: var(--card); box-shadow: 0 0 0 1px var(--box-line), 0 6px 18px rgba(0, 0, 0, 0.12); font-size: 11.5px; }
.mac-menu i { font-style: normal; }
.mac-bar { display: flex; gap: 2px; padding: 4px 6px; background: var(--tile); font-weight: 700; }
.mac-bar i { padding: 1px 7px; border-radius: 4px; }
.mac-bar i.on { background: var(--box-line); }
.mac-items { display: grid; padding: 4px; }
.mac-items i { padding: 3px 8px; border-radius: 4px; }
.mac-items i.sep { height: 1px; margin: 3px 6px; padding: 0; background: var(--line); }
.mac-items i.pick { background: #2f7cf6; color: #fff; }

@media screen and (max-width: 760px) {
  html.app-coder .app-bar { height: 56px; margin: 0 -16px 12px; padding: 0 16px; gap: 10px; border-bottom: 1px solid var(--line); background: var(--card); }
  html.app-coder .topbar > .app-brand, html.app-coder .topbar > .actions { display: flex; }
  .app-brand { gap: 8px; font-size: 18px; }
  .app-icon { width: 28px; height: 28px; border-radius: 7px; }
  .app-bar .iconbtn, .app-bar .avatar { width: 34px; height: 34px; }
  .app-install-btn { display: none; }
  /* the pill shrinks to its dot; the words stay for screen readers and in its tooltip */
  .app-sync { padding: 9px; }
  .app-sync .long { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .app-card { flex-wrap: wrap; align-items: flex-start; gap: 10px 14px; padding: 14px; }
  .app-card img { width: 48px; height: 48px; border-radius: 10px; }
  .app-card-text { flex-basis: calc(100% - 62px); }
  .app-card-actions { width: 100%; }
  .app-steps-3 { grid-template-columns: minmax(0, 1fr); }
  .app-file { flex-wrap: wrap; }
  .app-file > span:first-of-type { flex: 1 1 calc(100% - 40px); }
  .app-file-n { margin-left: 32px; }
  /* the dialogs come up from the bottom, as a sheet */
  .app-dialog.app-sheet { width: 100%; max-width: none; max-height: calc(100dvh - 40px); margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .app-table th:nth-child(2), .app-table th:nth-child(3) { white-space: normal; }
}

/* ---------------------------------------------------------------- signing in, and who is signed in */

.app-user { display: inline-grid; line-height: 1.1; }
.app-user b { font-size: 12.5px; color: var(--ink); }
.app-user small { font-size: 10.5px; font-weight: 600; color: var(--ink-3); }
.app-gate { display: grid; place-items: center; min-height: calc(100vh - 140px); padding: 24px 0; }
.app-signin { display: grid; gap: 12px; width: min(380px, 100%); padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--card); }
.app-signin-head { display: flex; align-items: center; gap: 12px; }
.app-signin-head img { border-radius: 10px; }
.app-signin h2 { margin: 0; font-size: 20px; font-weight: 800; font-style: italic; }
.app-signin-head p { margin: 2px 0 0; color: var(--ink-3); font-size: 12px; }
.app-signin label { display: grid; gap: 5px; font-size: 12px; font-weight: 700; }
.app-signin .searchbox { width: 100%; padding: 10px 12px; background: var(--tile); font-size: 14px; }
.app-signin .app-keep { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.app-signin .pill.primary { padding: 11px; font-size: 13px; }
.app-signin .muted { margin: 0; text-align: center; color: var(--ink-3); }
.app-signin .pill.quiet { justify-self: center; font-size: 12px; }
.app-signin-error { margin: 0; color: var(--red); font-size: 12.5px; font-weight: 700; }
.app-signin-error:empty { display: none; }

/* ---------------------------------------------------------------- sending to the Hub */

.send-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.send-chip svg { width: 13px; height: 13px; }
.send-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tbp); }
.send-chip.waiting { background: color-mix(in srgb, var(--tbp) 14%, var(--card)); color: var(--tbp); }
.send-chip.sending { background: var(--tile); color: var(--ink-2); }
.send-chip.sent { background: color-mix(in srgb, var(--win) 16%, var(--card)); color: var(--live); }
.send-chip.failed { background: color-mix(in srgb, var(--red) 13%, var(--card)); color: var(--red); }
.send-chip.final { background: var(--ink); color: var(--ink-accent); }
.send-chip .spin { width: 10px; height: 10px; border: 2px solid var(--box-line); border-top-color: var(--ink-2); border-radius: 50%; animation: send-spin 0.8s linear infinite; }
@keyframes send-spin { to { transform: rotate(360deg); } }
.send-slot { display: inline-flex; align-items: center; gap: 6px; }
html.app-coder .coder-head .saved:has(+ .send-slot .send-menu) { display: none; }
.send-menu > summary { list-style: none; cursor: pointer; }
.send-menu > summary::-webkit-details-marker { display: none; }
.send-body { width: 300px; }
.send-body p { margin: 0; font-size: 12.5px; color: var(--ink-2); text-wrap: pretty; }
.send-title { font-size: 14px; }
.send-why { color: var(--tbp) !important; }
.send-why.bad { color: var(--red) !important; }
.send-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.send-body .pill, .send-slot > .pill { display: inline-flex; align-items: center; }
.send-slot .pill svg, .send-body .pill svg, .send-dialog .pill svg { width: 13px; height: 13px; margin-right: 5px; }
.pill.danger-fill { background: var(--red); color: #fff; }
.pill.dark { background: var(--ink); color: var(--on-ink); }
.send-doubles { color: var(--red); }
.app-send-all[hidden] { display: none; }
.send-dialog ul { margin: 0; padding-left: 20px; font-size: 13px; }
.send-note { padding: 10px 14px; border-radius: var(--radius); background: color-mix(in srgb, var(--red) 10%, var(--card)); }
.send-error { color: var(--red); font-weight: 700; }
.send-error:empty { display: none; }
.send-taggers { display: grid; gap: 8px; padding: 12px 14px !important; border-radius: var(--radius); background: var(--card); list-style: none; }
.send-taggers li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.send-taggers small { color: var(--ink-3); }
.send-doubles-list { display: grid; gap: 8px; padding: 0 !important; list-style: none; }
.send-doubles-list li { display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: var(--card); font-size: 12.5px; }
.send-doubles-list small { color: var(--ink-3); }
.send-dbl-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.send-dbl-acts .pill { background: var(--tile); }

/* the events: who tagged each row (two taggers on a match) and the possible doubles */
.who { display: inline-grid; place-items: center; flex: none; width: 18px; height: 18px; margin-right: 5px; border-radius: 50%; background: var(--ink); color: var(--on-ink); font-size: 8.5px; font-style: normal; font-weight: 800; vertical-align: middle; }
.who.w1 { background: var(--purple); color: #fff; }
.who.w2 { background: var(--tbp); color: #fff; }
.who.w3 { background: var(--live); color: #fff; }
.send-taggers .who { width: 30px; height: 30px; margin: 0; font-size: 11px; }
.dbl-badge { display: inline-block; margin-right: 5px; padding: 0 5px; border-radius: 4px; background: var(--red); color: #fff; font-size: 9px; font-style: normal; font-weight: 800; vertical-align: middle; }
.ev-table tr.is-double td { background: color-mix(in srgb, var(--red) 9%, transparent); }

@media screen and (max-width: 760px) {
  .app-user { display: none; }
  /* the match list on a phone: the send state on a line of its own under the teams */
  html.app-coder .coder-row .fixture-venue { display: block; grid-column: 1 / -1; padding-left: 58px; }
  .send-body { width: min(300px, calc(100vw - 40px)); }
}

/* ---------------------------------------------------------------- the launch screen */

/* The app's own screen after Android's lime one (js/launch.js sets html.launching, from the first paint, when the app is
   opened as an installed app; the markup is hidden until then). The PSA is centred on the screen and as wide as Android
   draws it: 200 px, or 48.7% of a narrow screen (--w). The name is as wide, under it: Barlow ExtraBold capitals, 22 px
   with 0.28em spacing, the capitals starting 24 px below the PSA. On a narrow screen both keep these proportions, so
   sizes and offsets are shares of --w (as at 200 px: the PSA's box is 36 px high, 0.18, with the PSA centred in it;
   the name's line starts 0.1885 below the middle and its size is 0.11). No scrollbar shows while it is up: the page's
   gutter (styles.css) is lime */
html.launching { background: var(--lime); overflow: hidden; }
html.launching .launch { --w: min(200px, 48.7vw); position: fixed; inset: 0; z-index: 100; display: block; background: var(--lime); color: var(--on-lime); transition: opacity 0.25s ease; }
html.launching .launch.leaving { opacity: 0; pointer-events: none; }
.launch-psa { position: absolute; left: calc(50vw - var(--w) / 2); top: calc(50% - var(--w) * 0.09); display: block; width: var(--w); height: calc(var(--w) * 0.18); overflow: visible; fill: currentColor; stroke: none; }
/* the padding takes back the space the last letter carries, so the name sits centred under the PSA */
.launch-name { position: absolute; left: 0; top: calc(50% + var(--w) * 0.1885); width: 100vw; padding-left: 0.28em; font-size: calc(var(--w) * 0.11); line-height: 1; font-weight: 800; letter-spacing: 0.28em; text-align: center; text-transform: uppercase; white-space: nowrap; }
