:root {
  --bg: #1a1f2e;
  --text: #f5f5f5;
  --muted: rgba(255,255,255,0.7);
  --accent: #ffd166;
  --panel: rgba(255,255,255,0.06);
  --panel-border: rgba(255,255,255,0.12);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: linear-gradient(135deg, #1a1f2e 0%, #2c3e50 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
/* Only `body` is the flex container. Applying `display: flex` to `html` AS WELL
   would make body the sole flex item and the `align-items: center` declaration
   on html would shrink body to its intrinsic content width on phones,
   leaving huge empty margins on both sides of the page. */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
}
header {
  text-align: center;
  margin-bottom: 24px;
  max-width: 720px;
  width: 100%;
  position: relative;
}
.back-arrow {
  position: absolute;
  top: 0;
  left: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.back-arrow:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.25);
  transform: translateX(-2px);
}
.back-arrow svg { width: 18px; height: 18px; }
@media (max-width: 480px) {
  .back-arrow { width: 34px; height: 34px; }
}
h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 6px;
}
.subtitle {
  color: var(--muted);
  font-size: 13px;
}
#sections {
  width: 100%;
  max-width: 720px;
}
.section {
  width: 100%;
  max-width: 720px;
  margin-bottom: 24px;
}
.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin: 0 0 12px;
  font-weight: 600;
}
.link-card {
  display: flex;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
}
.link-card:hover {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.22);
}
.link-card:active { transform: translateY(1px); }
.link-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  margin-right: 14px;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
}
.link-icon svg { width: 22px; height: 22px; }
.link-body { flex: 1; min-width: 0; }
.link-title {
  font-size: 15px;
  font-weight: 600;
}
.link-desc {
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.nav {
  width: 100%;
  max-width: 720px;
  display: flex;
  justify-content: flex-start;
  margin-top: 8px;
}
.nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav a:hover { border-bottom-color: var(--accent); }
.back-arrow-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Native (Capacitor): respect safe-area insets so the header doesn't sit under
   the status bar / notch and the bottom nav clears the home indicator. Mirrors
   memory.css and app.css; falls back to the original 24px/16px padding on
   devices/browsers without insets. */
html.native body {
  padding: max(env(safe-area-inset-top), 24px)
           max(env(safe-area-inset-right), 16px)
           max(env(safe-area-inset-bottom), 24px)
           max(env(safe-area-inset-left), 16px);
}

/* ---------- tablet (native shell only) ----------
   Same gate as app.css - `min-width: 700px` is above every iPhone portrait width
   (max 440pt) and below the iPad mini's 744pt; `min-height: 600px` excludes iPhone
   landscape (852-956px wide rotated, <=440px tall) while keeping every iPad.

   Nothing here needs widening: header, #sections, .section and .nav are already
   capped at 720px, the same measure app.css widens to. The only tablet defect is
   vertical - the content is only ~430px tall in a 1366px viewport, with all the
   slack pooling below the back link.

   Scoped to `html.native`, NOT `html.compact`, because links.js deliberately never
   adds `.compact` (that class exists to drop a desktop min-width floor, and this
   file has none). Inside this gate the two are equivalent: iPadOS Safari sends a
   desktop UA with no `Mobi` token, so no iPad gets `.compact` from the web path, and
   the desktop site never gets `.native` at all. */
@media (min-width: 700px) and (min-height: 600px) {
  /* Two declarations, in this order, on purpose: iOS 15.0-15.3 predates the `safe`
     keyword and keeps plain `center`; iOS 15.4+ uses `safe center`, which degrades to
     flex-start rather than clipping the top if content ever outgrows the viewport. */
  html.native body {
    justify-content: center;
    justify-content: safe center;
  }
}
