/* ---------- header: compact, lives on the street band ---------- */
.site-header {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-t)) max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left));
  max-width: calc(var(--column) + 240px); margin: 0 auto;
}
.header-spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; flex: none;
  min-width: 46px; height: 46px; padding: 0 11px;
  font-family: var(--font-title); font-weight: 800; font-size: 15px; color: var(--brown-dark);
  background: #fff; border: 3px solid var(--brown-dark); border-radius: 13px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .22);
  cursor: pointer; text-decoration: none;
}
.chip:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, .22); }
.chip svg { width: 22px; height: 22px; flex: none; }
/* Back to top (js/ui.js): the header chip, floating at the bottom right of
   the column; --lift raises it above the footer links or a sticky bar. */
.to-top {
  position: fixed; z-index: 6;
  right: max(12px, env(safe-area-inset-right), calc(50vw - var(--column) / 2 - 62px));
  bottom: calc(12px + var(--safe-b) + var(--lift, 0px));
  width: 46px; padding: 0;
}
.to-top[hidden] { display: none; }
.to-top:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--blue); }
main:focus, main h1:focus { outline: none; }

/* ---------- buttons: the game's flat buttons with an offset edge ---------- */
.btn {
  --face: var(--green); --edge: var(--green-dark); --ink: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 6px 18px 9px;
  font-family: var(--font-title); font-weight: 800; font-size: 19px; line-height: 1.1; letter-spacing: .03em;
  color: var(--ink);
  -webkit-text-stroke: 3.5px var(--edge);
  paint-order: stroke fill;
  text-decoration: none; text-align: center;
  background: var(--face);
  border: 3px solid var(--edge);
  border-radius: 6px;
  box-shadow: 3px 4px 0 var(--edge);
  margin: 0 3px 4px 0;             /* room for the offset edge */
  cursor: pointer;
  transition: transform .06s, box-shadow .06s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { color: var(--ink); }
.btn:active { transform: translate(2px, 3px); box-shadow: 1px 1px 0 var(--edge); }
.btn[aria-disabled="true"] { --face: var(--grey); --edge: var(--grey-dark); cursor: not-allowed; }
.btn-grey { --face: var(--grey); --edge: var(--grey-dark); }
.btn-blue { --face: var(--blue); --edge: var(--blue-deep); }
.btn-red { --face: var(--red); --edge: var(--red-dark); }
.btn-yellow { --face: var(--yellow); --edge: var(--yellow-dark); }
.btn-small { white-space: nowrap; min-height: 46px; font-size: 16px; padding: 4px 14px 7px; -webkit-text-stroke-width: 3px; }
.btn-big { min-height: 62px; font-size: 25px; -webkit-text-stroke-width: 4.5px; }
.btn-block { display: flex; width: calc(100% - 3px); }
.btn .spinner { display: none; }
.btn[aria-busy="true"] .spinner {
  display: inline-block; width: 18px; height: 18px; flex: none;
  border: 4px solid rgba(255, 255, 255, .55); border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"] .spinner { animation-duration: 2.4s; }
  .btn, .chip { transition: none; }
}

/* ---------- panel: EmailPopupAnim2's blue frame, redrawn in CSS.
   On phones it is the screen: full width, 16px inner gutter. ---------- */
.popup {
  position: relative;
  background: #fff;
  border: 7px solid var(--blue);
  border-radius: 22px;
  box-shadow: 0 0 0 3px var(--blue-line), 0 7px 0 3px rgba(40, 60, 30, .32);
  padding: 20px var(--gutter) 20px;
  margin: 3px 3px 14px;
}
.popup::before { /* the frame's lighter inner lip */
  content: ""; position: absolute; inset: 0; border-radius: 15px;
  box-shadow: 0 0 0 1.5px var(--blue-light); pointer-events: none;
}
.popup-title {
  font-family: var(--font-title); font-weight: 800;
  font-size: clamp(25px, 7vw, 30px); line-height: 1.12;
  color: var(--brown); text-align: center;
  margin-bottom: 6px;
}
.popup-title:focus { outline: none; }
.popup-lead { text-align: center; color: var(--brown); font-size: 16px; margin-bottom: 16px; }
.popup-foot { margin-top: 8px; text-align: center; font-size: 16px; color: var(--brown); }
.popup-foot a, .link-tap { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }

/* ---------- bottom sheets (language, menu): <dialog> ---------- */
.sheet {
  width: 100%; max-width: 100%; max-height: 86dvh;
  margin: auto 0 0; padding: 0;
  border: 0; border-top: 7px solid var(--blue);
  border-radius: 22px 22px 0 0;
  background: #fff; color: var(--brown-dark);
  box-shadow: 0 -3px 0 var(--blue-line);
  overflow: hidden;
}
.sheet[open] { display: flex; flex-direction: column; animation: sheet-up .2s ease-out; }
.sheet::backdrop { background: rgba(25, 45, 55, .55); }
.sheet-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 10px 8px var(--gutter);
}
.sheet-head::before { /* grab handle */
  content: ""; position: absolute; left: 50%; top: 6px; width: 44px; height: 5px; margin-left: -22px;
  border-radius: 3px; background: var(--panel-line);
}
.sheet-head h2 { flex: 1; font-family: var(--font-title); font-size: 22px; color: var(--brown); padding-top: 6px; }
.sheet-close {
  width: 46px; height: 46px; flex: none; padding: 0; cursor: pointer;
  background: var(--red); border: 3px solid var(--red-dark); border-radius: 6px;
  box-shadow: 2px 3px 0 var(--red-dark); margin: 4px 4px 3px 0;
  display: grid; place-items: center;
}
.sheet-close svg { width: 24px; height: 24px; }
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 2px var(--gutter) calc(16px + var(--safe-b));
  display: grid; gap: 8px;
}
.row-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 54px; padding: 8px 14px; text-align: left; text-decoration: none;
  font-family: var(--font-body); font-weight: 700; font-size: 18px; color: var(--brown-dark);
  background: var(--panel-grey); border: 3px solid transparent; border-radius: 12px; cursor: pointer;
}
.row-btn[hidden] { display: none; }
.sheet-find { padding: 2px var(--gutter) 10px; }
.sheet-find .input { width: 100%; }
.sheet-none { margin: 10px 2px 0; color: #6f604b; }
.sheet-none[hidden] { display: none; }
.row-btn small { margin-left: auto; font-family: var(--font-title); font-size: 13px; color: #76664f; }
.row-btn[aria-checked="true"] { background: #effbd2; border-color: var(--green-dark); }
.row-btn[aria-checked="true"]::before {
  content: ""; width: 12px; height: 20px; margin: -6px 6px 0 4px; flex: none;
  border: solid var(--green-dark); border-width: 0 5px 5px 0; transform: rotate(40deg);
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }
@media (min-width: 700px) and (min-height: 600px) {
  .sheet { margin: auto; max-width: 420px; border: 7px solid var(--blue); border-radius: 22px; box-shadow: 0 0 0 3px var(--blue-line); }
  .sheet-head::before { display: none; }
}
