:root {
  color-scheme: light;
  --nav: #1b3159; --nav-active: #f9e4ad; --accent: #284d86; --accent-dark: #223d68;
  --ink: #1d2c49; --muted: #536071; --paper: #f7f2e4; --line: #d5cebd;
  --tint: #e8eef8; --danger: #9c3c29; --card: #fffcf4; --gold: #ffcf66;
  --display: "DM Serif Text", "Iowan Old Style", Georgia, serif;
  font-family: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink); background: var(--paper); font-size: 15px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden], .symbol-bank { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; }
.intro-screen {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; overflow: hidden; background: #080808; color: #fff;
}
.intro-screen::backdrop { background: #080808; }
.intro-screen video { width: 100%; height: 100%; display: block; object-fit: contain; }
.intro-cue {
  position: absolute; left: 50%; top: calc(50% + min(23vw,34vh)); transform: translate(-50%,-50%);
  width: max-content; max-width: calc(100% - 32px); color: #e2f0d9; text-shadow: 0 1px 4px #000;
  font: 600 .9rem/1.4 var(--body,sans-serif); letter-spacing: .03em;
}
.intro-screen:not([data-state="loading"]) .intro-loading,
.intro-screen:not([data-state="playing"]) .intro-playfield { display: none; }
.intro-screen button {
  min-width: 48px; min-height: 44px; padding: .4rem .9rem; border: 1px solid #ffffff70;
  border-radius: 999px; color: #fff; background: #111e;
  font-family: inherit; font-size: .82rem; font-weight: 600; line-height: 1.2; touch-action: manipulation;
}
.intro-screen button:focus-visible { outline: 2px solid #ffe7a8; outline-offset: 2px; }
.intro-playfield {
  --hand-size: clamp(110px,19vmin,152px);
  position: absolute; top: max(14px,env(safe-area-inset-top));
  right: max(14px,env(safe-area-inset-right)); bottom: max(14px,env(safe-area-inset-bottom));
  left: max(14px,env(safe-area-inset-left)); pointer-events: none;
}
.intro-target {
  position: absolute; left: var(--intro-x,100%); top: var(--intro-y,100%);
  transform: translate(calc(0% - var(--intro-x,100%)),calc(0% - var(--intro-y,100%)));
  display: grid; place-items: center; width: calc(var(--hand-size) + 44px); height: calc(var(--hand-size) + 44px);
}
.intro-target > * { grid-area: 1 / 1; }
#intro-skip {
  min-width: 116px; min-height: 56px; padding: .65rem 1.35rem; pointer-events: auto;
  border-color: #ffffffb5; font-size: 20px; font-weight: 700;
}
#intro-hand {
  display: block; width: var(--hand-size); height: var(--hand-size); object-fit: contain; opacity: 0;
  pointer-events: none; user-select: none; transform-origin: 50% 84%;
}
.intro-target.reacting #intro-hand { animation: intro-wrist-flick 600ms both; }
.intro-target.reacting #intro-skip { opacity: 0; pointer-events: none; }
@keyframes intro-wrist-flick {
  0%   { opacity: 0; transform: translateY(14px) rotate(-28deg) scale(.48); }
  14%  { opacity: 1; transform: translateY(1px) rotate(-12deg) scale(.92); }
  29%  { opacity: 1; transform: translateY(-7px) rotate(9deg) scale(1.06); }
  43%  { opacity: 1; transform: translateY(1px) rotate(-4deg) scale(.98); }
  58%, 81% { opacity: 1; transform: translateY(0) rotate(1deg) scale(1); }
  100% { opacity: 0; transform: translateY(9px) rotate(10deg) scale(.84); }
}
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
h1,h2,h3,p,dl,dd,fieldset { margin: 0; }
h1 { font: 700 clamp(2.25rem,4.1vw,3.85rem)/.99 var(--display); letter-spacing: -.056em; }
h2 { font: 700 1.44rem/1.12 var(--display); letter-spacing: -.038em; }
h3 { font-size: 1rem; font-weight: 640; letter-spacing: -.024em; }
small,.hint,.caption { font-size: .82rem; line-height: 1.5; color: var(--muted); }
button,input,select,textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
input,select,textarea { color: var(--ink); background: #fff; border: 1px solid #bdb8ab; border-radius: 6px; min-width: 0; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { width: 100%; padding: .57rem .72rem; font-size: .94rem; line-height: 1.42; }
select { cursor: pointer; }
input::placeholder, textarea::placeholder { color: #667186; }
textarea { resize: vertical; }
label,.field-label,legend { display: block; font-weight: 610; font-size: .87rem; line-height: 1.5; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible { outline: 3px solid #356cb5; outline-offset: 3px; }
.primary,.secondary,.text-button,.icon-button { display: inline-flex; align-items: center; justify-content: center; gap: .48rem; border-radius: 6px; font-weight: 620; font-size: .87rem; line-height: 1.25; }
.primary,.secondary { min-height: 38px; padding: .55rem .92rem; }
.primary { border: 1px solid var(--accent-dark); color: #fff; background: var(--accent-dark); }
.primary:hover:not(:disabled) { background: #122a4e; }
.primary:disabled { background: #627187; border-color: #627187; }
.secondary { border: 1px solid #bdb8ab; background: #fff; color: var(--ink); }
.secondary:hover,.icon-button:hover { background: #f1eddf; }
.text-button { color: var(--accent); border: none; background: transparent; padding: .4rem .22rem; }
.text-button:hover { text-decoration: underline; }
.icon-button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); }
button svg { width: 17px; height: 17px; }
.shell { display: grid; grid-template-columns: 218px minmax(0,1fr); min-height: 100vh; }
.spine { background: var(--nav); color: #fff; position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 25px 14px 16px; }
.brand { color: #fff5dc; text-decoration: none; display: flex; align-items: center; gap: 7px; padding-left: 2px; }
.brand-name { font: 700 clamp(1.2rem,1.55vw,1.48rem)/1.02 var(--display); letter-spacing: -.047em; }
.brand-name > span { display: block; }
.brand-mark { flex: none; width: 40px; height: 40px; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.spine nav { margin-top: 52px; display: flex; flex-direction: column; gap: 5px; }
.nav-item { border: 0; color: #dfe7f2; background: transparent; text-align: left; width: 100%; border-radius: 6px; display: flex; align-items: center; gap: 13px; padding: 12px 14px; font-size: .94rem; font-weight: 540; white-space: nowrap; }
.nav-item svg { width: 19px; height: 19px; color: #bdcce0; }
.nav-item:hover,.spine .signout:hover { background: #2b4873; color: #fff; }
.nav-item[aria-current="page"] { background: var(--nav-active); color: #213851; font-weight: 700; }
.nav-item[aria-current="page"] svg { color: #25446e; }
.nav-access { margin-top: 19px; }
.session-controls { border-top: 1px solid #465b7d; margin-top: auto; padding: 18px 5px 0; display: flex; align-items: center; gap: 9px; color: #d6dfed; font-size: .83rem; }
.role-avatar { border-radius: 50%; background: #354e76; display: grid; place-items: center; width: 29px; height: 29px; }
.role-avatar svg { width: 15px; height: 15px; }
.spine .signout { color: #dfe7f2; margin-left: auto; }
.stage {
  min-width: 0;
  background: var(--paper) url("/hanukkah-pattern.svg") 1px 44px / 232px 164px repeat;
}
.stage .page-head > div:has(#page-title) { position: relative; isolation: isolate; }
.stage .page-head > div:has(#page-title)::before {
  content: ""; position: absolute; z-index: -1; inset: -3px -9px; pointer-events: none;
  background: var(--paper); opacity: .88; filter: blur(5px);
}
@media (max-width:700px) {
  .stage { background-size: 190px auto; background-position: -10px 47px; }
}
.topbar { position: relative; }
.topbar::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: repeating-linear-gradient(90deg, #56739b 0 16px, #f5e5bf 16px 32px); }
.topbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 clamp(20px,3.4vw,54px); background: #fffcf4; border-bottom: 1px solid var(--line); }
.breadcrumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .83rem; }
.breadcrumbs strong { color: var(--ink); font-weight: 560; }
.breadcrumbs svg { width: 13px; height: 13px; color: #70829b; }
.profile-picker { position: relative; min-width: 150px; max-width: 245px; }
.profile-picker svg { width: 15px; height: 15px; position: absolute; left: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--accent); }
.profile-picker .picker-arrow { left: auto; right: 8px; color: var(--muted); }
.profile-picker select { appearance: none; padding: 6px 28px 6px 33px; border-color: var(--line); font-size: .86rem; font-weight: 560; text-overflow: ellipsis; }
.workspace { width: 100%; max-width: 1510px; margin: 0 auto; padding: 35px clamp(20px,3.4vw,54px) 66px; }
.page-head { padding-bottom: 17px; border-bottom: 3px double #a39f93; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 25px; }
.page-head p { color: var(--muted); font-size: .96rem; margin-top: 6px; }
.workspace:has(#rule-actions:not([hidden])) .page-head { border-bottom: 0; margin-bottom: 0; }
.page-actions {
  position: sticky; top: env(safe-area-inset-top,0px); z-index: 4;
  display: flex; align-items: center; justify-content: flex-end; gap: 13px;
  padding: 6px 12px; margin-bottom: 14px; min-height: 52px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 2px 5px #1b315914;
}
.page-actions .primary { min-height: 44px; }
#rule-form :is(input,button,select,summary),#paused { scroll-margin-top: calc(6rem + env(safe-area-inset-top,0px)); }
#save-state { margin-right: auto; font-size: .8rem; color: var(--muted); white-space: nowrap; }
#save-state.changed { color: #825824; }
#notice:not(:empty) { color: #145944; border: 1px solid #b8d6c9; background: #e8f5ee; border-radius: 6px; padding: 10px 12px; font-size: .88rem; }
#notice:not(:empty) { margin-bottom: 15px; }
#notice.error { color: #823b27; border-color: #e3c2b7; background: #fcf1ed; }
.rule-layout { display: grid; grid-template-columns: minmax(0,1fr) minmax(205px,.385fr); gap: 19px; align-items: start; }
.rule-layout form { min-width: 0; }
#rule-editor,.right-rail { display: grid; gap: 14px; }
.card,.rule-card,.recent-card,.profile-card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.section-head,.rule-heading,.rail-heading { padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title,.rule-heading .title-stack { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tile-icon { display: grid; place-items: center; width: 33px; height: 33px; flex: 0 0 33px; border-radius: 50%; color: #694812; background: #fae8ba; }
.tile-icon svg { width: 19px; height: 19px; }
.rule-card[data-icon="size"] .tile-icon { background: #e7eaf1; color: #34527e; }
.rule-card[data-icon="exit"] .tile-icon { background: #f1e3d8; color: #8f4b32; }
.rule-heading { padding-bottom: 11px; }
.rule-heading small { display: block; font-weight: 400; margin-top: 3px; }
.rule-body,.section-body { padding: 3px 20px 19px; }
.rule-body { display: grid; gap: 14px; }
.rule-body > p,.rule-body .hint { font-size: .8rem; color: var(--muted); }
.method-grid,.method-hours { min-width: 0; padding: 0; border: 0; }
.method-grid,.method-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,200px),1fr)); gap: 9px; }
.rule-card[data-icon="exit"] { container-type: inline-size; }
.method-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
.method-choice { display: flex; align-items: flex-start; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #fffef9; cursor: pointer; }
.method-choice:has(input:checked) { background: var(--tint); border-color: var(--accent); }
.method-choice input,.method-check input { accent-color: var(--accent); width: 16px; height: 16px; flex: 0 0 auto; margin: 2px 0 0; }
.method-copy { display: grid; gap: 3px; }
.method-copy small { font-weight: 400; }
.method-featured { grid-column: 1/-1; align-items: center; gap: 14px; padding: 18px; background: #fff6db; border-color: #bf9c52; }
.method-featured .method-copy { gap: 5px; }
.method-featured strong { color: var(--nav); font: 700 clamp(1.45rem,3vw,1.9rem)/1.08 var(--display); }
.method-recommendation { color: #72500d; text-transform: uppercase; font-size: .7rem; font-weight: 750; letter-spacing: .12em; }
.martingale-option { display: grid; gap: 5px; padding: 13px 15px; border-left: 3px solid #bc984f; background: #f8f2e3; }
.martingale-option .field { margin-top: 7px; }
.martingale-option .field-with-unit { max-width: 17rem; }
.custom-method { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 13px; }
.method-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.method-check:has(input:disabled) { color: var(--muted); }
.method-hours legend { font-size: .89rem; font-weight: 650; margin: 2px 0 4px; }
.method-hours label { display: grid; gap: 4px; }
.method-hours .hint { display: block; margin-top: 5px; }
.field { min-width: 0; }
.field > label,.field .field-label,.inline-form label,.share-box label,.section-body > label { margin-bottom: 5px; }
.field .hint { display: block; margin-top: 4px; }
.field-with-unit { position: relative; }
.entry-deviation .field-with-unit { max-width: 17rem; }
.field-with-unit input { padding-right: 48px !important; }
.field-with-unit span { position: absolute; top: 50%; right: 11px; transform: translateY(-50%); font-size: .79rem; color: var(--muted); pointer-events: none; }
.options { display: flex; flex-wrap: wrap; gap: 5px; }
.option { border: 1px solid #bdb8ac; background: #fff; color: #33475f; border-radius: 5px; display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 6px 11px; font-size: .85rem; font-weight: 540; }
.option[aria-pressed="true"] { border-color: #6884a8; color: #1b3b68; background: var(--tint); }
.option[aria-pressed="true"]::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.toggle-line,.pause-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.toggle-line input,.pause-row input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch {
  display: inline-flex; flex: none; width: 72px; height: 32px; overflow: hidden;
  border-radius: 999px; background: #515c6c; box-shadow: inset 0 0 0 1px #28364a;
}
.switch-reaction-layer {
  position: fixed; inset: 0; z-index: 24; pointer-events: none;
}
#rules-view { position: relative; }
.switch-reaction-mobile {
  position: absolute; inset: auto 0; height: var(--reaction-height, 0px);
  overflow: hidden;
}
.switch-reaction {
  position: absolute; inset: 0; margin: auto; pointer-events: none;
  width: min(94vw,860px,100%); height: min(82vh,760px,100%); object-fit: contain;
}
.switch-reaction[src^="/signal-pause-baby.webp"] {
  width: min(96vw, 650px, 82vh, 100%, var(--reaction-height, 100vh));
  height: auto;
  aspect-ratio: 722 / 718;
  object-fit: cover;
  object-position: top;
  /* Trace the silhouette in the upper 718 pixels of the photograph. */
  clip-path: polygon(
    64.82% 3.90%, 61.91% 3.34%, 61.08% 3.48%, 59.83% 4.60%, 59.83% 5.43%,
    60.53% 6.13%, 60.80% 7.24%, 59.42% 7.94%, 56.23% 6.55%, 52.77% 5.71%,
    52.49% 5.43%, 52.77% 4.60%, 52.77% 2.23%, 52.49% 1.67%, 51.39% 0.70%,
    50.42% 0.56%, 50.14% 0.00%, 48.89% 0.00%, 46.54% 2.37%, 44.74% 1.81%,
    43.49% 2.37%, 42.24% 2.37%, 40.58% 3.62%, 40.30% 5.29%, 41.14% 5.99%,
    42.66% 6.41%, 43.35% 7.24%, 42.94% 8.50%, 40.86% 10.45%, 39.75% 10.45%,
    38.50% 8.77%, 37.67% 8.22%, 36.98% 8.36%, 36.57% 8.08%, 36.15% 8.36%,
    35.04% 11.70%, 35.18% 12.40%, 35.73% 12.81%, 35.87% 15.60%, 36.15% 15.88%,
    36.01% 18.25%, 35.04% 19.64%, 34.90% 26.04%, 35.32% 28.55%, 35.32% 31.48%,
    34.90% 31.89%, 35.73% 34.12%, 35.73% 34.82%, 35.18% 35.24%, 35.04% 36.77%,
    35.60% 38.44%, 35.73% 41.09%, 36.43% 43.87%, 36.15% 44.99%, 36.43% 47.08%,
    37.81% 50.14%, 38.92% 51.39%, 38.92% 51.95%, 38.23% 52.51%, 32.55% 53.06%,
    29.09% 54.32%, 27.29% 55.57%, 23.82% 59.61%, 22.30% 63.65%, 22.16% 68.11%,
    20.22% 70.89%, 18.98% 75.49%, 17.04% 78.13%, 16.20% 80.22%, 14.27% 83.01%,
    13.43% 84.96%, 9.28% 99.86%, 21.61% 99.86%, 22.16% 98.19%, 25.48% 93.04%,
    28.53% 87.19%, 30.47% 84.96%, 31.02% 85.10%, 31.44% 85.79%, 31.44% 88.30%,
    31.02% 89.69%, 29.78% 91.64%, 28.95% 94.57%, 28.95% 97.49%, 29.92% 99.86%,
    61.50% 99.86%, 61.22% 99.58%, 61.22% 98.19%, 61.77% 97.77%, 62.74% 98.47%,
    62.47% 99.86%,
    72.58% 99.86%, 72.58% 98.19%, 72.02% 96.66%, 72.44% 94.29%, 73.27% 91.09%,
    73.96% 88.58%, 74.65% 87.19%, 75.62% 88.02%, 76.18% 88.86%, 75.48% 90.53%,
    74.52% 93.73%, 73.96% 96.80%, 73.13% 97.63%, 72.58% 98.19%, 72.58% 99.86%,
    86.15% 99.86%, 86.15% 99.30%, 87.12% 98.05%, 88.92% 93.59%,
    89.61% 90.67%, 90.03% 83.70%, 89.20% 81.34%, 88.37% 75.63%, 86.98% 72.14%,
    86.43% 71.73%, 86.57% 67.41%, 86.29% 65.46%, 84.90% 61.42%, 83.38% 59.05%,
    80.47% 56.55%, 76.73% 54.87%, 74.52% 54.74%, 72.16% 53.90%, 68.70% 52.23%,
    63.71% 49.03%, 63.71% 47.91%, 62.74% 47.21%, 62.74% 46.38%, 63.99% 45.54%,
    65.65% 39.69%, 68.98% 37.60%, 70.36% 35.65%, 70.91% 32.59%, 70.91% 30.22%,
    70.08% 27.58%, 71.75% 25.49%, 70.78% 23.12%, 68.98% 23.12%, 68.42% 22.70%,
    67.73% 19.50%, 67.87% 17.69%, 67.04% 16.71%, 66.07% 14.07%, 62.47% 9.75%,
    62.74% 8.91%, 63.71% 8.91%, 65.65% 8.08%, 65.10% 6.69%, 65.10% 4.18%
  );
}
.switch-art { width: 100%; height: 100%; stroke: none; pointer-events: none; }
.switch-powder { transform-origin: 37px 27px; }
.switch-nose { transform-origin: 25px 6px; }
input:checked + .switch { background: var(--accent); }
input:checked + .switch .switch-thumb { transform: translateX(37px); }
input:checked + .switch .switch-powder { transform: scale(0); opacity: 0; }
input:checked + .switch .switch-grains { transform: translate(16px,0); opacity: 0; }
input:focus-visible + .switch { outline: 3px solid #356cb5; outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  /* On release, return the grains to the pile before the nose slides away. */
  .switch-thumb { transition: transform .24s .38s ease-out; }
  .switch-grains { transition: transform .4s ease-out, opacity .08s ease-out; }
  .switch-powder { transition: transform .35s .18s ease-out, opacity .12s .18s ease-out; }
  input:checked + .switch .switch-thumb { transition-delay: 0s; }
  input:checked + .switch .switch-nose { animation: switch-sniff .78s .24s ease-in-out; }
  input:checked + .switch .switch-powder {
    transition: transform .5s .24s ease-in, opacity .12s .62s ease-in;
  }
  input:checked + .switch .switch-grains {
    transition: transform .47s .36s ease-in, opacity .1s .73s ease-in;
  }
}
@keyframes switch-sniff {
  0%, 100% { transform: none; }
  55% { transform: translate(-2px,1px) rotate(9deg); }
}
.profile-card { overflow: hidden; }
.profile-band { background: #2c4977; color: #fff; display: flex; align-items: center; gap: 11px; padding: 19px 16px; }
.profile-band .caption { font-size: .73rem; color: #dfe8f5; }
.profile-band h2 { overflow-wrap: anywhere; font-size: 1.42rem; margin-top: 2px; }
.profile-avatar { background: #fff0c8; color: #46371c; border-radius: 8px; width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; font-weight: 660; font-size: .91rem; }
.profile-card-body { padding: 14px 16px; }
.profile-id { font-size: .75rem; color: var(--muted); margin-bottom: 10px; }
.facts { display: grid; gap: 9px; }
.fact { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: .82rem; }
.fact dt { color: var(--muted); }
.fact dd { text-align: right; font-weight: 570; overflow-wrap: anywhere; }
.pause-row { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .83rem; }
.rail-heading { padding: 10px 13px 7px 16px; }
.rail-heading h2 { font-size: 1.25rem; }
.rail-empty,.empty { color: var(--muted); line-height: 1.55; }
.rail-empty { padding: 0 16px 15px; font-size: .84rem; }
.recent-row { padding: 9px 16px; border-top: 1px solid #e2dccc; }
.recent-row strong,.recent-row small { display: block; }
.recent-row strong { font-size: .86rem; font-weight: 610; }
.recent-row small { font-size: .76rem; }
.empty { padding: 24px 20px; }
.activity-card .section-head { border-bottom: 1px solid var(--line); }
.activity-card .section-head select { font-size: .83rem; padding: 5px 8px; }
.ledger-row { display: grid; grid-template-columns: minmax(120px,1fr) minmax(90px,.55fr) minmax(110px,1fr); align-items: start; gap: 14px; padding: 15px 20px; border-top: 1px solid #e2dccc; font-size: .86rem; }
.ledger-row:first-child { border: 0; }
.ledger-row strong,.ledger-row small { display: block; }
.ledger-row p { margin-top: 3px; }
.ledger-row .event-meta { color: var(--muted); font-size: .79rem; }
.tag { display: inline-flex; width: fit-content; align-items: center; padding: 3px 8px; border-radius: 4px; background: #e5f2e9; color: #245f44; font-size: .77rem; font-weight: 610; }
.tag.warn { background: #fbefe1; color: #80511e; }
.archive-card { padding-bottom: 3px; }
.archive-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 14px 22px; padding: 19px 20px 13px; }
.archive-head h2 { font-size: 1.55rem; }
.archive-source { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; color: var(--muted); font-size: .83rem; }
.archive-source a { color: var(--accent); text-underline-offset: .16em; }
.archive-filters { display: grid; gap: 3px; }
.archive-filters select { width: auto; min-height: 38px; }
.archive-symbols { min-width: 0; padding: 0; border: 0; margin: 2px 20px 10px; }
.archive-symbols legend { padding: 0; margin-bottom: 5px; }
.archive-symbol-options { display: flex; flex-wrap: wrap; gap: 5px; }
.archive-symbol-option {
  min-height: 36px; padding: 5px 11px; border: 1px solid #c8c3b5; border-radius: 6px;
  color: var(--ink); background: #fffdf8; font-size: .8rem; font-weight: 600; line-height: 1.2;
}
.archive-symbol-option:hover { border-color: var(--accent); }
.archive-symbol-option::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 6px 1px 0;
  border: 1px solid #9b9fa7; border-radius: 50%;
}
.archive-symbol-option[aria-pressed="true"] { border-color: var(--accent-dark); background: var(--accent-dark); color: white; }
.archive-symbol-option[aria-pressed="true"]::before {
  width: 7px; height: 4px; margin-bottom: 3px; border: solid white; border-width: 0 0 2px 2px;
  border-radius: 0; transform: rotate(-45deg);
}
@media (pointer: coarse) {
  .archive-symbol-option { min-height: 44px; }
}
.archive-feedback, #archive-scroll-hint { padding: 6px 20px 10px; color: var(--muted); font-size: .83rem; }
#archive-scroll-hint { display: block; padding-top: 0; }
#archive-retry { margin: 0 20px 14px; }
.archive-scroll { max-width: 100%; overflow-x: auto; margin: 0 0 2px; border-block: 1px solid var(--line); }
.archive-scroll:focus-visible { outline: 3px solid #356cb5; outline-offset: -3px; }
.archive-table { width: 100%; border-collapse: collapse; font-size: .84rem; text-align: left; font-variant-numeric: tabular-nums; }
.archive-table th,.archive-table td { white-space: nowrap; padding: .65rem .75rem; }
.archive-table thead { background: #f0ebdd; }
.archive-table thead th { font-size: .8rem; }
.archive-table tbody tr + tr { border-top: 1px solid #e6dfd0; }
.archive-table tbody tr:nth-child(even) { background: #fbf8ef; }
.archive-table .archive-price,.archive-table thead th:nth-child(n+5) { text-align: right; }
.archive-outcome { font-weight: 650; }
.archive-outcome.target { color: #286248; }
.archive-outcome.stop { color: #92482f; }
.archive-paging { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; padding: 10px 16px; }
.archive-paging select { width: auto; min-height: 38px; }
.archive-paging button:disabled { color: #666e78; background: #f3f0e7; }
.mt5-card { max-width: 760px; container-type: inline-size; }
.mt5-card .section-head { border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mt5-card > .section-body:first-child { padding-top: 18px; }
.mt5-card > .secondary { margin: 0 20px 18px; }
.mt5-body { display: grid; gap: 15px; padding-top: 16px; }
.mt5-body > p { max-width: 62ch; }
.mt5-body > button { justify-self: start; }
.mt5-body [role="status"]:empty { display: none; }
.mt5-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 18px; }
.mt5-form label { display: grid; align-content: start; gap: 4px; }
.mt5-form input { min-height: 44px; }
.mt5-form input:disabled { background: #f2efe6; }
.mt5-form .primary { grid-column: 1/-1; justify-self: start; }
.mt5-use-server { justify-self: start; }
.mt5-setup { grid-column: 1/-1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.mt5-setup p { flex: 1 1 20rem; font-size: .87rem; }
.mt5-setup button { min-height: 44px; }
.mt5-picker { grid-column: 1/-1; display: grid; gap: 4px; min-width: 0; }
.mt5-picker-control { position: relative; }
.mt5-servers { position: absolute; inset: calc(100% + 4px) 0 auto; z-index: 3; max-height: min(270px,36vh); overflow-y: auto; overscroll-behavior: contain; list-style: none; margin: 0; padding: 4px; background: #fff; border: 1px solid #a9a28f; border-radius: 6px; box-shadow: 0 6px 16px #1b31592b; }
.mt5-servers li { display: grid; align-content: center; min-height: 44px; padding: 7px 10px; border-radius: 4px; cursor: pointer; overflow-wrap: anywhere; }
.mt5-servers li:hover,.mt5-servers li[aria-selected="true"] { color: var(--accent-dark); background: var(--tint); }
.mt5-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 16px; }
.mt5-summary > div { display: grid; min-width: 0; overflow-wrap: anywhere; }
.mt5-connected { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; font-size: .85rem; font-weight: 650; color: #315e46; background: #edf4eb; border: 1px solid #bacbb7; border-radius: 5px; }
.mt5-connected::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #418354; }
@container (max-width:490px) {
  .method-grid { grid-template-columns: minmax(0,1fr); }
}
@container (max-width:440px) {
  .mt5-form { grid-template-columns: minmax(0,1fr); }
}
.access-row { border-top: 1px solid var(--line); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.access-row small { display: block; }
.inline-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-form,.share-box { padding: 16px 20px; border-top: 1px solid var(--line); }
.inline-form,.share-box > div { display: flex; align-items: end; gap: 9px; }
.share-box small { display: block; margin-top: 7px; }
.locked-panel { margin: clamp(42px,13vh,140px) auto; width: min(500px,calc(100% - 40px)); padding: 30px; background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--accent); border-radius: 8px; }
.locked-panel h1 { font-size: 2.25rem; margin-bottom: 14px; }
.locked-panel p { color: var(--muted); }
.locked-panel details { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.locked-panel summary { color: var(--accent); font-weight: 700; cursor: pointer; }
.locked-panel details p { margin-top: 8px; }
.lock-icon { color: var(--accent); margin-bottom: 16px; }
.lock-icon svg { width: 29px; height: 29px; }
#lock-status:not(:empty) { margin-top: 12px; color: var(--danger); }
.market-content { min-width: 0; }
.rule-card[data-icon="scope"] { container-type: inline-size; }
.gold-ticket {
  position: relative; isolation: isolate; width: 100%; min-width: 0; min-height: 138px;
  display: grid; grid-template-columns: minmax(0,1fr) auto auto; grid-template-areas: "type art action";
  align-items: center; gap: 12px; padding: 17px 19px 17px 25px; text-align: left;
  color: var(--gold); background: #203961; border: 2px solid #152c4d; border-radius: 8px;
  box-shadow: 0 3px 0 #c99b4c; touch-action: manipulation;
}
.gold-ticket::before {
  content: ""; position: absolute; z-index: -1; inset: 4px; border: 1px solid #aa9058;
  border-radius: 4px; pointer-events: none;
}
.gold-ticket:hover { background: #284775; }
.gold-ticket:active { transform: translateY(2px); box-shadow: 0 1px 0 #ae7c2b; }
.gold-ticket:focus-visible { outline: 3px solid #1d5eac; outline-offset: 4px; }
.gold-type { grid-area: type; min-width: 0; }
.gold-symbol {
  display: block; width: fit-content; color: var(--gold); letter-spacing: -.065em;
  font: 900 clamp(3.1rem,9.5cqi,5rem)/.94 "Rockwell", "American Typewriter", Georgia, serif;
  text-shadow: 1px 2px 0 #6d4924;
}
.gold-nickname {
  display: block; margin: 4px 0 0 3px; color: #ffe4a6;
  font: italic 600 clamp(1.1rem,3.4cqi,1.48rem)/1.15 var(--display);
}
.gold-art { grid-area: art; display: grid; place-items: center; pointer-events: none; }
.gold-art > svg { display: block; width: clamp(130px,25cqi,183px); height: auto; aspect-ratio: 168/82; }
.hunt-lid-inside, .hunt-lid-top { transform-origin: 38px 49px; }
.hunt-lid-top, .hunt-sniff { opacity: 0; }
.hunt-body { transform-origin: 108px 53px; }
.hunt-leg-back { transform-origin: 114px 50px; }
.hunt-leg-front { transform-origin: 103px 50px; }
@media (prefers-reduced-motion: no-preference) {
  .gold-art { --hunt-cycle: 7.6s; }
  .gold-art .hunt-walker { animation: treasure-walk var(--hunt-cycle) linear infinite; }
  .gold-art .hunt-body { animation: treasure-sniff var(--hunt-cycle) ease-in-out infinite; }
  .gold-art .hunt-leg-front, .gold-art .hunt-leg-back { animation: treasure-steps var(--hunt-cycle) ease-in-out infinite; }
  .hunt-leg-front { --stride: 17deg; --backstride: -17deg; }
  .hunt-leg-back { --stride: -17deg; --backstride: 17deg; }
  .gold-art .hunt-sniff { animation: treasure-scent var(--hunt-cycle) ease-out infinite; }
  .gold-art .hunt-lid-top { animation: treasure-lid var(--hunt-cycle) ease-in-out infinite; }
  .gold-art .hunt-lid-inside { animation: treasure-lining var(--hunt-cycle) ease-out infinite; }
  .gold-art .hunt-loot { animation: treasure-reveal var(--hunt-cycle) ease-out infinite; }
  .gold-art .hunt-glints { animation: treasure-glimmer var(--hunt-cycle) ease-in-out infinite; }
}
@keyframes treasure-walk {
  0%, 100% { transform: translateX(29px); }
  31% { transform: translateX(4px); }
  37%, 60% { transform: translateX(0); }
  65% { transform: translate(4px,-2px); }
  70%, 78% { transform: translateX(4px); }
  98% { transform: translateX(29px); }
}
@keyframes treasure-steps {
  0%, 36%, 78%, 100% { transform: rotate(0); }
  3%, 14%, 25%, 81%, 92% { transform: rotate(var(--stride)); }
  8.5%, 19.5%, 30.5%, 86.5%, 97% { transform: rotate(var(--backstride)); }
}
@keyframes treasure-sniff {
  0%, 6%, 17%, 28%, 37%, 46%, 56%, 62%, 71%, 78%, 84%, 95%, 100% { transform: none; }
  3%, 11.5%, 22.5%, 33.5%, 81%, 89.5%, 97.5% { transform: translateY(-1.5px); }
  42%, 51% { transform: translate(-2px,1px) rotate(-8deg); }
  66% { transform: translateY(-2px) rotate(6deg); }
}
@keyframes treasure-scent {
  0%, 37%, 46%, 55%, 100% { opacity: 0; transform: translateX(-3px); }
  41%, 50% { opacity: .95; transform: translateX(0); }
  44%, 53% { opacity: 0; transform: translateX(3px); }
}
@keyframes treasure-lid {
  0%, 54%, 93%, 100% { opacity: 1; transform: scaleY(1); }
  59%, 88% { opacity: 1; transform: scaleY(.12); }
  60%, 87% { opacity: 0; transform: scaleY(.07); }
}
@keyframes treasure-lining {
  0%, 56%, 91%, 100% { opacity: 0; transform: scaleY(.07); }
  60%, 87% { opacity: 1; transform: scaleY(.19); }
  65%, 82% { opacity: 1; transform: scaleY(1); }
}
@keyframes treasure-reveal {
  0%, 59%, 90%, 100% { opacity: 0; transform: translateY(10px); }
  66%, 82% { opacity: 1; transform: translateY(0); }
}
@keyframes treasure-glimmer {
  0%, 63%, 86%, 100% { opacity: 0; }
  68%, 79% { opacity: 1; }
  73% { opacity: .35; }
}
.gold-action {
  grid-area: action; align-self: stretch; display: flex; flex-direction: column-reverse;
  align-items: center; justify-content: center; gap: 7px; padding-left: 15px;
  border-left: 1px dashed #ae945b; color: #fff0ce; text-align: center;
  font-size: .82rem; font-weight: 700; line-height: 1.15;
}
.gold-action svg { width: 27px; height: 27px; color: #203961; background: #ffe4a6; border-radius: 50%; padding: 5px; stroke-width: 2.4; }
.gold-ticket[aria-pressed="true"] .gold-action svg { color: #fff2c6; background: #41694e; }
@container (max-width: 640px) {
  .gold-ticket {
    grid-template-columns: minmax(0,1fr) auto; grid-template-areas: "type art" "action art";
    gap: 9px 3px; min-height: 131px; padding: 15px 15px 16px 19px;
  }
  .gold-symbol { font-size: clamp(2.75rem,13.4cqi,4.2rem); }
  .gold-action { justify-self: start; flex-direction: row-reverse; gap: 6px; padding: 0; border: 0; }
  .gold-action svg { width: 19px; height: 19px; padding: 3px; }
  .gold-art > svg { width: clamp(88px,30cqi,154px); }
}
@container (max-width: 450px) {
  .gold-ticket { grid-template-columns: 1fr auto; grid-template-areas: "type type" "action art"; gap: 0 4px; }
  .gold-art > svg { width: 91px; }
}
.market-disclosure { border-top: 1px solid #e0d9c8; padding-top: 10px; }
.market-disclosure summary { color: var(--muted); cursor: pointer; font-size: .82rem; }
.market-disclosure summary:hover { color: var(--accent); }
.symbol-cloud,.symbol-grid { display: flex; flex-wrap: wrap; gap: 5px; padding-top: 8px; }
.market-tag,.symbol-button { border-radius: 4px; padding: 3px 8px; font-size: .78rem; font-weight: 570; }
.market-tag { color: #3d4e65; background: #f1eddf; }
.symbol-button { min-height: 29px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.symbol-button[aria-pressed="true"] { background: var(--tint); color: var(--accent-dark); border-color: #6a86aa; }
.symbol-button[aria-pressed="true"]::after { content: " ✓"; }
.symbol-caption,.lot-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.symbol-caption { margin-bottom: 6px; }
.lot-row { align-items: end; justify-content: start; }
.lot-row .field { width: min(190px,100%); }
.setting-note { font-size: .83rem; color: var(--muted); margin-bottom: 8px; max-width: 205px; }
.profile-status { display: flex; align-items: center; gap: 5px; }
.profile-status::before { content: ""; border-radius: 100%; height: 6px; width: 6px; background: var(--accent); }
.profile-status.paused::before { background: #ad743b; }
@media (min-width:1550px) { .workspace { padding-top: 43px; } .right-rail { max-width: 350px; } }
@media (max-width:1120px) {
  .shell { grid-template-columns: 185px minmax(0,1fr); }
  .spine { padding-inline: 10px; }
  .brand-mark { width: 34px; height: 34px; }
  .workspace,.topbar { padding-inline: 24px; }
  .rule-layout { grid-template-columns: minmax(0,1fr) 215px; gap: 13px; }
}
@media (max-width:920px) {
  .shell { grid-template-columns: 170px minmax(0,1fr); }
  .nav-item { gap: 8px; padding-inline: 10px; font-size: .88rem; }
  .rule-layout { grid-template-columns: minmax(0,1fr); }
  .right-rail { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-actions { gap: 6px; }
}
@media (max-width:700px) {
  .shell { display: block; }
  .spine { position: static; width: 100%; height: auto; padding: 12px 15px 8px; gap: 10px; display: grid; grid-template-columns: 1fr auto; align-items: center; }
  .brand { padding: 0; }
  .brand-name { font-size: 1.17rem; }
  .brand-mark { width: 31px; height: 31px; }
  .spine nav { grid-column: 1/-1; grid-row: 2; margin: 0; flex-direction: row; gap: 3px; flex-wrap: wrap; }
  .nav-item { width: auto; padding: 6px 9px; font-size: .82rem; gap: 5px; }
  .nav-item svg { width: 14px; height: 14px; }
  .nav-access { margin: 0; }
  .session-controls { grid-column: 2; grid-row: 1; border: 0; margin: 0; padding: 0; gap: 3px; font-size: .72rem; }
  .role-avatar { display: none; }
  .topbar { min-height: 50px; padding: 0 16px; }
  .workspace { padding: 23px 15px 44px; }
  .page-head { align-items: start; gap: 10px; margin-bottom: 18px; padding-bottom: 12px; }
  .page-head p { font-size: .87rem; }
  .page-actions { flex-wrap: wrap; justify-content: start; gap: 6px; }
  #save-state { font-size: .72rem; }
  .page-actions .primary { white-space: nowrap; }
  .section-head,.rule-heading { padding: 14px 15px 10px; }
  .rule-body,.section-body { padding: 3px 15px 16px; }
  .ledger-row { grid-template-columns: 1fr auto; padding: 12px 14px; gap: 6px; }
  .ledger-row > :last-child { grid-column: 1/-1; }
  .access-row { flex-wrap: wrap; padding-inline: 15px; }
  .inline-form,.share-box { padding-inline: 15px; }
}
@media (max-width:430px) {
  .nav-item { padding: 6px; font-size: .76rem; }
  .nav-item svg { width: 13px; }
  .profile-picker { min-width: 117px; max-width: 150px; }
  .breadcrumbs { font-size: .76rem; gap: 3px; }
  .primary,.secondary { padding-inline: .66rem; }
  .right-rail { grid-template-columns: minmax(0,1fr); }
  .lot-row { flex-wrap: wrap; gap: 4px; }
  .setting-note { max-width: none; margin: 0; }
  .page-head { flex-wrap: wrap; }
  .page-actions { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 8px; }
  #save-state { grid-area: 1/1; }
  #discard { grid-area: 2/1; justify-self: start; padding-left: 0; }
  #save { grid-area: 1/2/3/3; }
  #discard[hidden] + #save { grid-row: 1; }
}

.tzedakah-dialog {
  width: min(23rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem);
  margin: auto; padding: 0 0 20px; overflow: auto; overscroll-behavior: contain;
  color: var(--ink); background: var(--card); text-align: center;
  border: 1px solid #8e7854; border-radius: 15px; box-shadow: 0 16px 60px #12234142;
}
.tzedakah-dialog::backdrop { background: #15243bc2; }
.tzedakah-art {
  display: grid; place-items: center; height: clamp(116px,29dvh,198px);
  background: radial-gradient(ellipse at center, #fffae8 10%, #e7efdd 94%);
  border-bottom: 1px solid #cad1b9;
}
.tzedakah-art > svg { width: min(92%,210px); height: 96%; }
.tzedakah-dialog h2 { margin: 19px 16px 6px; font-size: 2.3rem; }
.tzedakah-dialog h2:focus { outline: none; }
.tzedakah-dialog p { margin: 0 auto; padding-inline: 19px; max-width: 22rem; color: var(--muted); font-size: .94rem; }
.tzedakah-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 18px 20px 0; }
.tzedakah-choices button { min-height: 44px; }
.tzedakah-choices .primary { background: #215442; border-color: #184331; }
.tzedakah-choices .primary:hover { background: #163c2e; }

.gold-coin-shower {
  position: fixed; inset: 0; z-index: 20; overflow: hidden;
  pointer-events: none; user-select: none; contain: strict;
}
.gold-coin-shower > span {
  position: absolute; top: -34px; width: var(--coin-size); height: var(--coin-size);
  border: 1px solid #a16821; border-radius: 50%;
  background: radial-gradient(ellipse at 28% 19%, #fff3bc 0, transparent 42%),
              linear-gradient(135deg, #e9aa3a 10%, var(--gold) 33%, #e6a138 60%, #ba7b26);
  box-shadow: inset 0 0 0 1px #ffdf8d, inset 0 0 0 3px #c78c34, 1px 2px #956424;
  animation: gold-coin-fall var(--coin-fall) cubic-bezier(.37,.15,.71,.72) var(--coin-delay) both;
}
.gold-coin-shower > span::after {
  content: ""; position: absolute; inset: 30% 34%; transform: rotate(34deg);
  border: 1px solid #ac7328; border-radius: 1px;
  background: linear-gradient(100deg, #fbe3a1 48%, #d09233 50%);
}
@keyframes gold-coin-fall {
  from { transform: translate3d(-50%, 0, 0) rotate(var(--coin-tilt)) rotateY(30deg); }
  to { transform: translate3d(var(--coin-drift), calc(100vh + 70px), 0) rotate(calc(var(--coin-tilt) + 150deg)) rotateY(580deg); }
}
@media (prefers-reduced-motion: reduce) {
  .gold-coin-shower { display: none; }
}

.tzedakah-toy {
  display: block; width: min(100%, 200px); height: auto; margin: auto;
  fill: none; stroke: none; stroke-width: 1; overflow: visible;
}
.tzedakah-toy .tzedakah-toy-strike { opacity: 0; }
@media (prefers-reduced-motion: no-preference) {
  .tzedakah-toy .tzedakah-toy-hand { animation: tzedakah-clap 1.65s ease-in-out infinite; }
  .tzedakah-toy .tzedakah-toy-sleeve {
    transform-box: fill-box; transform-origin: left center;
    animation: tzedakah-reach 1.65s ease-in-out infinite;
  }
  .tzedakah-toy .tzedakah-toy-head { animation: tzedakah-nod 1.65s ease-in-out infinite; }
  .tzedakah-toy .tzedakah-toy-strike { animation: tzedakah-ring 1.65s ease-out infinite; }
}
@keyframes tzedakah-clap {
  0%, 13%, 72%, 100% { transform: translate(0, 0); }
  29%, 33%, 47%, 50% { transform: translate(12px, -1px); }
  40% { transform: translate(5px, 0); }
}
@keyframes tzedakah-reach {
  0%, 13%, 72%, 100% { transform: scaleX(1); }
  29%, 33%, 47%, 50% { transform: scaleX(1.51); }
  40% { transform: scaleX(1.2); }
}
@keyframes tzedakah-nod {
  0%, 16%, 40%, 63%, 100% { transform: translateY(0); }
  31%, 49% { transform: translateY(1.8px); }
}
@keyframes tzedakah-ring {
  0%, 27%, 40%, 45%, 58%, 100% { opacity: 0; }
  30%, 48% { opacity: .95; }
}
