/* BIMBLY handheld skin ~*~ Palm m500 / Tungsten-era grayscale LCD (not green) ~*~
   Only applies when <html> has class "palm" (set server-side for phones by includes/shell.php,
   or by js/palm.js on small touch screens). Desktop never matches any rule in here. */

@font-face { font-family: "BB Silk"; src: url("../fonts/Silkscreen-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "BB Silk"; src: url("../fonts/Silkscreen-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "BB Pixel"; src: url("../fonts/PixelifySans.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }

html.palm {
  --lcd: #c4c6be;      /* lit gray LCD */
  --hi: #d6d7d0;       /* field / dialog */
  --lite: #9a9c95;
  --mid: #62645f;
  --ink: #1c1d1b;
  --bezel: #2c2e2c;
  --silk: #8d908a;     /* silkscreen / graffiti glass */
  --title-h: 34px;
  --strip-h: 104px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html.palm, html.palm body.bb-shell-body { height: auto; min-height: 100%; }
html.palm { background: var(--lcd); }
html.palm body.bb-shell-body { display: flex; flex-direction: column; min-height: 100vh; }
html.palm body.bb-shell-body {
  margin: 0;
  background: var(--lcd);
  /* faint LCD pixel grid */
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.03) 0 1px, transparent 1px 3px);
  color: var(--ink);
  font-family: "BB Pixel", "Courier New", monospace;
  font-size: 15px;
  line-height: 1.35;
  -webkit-tap-highlight-color: rgba(28,29,27,.25);
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0, "clig" 0;
  overflow-x: clip; /* not hidden: overflow-x:hidden on body breaks position:fixed bars on iOS Safari */
}

/* ---- shell: drop the desktop frames, one column ---- */
html.palm #bb-shell,
html.palm #bb-shell > tbody,
html.palm #bb-shell > tbody > tr,
html.palm #bb-shell > tbody > tr > td { display: block; width: auto; height: auto; }
html.palm #bb-row-banner, html.palm #bb-row-hbar, html.palm #bb-nav, html.palm #bb-shell td.bb-vbar { display: none !important; }
html.palm #bb-main {
  background: transparent none !important;
  color: var(--ink) !important;
  padding: calc(var(--title-h) + 8px) 18px 16px 8px;
  overflow-wrap: anywhere;
}
html.palm .palm-only { display: block; }

/* ---- monochrome everything inside the content ---- */
html.palm #bb-main * {
  color: var(--ink) !important;
  text-shadow: none !important;
  background-color: transparent !important;
  border-color: var(--ink) !important;
  font-family: inherit;
  max-width: 100%;
  box-sizing: border-box;
}
html.palm #bb-main [style*="rainbow_bar"] { filter: grayscale(1) contrast(.8); height: 6px !important; margin: 6px 0; }
html.palm #bb-main img { filter: grayscale(1) contrast(1.05); height: auto; image-rendering: auto; }
html.palm #bb-main img[width="88"][height="31"], html.palm #bb-main img[src$=".gif"] { image-rendering: pixelated; }
html.palm #bb-main .tiny, html.palm #bb-main .stamp {
  font-family: "BB Silk", monospace; font-size: 8px; letter-spacing: .5px; color: var(--mid) !important;
}
html.palm #bb-main h1, html.palm #bb-main h2, html.palm #bb-main h3, html.palm #bb-main .impact, html.palm #bb-main .banner-title {
  font-family: "BB Silk", monospace !important;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  margin: 12px 0 6px;
}
html.palm #bb-main h1 { font-size: 18px !important; border-bottom: 2px solid var(--ink); padding-bottom: 3px; }
html.palm #bb-main h2 { font-size: 14px !important; }
html.palm #bb-main h3 { font-size: 12px !important; }
html.palm #bb-main .comic, html.palm #bb-main p, html.palm #bb-main li { font-family: "BB Pixel", monospace; }
html.palm #bb-main .mono, html.palm #bb-main pre, html.palm #bb-main code { font-family: "BB Silk", monospace; font-size: 10px; }
html.palm #bb-main .news-body { font-size: 16px; line-height: 1.4; }
html.palm #bb-main b, html.palm #bb-main strong, html.palm #bb-main .gold, html.palm #bb-main .hot { font-weight: 700; }
html.palm #bb-main hr { border: 0; border-top: 2px dotted var(--ink); height: 0; }

