:root {
  --paper: var(--fm-bg);
  --ink: var(--fm-text);
  --pine: var(--fm-primary);
  --clay: var(--fm-primary-pressed);
  --copper: var(--fm-primary);
  --muted: var(--fm-muted);
  --border: var(--fm-line);
  --sans: var(--fm-font);
  --serif: var(--sans);
  --app-width: 440px;
  --dock: var(--fm-nav-h);
  --shell-top: 0px;
  --content-pad: var(--fm-page-x);
  --chat-height: calc(var(--visible-height, 100dvh) - var(--dock) - var(--shell-top) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  font-family: var(--sans);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  scroll-padding-block-start: calc(var(--fm-header-h) + 8px);
  scroll-padding-block-end: calc(var(--dock) + env(safe-area-inset-bottom));
}
body {
  display: flow-root;
  background: var(--fm-canvas);
  color: var(--ink);
}
.fm-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.fm-icon {
  width: 24px; height: 24px; flex: 0 0 auto; display: inline-block;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.fm-icon use { pointer-events: none; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--fm-primary); outline-offset: 2px;
}
.masthead, main { width: min(100%, var(--app-width)); }
.masthead { gap: .7rem; min-height: 4rem; padding-inline: var(--content-pad); }
body:has(#app:not([hidden])) .masthead { display: none; }
main {
  min-height: calc(100dvh - var(--shell-top)); margin: var(--shell-top) auto 0; padding: 0;
  background: var(--fm-bg);
}
#app {
  max-width: 100%; margin: 0; padding: env(safe-area-inset-top) var(--content-pad) calc(var(--dock) + env(safe-area-inset-bottom) + 1.1rem);
}
#app > section > .section-head {
  z-index: 3; position: sticky; top: 0;
  min-height: var(--fm-header-h); gap: 12px;
  margin: 0; padding: 16px 4px; background: var(--fm-bg);
}
#app > section > .section-head h1 {
  font: 700 var(--fm-title-size)/var(--fm-title-line) var(--sans);
  color: var(--ink); letter-spacing: -.02em;
}
.chat-active #app { padding-bottom: 0; }
.chat-active #chat { display: flex; flex-direction: column; height: var(--chat-height); min-height: 0; }
.brand { color: var(--ink); letter-spacing: -.055em; }
.brand-mark {
  width: 2rem; height: 2rem; background: #f9d9c2; border: 1px solid #eac2a8;
  border-radius: .72rem; color: #855036; font: 700 1.28rem/1 var(--sans);
}
.review-label { color: var(--muted); font-size: .76rem; }
#account-name { display: none; }
#logout { font-size: .78rem; padding: .35rem .6rem; }
.primary, .comment-submit {
  color: white; background: var(--fm-primary); border: 1px solid transparent;
  border-radius: var(--fm-button-radius); font-weight: 600;
}
.primary:hover, .comment-submit:hover { background: var(--fm-primary-hover); }
.primary:active, .comment-submit:active { background: var(--fm-primary-pressed); }
.small-button:hover { background: var(--fm-primary-soft); }
.tabs {
  position: fixed; inset: auto 0 0; z-index: 5;
  width: min(100%, var(--app-width)); height: calc(var(--dock) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .25rem; align-items: center;
  margin: 0 auto; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: var(--fm-bg); border-radius: 0; border: 0; border-top: var(--fm-border);
}
.tab, .tab:where(:hover) {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px;
  width: min(100%, 88px); height: 100%; justify-self: center; min-height: 44px;
  padding: 4px; border: 0; border-radius: 16px; color: var(--fm-icon);
  background: transparent; font: 500 var(--fm-nav-size)/var(--fm-nav-line) var(--sans);
}
.tab:hover { color: var(--fm-text); background: #fbf5ef; }
.tab[aria-current="page"] { font-weight: 600; color: var(--fm-nav-active); background: var(--fm-primary-soft); box-shadow: none; }
.reaction-row button { color: #705345; }
.reaction-row button[aria-pressed="true"] { color: #ac482e; }
.comment-composer { background: #fffaf5; }
.comment-input { background: #fffaf7; border-color: var(--border); }
dialog:not(.photo-viewer) { border-color: var(--border); color: var(--ink); background: #fffcf8; }
dialog::backdrop { background: #37241c65; }
textarea, .profile-form input[name="displayName"] {
  border: 1px solid #dbc4b5; color: var(--ink); background: #fffdfb; border-radius: .65rem; padding: .65rem .8rem;
}

@media (min-width: 540px) {
  :root { --shell-top: .75rem; }
  main {
    border-radius: 1.5rem 1.5rem 0 0;
    box-shadow: 0 .5rem 2.5rem #593d291a, 0 0 0 1px #e6d9d0;
  }
  #welcome { flex-direction: column; text-align: center; padding-inline: var(--content-pad); }
}
