
.legal-nav-links { display: flex; align-items: center; gap: 0.5rem; }
.legal-nav-links a.tab { font-weight: 800; text-decoration: none; padding: 0.3rem 0.75rem; border-radius: 12px; border: 2.5px solid transparent; white-space: nowrap; }
.legal-nav-links a.tab:hover { border-color: var(--ink); background: #fff; }
.legal-nav-links a.tab.on { background: var(--yellow); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
@media (max-width: 760px) { .legal-nav-links a.tab:not(.on) { display: none; } }

@media (max-width: 520px) { .legal-nav-links a.tab { display: none; } }

.legal-wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.legal-head {
  position: relative; overflow: hidden; margin-top: 2.2rem; padding: 2.2rem 2.4rem;
  background: var(--yellow); border: var(--b); border-radius: 26px; box-shadow: var(--s-lg);
}
.legal-head::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 90% 10%, rgba(255,255,255,0.4), transparent 40%), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240' viewBox='0 0 240 240'%3E%3Cdefs%3E%3Cg id='p'%3E%3Cellipse cx='0' cy='8' rx='11' ry='9'/%3E%3Ccircle cx='-12' cy='-4' r='4.5'/%3E%3Ccircle cx='-4.5' cy='-11' r='4.5'/%3E%3Ccircle cx='4.5' cy='-11' r='4.5'/%3E%3Ccircle cx='12' cy='-4' r='4.5'/%3E%3C/g%3E%3Cpath id='s' d='M0-9C1-3 3-1 9 0 3 1 1 3 0 9-1 3-3 1-9 0-3-1-1-3 0-9Z'/%3E%3C/defs%3E%3Cg fill='%23ffffff' fill-opacity='0.11'%3E%3Cuse href='%23p' transform='translate%2842 52%29 rotate%28-20%29 scale%281.0%29'/%3E%3Cuse href='%23p' transform='translate%28172 40%29 rotate%2825%29 scale%280.65%29'/%3E%3Cuse href='%23p' transform='translate%28120 142%29 rotate%2810%29 scale%281.25%29'/%3E%3Cuse href='%23p' transform='translate%2834 190%29 rotate%28-35%29 scale%280.7%29'/%3E%3Cuse href='%23p' transform='translate%28206 178%29 rotate%2840%29 scale%280.9%29'/%3E%3Cuse href='%23s' transform='translate%2898 62%29 rotate%280%29 scale%281.0%29'/%3E%3Cuse href='%23s' transform='translate%28216 104%29 rotate%2815%29 scale%280.7%29'/%3E%3Cuse href='%23s' transform='translate%2870 122%29 rotate%280%29 scale%280.55%29'/%3E%3Cuse href='%23s' transform='translate%28150 218%29 rotate%2820%29 scale%280.85%29'/%3E%3Ccircle cx='140' cy='20' r='2.2'/%3E%3Ccircle cx='12' cy='110' r='2.2'/%3E%3Ccircle cx='230' cy='230' r='2.2'/%3E%3Ccircle cx='92' cy='230' r='2.2'/%3E%3Ccircle cx='190' cy='140' r='2.2'/%3E%3C/g%3E%3C/svg%3E");
}
.legal-head > * { position: relative; }
.legal-head h1 { font-size: clamp(2rem, 5vw, 3.2rem); line-height: 1.02; margin: 0.8rem 0 0.4rem; }
.legal-head p { margin: 0; font-weight: 700; color: #4a3a1c; max-width: 640px; }
.legal-head .updated { display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.9rem; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 999px; padding: 0.1rem 0.75rem; font-weight: 800; font-size: 0.85rem; box-shadow: 2px 2px 0 var(--ink); }

.legal-layout { display: grid; grid-template-columns: 1fr 260px; gap: 2rem; align-items: start; margin: 2rem 0 3rem; }
.legal-layout.single { grid-template-columns: minmax(0, 720px); justify-content: center; }
@media (max-width: 900px) { .legal-layout { grid-template-columns: 1fr; } .toc { display: none; } }

.legal-card {
  background: var(--paper); border: var(--b); border-radius: var(--r); box-shadow: var(--s);
  padding: 2rem 2.2rem; counter-reset: sec;
}
@media (max-width: 560px) { .legal-card { padding: 1.4rem 1.2rem; } .legal-head { padding: 1.6rem 1.3rem; } }
.legal-card > p:first-child { font-size: 1.08rem; font-weight: 700; color: var(--ink); margin-top: 0; }
.legal-card p, .legal-card li { font-weight: 600; color: var(--muted); line-height: 1.7; }
.legal-card ul { padding-left: 1.2rem; margin: 0.4rem 0 0; }
.legal-card li { margin-bottom: 0.35rem; }
.legal-card li::marker { color: var(--coral); }
.legal-card strong { color: var(--ink); }
.legal-card a { font-weight: 800; color: var(--ink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.legal-card a:hover { color: var(--coral); }

.legal-card section { scroll-margin-top: 100px; margin-top: 1.6rem; padding: 1.6rem 0 0; border-top: 2px dashed #e4d3b1; }
.legal-card section h2 { display: flex; align-items: center; gap: 0.65rem; font-size: 1.35rem; line-height: 1.15; margin: 0 0 0.5rem; }
.legal-card section h2::before {
  counter-increment: sec; content: counter(sec);
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: var(--yellow); border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-size: 1rem;
}
.legal-card section:nth-of-type(3n+2) h2::before { background: var(--teal); }
.legal-card section:nth-of-type(3n) h2::before { background: var(--pink); }

.toc { position: sticky; top: 96px; background: var(--paper); border: var(--b); border-radius: var(--r); box-shadow: var(--s-sm); padding: 1rem; }
.toc .eyebrow { margin-bottom: 0.7rem; }
.toc a { display: block; padding: 0.35rem 0.6rem; border-radius: 10px; font-weight: 700; font-size: 0.92rem; text-decoration: none; color: var(--muted); }
.toc a:hover { background: #fff3cf; color: var(--ink); }

.legal-more { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.4rem; }

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 800; margin-bottom: 0.35rem; }
.field input, .field textarea {
  width: 100%; padding: 0.7rem 0.9rem; border: var(--b); border-radius: 14px; background: #fff;
  font: 600 1rem "Baloo 2", sans-serif; color: var(--ink); resize: vertical;
}
.field input:focus, .field textarea:focus { outline: none; box-shadow: var(--s-sm); }
.legal-card .warn { margin: 0 0 1.4rem; }
.btn-danger { background: #e5372b; color: #fff; }
.btn[disabled] { opacity: 0.6; cursor: wait; transform: none; }
.form-error { display: flex; gap: 0.6rem; align-items: center; background: #ffe1db; border: var(--b); border-radius: 14px; padding: 0.7rem 1rem; font-weight: 800; margin-bottom: 1.2rem; }
.form-error[hidden], .success[hidden] { display: none; }
.success { text-align: center; padding: 1rem 0 0.5rem; }
.success img { width: 230px; margin: 0 auto 1rem; }
.success h2 { margin: 0 0 0.4rem; font-size: 1.8rem; }

.legal-foot { background: var(--ink); color: var(--cream); border-top: var(--b); padding: 1.6rem 0; }
.legal-foot .legal-wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem; align-items: center; }
.legal-foot nav { display: flex; flex-wrap: wrap; gap: 1.1rem; font-weight: 700; }
.legal-foot a { text-decoration: none; color: #e8dfc8; }
.legal-foot a:hover { color: var(--yellow); }
.legal-foot small { color: #b9b09a; font-weight: 600; }

.fb-stats { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.1rem; }
.fb-stat { background: var(--paper); border: 2.5px solid var(--ink); border-radius: 14px; box-shadow: 2px 2px 0 var(--ink); padding: 0.35rem 0.9rem; font-weight: 700; }
.fb-stat b { font-size: 1.35rem; margin-right: 0.25rem; }
@media (max-width: 520px) { .fb-stats { gap: 0.5rem; } .fb-stat { padding: 0.3rem 0.7rem; font-size: 0.9rem; } .fb-stat b { font-size: 1.15rem; } }

.fb-actions { display: flex; align-items: flex-end; gap: 0.5rem; margin: 1.8rem 0 0; position: relative; z-index: 1; }
.fb-action {
  position: relative; display: flex; align-items: center; gap: 0.8rem; text-decoration: none;
  padding: 0.75rem 1.3rem 0.7rem; border: var(--b); border-bottom: 0; border-radius: 18px 18px 0 0;
  background: #eadcbc; color: var(--muted); transition: background 0.12s ease, padding 0.12s ease;
}
.fb-action .ic { margin: 0; flex-shrink: 0; width: 40px; height: 40px; font-size: 1.15rem; }
.fb-action b { display: block; font-size: 1.1rem; line-height: 1.1; }
.fb-action small { font-weight: 600; color: var(--muted); }
.fb-action[aria-selected="true"] { background: var(--paper); color: var(--ink); padding: 0.95rem 1.5rem 1rem; margin-bottom: -2.5px; }

.fb-action[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 6px; background: var(--paper); }
.fb-action[aria-selected="false"]:hover { background: #f2e7cd; color: var(--ink); }
.fb-action[aria-selected="false"] .ic { filter: saturate(0.6); }
.fb-action:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

#panel-ideas .fb-block > .legal-card:first-child, #panel-bug .fb-block > .legal-card:first-child { border-top-left-radius: 0; }
@media (max-width: 640px) {
  .fb-actions { gap: 0.35rem; padding-right: var(--r); }
  .fb-action { flex: 1; min-width: 0; gap: 0.4rem; padding: 0.55rem 0.5rem 0.5rem; border-radius: 14px 14px 0 0; }
  .fb-action[aria-selected="true"] { padding: 0.75rem 0.55rem 0.8rem; }
  .fb-action small { display: none; }
  .fb-action .ic { width: 26px; height: 26px; font-size: 0.8rem; border-radius: 8px; }
  .fb-action b { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .fb-action > span:not(.ic) { min-width: 0; }
}
#panel-ideas[hidden], #panel-bug[hidden] { display: none; }

.fb-block { margin-bottom: 1.6rem; padding: 0; scroll-margin-top: 100px; }
.fb-step { display: inline-block; background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 999px; padding: 0 0.7rem; font-weight: 800; font-size: 0.78rem; margin-bottom: 0.4rem; }
.fb-block h2 { font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.08; margin: 0.2rem 0 0.4rem; }
.fb-block > .legal-card > p { margin-top: 0; }

.fb-flow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1.2rem 2rem; padding: 1.3rem 1.5rem; margin-bottom: 1.4rem; }
@media (max-width: 820px) { .fb-flow { grid-template-columns: 1fr; } }
.fb-flow-steps { --p: 0; position: relative; display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; padding: 0; margin: 0; text-align: center; }
.fb-flow-steps::before, .fb-flow-steps::after { content: ""; position: absolute; top: 17px; left: 16.66%; height: 10px; border-radius: 999px; }
.fb-flow-steps::before { right: 16.66%; background: #fff; border: 2.5px solid var(--ink); }
.fb-flow-steps::after {
  top: 19.5px; width: calc(66.68% * var(--p));
  background: repeating-linear-gradient(-45deg, var(--coral) 0 8px, #ff9a7a 8px 16px);
  transition: width 0.6s cubic-bezier(.3, 1.4, .5, 1);
}
.fb-flow.unlocked .fb-flow-steps { --p: 1; }
.fb-flow-steps li { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; padding: 0 0.3rem; }
.fb-flow-dot {
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem;
  background: #fff; border: var(--b); border-radius: 50%; box-shadow: 2px 2px 0 var(--ink); margin-bottom: 0.35rem;
  transition: background 0.3s ease 0.3s, transform 0.3s ease 0.3s;
}
.fb-flow-steps li:first-child .fb-flow-dot, .fb-flow.unlocked .fb-flow-dot { background: var(--yellow); }
.fb-flow.unlocked li:last-child .fb-flow-dot { background: var(--coral); color: #fff; transform: rotate(-8deg) scale(1.08); }

.fb-flow.celebrate .fb-flow-dot { animation: dot-wobble 0.55s ease both; }
.fb-flow.celebrate li:nth-child(2) .fb-flow-dot { animation-delay: 0.25s; }
.fb-flow.celebrate li:nth-child(3) .fb-flow-dot { animation-delay: 0.5s; }
.fb-flow.celebrate .fb-unlock { animation: unlock-pop 0.5s cubic-bezier(.3, 1.7, .5, 1) 0.65s both; }
@keyframes dot-wobble {
  0% { transform: rotate(0) scale(1); } 25% { transform: rotate(-16deg) scale(1.18); } 50% { transform: rotate(12deg) scale(1.12); }
  75% { transform: rotate(-6deg) scale(1.05); } 100% { transform: rotate(0) scale(1); }
}
@keyframes unlock-pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.06) rotate(-1deg); } 100% { transform: none; } }
.confetti { position: fixed; z-index: 2000; width: 9px; height: 13px; border: 1.5px solid var(--ink); border-radius: 2px; pointer-events: none; }
.fb-flow-steps b { line-height: 1.1; }
.fb-flow-steps small { font-weight: 600; color: var(--muted); line-height: 1.2; font-size: 0.8rem; }
.fb-flow-cta { min-width: 250px; }
.fb-flow-cta .fb-ok { font-size: 0.85rem; margin-top: 0.7rem; }
.fb-unlock { width: 100%; }
.fb-unlock[disabled] { background: #f1e6cc; color: #7a6a48; box-shadow: none; cursor: not-allowed; opacity: 1; }

.fb-board-head { padding: 1.3rem 1.5rem; margin-bottom: 1.4rem; }
.fb-board-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1.5rem; }
.fb-board-top h2 { margin: 0; display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.fb-count { font-size: 0.85rem; line-height: 1.5; font-weight: 800; background: var(--teal); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: 2px 2px 0 var(--ink); padding: 0.1rem 0.75rem; white-space: nowrap; }
.fb-search { display: flex; gap: 0.5rem; flex: 1 1 320px; max-width: 460px; }
.fb-search-input { position: relative; flex: 1; min-width: 0; }
.fb-search-input .bi { position: absolute; left: 0.9rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.fb-search-input input {
  width: 100%; padding: 0.65rem 0.9rem 0.65rem 2.4rem; border: var(--b); border-radius: 14px; background: #fff;
  font: 600 1rem "Baloo 2", sans-serif; color: var(--ink);
}
.fb-search-input input:focus { outline: none; box-shadow: var(--s-sm); }
.fb-search { align-items: stretch; }
.fb-search .btn { white-space: nowrap; padding-block: 0; box-shadow: var(--s-sm); }
.fb-board-sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; margin-top: 0.7rem; }
.fb-hint { display: block; font-weight: 600; color: var(--muted); }
.fb-hint.err { color: #c62d22; }
.fb-filters {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.7rem;
  margin-top: 1rem; padding: 0.7rem 0.8rem; background: #f4eee3; border-radius: 14px;
}
.fb-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.fb-chips button, .fb-sort button {
  font: 800 0.82rem "Baloo 2", sans-serif; border: 2.5px solid var(--ink); border-radius: 999px; padding: 0.15rem 0.75rem;
  background: #fff; color: var(--ink); cursor: pointer;
}
.fb-chips button[aria-pressed="true"] { background: var(--coral); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.fb-sort { display: inline-flex; border: 2.5px solid var(--ink); border-radius: 12px; overflow: hidden; }
.fb-sort button { border: 0; border-radius: 0; padding: 0.35rem 0.85rem; }
.fb-sort button + button { border-left: 2.5px solid var(--ink); }
.fb-sort button[aria-pressed="true"] { background: var(--teal); }

.fb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); gap: 1.6rem 1.3rem; padding-top: 0.6rem; }
.idea {
  position: relative; display: flex; flex-direction: column; padding: 1.3rem 1.2rem 1rem;
  background: #fff; border: var(--b); border-radius: var(--r); box-shadow: var(--s);
  transform: rotate(-0.8deg); transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.idea:nth-child(even) { transform: rotate(0.7deg); }
.idea:nth-child(3n) { transform: rotate(-0.3deg); }
.idea:hover { transform: rotate(0) translateY(-3px); box-shadow: var(--s-lg); }
.idea::before {
  content: ""; position: absolute; top: -11px; left: 50%; width: 70px; height: 20px; transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 207, 72, 0.75); border: 1.5px solid rgba(80, 43, 4, 0.25); border-radius: 3px;
}
.idea:nth-child(even)::before { background: rgba(120, 214, 200, 0.75); transform: translateX(-50%) rotate(4deg); }
.idea-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.idea-tag { font-size: 0.72rem; font-weight: 800; padding: 0.05rem 0.6rem; border-radius: 999px; background: #fff3cf; border: 2px solid var(--ink); }
.idea-tag.st-planned { background: var(--teal); }
.idea-tag.st-in_progress { background: var(--yellow); }
.idea-tag.st-done { background: #b9cf8f; }
.idea h3 { margin: 0 0 0.3rem; font-size: 1.25rem; line-height: 1.15; overflow-wrap: anywhere; }
.idea p { margin: 0; font-weight: 600; color: var(--muted); overflow-wrap: anywhere; white-space: pre-line; }
.idea-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-top: auto; padding-top: 1rem; }
.idea-foot small { font-weight: 700; color: var(--muted); }

.vote-pill { display: inline-flex; align-items: center; gap: 0.45rem; }
.vote-pill .vote-n { min-width: 2.2ch; text-align: center; font-size: 1.2rem; line-height: 1; }
.vote {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 1rem; padding: 0;
  background: #fff; color: var(--ink); border: 2.5px solid var(--ink); border-radius: 11px; box-shadow: 3px 3px 0 var(--ink);
  cursor: pointer; transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.12s ease;
}
.vote:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); background: #fff3cf; }
.vote:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.vote[data-v="1"][aria-pressed="true"] { background: var(--coral); color: #fff; }
.vote[data-v="-1"][aria-pressed="true"] { background: #6b8fd6; color: #fff; }
.vote[aria-pressed="true"] { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.vote[disabled] { opacity: 0.6; cursor: wait; }
.vote:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.vote-pill[data-my="1"] .vote-n { color: #d2452f; }
.vote-pill[data-my="-1"] .vote-n { color: #4f72bb; }

.fb-empty { grid-column: 1 / -1; text-align: center; font-weight: 800; padding: 1.6rem; background: var(--paper); border: var(--b); border-radius: var(--r); }
.fb-note { font-size: 0.78rem; font-weight: 600; color: var(--muted); text-align: center; margin: 1.6rem 0 0; }

.fb-dialog { width: min(520px, 92vw); padding: 1.4rem 1.5rem; border: var(--b); border-radius: 22px; box-shadow: var(--s-lg); background: var(--paper); color: var(--ink); }
.fb-dialog::backdrop { background: rgba(80, 43, 4, 0.45); backdrop-filter: blur(3px); }
.fb-dialog-head { display: flex; justify-content: space-between; align-items: center; }
.fb-dialog-x { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: #fff; border: 2.5px solid var(--ink); border-radius: 50%; cursor: pointer; }
.fb-dialog h2 { font-size: 1.8rem; margin: 0.4rem 0 1rem; }

.fb-row { display: grid; grid-template-columns: 2fr 1fr; gap: 0 1rem; }
@media (max-width: 640px) { .fb-row { grid-template-columns: 1fr; } }
.field select { width: 100%; padding: 0.7rem 0.9rem; border: var(--b); border-radius: 14px; background: #fff; font: 600 1rem "Baloo 2", sans-serif; color: var(--ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.fb-ok { display: flex; gap: 0.6rem; align-items: center; background: #e3f2cf; border: var(--b); border-radius: 14px; padding: 0.7rem 1rem; font-weight: 800; margin-top: 1rem; }
.fb-ok[hidden] { display: none; }
