/* Blog · các demo bấm thử trong bài (bảng điện, form 100 người, thẻ tích điểm,
   lưới đối xứng, hộp thoại mẫu...). Chép nguyên từ legacy/styles.css bằng
   tmp/clean-build/build_blog.py; chỉ đổi biến màu và chữ cho hợp bản mới.
   Khung bài viết (tiêu đề, mục lục, chữ) nằm trong site.css. */
.ppage {
  --paper: #f7f7f5;
  --paper-soft: #efefeb;
  --ink: #1a1a19;
  --ink-soft: #5e5e5a;
  --accent: #e8380c;
  --line: #ecece9;
  --line-strong: #dcdcd8;
  --font-display: var(--sans);
  --font-body: var(--sans);
  --font-serif: var(--sans);
  --pad: 24px;
}
.roadsign {
  margin: 1.6rem 0 2rem; padding: clamp(1.3rem, 3.4vw, 2rem);
  background: #f5c518; color: #111; border: 4px solid #111; border-radius: 10px;
  box-shadow: inset 0 0 0 4px #f5c518, inset 0 0 0 6px #111;
}
.roadsign p {
  margin: 0; text-transform: uppercase; text-align: center;
  font-family: var(--font-display); font-weight: 700; font-stretch: 85%;
  font-size: clamp(0.92rem, 1.6vw, 1.15rem); line-height: 1.35; letter-spacing: 0.01em;
}
.alertcard { margin: 1.4rem 0 2rem; max-width: 30rem; }
.alertcard__head, .alertcard__text {
  background: #2a2926; color: #f4f2ec; font-family: var(--font-body);
}
.alertcard__head {
  margin: 0; padding: 0.9rem 1.2rem 0.3rem; border-radius: 18px 18px 0 0;
  font-weight: 600; font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; color: #ff8a5c;
}
.alertcard__head::before { content: "⚠ "; }
.post__body .alertcard__text {
  margin: 0; padding: 0.2rem 1.2rem 1.1rem; border-radius: 0 0 18px 18px;
  font-weight: 600; font-size: 1rem; line-height: 1.45; text-transform: uppercase;
}
.alertcard figcaption { margin-top: 0.7rem; font-size: 0.85rem; line-height: 1.5; color: var(--ink-soft); }
.uimock {
  margin: 1.8rem 0 2.2rem; padding: clamp(1.6rem, 4vw, 2.6rem);
  border-radius: 22px; background: var(--paper-soft);
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.uimock--good { background: #f6dccd; }
.uimock__tag {
  align-self: flex-start;
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft);
}
.uimock--good .uimock__tag { color: var(--accent); }
.uimock__card {
  width: min(100%, 340px); padding: 1.3rem 1.3rem 1.1rem;
  background: #fff; border-radius: 18px; text-align: left;
  box-shadow: 0 1px 0 rgba(14, 14, 12, 0.05), 0 22px 44px -22px rgba(14, 14, 12, 0.4);
  font-family: var(--font-body); color: #1d1d1b;
}
.uimock__title { font-weight: 600; font-size: 1rem; margin-bottom: 0.4rem; }
.uimock__text { font-size: 0.93rem; line-height: 1.5; color: #55544f; }
.uimock__text--lead { color: #1d1d1b; }
.uimock__text b { font-weight: 600; }
.uimock__btn {
  display: block; margin-top: 1.1rem; padding: 0.78em 1em; border-radius: 12px;
  background: var(--ink); color: var(--paper); text-align: center;
  font-weight: 600; font-size: 0.92rem;
}
.uimock__btn--ghost { background: #efeee9; color: #55544f; }
.undo {
  position: relative; overflow: hidden;
  margin: 1.8rem 0 2.4rem; padding: clamp(1.4rem, 3.6vw, 2.2rem);
  border-radius: 22px; background: var(--ink); color: var(--paper);
}
.undo__label {
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(241, 239, 233, 0.6); margin-bottom: 1rem;
}
.undo__grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.undo__grid span {
  aspect-ratio: 1; border-radius: 6px;
  background: linear-gradient(140deg, #f1b48f, #e8380c);
  transition: transform 0.45s var(--ease), opacity 0.45s var(--ease);
}
.undo__grid span:nth-child(3n+2) { background: linear-gradient(140deg, #f3e3c3, #d9a65a); }
.undo__grid span:nth-child(4n+3) { background: linear-gradient(140deg, #c9d6c4, #6f8f6a); }
.undo__grid span:nth-child(5n+1) { background: linear-gradient(140deg, #d7d2f0, #7d6fd0); }
.undo.is-gone .undo__grid span { transform: scale(0.6); opacity: 0; }
.undo.is-gone .undo__grid span:nth-child(odd) { transition-delay: 0.04s; }
.undo__bar { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin-top: 1.2rem; min-height: 2.9rem; }
.undo__del, .undo__reset {
  padding: 0.8em 1.4em; border-radius: 999px; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%; font-size: 0.92rem;
}
.undo__del { border: 0; background: var(--paper); color: var(--ink); }
.undo__del:disabled { opacity: 0.35; cursor: default; }
.undo__reset { border: 1px solid rgba(241, 239, 233, 0.4); background: none; color: var(--paper); }
.undo__reset[hidden] { display: none; }
.undo__bar { transition: opacity 0.3s var(--ease); }
.undo.is-toast .undo__bar { opacity: 0; pointer-events: none; }
.undo__toast {
  position: absolute; left: clamp(1.4rem, 3.6vw, 2.2rem); bottom: clamp(1.4rem, 3.6vw, 2.2rem);
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0.75rem 0.9rem 0.75rem 1.2rem; border-radius: 12px;
  background: #2b2a27; color: var(--paper); font-size: 0.92rem; white-space: nowrap;
  box-shadow: 0 16px 34px -14px rgba(0, 0, 0, 0.7);
  transform: translateY(calc(100% + 2.4rem)); transition: transform 0.5s var(--ease);
}
.undo.is-toast .undo__toast { transform: translateY(0); }
.undo__toast button {
  border: 0; background: none; cursor: pointer; padding: 0.3em 0.4em;
  font-family: var(--font-display); font-weight: 700; font-stretch: 110%; font-size: 0.92rem;
  color: #ff8a5c;
}
.post__body p, .post__body li, .post__body figcaption, .post__body .fn,
.uimock, .undo, .roadsign, .alertcard, .post__art { transition: color 0.5s var(--ease), opacity 0.5s var(--ease); }
@media (max-width: 700px) {
  .undo__toast { gap: 0.6rem; font-size: 0.85rem; }
}
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(241, 239, 233, 0.12); }
.seg button {
  padding: 0.5em 1em; border: 0; border-radius: 999px; cursor: pointer;
  background: none; color: rgba(241, 239, 233, 0.7);
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%; font-size: 0.82rem;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg--light { background: var(--paper-soft); }
.seg--light button { color: var(--ink-soft); }
.seg--light button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.board {
  --up: #22b14c; --down: #ef3b36; --ref: #f0c419; --ceil: #c26cf0; --floor: #2bb8e8;
  margin: 1.8rem 0 2.4rem; padding: clamp(1.1rem, 3vw, 1.6rem);
  border-radius: 18px; background: #0b0b0a; color: #f1efe9;
}
.board.is-cn { --up: #ef3b36; --down: #22b14c; --ceil: #ef3b36; --floor: #22b14c; --ref: #e9e7e1; }
.board__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 1rem; }
.board__label {
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(241, 239, 233, 0.6);
}
.board__table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.board__table th, .board__table td {
  padding: 0.62rem 0.4rem; border-top: 1px solid rgba(241, 239, 233, 0.1);
  text-align: right; font-size: 0.98rem;
}
.board__table thead th {
  border-top: 0; padding-top: 0;
  font-family: var(--font-body); font-weight: 500; font-size: 0.74rem; color: rgba(241, 239, 233, 0.5);
}
.board__table th:first-child { text-align: left; }
.board__table tbody th { font-family: var(--font-display); font-weight: 700; font-stretch: 110%; letter-spacing: 0.02em; }
.board__table tbody td { font-weight: 600; }
.board__table tbody td:nth-child(2) { color: var(--ref); font-weight: 500; }
.board tr.is-up > :is(th, td:nth-child(n+3)) { color: var(--up); }
.board tr.is-down > :is(th, td:nth-child(n+3)) { color: var(--down); }
.board tr.is-ref > :is(th, td) { color: var(--ref); }
.board tr.is-ceil > :is(th, td:nth-child(n+3)) { color: var(--ceil); }
.board tr.is-floor > :is(th, td:nth-child(n+3)) { color: var(--floor); }
.board.board--mini tbody tr.is-up > * { color: var(--up); font-weight: 600; }
.board.board--mini tbody tr.is-down > * { color: var(--down); font-weight: 600; }
.board .board__table, .board .board__table * { transition: color 0.4s var(--ease); }
.board .board__table { transition: filter 0.4s var(--ease); }
.board.is-cvd .board__table { filter: url(#cvd-deutan); }
.board .arr { display: none; }
.board.is-arrows .arr { display: inline; }
.board figcaption { margin-top: 0.9rem; font-size: 0.82rem; line-height: 1.5; color: rgba(241, 239, 233, 0.55); }
.tetmock { margin: 1.8rem 0 2.2rem; padding: clamp(1.6rem, 4vw, 2.6rem); border-radius: 22px; background: var(--paper-soft); }
.tetmock__screen {
  width: min(100%, 320px); margin: 0 auto; padding: 1.6rem 1.3rem 1.3rem; border-radius: 26px;
  background: radial-gradient(circle at 100% 0%, #f6c54a 0 9%, transparent 9.5%),
              radial-gradient(circle at 0% 100%, #e8483c 0 12%, transparent 12.5%),
              linear-gradient(170deg, #d4241c, #a8130f);
  color: #ffe7b0; text-align: center; font-family: var(--font-body);
  box-shadow: 0 22px 44px -22px rgba(14, 14, 12, 0.5);
}
.tetmock__banner { font-family: var(--font-serif); font-style: italic; font-weight: 700; font-size: 1.5rem; line-height: 1.15; color: #ffd36a; }
.tetmock__sub { margin-top: 0.3rem; font-size: 0.85rem; color: #ffd9a8; }
.tetmock__field {
  display: block; margin: 1.3rem 0 0.5rem; padding: 0.7rem; border-radius: 12px;
  background: rgba(255, 231, 176, 0.14); letter-spacing: 0.35em; font-weight: 600;
}
.post__body .tetmock__err { margin: 0; font-size: 0.8rem; line-height: 1.4; color: #ff3b2f; }
.tetmock__btn { display: block; margin-top: 1rem; padding: 0.75em; border-radius: 12px; background: #ffcf5a; color: #8a1410; font-weight: 700; font-size: 0.92rem; }
.tetmock figcaption { margin-top: 1.1rem; text-align: center; font-size: 0.9rem; color: var(--ink-soft); }
.bars { margin: 1.8rem 0 2.4rem; padding: clamp(1.2rem, 3vw, 1.8rem) 0; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.bars__title {
  margin-bottom: 1.2rem;
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%;
  font-size: 0.78rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft);
}
.bars__row { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) 5.2rem; gap: 1rem; align-items: center; padding: 0.7rem 0; }
.bars__name { font-family: var(--font-display); font-weight: 700; font-stretch: 112%; font-size: 1.15rem; line-height: 1.2; }
.bars__name small { display: block; margin-top: 0.2rem; font-family: var(--font-body); font-weight: 400; font-stretch: 100%; font-size: 0.78rem; line-height: 1.35; color: var(--ink-soft); }
.bars__track { position: relative; height: 26px; border-radius: 4px; background: var(--paper-soft); overflow: hidden; }
.bars__fill { position: absolute; inset: 0 auto 0 0; width: var(--v); border-radius: 0 4px 4px 0; background: #8a887f; }
.bars__row.is-hi .bars__fill { background: var(--accent); }
.bars__val { font-family: var(--font-display); font-weight: 700; font-stretch: 116%; font-size: 1.25rem; text-align: right; font-variant-numeric: tabular-nums; }
.bars__row.is-hi .bars__val { color: var(--accent); }
.post__body .bars__note { margin: 0.8rem 0 0; font-size: 0.8rem; color: var(--ink-soft); }
@media (max-width: 600px) {
  .bars__row { grid-template-columns: minmax(0, 1fr) 4.6rem; row-gap: 0.5rem; }
  .bars__name { grid-column: 1 / -1; }
}
.crowd { margin: 1.8rem 0 2.4rem; padding: clamp(1.2rem, 3.4vw, 2rem); border-radius: 22px; background: var(--ink); color: var(--paper); }
.crowd__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.3rem; }
.crowd__form { display: inline-flex; align-items: center; gap: 0.7rem; padding: 0.7rem 1rem; border-radius: 12px; background: #f1efe9; color: #1d1d1b; font-size: 0.92rem; font-weight: 500; }
.crowd__box { position: relative; width: 20px; height: 20px; border: 2px solid #1d1d1b; border-radius: 5px; flex: none; }
.crowd__box.is-on { background: var(--accent); border-color: var(--accent); }
.crowd__box.is-on::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.crowd__grid { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 5px; }
.crowd__grid span { aspect-ratio: 1; border-radius: 50%; background: rgba(241, 239, 233, 0.16); transition: background-color 0.25s var(--ease), transform 0.25s var(--ease); }
.crowd__grid span.is-yes { background: var(--accent); }
.crowd__grid span.is-no { background: rgba(241, 239, 233, 0.42); }
.crowd__bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.2rem; margin-top: 1.3rem; }
.crowd__run {
  padding: 0.8em 1.4em; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%; font-size: 0.92rem;
}
.crowd__run:disabled { opacity: 0.4; cursor: default; }
.crowd__run:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.post__body .crowd__result { margin: 0; font-family: var(--font-display); font-weight: 600; font-stretch: 110%; font-size: 1rem; }
.crowd__result b { color: #ff8a5c; }
.crowd figcaption { margin-top: 1rem; font-size: 0.82rem; line-height: 1.5; color: rgba(241, 239, 233, 0.55); }
.board, .tetmock, .bars, .crowd { transition: opacity 0.5s var(--ease); }
@media (max-width: 600px) {
  .crowd__grid { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; }
}
.stamps { margin: 1.8rem 0 2.4rem; padding: clamp(1.2rem, 3.4vw, 2rem); border-radius: 22px; background: var(--paper-soft); }
.stamps__cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.stamps__card { padding: 1rem 1rem 0.9rem; border: 1.5px dashed var(--line-strong); border-radius: 14px; background: #fbfaf6; }
.post__body .stamps__name { margin: 0 0 0.8rem; font-family: var(--font-display); font-weight: 600; font-stretch: 110%; font-size: 0.86rem; }
.stamps__grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.stamps__grid span { aspect-ratio: 1; border: 1.5px solid var(--line-strong); border-radius: 50%; transition: background-color 0.3s var(--ease), border-color 0.3s var(--ease), transform 0.3s var(--ease); }
.stamps__grid span.is-gift { background: var(--accent); border-color: var(--accent); }
.stamps__grid span.is-on { background: var(--ink); border-color: var(--ink); transform: scale(0.92); }
.post__body .stamps__left { margin: 0.8rem 0 0; font-size: 0.86rem; color: var(--ink-soft); }
.stamps__bar { display: flex; gap: 0.7rem; margin-top: 1.1rem; }
.stamps__buy, .stamps__reset {
  padding: 0.8em 1.4em; border-radius: 999px; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%; font-size: 0.92rem;
}
.stamps__buy { border: 0; background: var(--ink); color: var(--paper); }
.stamps__buy:disabled { opacity: 0.35; cursor: default; }
.stamps__reset { border: 1px solid var(--line-strong); background: none; color: var(--ink); }
.stamps__reset[hidden] { display: none; }
.stamps { transition: opacity 0.5s var(--ease); }
@media (max-width: 560px) {
  .stamps__cards { grid-template-columns: minmax(0, 1fr); }
}
.sym { margin: 1.8rem 0 2.4rem; padding: clamp(1.2rem, 3.4vw, 2rem); border-radius: 22px; background: var(--paper-soft); transition: opacity 0.5s var(--ease); }
.sym__label {
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%;
  font-size: 0.72rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 1rem;
}
.sym__grid, .sym__bar, .post__body .sym__msg { max-width: 360px; margin-inline: auto; }
.sym__grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.sym__grid button {
  aspect-ratio: 1; padding: 0; cursor: pointer;
  border: 1.5px solid var(--line-strong); border-radius: 5px; background: #fbfaf6;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.sym__grid button.is-on { background: var(--accent); border-color: var(--accent); }
.sym.is-done .sym__grid button.is-on { background: var(--ink); border-color: var(--ink); }
.sym__grid button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.sym__bar { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; margin-top: 1.1rem; min-height: 2.9rem; }
.post__body .sym__count { margin: 0; font-family: var(--font-display); font-weight: 600; font-stretch: 110%; font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.sym__reset {
  padding: 0.8em 1.4em; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: none; color: var(--ink);
  font-family: var(--font-display); font-weight: 600; font-stretch: 110%; font-size: 0.92rem;
}
.sym__reset[hidden] { display: none; }
.post__body .sym__msg { margin-top: 0.6rem; margin-bottom: 0; font-size: 0.92rem; line-height: 1.55; color: var(--ink-soft); }
.post__body .sym__msg:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  .sym__grid button { transition: none; }
}
