/* The workspace page, in OrbitX's colors: the blues of its mark, its navy wordmark.
   Colors are tokens: light below, dark when the system asks for it (unless the person
   chose light) or when they chose dark. The tiles stay white in both. */

:root {
  --bg-center: #ffffff;
  --bg-mid: #eef3fe;
  --bg-edge: #dce5fa;
  --orbit: rgba(20, 66, 225, 0.08);
  --text: #0e1240;
  --muted: #5a6389;
  --brand-text: #03008f;
  --surface: #ffffff;
  --surface-hover: #eef3fe;
  --border: rgba(14, 18, 64, 0.1);
  --accent: #1442e1;
  --accent-soft: rgba(20, 66, 225, 0.1);
  --tile-shadow: 0 2px 5px rgba(13, 35, 221, 0.06), 0 8px 22px rgba(13, 35, 221, 0.13), 0 20px 60px rgba(13, 35, 221, 0.09);
  --tile-shadow-hover: 0 4px 8px rgba(13, 35, 221, 0.1), 0 14px 30px rgba(13, 35, 221, 0.2), 0 28px 70px rgba(13, 35, 221, 0.15);
  --menu-shadow: 0 12px 40px rgba(14, 18, 64, 0.16);
  --danger: #c4314b;
  --veil: rgba(236, 242, 254, 0.58);
  --tabs-bg: rgba(255, 255, 255, 0.72);
  --code-bg: #f2f5fd;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-center: #0f2185;
    --bg-mid: #0a1248;
    --bg-edge: #04061a;
    --orbit: rgba(31, 187, 232, 0.08);
    --text: #ffffff;
    --muted: #a5b0d6;
    --brand-text: #ffffff;
    --surface: #0f1538;
    --surface-hover: #18215a;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3fb0f0;
    --accent-soft: rgba(63, 176, 240, 0.16);
    --menu-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
    --danger: #ff7a8f;
    --veil: rgba(4, 6, 26, 0.6);
    --tabs-bg: rgba(15, 21, 56, 0.62);
    --code-bg: #0a1034;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg-center: #0f2185;
  --bg-mid: #0a1248;
  --bg-edge: #04061a;
  --orbit: rgba(31, 187, 232, 0.08);
  --text: #ffffff;
  --muted: #a5b0d6;
  --brand-text: #ffffff;
  --surface: #0f1538;
  --surface-hover: #18215a;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #3fb0f0;
  --accent-soft: rgba(63, 176, 240, 0.16);
  --menu-shadow: 0 16px 48px rgba(0, 0, 0, 0.55);
  --danger: #ff7a8f;
  --veil: rgba(4, 6, 26, 0.6);
  --tabs-bg: rgba(15, 21, 56, 0.62);
  --code-bg: #0a1034;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

/* The scrollbar's place is kept whether it shows or not: locking the page behind an
   overlay (html.is-locked) then moves nothing sideways. */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font: 14px/20px "InterVariable", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg-edge);
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

/* An open fork or guide holds the page still behind it. */
html.is-locked { overflow: hidden; }

a { color: inherit; }

button { font: inherit; color: inherit; }

