/* Nearby · one button for the whole town (→ /fbkit/fbb.css, linked on every town page by release.py)
   Pixel wood: VT323, a 3px black border, a bevel, a hard drop shadow. Pressing pushes it in; amber means chosen or "go";
   teal means a friend is here. Every button is at least 44px to touch, shows a ring when reached by keyboard, and fades
   when it can't be used.

   Classes, for new buttons and the town's shared parts (top bar, Wei, the friend card, first-visit cards):
     .fbb                 wood, 44px high
     .fbb-pri             amber: the one thing to do next
     .fbb-glass           see-through, for buttons over a landscape
     .fbb-icon            44px square, an emoji alone
     .fbb-lg              56px high, a bigger label
     .fbb-choice          full width, left aligned: one of Wei's choices
     [aria-pressed=true] / .on    chosen (amber with a white ring); .fbb-glass.on / #duo.on: a friend is here (teal)
   The town's own pages (html.fbt) get the same look on the classes they already use: .pill .chip .tool .seed .big,
   and Next Door's .btn .btn-amber .opt-btn .icon-btn .chip-btn; each page keeps its own sizes. */
:root {
  --fbb-ink: #fbeedd; --fbb-wood: #3a2214; --fbb-wood-hi: #4d2e1a; --fbb-amber: #f6b73c; --fbb-amber-hi: #ffc95a; --fbb-amber-ink: #1d130d;
  --fbb-teal: #1f6f62; --fbb-glass: rgba(14, 16, 26, .62); --fbb-glass-hi: rgba(30, 34, 52, .78);
  --fbb-bevel: inset -3px -3px 0 rgba(0, 0, 0, .38), inset 3px 3px 0 rgba(255, 220, 170, .16);
  --fbb-bevel-pri: inset -3px -3px 0 rgba(0, 0, 0, .22), inset 3px 3px 0 rgba(255, 255, 255, .42);
  --fbb-drop: 3px 3px 0 #000;
  --fbb-font: "VT323", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-monospace, monospace;
  /* the town's page: the map's and the top bar's night ink under a 4px pixel check. A place uses
     background: var(--fbt-px), var(--fbt-page) for the field around its content (it stays night in light mode);
     html.fbt-pg turns that field to paper in light mode, for pages whose words all sit in their own boxes. */
  --fbt-page: #14101e; --fbt-px: repeating-conic-gradient(rgba(0, 0, 0, .25) 0 25%, transparent 0 50%) 0 0 / 4px 4px;
}
html.fbt-pg body { background: var(--fbt-px), var(--fbt-page); }

/* ---------- the button ---------- */
.fbb,
html.fbt :is(button, a):is(.pill, .chip, .tool, .seed, .big),
html.fbt :is(button, a):is(.btn, .opt-btn, .icon-btn, .chip-btn) {
  -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent;
  box-sizing: border-box; min-height: 44px; border: 3px solid #000; border-radius: 0;
  background: var(--fbb-wood); color: var(--fbb-ink); font-family: var(--fbb-font); font-weight: 400; letter-spacing: .02em;
  box-shadow: var(--fbb-bevel), var(--fbb-drop); text-decoration: none; cursor: pointer;
  transition: background-color .12s, transform .06s, box-shadow .06s;
}
.fbb { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; font-size: 20px; line-height: 1; }
.fbb-icon { width: 44px; min-width: 44px; padding: 0; font-size: 22px; }
.fbb-lg { min-height: 56px; padding: 0 18px; font-size: 23px; }
.fbb-choice { display: flex; width: 100%; justify-content: flex-start; text-align: left; padding: 8px 12px; font-size: 19px; line-height: 1.15; }

/* amber: go */
.fbb-pri,
html.fbt :is(button, a).big,
html.fbt :is(button, a).btn-amber { background: var(--fbb-amber); color: var(--fbb-amber-ink); box-shadow: var(--fbb-bevel-pri), var(--fbb-drop); }
html.fbt :is(button, a).big { border-width: 3px; }
html.fbt :is(button, a).big.alt { background: var(--fbb-wood); color: var(--fbb-ink); box-shadow: var(--fbb-bevel), var(--fbb-drop); }