html.palm #bb-main a { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
html.palm #bb-main a:hover, html.palm #bb-main a:active { background-color: var(--ink) !important; color: var(--lcd) !important; }

/* ---- layout tables become one column; data tables (with <th>) stay tables ---- */
html.palm #bb-main table:not(:has(> tbody > tr > th)),
html.palm #bb-main table:not(:has(> tbody > tr > th)) > tbody,
html.palm #bb-main table:not(:has(> tbody > tr > th)) > tbody > tr,
html.palm #bb-main table:not(:has(> tbody > tr > th)) > tbody > tr > td {
  display: block;
  width: auto !important;
  height: auto !important;
}
html.palm #bb-main table:not(:has(> tbody > tr > th)) > tbody > tr > td { padding: 4px 0 !important; }
html.palm #bb-main table:has(> tbody > tr > th) { width: 100% !important; border-collapse: collapse; font-size: 13px; }
html.palm #bb-main table:has(> tbody > tr > th) th { font-family: "BB Silk", monospace; font-size: 9px; background-color: var(--ink) !important; color: var(--lcd) !important; padding: 3px; }
html.palm #bb-main table:has(> tbody > tr > th) td { border: 1px solid var(--lite) !important; padding: 3px !important; }
html.palm #bb-main .track-row img { width: 32px; height: 32px; }

/* boxes -> Palm form/dialog boxes */
html.palm #bb-main .beveled, html.palm #bb-main .beveled-in, html.palm #bb-main .hotpink-table, html.palm #bb-main .cyan-table,
html.palm #bb-main .arcade-box, html.palm #bb-main .guestbook-entry, html.palm #bb-main .merch-card, html.palm #bb-main .merch-banner,
html.palm #bb-main .merch-cart {
  border: 2px solid var(--ink) !important;
  border-radius: 4px;
  background-color: var(--hi) !important;
  box-shadow: 2px 2px 0 var(--mid);
  padding: 8px !important;
  margin: 10px 0 !important;
}
html.palm #bb-main .beveled-in { background-color: transparent !important; box-shadow: none; border-style: dotted !important; }
html.palm #bb-main .guestbook-entry { box-shadow: none; border-style: dashed !important; }
html.palm #bb-main .hotpink-table .hotpink-table, html.palm #bb-main .beveled .beveled { box-shadow: none; }
html.palm #bb-main .cover, html.palm #bb-main .cover-sm { border: 2px solid var(--ink) !important; }
html.palm #bb-main marquee, html.palm #bb-main .marquee-wrap {
  display: block; border: 2px solid var(--ink) !important; border-radius: 3px; background-color: var(--hi) !important;
  font-family: "BB Silk", monospace; font-size: 10px; padding: 4px 0;
}

/* ---- stylus buttons ---- */
html.palm #bb-main .coin-btn, html.palm #bb-main input[type="submit"], html.palm #bb-main input[type="reset"],
html.palm #bb-main input[type="button"], html.palm #bb-main button, html.palm #palm-menu summary {
  -webkit-appearance: none; appearance: none;
}
html.palm #bb-main .coin-btn, html.palm #bb-main input[type="submit"], html.palm #bb-main input[type="reset"],
html.palm #bb-main input[type="button"], html.palm #bb-main button {
  display: inline-block;
  min-height: 44px;
  min-width: 64px;
  padding: 12px 16px !important;
  margin: 4px 4px 4px 0;
  border: 2px solid var(--ink) !important;
  border-radius: 12px;
  background-color: var(--hi) !important;
  font-family: "BB Silk", monospace !important;
  font-weight: 700;
  font-size: 11px !important;
  line-height: 16px;
  letter-spacing: 0;
  text-decoration: none !important;
  text-align: center;
  cursor: pointer;
}
html.palm #bb-main .coin-btn:active, html.palm #bb-main input[type="submit"]:active, html.palm #bb-main input[type="reset"]:active,
html.palm #bb-main button:active, html.palm #bb-main .coin-btn:hover {
  background-color: var(--ink) !important; color: var(--lcd) !important;
}
html.palm #bb-main a.coin-btn { display: block !important; margin: 8px 0 !important; }

