/* Bulletin Board page (board.html) */
.bb-content { max-width: 1120px; }
.bb-h2 { font-family: var(--font-display); font-size: 1.25rem; letter-spacing: 0.02em; margin-bottom: 18px; }

/* ---- Drawing studio ---- */
.bb-studio {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin: 8px 0 56px;
}
.bb-paper-wrap {
  max-width: 640px;
  margin-inline: auto;
  padding: 10px;
  background: #e9dcc3;
  border-radius: 10px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.45);
}
#bbCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 640 / 420;
  background: #fffdf6;
  border-radius: 4px;
  cursor: crosshair;
  touch-action: none;
}
.bb-toolbar {
  max-width: 640px;
  margin: 18px auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bb-colors { display: flex; flex-wrap: wrap; gap: 10px; }
.bb-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  outline: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: transform 0.15s;
}
.bb-swatch:hover { transform: scale(1.12); }
.bb-swatch[aria-pressed="true"] { border-color: var(--text); outline-color: var(--accent); transform: scale(1.12); }
.bb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bb-tool {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.bb-tool:hover { border-color: var(--muted); }
.bb-tool[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.bb-tool:disabled { opacity: 0.4; cursor: default; }
.bb-size { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; margin-inline: 6px; }
.bb-size input { width: 120px; accent-color: var(--accent); }

.bb-form { max-width: 640px; margin: 24px auto 0; }
.bb-fields { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 18px; }
.bb-field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.bb-field > span:first-child { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.bb-field input,
.bb-field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  resize: vertical;
}
.bb-field input:focus,
.bb-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.bb-count { position: absolute; inset-inline-end: 10px; bottom: 8px; font-size: 0.72rem; color: var(--muted); pointer-events: none; }
.bb-hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.bb-status { min-height: 1.4em; margin-top: 12px; font-size: 0.9rem; color: var(--accent-2); }
.bb-status.is-error { color: #ff7a66; }
.bb-status.is-ok { color: #6fdc8c; }
.bb-rules { margin-top: 6px; font-size: 0.8rem; color: var(--muted); }

/* ---- The board (cork + wood frame) ---- */
.bb-wall {
  position: relative;
  padding: 44px 34px 52px;
  min-height: 260px;
  border: 16px solid #4a2f1b;
  border-radius: 10px;
  background-color: #b4824f;
  background-image:
    radial-gradient(rgba(60, 30, 5, 0.28) 1px, transparent 1.6px),
    radial-gradient(rgba(255, 235, 200, 0.2) 1px, transparent 1.6px),
    radial-gradient(rgba(60, 30, 5, 0.14) 2px, transparent 2.6px);
  background-size: 13px 13px, 21px 21px, 37px 37px;
  background-position: 0 0, 6px 9px, 14px 3px;
  box-shadow:
    inset 0 0 0 3px #2f1c0e,
    inset 0 10px 30px rgba(0, 0, 0, 0.35),
    0 14px 36px rgba(0, 0, 0, 0.55);
}
.bb-notes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 38px 30px;
}
.bb-note {
  --rot: 0deg;
  --paper: #fffdf3;
  position: relative;
  margin: 0;
  padding: 16px 14px 14px;
  background: var(--paper);
  color: #2b2118;
  border-radius: 3px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transform: rotate(var(--rot));
  transform-origin: 50% 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.bb-note:nth-child(4n+2) { --paper: #fff3a8; }
.bb-note:nth-child(4n+3) { --paper: #ffd7e0; }
.bb-note:nth-child(4n+4) { --paper: #d3f2e3; }
.bb-note::before {
  content: "";
  position: absolute;
  top: -11px;
  inset-inline-start: 50%;
  width: 18px;
  height: 18px;
  margin-inline-start: -9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff8a75 0 14%, var(--accent) 45%, #a01f0e 100%);
  box-shadow: 0 3px 4px rgba(0, 0, 0, 0.45);
}
.bb-note:hover { transform: rotate(0deg) translateY(-4px) scale(1.02); box-shadow: 0 12px 22px rgba(0, 0, 0, 0.45); z-index: 2; }
.bb-note-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 640 / 420;
  background: #fffdf6;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 2px;
  object-fit: cover;
}
.bb-note-msg {
  font-family: 'Caveat', 'Gveret Levin', 'Heebo', cursive;
  font-size: 1.45rem;
  line-height: 1.15;
  font-weight: 700;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
html[dir="rtl"] .bb-note-msg { font-family: 'Gveret Levin', 'Heebo', cursive; font-size: 1.3rem; line-height: 1.25; font-weight: 400; }
.bb-note-meta {
  font-size: 0.72rem;
  color: rgba(43, 33, 24, 0.7);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.bb-note-name { font-weight: 700; overflow-wrap: anywhere; }
.bb-note.is-new { animation: bb-pop 0.5s ease; }
@keyframes bb-pop {
  from { opacity: 0; transform: translateY(-24px) rotate(calc(var(--rot) * 3)) scale(0.92); }
  to { opacity: 1; transform: rotate(var(--rot)); }
}
.bb-empty { text-align: center; color: #3a2512; font-weight: 700; padding: 40px 10px; }
.bb-more { text-align: center; margin-top: 26px; }

@media (max-width: 640px) {
  .bb-studio { padding: 18px 14px; }
  .bb-wall { padding: 34px 16px 40px; border-width: 11px; }
  .bb-notes { grid-template-columns: 1fr; gap: 34px; }
  .bb-size input { width: 90px; }
}
@media (prefers-reduced-motion: reduce) {
  .bb-note, .bb-swatch { transition: none; }
  .bb-note.is-new { animation: none; }
  .bb-note:hover { transform: rotate(var(--rot)); }
}
html.a11y-reduce-motion .bb-note.is-new { animation: none; }
html.a11y-reduce-motion .bb-note { transition: none; }
/* Notes are physical paper — keep them readable under the site's contrast/grayscale modes */
html.a11y-contrast .bb-wall { background: #000 !important; border-color: #fff !important; }
html.a11y-contrast .bb-note { background: #fff !important; color: #000 !important; }

.bb-content [hidden] { display: none !important; }

/* Admin moderation overlay (only rendered for the logged-in admin) */
.bb-adminbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 16px; padding: 10px 14px;
  background: rgba(255, 184, 0, 0.12); border: 1px dashed var(--accent-2); border-radius: 8px;
  font-size: 0.85rem; color: var(--accent-2);
}
.bb-adminbar a { color: var(--text); font-weight: 700; text-decoration: underline; }
.bb-admin { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 8px; border-top: 1px dashed rgba(0, 0, 0, 0.25); }
.bb-admin button {
  padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(0, 0, 0, 0.35);
  background: #fff; color: #2b2118; font: 700 0.72rem/1 var(--font-body); cursor: pointer;
}
.bb-admin button:hover { background: #2b2118; color: #fff; }
.bb-admin .bb-admin-del { border-color: #b3261e; color: #b3261e; }
.bb-admin .bb-admin-del:hover { background: #b3261e; color: #fff; }
.bb-admin-tag { font-size: 0.7rem; font-weight: 800; color: #b3261e; margin-inline-end: auto; }
.bb-note.is-hidden-note { opacity: 0.55; filter: grayscale(0.7); }
.bb-note.is-hidden-note .bb-admin { opacity: 1; }
