/* Hold up a sign (v-bold-51): the button, the setup sheet and the full-screen sign. Used by the resident
   page, the demo and the kid view. Sizes are in rem where text should follow the toolbar's bigger text;
   the sign's own words are fitted in px by src/client/track/sign.ts and ignore it on purpose. */
html.tr-sign-lock { overflow: hidden; }

/* The button on the resident page. */
.tr-sign { margin: 0 0 12px; }
.tr-sign-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; max-width: 100%;
  min-height: 56px; padding: 10px 24px; border-radius: 999px; border: 3px solid #c31432; background: #c31432; color: #fff;
  font: inherit; font-size: 1.2rem; font-weight: 800; line-height: 1.2; text-align: center; cursor: pointer;
}
.tr-sign-btn:hover { background: #9a1028; border-color: #9a1028; }
.tr-sign-btn:focus-visible { outline: 3px solid #0f1b2d; outline-offset: 3px; box-shadow: 0 0 0 6px #f2b043; }
.tr-sign-icon { font-size: 1.5rem; line-height: 1; }
.tr-sign-label { overflow-wrap: anywhere; }
@media (max-width: 380px) { .tr-sign-btn { padding: 10px 16px; font-size: 1.1rem; } }

/* The kid view's big button. */
.kd-sign { display: contents; }
.kd-sign-btn { font-size: 1.4rem; min-height: 4rem; color: #0f1b2d; background: #f2b043; border-color: #f2b043; }
.kd-sign-btn:hover { color: #0f1b2d; background: #f7c164; }
.kd-sign-btn:focus-visible { outline: 3px solid #fbf3e6; outline-offset: 3px; }

/* The setup sheet. */
.tr-sign-sheet {
  position: fixed; inset: 0; z-index: 2147482000; display: flex; padding: 12px; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(15, 27, 45, 0.78);
}
.tr-sign-card {
  box-sizing: border-box; width: 100%; max-width: 32rem; margin: auto; padding: 20px; border-radius: 16px;
  background: #fff; color: #0f1b2d; border: 1px solid #c9d3e0; text-align: left;
}
.tr-sign-card h2 { margin: 0 0 6px; font-size: 1.6rem; line-height: 1.15; overflow-wrap: anywhere; }
.tr-sign-card p { margin: 0 0 12px; }
.tr-sign-bright { font-weight: 700; }
.tr-sign-set { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.tr-sign-set legend { padding: 0; margin: 0 0 4px; font-weight: 800; }
.tr-sign-opt { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; cursor: pointer; overflow-wrap: anywhere; }
.tr-sign-radio { flex: none; width: 26px; height: 26px; margin: 0; appearance: none; -webkit-appearance: none; border: 3px solid #0f1b2d; border-radius: 50%; background: transparent; }
.tr-sign-radio:checked { background: radial-gradient(circle, #c31432 0 40%, transparent 46%); border-color: #c31432; }
.tr-sign-radio:focus-visible { outline: 3px solid #0f1b2d; outline-offset: 3px; }
.tr-sign-own-wrap { margin: 0 0 12px; display: grid; gap: 4px; }
.tr-sign-own-wrap[hidden], .tr-sign-hint[hidden] { display: none; }
.tr-sign-own-wrap label { font-weight: 700; }
.tr-sign-own { box-sizing: border-box; width: 100%; min-height: 48px; padding: 8px 12px; font: inherit; font-size: 1.1rem; color: #0f1b2d; background: #fff; border: 2px solid #0f1b2d; border-radius: 10px; }
.tr-sign-own:focus-visible { outline: 3px solid #c31432; outline-offset: 2px; }
.tr-sign-hint { margin: 0 0 12px; color: #9a1028; font-weight: 700; }
.tr-sign-swatch { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 36px; border-radius: 8px; border: 2px solid #0f1b2d; font-weight: 800; font-size: 1.1rem; }
.tr-sign-privacy { color: #4a5668; }
.tr-sign-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.tr-sign-go, .tr-sign-cancel {
  min-height: 48px; max-width: 100%; padding: 8px 22px; border-radius: 999px; font: inherit; font-size: 1.1rem; font-weight: 800; line-height: 1.2; cursor: pointer;
}
.tr-sign-go { color: #fff; background: #c31432; border: 3px solid #c31432; }
.tr-sign-go:hover { background: #9a1028; border-color: #9a1028; }
.tr-sign-cancel { color: #0f1b2d; background: transparent; border: 3px solid #0f1b2d; }
.tr-sign-cancel:hover { background: #e9eef5; }
.tr-sign-go:focus-visible, .tr-sign-cancel:focus-visible { outline: 3px solid #0f1b2d; outline-offset: 3px; box-shadow: 0 0 0 6px #f2b043; }

/* The sign. Its colours come from the picked theme and never change in night mode. */
.tr-sign-full {
  position: fixed; inset: 0; z-index: 2147483000; box-sizing: border-box; overflow: hidden; overscroll-behavior: contain; touch-action: none;
  width: 100%; height: 100vh; height: 100dvh; background: var(--sign-bg); color: var(--sign-fg);
  display: flex; flex-direction: column; hyphens: manual; -webkit-hyphens: manual;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.tr-sign-full[data-sign="cream"] { --sign-glow: rgba(255, 255, 255, 0.9); }
.tr-sign-full[data-sign="red"] { --sign-glow: rgba(255, 255, 255, 0.1); }
.tr-sign-full[data-sign="navy"] { --sign-glow: rgba(242, 176, 67, 0.12); }
.tr-sign-glow { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, var(--sign-glow) 0, transparent 72%); opacity: 0.75; }
.tr-sign-bar {
  position: relative; z-index: 1; flex: none; display: flex; justify-content: flex-end;
  padding: max(10px, env(safe-area-inset-top, 0px)) max(10px, env(safe-area-inset-right, 0px)) 6px max(10px, env(safe-area-inset-left, 0px));
}
.tr-sign-box {
  position: relative; flex: 1 1 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden;
  margin: 0 max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.tr-sign-text { margin: 0; font-weight: 800; line-height: 1.1; text-align: center; text-wrap: balance; color: var(--sign-fg); }
.tr-sign-close {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 48px; min-height: 48px; padding: 6px 16px;
  font: inherit; font-size: 1.05rem; font-weight: 800; line-height: 1; cursor: pointer; border-radius: 999px;
  color: var(--sign-fg); background: var(--sign-bg); border: 3px solid var(--sign-fg);
}
.tr-sign-close span[aria-hidden] { font-size: 1.6rem; line-height: 1; }
.tr-sign-close:focus-visible { outline: 3px solid var(--sign-fg); outline-offset: 3px; }
/* A slow glow: 6 seconds a cycle, a small change, never dark to bright. No motion at all under Less motion or reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  html:not(.a11y-motion) .tr-sign-full:not(.tr-sign-still) .tr-sign-glow { animation: tr-sign-glow 6s ease-in-out infinite; }
}
@keyframes tr-sign-glow { 0%, 100% { opacity: 0.55; } 50% { opacity: 0.95; } }

/* Night mode: the button and the sheet go dark. The sign itself doesn't. */
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-btn { color: #fbf3e6; background: #14233a; border-color: #fbf3e6; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-btn:hover { color: #0f1b2d; background: #fbf3e6; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-btn:focus-visible { outline-color: #fbf3e6; box-shadow: 0 0 0 6px #f2b043; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-card { background: #0f1b2d; color: #fbf3e6; border-color: #2c3d58; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-own { color: #fbf3e6; background: #14233a; border-color: #8fa0bb; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-radio { border-color: #fbf3e6; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-radio:checked { border-color: #f2b043; background: radial-gradient(circle, #f2b043 0 40%, transparent 46%); }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-own:focus-visible, html[data-theme="night"]:not(.a11y-contrast) .tr-sign-radio:focus-visible { outline-color: #f2b043; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-hint { color: #ff9aa8; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-privacy { color: #b9c3d4; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-swatch { border-color: #fbf3e6; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-go { color: #0f1b2d; background: #f2b043; border-color: #f2b043; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-go:hover { background: #f7c164; border-color: #f7c164; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-cancel { color: #fbf3e6; border-color: #fbf3e6; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-cancel:hover { color: #0f1b2d; background: #fbf3e6; }
html[data-theme="night"]:not(.a11y-contrast) .tr-sign-go:focus-visible, html[data-theme="night"]:not(.a11y-contrast) .tr-sign-cancel:focus-visible { outline-color: #fbf3e6; box-shadow: 0 0 0 6px #f2b043; }

/* Wide or short screens (a phone on its side, a tablet): messages and colours sit in two columns so the sheet stays short. */
@media (min-width: 560px), (max-height: 520px) {
  .tr-sign-card { max-width: 40rem; }
  .tr-sign-set { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
  .tr-sign-set legend { grid-column: 1 / -1; }
  .tr-sign-themes { grid-template-columns: 1fr; }
}

/* Small and short screens. */
@media (max-width: 380px) { .tr-sign-card { padding: 16px; } .tr-sign-card h2 { font-size: 1.4rem; } }
