/* /play: the console's frame over the whole page, the account dialog over it, and on a
   desktop or a tablet (no SELECT button there) two small buttons in a corner. */

@font-face {
  font-family: "Instrument Sans";
  src: url(../engine/fonts/instrument-sans-latin.woff2) format("woff2");
  font-weight: 400 700; font-stretch: 75% 100%;
}

:root { --room: #08080c; color-scheme: dark; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--room); overscroll-behavior: none; transition: background 600ms ease; }
body { font-family: "Instrument Sans", system-ui, sans-serif; }

#console { position: fixed; inset: 0; width: 100%; height: 100dvh; border: 0; display: block; background: var(--room); }

.host-bar { position: fixed; bottom: max(10px, env(safe-area-inset-bottom)); left: 12px; display: none; gap: 8px; z-index: 2; }
.host-bar button {
  font: 600 13px/1 "Instrument Sans", system-ui, sans-serif; padding: 8px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .14); background: rgba(10, 9, 22, .55); color: #d8d4ff; backdrop-filter: blur(6px);
  opacity: .55; transition: opacity 160ms ease;
}
.host-bar button:hover, .host-bar button:focus-visible { opacity: 1; }
.host-bar button[hidden] { display: none; }
/* a phone has SELECT for the account; a desktop or a tablet has these */
@media (hover: hover) and (pointer: fine), (pointer: coarse) and (min-width: 600px) and (min-height: 600px) {
  .host-bar { display: flex; }
}

/* ---------- the account dialog (account.js) ---------- */

dialog.account {
  width: min(92vw, 380px);
  padding: 22px 22px 18px;
  border: 0;
  border-radius: 14px;
  background: #1c1940;
  color: #e8e6ff;
  font: 15px/1.45 'Instrument Sans', system-ui, sans-serif;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6), inset 0 0 0 1px #2e2a60;
}
dialog.account input { -webkit-user-select: text; user-select: text; }
dialog.account::backdrop { background: rgba(6, 5, 16, .72); }
dialog.account h2 { margin: 0 0 10px; font-size: 18px; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
dialog.account p { margin: 0 0 14px; color: #c8c4f0; }
dialog.account form { display: grid; gap: 12px; }
dialog.account label { display: grid; gap: 6px; font-size: 13px; color: #a8a4d8; }
dialog.account input {
  font: inherit; font-size: 17px; /* 16px or more: iOS does not zoom into the field */
  width: 100%; min-width: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid #3a3670; background: #121026; color: #fff;
}
dialog.account input:focus { outline: 2px solid #5fd0ff; outline-offset: 1px; }
dialog.account textarea, dialog.account select { font: inherit; font-size: 17px; width: 100%; min-width: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid #3a3670; background: #121026; color: #fff; resize: vertical; -webkit-user-select: text; user-select: text; }
dialog.account textarea:focus, dialog.account select:focus { outline: 2px solid #5fd0ff; outline-offset: 1px; }
dialog.account .account__code { font-size: 26px; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
dialog.account button {
  font: inherit; font-weight: 600; padding: 10px 14px; border-radius: 8px; border: 0;
  background: #5fd0ff; color: #0b0b20; cursor: pointer;
}
dialog.account button:disabled { opacity: .5; }
dialog.account .account__close {
  position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; padding: 0;
  background: none; color: #8a86c0; font-size: 24px; font-weight: 400; line-height: 1;
}
dialog.account .account__link { margin-top: 10px; background: none; color: #8a86c0; padding: 4px 0; font-weight: 400; text-decoration: underline; }
dialog.account .account__error { margin: 0; min-height: 1.2em; color: #ff7d8f; font-size: 13px; }
dialog.account h3 { margin: 16px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #8a86c0; }
dialog.account .account__muted { color: #8a86c0; font-size: 13px; }
dialog.account .account__saves { list-style: none; margin: 0 0 4px; padding: 0; max-height: 30vh; overflow-y: auto; }
dialog.account .account__saves li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #2e2a60; font-size: 14px; }
dialog.account .account__saves time { color: #8a86c0; font-variant-numeric: tabular-nums; white-space: nowrap; }
dialog.account .account__actions { display: grid; gap: 10px; margin-top: 18px; }
dialog.account .account__secondary { background: none; color: #5fd0ff; box-shadow: inset 0 0 0 1px #5fd0ff; }
dialog.account .account__notice { color: #7ee08a; font-size: 14px; }
dialog.account .account__patreon { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; padding: 11px 14px; border-radius: 8px; background: #ff424d; color: #fff; font-weight: 600; text-align: center; text-decoration: none; }
dialog.account .account__patreon-mark { display: inline-flex; width: 18px; height: 18px; }
dialog.account .account__patreon-mark svg { width: 100%; height: 100%; }
dialog.account .account__patreon:focus-visible { outline: 2px solid #5fd0ff; outline-offset: 2px; }
dialog.account .account__danger { background: none; color: #ff7d8f; box-shadow: inset 0 0 0 1px #ff7d8f; }
dialog.account form .account__danger { background: #ff5d73; color: #1a0610; box-shadow: none; }

/* ---------- the account as a menu (account.js, showAccount) ---------- */
dialog.account .who { display: flex; align-items: center; gap: 14px; margin: 4px 0 16px; }
.who__avatar { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(145deg, #5d58b8, #34307a); color: #fff; font-size: 21px; font-weight: 700; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12); }
.who__text { display: grid; gap: 2px; min-width: 0; }
.who__email { font-size: 16px; overflow-wrap: anywhere; }
.who__status { font-size: 13.5px; color: #a8a4d8; }
.who__status.is-good { color: #7ee08a; }
.who__status.is-bad { color: #ff7d8f; }
dialog.account .who__alert { margin: 0 0 12px; }
dialog.account .menu { display: grid; margin: 0 0 14px; border-radius: 12px; overflow: hidden; background: #24204e; box-shadow: inset 0 0 0 1px #2e2a60; }
dialog.account .menu__row { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; margin: 0; padding: 10px 16px;
  border: 0; border-radius: 0; background: none; box-shadow: none; color: #f0eeff; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
dialog.account .menu__row + .menu__row { box-shadow: inset 0 1px 0 #2e2a60; }
dialog.account .menu__row:hover, dialog.account .menu__row:focus-visible { background: rgba(255, 255, 255, .05); }
dialog.account .menu__row:active { background: rgba(255, 255, 255, .09); }
dialog.account .menu__row:disabled { opacity: .55; }
.menu__text { display: grid; gap: 1px; flex: 1; min-width: 0; }
.menu__label { font-size: 16px; font-weight: 600; }
.menu__sub { font-size: 13px; color: #a8a4d8; }
.menu__chev { flex: none; font-size: 24px; line-height: 1; color: #6f6ba3; }
dialog.account .menu__row.is-danger .menu__label { color: #ff7d8f; }
dialog.account > .account__patreon { margin: 0 0 14px; }

/* a phone: the dialog is a sheet from the bottom, as wide as the screen, within a thumb's reach */
@media (max-width: 600px) {
  dialog.account { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0; overflow-y: auto; }
  dialog.account::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 12px; border-radius: 2px; background: #3a3670; }
  dialog.account[open] { animation: sheet .22s ease-out; }
  @keyframes sheet { from { transform: translateY(40px); opacity: .4; } }
  dialog.account .account__close { top: 14px; }
}
@media (prefers-reduced-motion: reduce) { dialog.account[open] { animation: none; } }

/* the dialog itself takes the focus on opening: no ring around the whole sheet */
dialog.account:focus { outline: none; }
