.mbr-dialog {
  --room-red: #aa191c;
  --room-ink: #201d19;
  --room-rule: #c6b9a7;
  --room-paper: #faf4e7;
  width: min(40rem, calc(100vw - 2rem));
  max-width: 100%;
  max-height: min(55rem, 90vh);
  max-height: min(55rem, 90dvh);
  margin: auto;
  padding: 0;
  overflow: hidden;
  background: var(--room-paper);
  color: var(--room-ink);
  border: 1px solid var(--room-ink);
  border-radius: 3px;
  box-shadow: 0 18px 80px #21170d40;
  font: 1rem/1.45 system-ui, sans-serif;
  color-scheme: light;
}
.mbr-dialog[open] { display: flex; flex-direction: column; }
.mbr-dialog::backdrop { background: #211b16a6; }
.mbr-dialog *, .mbr-dialog *::before, .mbr-dialog *::after { box-sizing: border-box; }
.mbr-dialog [hidden] { display: none !important; }
.mbr-dialog button, .mbr-dialog select, .mbr-dialog textarea { font: inherit; color: inherit; }
.mbr-dialog button, .mbr-dialog summary, .mbr-dialog label:has(input[type=checkbox]) { cursor: pointer; }
.mbr-dialog :focus-visible { outline: 3px solid var(--room-red); outline-offset: 2px; }
.mbr-dialog a { color: var(--room-red); text-underline-offset: .14em; }
.mbr-fixture { flex: none; display: grid; gap: .25rem; padding: 1rem 1.25rem; background-color: #ebd8bc; background-size: cover; background-position: center; border-bottom: 4px solid var(--room-red); }
.mbr-fixture strong, .mbr-heading h2, .mbr-wordmark { font-family: var(--mb-display, 'Arial Narrow'), Impact, sans-serif; font-style: italic; font-weight: 900; line-height: .95; }
.mbr-fixture strong { max-width: 17em; font-size: clamp(1.5rem, 5.5vw, 2.8rem); text-transform: uppercase; }
.mbr-wordmark { width: max-content; color: var(--room-red); font-size: 1.35rem; }
.mbr-fixture-meta { font-size: .82rem; font-weight: 650; }
.mbr-fixture-meta:empty { display: none; }
.mbr-heading { display: flex; flex: none; align-items: center; gap: .7rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--room-rule); }
.mbr-heading h2 { color: var(--room-ink); margin: 0; font-size: clamp(1.6rem, 6vw, 2.5rem); }
.mbr-heading > span { padding-left: .7rem; border-left: 1px solid var(--room-rule); font-size: .84rem; }
.mbr-heading [data-close] { width: 44px; height: 44px; margin-left: auto; border: 0; background: transparent; font-size: 1.8rem; line-height: .65; }
.mbr-heading .mbr-refresh { flex: none; min-width: 6.4rem; min-height: 44px; margin-left: auto; padding: .4rem .65rem; border: 1px solid var(--room-rule); border-radius: var(--mb-control-radius, .2rem); background: transparent; font-size: .875rem; font-weight: 650; }
.mbr-refresh[aria-disabled=true] { cursor: default; color: var(--mb-muted, #625647); }
.mbr-refresh[aria-disabled=false]:hover { border-color: var(--room-red); }
.mbr-last-post { margin: 0; padding: .5rem 1.25rem; border-bottom: 1px solid var(--room-rule); color: var(--mb-muted, #625647); font-size: .8125rem; }
.mbr-scroll { min-height: 4rem; overflow-y: auto; overscroll-behavior: contain; padding: .2rem 1.25rem .8rem; }
.mbr-messages { list-style: none; margin: 0; padding: 0; }
.mbr-read-status, .mbr-write-status, .mbr-options p { font-size: .875rem; line-height: 1.45; }
.mbr-read-status:empty { display: none; }
.mbr-message { display: flex; gap: .6rem; border-top: 1px solid var(--room-rule); padding: .75rem 0; }
.mbr-message:first-child { border-top: 0; }
.mbr-message.mbr-featured-prompt { margin: .55rem 0 .15rem; padding: .75rem .65rem .55rem; border: 1px solid var(--room-rule); border-inline-start: 3px solid var(--room-red); background: color-mix(in srgb, var(--room-red) 5%, var(--room-paper)); }
.mbr-prompt-label { display: block; margin-bottom: .3rem; color: var(--room-red); font-size: .8rem; font-weight: 750; }
.mbr-avatar { display: grid; place-items: center; flex: 0 0 2rem; height: 2rem; background: var(--room-red); color: #fff; border-radius: 50%; font-weight: 750; }
.mbr-body { min-width: 0; }
.mbr-byline { display: flex; align-items: baseline; gap: .45rem; flex-wrap: wrap; }
.mbr-byline time, .mbr-report, .mbr-options small { color: #625647; font-size: .75rem; }
.mbr-body p { margin: .15rem 0 .2rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.mbr-report summary { width: max-content; padding: .18rem 0; }
.mbr-report form { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; padding: .35rem 0; }
.mbr-report button, .mbr-report select { min-height: 2.25rem; border: 1px solid var(--room-rule); background: transparent; border-radius: .2rem; }
.mbr-pin { margin-top: .5rem; padding: .7rem .8rem; border: 1px solid var(--room-rule); border-left: 3px solid var(--room-red); }
.mbr-pin > span { display: block; color: var(--room-red); font-size: .68rem; font-weight: 740; letter-spacing: .1em; text-transform: uppercase; }
.mbr-dialog .mbr-story { display: block; padding: .26rem 0; color: var(--room-ink); font-weight: 730; text-decoration: none; }
.mbr-dialog .mbr-story::after { content: ' →'; color: var(--room-red); }
.mbr-dialog .mbr-story:hover { text-decoration: underline; }
.mbr-compose { flex: none; border-top: 1px solid var(--room-rule); padding: .4rem 1.25rem max(.75rem, env(safe-area-inset-bottom)); background: var(--room-paper); }
.mbr-options { font-size: .82rem; margin: 0 0 .2rem; }
.mbr-options summary { width: max-content; padding: .35rem 0; font-weight: 650; }
.mbr-options p { margin: .15rem 0 .4rem; }
.mbr-options small { display: block; margin: .35rem 0; }
.mbr-consent { display: block; font-size: .8rem; padding: .25rem 0 .55rem; }
.mbr-compose input[type=checkbox] { accent-color: var(--room-red); }
.mbr-entry { display: flex; gap: .5rem; align-items: center; }
.mbr-entry textarea { resize: vertical; flex: 1; min-width: 0; min-height: 44px; max-height: 5rem; padding: .65rem .9rem; color: var(--room-ink); background: #fffcf4; border-radius: 14px; border: 1px solid #978977; }
.mbr-entry button { width: 44px; height: 44px; border-radius: 50%; background: var(--room-red); color: #fff; border: 0; }
.mbr-entry button:disabled { opacity: .47; cursor: default; }
.mbr-write-status { margin: .35rem 0 0; }
@media (max-width: 600px) {
  .mbr-dialog { margin: auto auto 0; width: 100%; max-height: 91dvh; min-height: min(34rem, 88dvh); border-width: 1px 0 0; border-radius: 14px 14px 0 0; }
  .mbr-scroll { flex: 1; }
  .mbr-heading, .mbr-fixture, .mbr-last-post, .mbr-scroll, .mbr-compose { padding-left: 1rem; padding-right: 1rem; }
}
@media (max-height: 535px) { .mbr-fixture { display: none; } .mbr-options[open] { max-height: 4rem; overflow-y: auto; } }
.mbr-pin { background: linear-gradient(to right,transparent 0 76px,var(--room-paper) 76px),url('/matchbook/opening-day.webp') left center / auto 100% no-repeat; padding-left: 88px; min-height: 64px; }
.mbr-dialog[open] .mbr-fixture { border-bottom-color: #af2022; }
:root[data-theme=dark] .mbr-dialog { --room-red: #ffb0a0; --room-ink: #f8ecdb; --room-rule: #857766; --room-paper: #27221e; color-scheme: dark; }
:root[data-theme=dark] .mbr-fixture { color: #201d19; }
:root[data-theme=dark] .mbr-wordmark { color: #a8181a; }
:root[data-theme=dark] .mbr-avatar, :root[data-theme=dark] .mbr-entry button { color: #fff7ec; background: #932323; }
:root[data-theme=dark] .mbr-entry textarea { background: #211e1b; }
:root[data-theme=dark] .mbr-byline time, :root[data-theme=dark] .mbr-report, :root[data-theme=dark] .mbr-options small { color: #d3c3ae; }
.mbr-dialog .mbr-story{display:inline-flex;align-items:center;gap:.55rem}
.mbr-story::before{content:'';display:inline-block;width:3.5rem;height:2.6rem;flex:none;background:center / cover url('/matchbook/opening-day.webp')}

.mb-body .mbr-contextual .mb-titlebar { padding-bottom: .4rem; }
.mb-body .mbr-contextual .mb-titlebar h1 { font-size: clamp(2.65rem, 8.5vw, 4.5rem); }
.mbr-scope { margin: .35rem 0; }
.mbr-context-line { display: flex; flex-wrap: wrap; align-items: center; column-gap: .7rem; margin: .25rem 0 .65rem; }
.mb-body .mbr-context-line .mb-context { gap: .35rem; margin: 0; font-weight: 650; }
.mbr-context-line > span { color: var(--mb-muted, #625647); font-size: .85rem; }
.mb-body .mbr-inline { width: 100%; max-width: 48rem; min-height: 0; max-height: none; margin: .75rem 0 0; display: flex; flex-direction: column; box-shadow: none; border-radius: 0; }
.mbr-inline .mbr-scroll { min-height: 0; max-height: clamp(9rem, 32dvh, 24rem); overflow-y: auto; overscroll-behavior: contain; }
.mbr-inline .mbr-scroll:focus-visible { outline-offset: -3px; }
.mbr-inline .mbr-compose { padding-top: .55rem; }
.mbr-inline .mbr-pin { margin-top: 1rem; }
.mbr-inline .mbr-heading { gap: .55rem; }
.mbr-inline .mbr-heading h2 { font-size: clamp(1.15rem, 5vw, 1.5rem); }
.mbr-inline .mbr-consent { display: flex; align-items: center; min-height: 44px; column-gap: .45rem; }
.mb-body .mbr-inline .mbr-consent input[type=checkbox] { flex: none; width: 1.125rem; height: 1.125rem; min-height: 0; margin: 0; }
.mbr-inline .mbr-compose :is(input,textarea,button,summary) { scroll-margin-bottom: calc(76px + env(safe-area-inset-bottom)); }
.mbr-inline .mbr-write-status:empty { margin: 0; min-block-size: 0; }

.mbr-compose .mbr-write-status { min-block-size: 1.35em; }
@media (prefers-reduced-motion: no-preference) {
  .mbr-entry button { transition: opacity 110ms ease-out, transform 110ms ease-out; }
  .mbr-entry button:enabled:active { transform: scale(.94); }
  .mbr-new-message { animation: mbr-message-in 170ms ease-out; }
}
@keyframes mbr-message-in { from { opacity: .65; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Carry the programme's control colours into both room layouts. */
.mb-body .mbr-dialog {
  --room-red: var(--mb-red);
  --room-ink: var(--mb-ink);
  --room-rule: var(--mb-divider);
  --room-paper: var(--mb-panel);
  font-family: var(--mb-text);
}
.mb-body .mbr-entry textarea,.mb-body .mbr-report select {
  border: 1px solid var(--mb-line); background: var(--mb-paper); color: var(--mb-ink);
  border-radius: var(--mb-control-radius);
}
.mb-body .mbr-entry button { background: var(--mb-action-fill); color: var(--mb-on-action); }
.mb-body .mbr-entry button:enabled:hover { background: var(--mb-action-hover); }
.mb-body .mbr-entry button:disabled { background: var(--mb-divider); color: var(--mb-ink); opacity: 1; }
.mb-body .mbr-report :is(button,select) { min-height: 44px; }
.mb-body .mbr-byline time,.mb-body .mbr-options small { color: var(--mb-muted); }