/* ---- fields: Palm dotted underline ---- */
html.palm #bb-main input[type="text"], html.palm #bb-main input:not([type]), html.palm #bb-main input[type="email"],
html.palm #bb-main input[type="number"], html.palm #bb-main input[type="password"], html.palm #bb-main select, html.palm #bb-main textarea {
  width: 100%;
  min-height: 40px;
  font-family: "BB Pixel", monospace;
  font-size: 16px;            /* >=16px keeps iOS from zooming */
  border: 0 !important;
  border-bottom: 2px dotted var(--ink) !important;
  border-radius: 0;
  background-color: rgba(255,255,255,.18) !important;
  padding: 6px 4px;
}
html.palm #bb-main textarea { border: 2px dotted var(--ink) !important; min-height: 110px; }
html.palm #bb-main input:focus, html.palm #bb-main textarea:focus, html.palm #bb-main select:focus { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---- title bar with menu tab ---- */
html.palm #palm-title {
  position: fixed; z-index: 50; top: 0; left: 0; right: 0;
  height: var(--title-h);
  padding-top: env(safe-area-inset-top);
  background: var(--lcd);
  border-bottom: 2px solid var(--ink);
  font-family: "BB Silk", monospace;
}
html.palm #palm-menu > summary {
  list-style: none; display: flex; align-items: stretch; gap: 8px; height: var(--title-h); cursor: pointer; padding-right: 72px;
}
html.palm #palm-menu > summary::-webkit-details-marker { display: none; }
html.palm .palm-tab {
  display: flex; align-items: center;
  background: var(--ink); color: var(--lcd);
  font-weight: 700; font-size: 11px; text-transform: uppercase;
  padding: 0 12px 0 8px;
  border-top-right-radius: 9px;
  max-width: 62vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 4px;
}
html.palm .palm-menu-hint { display: flex; align-items: center; font-size: 8px; color: var(--mid); }
html.palm .palm-status { position: absolute; right: 8px; top: calc(env(safe-area-inset-top) + 9px); display: flex; gap: 6px; align-items: center; font-size: 9px; font-weight: 700; color: var(--ink); pointer-events: none; }
html.palm .palm-batt { width: 20px; height: 10px; border: 2px solid var(--ink); position: relative; background: linear-gradient(90deg, var(--ink) 0 70%, transparent 70%); background-clip: content-box; padding: 1px; box-sizing: border-box; }
html.palm .palm-batt::after { content: ""; position: absolute; right: -5px; top: 1px; width: 2px; height: 4px; background: var(--ink); }

html.palm .palm-menu-pop {
  position: absolute; left: 0; right: 0; top: calc(var(--title-h) + env(safe-area-inset-top));
  background: var(--hi);
  border-bottom: 2px solid var(--ink);
  box-shadow: 0 4px 0 rgba(28,29,27,.45);
  max-height: calc(100vh - var(--title-h) - var(--strip-h) - 10px);
  overflow-y: auto;
}
html.palm .palm-menu-bar { display: flex; background: var(--ink); }
html.palm .palm-menu-bar b { color: var(--lcd); font-size: 10px; padding: 6px 12px; }
html.palm .palm-menu-bar b:first-child { background: var(--lcd); color: var(--ink); }
html.palm .palm-menu-cols { display: grid; grid-template-columns: 1.3fr 1fr; }
html.palm .palm-menu-go, html.palm .palm-menu-opt { display: flex; flex-direction: column; padding: 4px; }
html.palm .palm-menu-opt { border-left: 2px dotted var(--ink); }
html.palm .palm-menu-pop a {
  display: flex; align-items: center; min-height: 40px; padding: 0 10px;
  color: var(--ink); text-decoration: none; font-size: 10px; font-weight: 700;
  border-bottom: 1px dotted var(--lite);
}
html.palm .palm-menu-pop a.cur, html.palm .palm-menu-pop a:active, html.palm .palm-menu-pop a:hover { background: var(--ink); color: var(--lcd); }

