/* Survival Guide: dark, high-contrast, thumb-friendly */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-size: var(--text-base); line-height: 1.55; font-family: var(--font); }
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px;
  /* Keep content clear of the iPhone notch and home bar in Home Screen mode */
  padding-top: calc(20px + env(safe-area-inset-top));
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
a { color: inherit; }
h1 { font-size: 1.9rem; margin: 0; }
h2 { font-size: 1.5rem; margin: 0; }

/* Header */
.app-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.logo { font-size: 2rem; }
.badge { color: var(--ok) !important; margin-left: auto; font-size: .8rem; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }

/* Home grid */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tile { display: flex; flex-direction: column; justify-content: center; gap: 8px;
  min-height: 120px; padding: 16px; border-radius: var(--radius); text-decoration: none;
  background: var(--surface); border: 2px solid var(--border); border-left: 8px solid var(--c); }
.tile:hover, .tile:focus-visible { border-color: var(--c); outline: none; }
.tile-icon { width: 40px; height: 40px; }
.logo { width: 40px; height: 40px; }
.inline-icon { width: 1.2em; height: 1.2em; vertical-align: -0.2em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile-name { font-weight: 700; font-size: 1.15rem; overflow-wrap: anywhere; }
@media (max-width: 420px) { .tile-name { font-size: 1.02rem; } }
.tile-count { color: var(--text-muted); font-size: .9rem; }

/* Top bar with back button */
.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.back { display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap); border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); text-decoration: none; font-size: 1.4rem; }

/* Guide list */
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.list a { display: block; padding: 16px; min-height: var(--tap); border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--c);
  text-decoration: none; }
.list strong { display: block; font-size: 1.15rem; }
.list span { color: var(--text-muted); }
.empty { color: var(--text-muted); }

/* Guide reader */
.guide h1 { font-size: 2rem; line-height: 1.2; margin: 4px 0 16px; }
.cat-label { color: var(--c); font-weight: 700; text-transform: uppercase; font-size: .85rem; letter-spacing: .05em; }
.box { border-radius: var(--radius); padding: 14px 18px; margin: 16px 0; }
.box h3 { margin: 0 0 6px; font-size: 1.05rem; }
.box ul { margin: 0; padding-left: 22px; }
.key { background: var(--surface-2); border: 1px solid var(--border); border-left: 6px solid var(--c); }
.warn { background: var(--warning-bg); border: 1px solid var(--warning); }
.warn h3 { color: var(--warning); }
.steps { padding-left: 26px; }
.steps li { margin: 10px 0; }
.source { color: var(--text-muted); font-size: .9rem; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 24px; }

/* An odd last tile spans the full row so it isn't left alone. */
.tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
@media (max-width: 330px) { .grid { grid-template-columns: 1fr; } }
