/* Shared phone viewport and quiet, theme-aware backdrop for Flutter and public pages. */
:root {
  color-scheme: dark;
  --shell-paper: #000;
  --shell-ink: #f1f0eb;
  --shell-muted: #a2a39c;
  --shell-border: #393a37;
  --shell-backdrop: #141513;
  --shell-pattern-filter: invert(1);
  --shell-pattern-opacity: .19;
  --shell-shadow: 0 16px 64px #0005;
}

:root[data-theme="light"] {
  color-scheme: light;
  --shell-paper: #f7f6f2;
  --shell-ink: #20211e;
  --shell-muted: #696b63;
  --shell-border: #d8d8d1;
  --shell-backdrop: #e9e8e3;
  --shell-pattern-filter: none;
  --shell-pattern-opacity: .32;
  --shell-shadow: 0 16px 64px #20211e14;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--shell-backdrop);
  color: var(--shell-ink);
}

body {
  position: relative;
  height: 100dvh;
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("letter-tiles.webp") center / 720px 720px repeat;
  filter: var(--shell-pattern-filter);
  opacity: var(--shell-pattern-opacity);
}

.phone-shell {
  position: absolute;
  inset: 0;
  margin: auto;
  width: min(480px, calc(100% - 48px));
  height: min(900px, calc(100dvh - 48px));
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 28px;
  background: var(--shell-paper);
  box-shadow: 0 0 0 1px var(--shell-border), var(--shell-shadow);
}

#flutter-host {
  width: 100%;
  height: 100%;
  /* Browser text dragging must not steal successive swipes from Flutter's board. */
  user-select: none;
  -webkit-user-select: none;
}

.policy-scroll {
  box-sizing: border-box;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--shell-border) transparent;
  padding: 28px 24px;
  font: 15px/1.65 system-ui, sans-serif;
  overflow-wrap: anywhere;
}

.policy-scroll::-webkit-scrollbar { width: 5px; }
.policy-scroll::-webkit-scrollbar-thumb { background: var(--shell-border); border-radius: 8px; }
.policy-scroll a { color: inherit; text-underline-offset: 3px; }
.policy-scroll a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.policy-scroll h1, .policy-scroll h2, .policy-scroll h3 { line-height: 1.25; }
.policy-scroll h1 { font-size: 28px; }
.policy-scroll h2 { font-size: 19px; margin-top: 2em; }
.policy-scroll h3 { font-size: 16px; margin: 1.5em 0 0; }
.policy-scroll nav { display: flex; gap: 12px 18px; flex-wrap: wrap; font-size: 13px; }

/* On phones, at high zoom, and in short landscape windows, the app is the whole page: no frame or wallpaper. */
@media (max-width: 520px), (max-height: 480px) {
  html, body { background: var(--shell-paper); }
  body::before { display: none; }
  .phone-shell {
    margin: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .policy-scroll {
    padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
  }
}