/* ---- Palm scroll bar feel (decorative; driven by js/palm.js, page still scrolls natively) ---- */
html.palm #palm-scroll {
  position: fixed; z-index: 40; right: 2px; width: 12px;
  top: calc(var(--title-h) + env(safe-area-inset-top) + 6px);
  bottom: calc(var(--strip-h) + 6px);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
html.palm #palm-scroll b { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; }
html.palm #palm-scroll .ps-up { border-bottom: 7px solid var(--ink); }
html.palm #palm-scroll .ps-dn { border-top: 7px solid var(--ink); }
html.palm #palm-scroll .ps-track { flex: 1; width: 2px; background: var(--mid); position: relative; }
html.palm #palm-scroll .ps-thumb { position: absolute; left: -3px; width: 8px; top: 0; height: 30%; background: var(--ink); }

/* ---- Graffiti area = the nav ---- */
html.palm #palm-graffiti {
  position: -webkit-sticky; position: sticky; z-index: 45; bottom: 0; margin-top: auto; /* sticky, not fixed: iOS Safari clips fixed bottom bars */
  height: var(--strip-h);
  box-shadow: 0 160px 0 0 var(--silk); /* fills the gap iOS leaves under the strip while its toolbar collapses */
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-sizing: content-box;
  background: var(--silk);
  border-top: 4px solid var(--bezel);
  display: grid;
  grid-template-columns: 50px 1fr 1fr 50px;
  gap: 4px;
  font-family: "BB Silk", monospace;
}
html.palm #palm-graffiti a { -webkit-tap-highlight-color: transparent; text-decoration: none; color: var(--ink); }
html.palm .pg-col { display: grid; grid-template-rows: 1fr 1fr; gap: 4px; }
html.palm .pg-sk {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  border: 2px solid var(--ink); border-radius: 50%;
  font-size: 7px; font-weight: 700; padding-bottom: 6px; position: relative;
  background: rgba(255,255,255,.08);
}
html.palm .pg-sk::before { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); font-family: "BB Silk", monospace; font-size: 15px; line-height: 1; font-weight: 700; }
html.palm .pg-home::before { content: "\2302"; }
html.palm .pg-menu::before { content: "\2261"; }
html.palm .pg-top::before { content: "\25B2"; font-size: 11px; top: 9px; }
html.palm .pg-sync::before { content: "\21C5"; }
html.palm .pg-area {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 4px;
  border: 2px solid var(--ink); border-radius: 6px; padding: 4px;
  background: rgba(196,198,190,.35);
}
html.palm .pg-area > i {
  position: absolute; right: 6px; bottom: -2px; font-style: normal; font-size: 22px; color: rgba(28,29,27,.12); pointer-events: none;
}
html.palm .pg-area::after { /* Graffiti divider tick marks */
  content: ""; position: absolute; left: 50%; top: -6px; width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid var(--ink); transform: translateX(-50%);
}
html.palm .pg-btn {
  display: flex; align-items: center; justify-content: center; min-height: 40px;
  border: 2px solid var(--ink); border-radius: 10px;
  background: var(--lcd);
  font-size: 8px; font-weight: 700; text-transform: uppercase; text-align: center; line-height: 1.1;
  box-shadow: 1px 1px 0 var(--bezel);
}
html.palm .pg-btn[aria-current="page"], html.palm .pg-sk[aria-current="page"], html.palm .pg-btn:active, html.palm .pg-sk:active {
  background: var(--ink); color: var(--lcd) !important; box-shadow: none;
}