svg { flex-shrink: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ------------------------------------------------------------------ backdrop */
/* A glow in the middle, and two faint orbits around it. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 42%, var(--bg-center) 12%, var(--bg-mid) 38%, var(--bg-edge) 78%);
}
.backdrop::before,
.backdrop::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  border: 1px solid var(--orbit);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-14deg);
}
.backdrop::before { width: min(1040px, 140vw); height: min(380px, 56vw); }
.backdrop::after { width: min(780px, 110vw); height: min(270px, 40vw); transform: translate(-50%, -50%) rotate(10deg); }

/* -------------------------------------------------------------------- header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 40px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: 8px;
}
.brand-mark { width: 28px; height: 31px; }
.brand-name { font-size: 20px; line-height: 24px; font-weight: 700; letter-spacing: -0.015em; color: var(--brand-text); }

.topbar-end { display: flex; align-items: center; gap: 12px; }

.user { position: relative; }

.user-button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 4px; padding-inline: 12px 4px;
  border: 0;
  border-radius: 10px;
  background: none;
  cursor: pointer;
  text-align: end;
}
.user-button:hover { background: var(--accent-soft); }

.user-text { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-weight: 600; font-size: 13px; line-height: 16px; }
.user-email { color: var(--muted); font-size: 12px; line-height: 16px; }
.user-name, .user-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  /* The mark's own gradient, in both themes. */
  background: linear-gradient(135deg, #1442e1, #1d9be7);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar-lg { width: 40px; height: 40px; border-radius: 10px; font-size: 14px; }

.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--accent);
  cursor: pointer;
}
.icon-button:hover { background: var(--accent-soft); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.icon-button svg .fill { fill: currentColor; stroke: none; }

/* ----------------------------------------------------------------- languages */
.lang { position: relative; }
.lang-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.lang-button:hover { background: var(--accent-soft); border-color: transparent; }
.lang-button svg { width: 16px; height: 16px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.lang-menu { width: 200px; }
.lang-item { justify-content: space-between; }
.lang-check { color: var(--accent); font-weight: 700; visibility: hidden; }
.lang-item[aria-checked="true"] .lang-check { visibility: visible; }
.lang-item[aria-checked="true"] { font-weight: 600; }

/* Arabic: its own faces first, and no letter spacing, which would break its joined
   letters; no capitals either. */
:root:lang(ar) body { font-family: "Noto Sans Arabic", "Segoe UI", "Geeza Pro", "Arial", system-ui, sans-serif; }
:root:lang(ar) *:not(code):not(pre):not(.lang-code) { letter-spacing: 0 !important; }
:root:lang(ar) .fork-caption { text-transform: none; font-size: 13px; }
[dir="rtl"] { --dir: -1; }
/* Inline code keeps its own direction inside Arabic text, and a tile's detail (.odt) the
   direction of its first letter. */
.modal-body code { direction: ltr; unicode-bidi: isolate; }
.app-detail { unicode-bidi: plaintext; }

/* ---------------------------------------------------------------------- menu */
.menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  z-index: 10;
  width: 264px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--menu-shadow);
  animation: pop 0.14s ease-out;
}
.menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.menu-who { display: flex; flex-direction: column; min-width: 0; }
.menu-name { font-weight: 600; }
.menu-email { color: var(--muted); font-size: 12px; }
.menu-name, .menu-email { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-hover); }
.menu-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------------- stage */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  /* The spaces follow the window's height, so the page fits it. */
  padding: clamp(12px, 4vh, 48px) 16px clamp(8px, 2vh, 24px);
  /* Tiles slide in from the side (from-next): on a phone that would widen the page,
     and bringing a tab into sight would then scroll the page instead of the tab bar. */
  overflow-x: clip;
}

.welcome { text-align: center; margin-bottom: clamp(20px, 5vh, 52px); }
.welcome-title { margin: 0 0 8px; font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.015em; }
.welcome-tagline { margin: 0; color: var(--muted); font-size: 15px; }

.catalog {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(22px, 5vh, 44px);
  width: 100%;
}

/* The tab bar: a pill of glass, the chosen tab under a gradient highlight that slides
   to it (--x, --w: the tab's place and width, from workspace.js). A bar wider than the
   screen scrolls sideways. */
.tabs {
  position: relative;
  display: inline-flex;
  gap: 2px;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--tabs-bg);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 8px 30px rgba(13, 35, 221, 0.12);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs.fade-end { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 36px), transparent); }