/* see-through, over a landscape */
.fbb-glass { background: var(--fbb-glass); color: #eef2ff; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .12), var(--fbb-drop); }

/* hover, where there is a pointer that hovers */
@media (hover: hover) {
  .fbb:hover, html.fbt :is(button, a):is(.pill, .chip, .tool, .seed, .big.alt, .btn, .opt-btn, .icon-btn, .chip-btn):hover { background-color: var(--fbb-wood-hi); }
  .fbb-pri:hover, html.fbt :is(button, a):is(.big:not(.alt), .btn-amber):hover { background-color: var(--fbb-amber-hi); }
  .fbb-glass:hover { background-color: var(--fbb-glass-hi); }
}

/* pressed in */
.fbb:active:not(:disabled),
html.fbt :is(button, a):is(.pill, .chip, .tool, .seed, .big, .btn, .opt-btn, .icon-btn, .chip-btn):active:not(:disabled) {
  transform: translate(2px, 2px); box-shadow: inset 3px 3px 0 rgba(0, 0, 0, .35), 1px 1px 0 #000;
}

/* chosen */
.fbb[aria-pressed="true"], .fbb.on:not(.fbb-glass),
html.fbt :is(button, a):is(.pill, .chip, .tool, .seed, .btn, .opt-btn, .icon-btn, .chip-btn):is([aria-pressed="true"], .active) {
  background: var(--fbb-amber); color: var(--fbb-amber-ink); box-shadow: var(--fbb-bevel-pri), 0 0 0 3px #fff, 5px 5px 0 #000;
}
html.fbt :is(button, a):is(.pill, .chip, .tool, .seed, .btn, .opt-btn, .icon-btn, .chip-btn):is([aria-pressed="true"], .active) :is(span, small, b) { color: inherit; }
/* a friend is here */
.fbb-glass.on, .fbb.fbb-friend.on { background: var(--fbb-teal); color: #eef2ff; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .2), 0 0 0 2px #8ee6d4, var(--fbb-drop); }

/* reached by keyboard */
.fbb:focus-visible,
html.fbt :is(button, a):is(.pill, .chip, .tool, .seed, .big, .btn, .opt-btn, .icon-btn, .chip-btn):focus-visible { outline: 3px solid var(--fbb-amber); outline-offset: 3px; }
.fbb-pri:focus-visible, html.fbt :is(button, a):is(.big, .btn-amber):focus-visible { outline-color: #fff; }

/* can't be used yet */
.fbb:disabled, .fbb[aria-disabled="true"],
html.fbt :is(button, a):is(.pill, .chip, .tool, .seed, .big, .btn, .opt-btn, .icon-btn, .chip-btn):is(:disabled, [aria-disabled="true"]) {
  opacity: .45; cursor: default; transform: none; box-shadow: var(--fbb-bevel); filter: none;
}

@media (prefers-reduced-motion: reduce) { .fbb, html.fbt :is(button, a) { transition: none; } }

/* Next Door's own classes: VT323 needs a larger size than the old pixel font to read the same */
html.fbt :is(button, a).opt-btn { font-size: 19px; line-height: 1.15; }
html.fbt :is(button, a).btn { font-size: 19px; line-height: 1; }
html.fbt :is(button, a).btn.btn-sm { min-height: 36px; font-size: 17px; }
html.fbt :is(button, a):is(.icon-btn, .chip-btn) { min-height: 36px; font-size: 18px; }

/* ---------- one screen, in town (html.fbt.fbfit inside the shell's frame) ----------
   The top bar already names the place, so the place's own title goes (.fit-title) and its little tools float top-right
   (.fit-head). The scene (.fit-hero, its aspect in --fit-ar) stays whole; everything else sits in one panel (.fit-panel)
   that scrolls by itself, so the frame never does. Upright: scene on top. Wide: scene left, panel right. */
html.fbsh-in.fbfit, html.fbsh-in.fbfit body { height: 100%; overflow: hidden; }
html.fbsh-in.fbfit body { min-height: 0 !important; display: flex; flex-direction: column; }
html.fbsh-in.fbfit .fit-title { display: none !important; }
html.fbsh-in.fbfit .fit-head { position: fixed !important; top: 8px; right: 10px; z-index: 30; display: flex; gap: 6px; width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; background: none !important; }
html.fbsh-in.fbfit .fit-main { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: none !important; margin: 0 !important; padding: 10px 12px 0 !important; box-sizing: border-box; }
html.fbsh-in.fbfit .fit-hero { flex: none; width: min(100%, calc(var(--fit-h, 38vh) * var(--fit-ar, 1.78))); width: min(100%, calc(var(--fit-h, 38dvh) * var(--fit-ar, 1.78))); margin: 0 auto !important; }
html.fbsh-in.fbfit .fit-panel { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px 4px 16px; scrollbar-width: thin; }
html.fbsh-in.fbfit .fit-panel > :first-child { margin-top: 0 !important; }
@media (min-aspect-ratio: 5/4) and (min-width: 640px) {
  html.fbsh-in.fbfit .fit-main { flex-direction: row; align-items: center; gap: 20px; padding: 12px 16px !important; max-width: 1400px !important; margin: 0 auto !important; }
  html.fbsh-in.fbfit .fit-hero { flex: 0 1 auto; width: min(60%, calc((100vh - 28px) * var(--fit-ar, 1.78))); width: min(60%, calc((100dvh - 28px) * var(--fit-ar, 1.78))); }
  html.fbsh-in.fbfit .fit-panel { flex: 1 1 0; align-self: stretch; min-width: 300px; padding-top: 52px; }
}
/* a wide, short scene (a shopfront, a street) reads better above its panel even on a wide window: .fit-col keeps the column */
@media (min-aspect-ratio: 5/4) and (min-width: 640px) {
  html.fbsh-in.fbfit.fit-col .fit-main { flex-direction: column; align-items: stretch; max-width: 1100px !important; padding-top: 10px !important; }
  html.fbsh-in.fbfit.fit-col .fit-hero { flex: none; width: min(100%, calc(var(--fit-h, 30vh) * var(--fit-ar, 1.78))); width: min(100%, calc(var(--fit-h, 30dvh) * var(--fit-ar, 1.78))); }
  html.fbsh-in.fbfit.fit-col .fit-panel { flex: 1 1 0; min-width: 0; padding-top: 4px; }
}

/* ---------- light mode: the same town in paper and light oak (follows the device; dark keeps the night look) ----------
   Only the town's shared parts change: buttons, the top bar, Wei's card, notes, first-visit and story cards, the privacy
   card, the friend card and the waiting card; inside a place only those cards change, its own buttons and drawing keep
   the night look. */
@media (prefers-color-scheme: light) {
  html:has(.fbsh), html .fbw, html .fbn, html .fbs, html .fbo, html .fbduo, html .fbc-town, html .fbc-intro, html .fbsh-wait {
    --fbb-ink: #2b1a0f; --fbb-wood: #d6ad7a; --fbb-wood-hi: #e4c093; --fbb-amber: #f2a93b; --fbb-amber-hi: #ffbe55;
    --fbb-glass: rgba(250, 242, 226, .74); --fbb-glass-hi: rgba(255, 248, 234, .88);
    --fbb-bevel: inset -3px -3px 0 rgba(110, 62, 24, .3), inset 3px 3px 0 rgba(255, 255, 255, .55);
    --fbl-paper: #f4e8cf; --fbl-paper2: #e9d6b0; --fbl-ink: #2b1a0f; --fbl-muted: #6e5638; --fbl-label: #9a530b;
  }
  html.fbt-pg { --fbt-page: #f4e8cf; --fbt-px: repeating-conic-gradient(rgba(110, 62, 24, .06) 0 25%, transparent 0 50%) 0 0 / 4px 4px; }
  html .fbsh { background: var(--fbl-paper2); color: var(--fbl-ink); box-shadow: 0 3px 0 rgba(60, 36, 14, .25); }
  html .fbsh .fbsh-home { color: var(--fbl-ink); }
  html .fbsh-mid { color: var(--fbl-label); }
  html .fbsh .fbsh-wei.zz { background: #c9b892; }
  html .fbsh .fbsh-wei.zz::after { color: #5a3a1a; }
  html .fbsh-frame, html .fbsh-frame iframe { background: var(--fbl-paper); }
  html .fbsh-dim { background: rgba(70, 44, 20, .3); }
  html .fbw, html .fbn.fbn, html .fbs.fbs, html .fbsh-wait, html .fbo, html .fbduo-c, html .fbc.fbc-town, html .fbc-intro, html .fbduo-toast {
    background: rgba(246, 236, 214, .97); color: var(--fbl-ink); box-shadow: 6px 6px 0 rgba(0, 0, 0, .55), inset 0 0 0 2px #c9a26e;
  }
  html .fbn.fbn, html .fbs.fbs, html .fbsh-wait { box-shadow: 4px 4px 0 rgba(0, 0, 0, .45); }
  html .fbw-say { color: #3a220f; }
  html .fbn .fbn-l, html .fbs .fbs-t, html .fbsh-wait b, html .fbduo-c h2, html .fbc-town .fbc-t, html .fbc-town .fbc-m, html .fbc-town .fbc-w, html .fbc-det { color: var(--fbl-label); }
  html .fbn a.fbn-a { color: var(--fbl-label) !important; }
  html .fbs .fbs-n, html .fbduo-or { color: var(--fbl-muted); }
  html .fbs .fbs-x::before, html .fbs .fbs-x::after { background: var(--fbl-ink); }
  html .fbs .fbs-x { border-color: rgba(0, 0, 0, .35); }
  html .fbo li b { background: rgba(110, 62, 24, .12); }
  html .fbw-opts .fbw-ghost { color: var(--fbl-ink); border-color: rgba(0, 0, 0, .3); }
  html .fbw-set button, html .fbw-tags button, html .fbw-x, html .fbc-town .fbc-b button { background: var(--fbb-wood); color: var(--fbb-ink); }
  html .fbw-set .fbw-heart { color: #a3122a; text-shadow: 0 1px 0 rgba(255, 240, 220, .6); font-size: 24px; }
  html .fbc-town .fbc-b button:last-child { background: var(--fbb-amber); color: #1d130d; }
  html .fbc-town .fbc-b button:hover, html .fbc-town .fbc-b button:focus-visible { background: var(--fbb-wood-hi); color: var(--fbb-ink); }
  html .fbc-town .fbc-ps li { color: #3a2a1a; }
  html .fbs-links a { background: var(--fbl-paper2); color: #7a4510; }
  html .fbw-notes p { background: var(--fbl-paper2); color: var(--fbl-ink); }
  html .fbw-notes p.me { background: #dfc392; }
  html .fbduo { background: rgba(70, 44, 20, .35); }
  html .fbduo-code { color: #136b5d; }
  html .fbduo-st { color: #136b5d; }
}