/* ---- phone frameset: the strip lives in its own bottom frame (pages/palm-nav.php) ---- */
html.palm.palm-framed { --strip-h: 0px; }
html.palm.palm-framed #palm-graffiti { display: none !important; }
html.palm.palm-nav, html.palm.palm-nav body { height: 100%; margin: 0; padding: 0; overflow: hidden; background: var(--silk); }
html.palm.palm-nav body { -webkit-tap-highlight-color: transparent; }
html.palm.palm-nav #palm-graffiti {
  position: static; margin: 0; box-shadow: none;
  height: 100%; box-sizing: border-box;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  grid-template-rows: minmax(0, 1fr); /* everything fits the fixed 104px frame */
}
html.palm.palm-nav .pg-col, html.palm.palm-nav .pg-area { grid-template-rows: repeat(2, minmax(0, 1fr)); min-height: 0; }
html.palm.palm-nav .pg-area { padding: 3px; }
html.palm.palm-nav .pg-btn { min-height: 0; }

/* ---- phone frameset: the title/menu bar lives in its own top frame (pages/palm-top.php) ---- */
/* content frame: no fixed bar, no reserved space; the menu (still here) drops from the frame's top edge */
html.palm.palm-framed { --title-h: 0px; }
html.palm.palm-framed #palm-title { height: 0; padding: 0; border: 0; background: none; }
html.palm.palm-framed #palm-menu > summary, html.palm.palm-framed #palm-title > .palm-status { display: none; }
html.palm.palm-framed .palm-menu-pop { position: fixed; top: 0; max-height: calc(100vh - 10px); }
html.palm.palm-framed #bb-main { padding-top: 8px; }
/* the bar document: fills its fixed 36px frame, never scrolls or bounces */
html.palm.palm-topbar, html.palm.palm-topbar body {
  height: 100%; margin: 0; padding: 0; overflow: hidden; overscroll-behavior: none; background: var(--lcd);
}
html.palm.palm-topbar body { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html.palm.palm-topbar #palm-title {
  position: relative; height: 100%; padding-top: 0; box-sizing: border-box;
  -webkit-user-select: none; user-select: none;
}
html.palm.palm-topbar #palm-menu-tap {
  display: flex; align-items: stretch; gap: 8px; height: var(--title-h); padding-right: 72px;
  color: var(--ink); text-decoration: none; cursor: pointer;
}
html.palm.palm-topbar #palm-menu-tap[aria-expanded="true"] .palm-menu-hint { color: var(--ink); }
html.palm.palm-topbar .palm-status { top: 9px; }

/* ---- gag badge shelf ---- */
html.palm #palm-badges {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  margin: 18px 0 4px; padding: 10px 4px 6px; border-top: 2px dotted var(--ink);
}
html.palm #palm-badges .pb-h { flex-basis: 100%; text-align: center; margin: 0 0 4px; font-family: "BB Silk", monospace; font-size: 8px; color: var(--mid) !important; }
html.palm #palm-badges img { width: 88px; height: 31px; filter: none; image-rendering: pixelated; }

/* "HotSync" flash */
html.palm.palm-syncing #bb-main { opacity: .35; transition: opacity .2s; }

/* tablets/landscape: keep the column readable */
@media (min-width: 600px) {
  html.palm #bb-main { max-width: 620px; margin: 0 auto; }
  html.palm #palm-graffiti { grid-template-columns: 64px minmax(0, 260px) minmax(0, 260px) 64px; justify-content: center; }
}

/* touch phones viewing the full desktop site: small way back */
.palm-back { display: none; }
html.palm-can #palm-back {
  display: block; position: fixed; right: 10px; bottom: 10px; z-index: 99;
  font: bold 14px "Courier New", monospace; padding: 12px 16px; border: 3px outset #aaa; background: #c4c6be; color: #1c1d1b; text-decoration: none;
}