.tabs.fade-start { -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px); mask-image: linear-gradient(90deg, transparent, #000 36px); }
.tabs.fade-start.fade-end {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 36px, #000 calc(100% - 36px), transparent);
}
[dir="rtl"] .tabs.fade-end { -webkit-mask-image: linear-gradient(270deg, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(270deg, #000 calc(100% - 36px), transparent); }
[dir="rtl"] .tabs.fade-start { -webkit-mask-image: linear-gradient(270deg, transparent, #000 36px); mask-image: linear-gradient(270deg, transparent, #000 36px); }

.tabs-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: var(--w, 0px);
  border-radius: 999px;
  background: linear-gradient(135deg, #1442e1, #1d9be7);
  box-shadow: 0 6px 18px rgba(20, 66, 225, 0.35);
  transform: translateX(var(--x, 0px));
  transition: transform 0.38s cubic-bezier(0.3, 0.8, 0.3, 1), width 0.38s cubic-bezier(0.3, 0.8, 0.3, 1);
}
/* In place at once on the first draw, without sliding there. */
.tabs-thumb.is-still { transition: none; }

.tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-block: 9px; padding-inline: 18px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: #ffffff; }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tab-count {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  transition: background 0.2s ease, color 0.2s ease;
}
.tab.is-active .tab-count { background: rgba(255, 255, 255, 0.24); color: #ffffff; }

.tab-panel { display: flex; justify-content: center; width: 100%; }

/* A new tab's tiles slide in from the side it is on. */
.apps.enter-next { animation: from-next 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.apps.enter-prev { animation: from-prev 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes from-next { from { opacity: 0; transform: translateX(calc(32px * var(--dir, 1))); } to { opacity: 1; transform: none; } }
@keyframes from-prev { from { opacity: 0; transform: translateX(calc(-32px * var(--dir, 1))); } to { opacity: 1; transform: none; } }

/* Five across at most, like a home screen. */
.apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, 120px);
  justify-content: center;
  gap: 32px;
  width: 100%;
  max-width: 728px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 4px 0;
  border: 0;
  border-radius: 16px;
  background: none;
  font: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  animation: rise 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.app-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: var(--icon, 72px);
  height: var(--icon, 72px);
  border-radius: 27%;
  background: linear-gradient(180deg, #ffffff, #d6e0f6);
  box-shadow: var(--tile-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* The face of the tile, one pixel inside its edge. */
.app-icon::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(109deg, rgba(31, 187, 232, 0.06), rgba(13, 35, 221, 0.06)), #ffffff;
}
.app-icon svg { position: relative; width: calc(var(--icon, 72px) * 0.61); height: calc(var(--icon, 72px) * 0.61); }

/* Two lines of a name about as long as each other: "Kerberos / sign-in", not "sign- / in". */
.app-name { font-size: 14px; line-height: 20px; text-align: center; max-width: 120px; overflow-wrap: break-word; text-wrap: balance; }
.app-detail { margin-top: -8px; color: var(--muted); font-size: 12px; line-height: 16px; text-align: center; max-width: 120px; }

/* A ribbon over the icon (badge): "Recommended". */
.app-ribbon {
  position: absolute;
  top: -11px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1442e1, #1d9be7);
  color: #ffffff;
  font-size: 10px;
  line-height: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(20, 66, 225, 0.35);
}

/* How many tiles a fork opens into. */
.app-badge {
  position: absolute;
  top: -6px;
  inset-inline-end: -6px;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 2px solid var(--bg-mid);
  border-radius: 11px;
  background: linear-gradient(135deg, #1442e1, #1d9be7);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.app:hover .app-icon,
.app:focus-visible .app-icon { transform: translateY(-3px); box-shadow: var(--tile-shadow-hover); }
.app:active .app-icon { transform: translateY(0) scale(0.97); }
.app:focus-visible { outline: none; }
.app:focus-visible .app-icon { outline: 2px solid var(--accent); outline-offset: 4px; }

/* ------------------------------------------------------- status and notices */
.status { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 18vh; color: var(--muted); }
.status-text { margin: 0; }

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  margin-top: 8px;
  text-align: center;
}
.notice-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
  border-radius: 27%;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
}
.notice-icon svg { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.notice.is-error .notice-icon svg { stroke: var(--danger); }
.notice-title { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; }
.notice-text { margin: 0 0 12px; color: var(--muted); }

/* -------------------------------------------------------------------- footer */
.foot { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px 16px clamp(14px, 3vh, 28px); }

.credit { margin: 0; color: var(--muted); font-size: 12px; line-height: 16px; letter-spacing: 0.01em; }
.credit strong { color: var(--text); font-weight: 600; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pill:hover { background: var(--accent-soft); border-color: transparent; }
.pill svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }

/* --------------------------------------------------------------------- forks */
/* The page blurs, the tile lifts to the middle, and its options fork out of it to their
   places (--sx, --sy: from the tile to the place; workspace.js sets them). */
.fork, .modal { position: fixed; inset: 0; z-index: 30; }

.fork-backdrop, .modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--veil);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  backdrop-filter: blur(14px) saturate(130%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.fork.is-open .fork-backdrop, .modal.is-open .modal-backdrop { opacity: 1; }

.fork-anchor, .fork-item {
  --icon: 72px;
  position: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 128px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  /* left and top are the icon's centre: the icon is the top 72px of the item. */
  transform: translate(-50%, -36px) translate(var(--sx, 0px), var(--sy, 0px));
}
.fork-anchor {
  /* Grows about its icon's centre, which left and top point at. */
  transform-origin: 50% 36px;
  transform: translate(-50%, -36px) translate(var(--sx, 0px), var(--sy, 0px)) scale(var(--ss, 1));
  transition: transform 0.42s cubic-bezier(0.3, 0.8, 0.3, 1);
}
.fork-item {
  opacity: 0;
  transform: translate(-50%, -36px) translate(var(--sx, 0px), var(--sy, 0px)) scale(0.3);
  transition:
    transform 0.5s cubic-bezier(0.2, 0.9, 0.25, 1.12) calc(70ms + var(--i, 0) * 34ms),
    opacity 0.3s ease calc(70ms + var(--i, 0) * 34ms);
}
.fork.is-open .fork-anchor { transform: translate(-50%, -36px); }
.fork.is-open .fork-item { opacity: 1; transform: translate(-50%, -36px); }
/* Closing folds them back into the tile, all at once. */
.fork:not(.is-open) .fork-item { transition-delay: 0s, 0s; transition-duration: 0.3s, 0.2s; }

.fork-lines { position: fixed; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.fork-lines path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-opacity: 0.35;
  stroke-dasharray: var(--len, 0);
  stroke-dashoffset: var(--len, 0);
  transition: stroke-dashoffset 0.5s cubic-bezier(0.3, 0.8, 0.3, 1) calc(90ms + var(--i, 0) * 34ms);
}
.fork.is-open .fork-lines path { stroke-dashoffset: 0; }
.fork:not(.is-open) .fork-lines path { transition-delay: 0s; transition-duration: 0.25s; }

.fork-anchor .app-icon { box-shadow: var(--tile-shadow-hover); }
.fork-item:hover .app-icon, .fork-item:focus-visible .app-icon { transform: translateY(-3px); box-shadow: var(--tile-shadow-hover); }
.fork-item:focus-visible, .fork-anchor:focus-visible { outline: none; }
.fork-item:focus-visible .app-icon, .fork-anchor:focus-visible .app-icon { outline: 2px solid var(--accent); outline-offset: 4px; }

.fork-caption {
  position: fixed;
  transform: translate(-50%, -100%);
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease 0.25s;
}
.fork.is-open .fork-caption { opacity: 1; }
.fork:not(.is-open) .fork-caption { transition-delay: 0s; }

.fork-close {
  position: fixed;
  top: 20px;
  inset-inline-end: 24px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--text);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.fork.is-open .fork-close { opacity: 1; }
.fork-close svg, .modal-close svg { stroke-linecap: round; stroke-width: 1.8; }

/* -------------------------------------------------------------------- guides */
.modal { display: grid; place-items: center; padding: 16px; }

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(660px, 100%);
  max-height: min(86vh, 780px);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--menu-shadow);
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  transition: opacity 0.26s ease, transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal.is-open .modal-panel { opacity: 1; transform: none; }

.modal-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-block: 16px; padding-inline: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 27%;
  background: #ffffff;
  box-shadow: var(--tile-shadow);
}
.modal-icon svg { width: 30px; height: 30px; }
.modal-title { flex: 1; margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; }

.modal-body { overflow: auto; padding: 18px 22px 22px; }
.modal-body > :first-child { margin-top: 0; }
.modal-body > :last-child { margin-bottom: 0; }
.modal-body h3 { margin: 22px 0 8px; font-size: 14px; line-height: 20px; font-weight: 600; }
.modal-body p { margin: 0 0 12px; }

.modal-body code {
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--code-bg);
  font: 0.92em/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}

.steps { margin: 0 0 14px; padding-inline-start: 22px; }
.steps li { margin: 0 0 8px; padding-inline-start: 4px; }
.steps li::marker { color: var(--accent); font-weight: 600; }

.code { position: relative; margin: 0 0 14px; direction: ltr; }
.code pre {
  margin: 0;
  padding: 12px 84px 12px 14px;
  direction: ltr;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code-bg);
  overflow-x: auto;
}
.code pre code { padding: 0; background: none; font-size: 13px; line-height: 20px; white-space: pre; overflow-wrap: normal; }
.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 12px;
  line-height: 16px;
  cursor: pointer;
}
.copy:hover { background: var(--surface-hover); }

.table-wrap { margin: 0 0 14px; overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 18px; }
.table-wrap th, .table-wrap td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: top; }
.table-wrap th { color: var(--muted); font-weight: 600; }

.note { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.guide-link { margin: 0 0 14px; }

/* ---------------------------------------------------------------- animation */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition: none !important; }
}

/* --------------------------------------------------------------------- small */
@media (max-width: 640px) {
  .topbar { padding: 14px 16px; }
  .topbar-end { gap: 8px; }
  .user-text { display: none; }
  /* The globe alone, like the theme's button: the header fits a 360px phone. */
  .lang-code { display: none; }
  .lang-button { width: 32px; padding: 0; justify-content: center; }
  .stage { padding-top: 24px; }
  .welcome { margin-bottom: 28px; }
  .welcome-title { font-size: 24px; line-height: 32px; }
  .apps { grid-template-columns: repeat(3, minmax(0, 96px)); gap: 24px 16px; }
  .app-name, .app-detail { max-width: 96px; }
  .catalog { gap: 24px; }
  .tabs { align-self: stretch; }
  .tab { padding-block: 8px; padding-inline: 14px 12px; font-size: 13px; }
  .fork-anchor, .fork-item { width: 100px; }
  .fork-item .app-name { font-size: 13px; line-height: 18px; }
  .fork-close { top: 12px; inset-inline-end: 12px; }
  .modal { padding: 10px; align-items: end; }
  .modal-panel { max-height: 90vh; border-radius: 18px; }
  .modal-body { padding: 16px; }
}