/* Westerbone Medieval Speech: every rule is scoped under .wbts */
.wbts {
  --wbts-bg: #fbf7ef;
  --wbts-card: #fffdf8;
  --wbts-ink: #2b2219;
  --wbts-muted: #6a5b4b;
  --wbts-line: #ddd0bb;
  --wbts-soft: #f2eadb;
  --wbts-accent: #7c2d1e;
  --wbts-accent-ink: #ffffff;
  --wbts-auth: #2f5d3a;
  --wbts-auth-bg: #e4efe2;
  --wbts-form: #6a4c12;
  --wbts-form-bg: #f6ead0;
  --wbts-plaus: #3e4f72;
  --wbts-plaus-bg: #e5e9f2;
  --wbts-later: #8a2a1c;
  --wbts-later-bg: #f7e1dc;
  --wbts-focus: #b8860b;
  --wbts-serif: 'Alegreya', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --wbts-caps: 'Alegreya SC', 'Alegreya', Georgia, serif;
  container-type: inline-size;
  container-name: wbts;
  background: var(--wbts-bg);
  color: var(--wbts-ink);
  font-family: var(--wbts-serif);
  font-size: 17px;
  line-height: 1.5;
  border: 1px solid var(--wbts-line);
  border-radius: 10px;
  padding: 16px;
  margin: 1.5em 0;
  box-sizing: border-box;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
}
.wbts[data-fonts="no"] { --wbts-serif: inherit; --wbts-caps: inherit; }
.wbts[data-theme="dark"] {
  --wbts-bg: #1d1814; --wbts-card: #26201a; --wbts-ink: #efe6d6; --wbts-muted: #b8a891; --wbts-line: #463b30; --wbts-soft: #2f2720;
  --wbts-accent: #d98a6c; --wbts-accent-ink: #1d1814; --wbts-auth: #9fd0a6; --wbts-auth-bg: #22382a; --wbts-form: #e8c785; --wbts-form-bg: #3b301a;
  --wbts-plaus: #aebde0; --wbts-plaus-bg: #262f45; --wbts-later: #f0a090; --wbts-later-bg: #45231d; --wbts-focus: #e8c785;
}
@media (prefers-color-scheme: dark) {
  .wbts[data-theme="auto"] {
    --wbts-bg: #1d1814; --wbts-card: #26201a; --wbts-ink: #efe6d6; --wbts-muted: #b8a891; --wbts-line: #463b30; --wbts-soft: #2f2720;
    --wbts-accent: #d98a6c; --wbts-accent-ink: #1d1814; --wbts-auth: #9fd0a6; --wbts-auth-bg: #22382a; --wbts-form: #e8c785; --wbts-form-bg: #3b301a;
    --wbts-plaus: #aebde0; --wbts-plaus-bg: #262f45; --wbts-later: #f0a090; --wbts-later-bg: #45231d; --wbts-focus: #e8c785;
  }
}
.wbts *, .wbts *::before, .wbts *::after { box-sizing: border-box; }
.wbts-loading { color: var(--wbts-muted); font-style: italic; }

/* header: tabs + year */
.wbts .wbts-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--wbts-line); padding-bottom: 10px; margin-bottom: 14px; }
.wbts .wbts-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.wbts .wbts-tab { font: 600 15px/1.2 var(--wbts-caps); letter-spacing: .02em; background: transparent; color: var(--wbts-muted); border: 1px solid transparent; border-radius: 999px; padding: 8px 12px; cursor: pointer; min-height: 38px; }
.wbts .wbts-tab:hover { color: var(--wbts-ink); background: var(--wbts-soft); }
.wbts .wbts-tab[aria-selected="true"] { background: var(--wbts-accent); color: var(--wbts-accent-ink); }
.wbts .wbts-year { display: flex; align-items: center; gap: 6px; }
.wbts .wbts-year-l { font: 600 14px/1 var(--wbts-caps); color: var(--wbts-muted); }
.wbts .wbts-year input { width: 78px; text-align: center; }
.wbts .wbts-step { width: 38px; height: 38px; border: 1px solid var(--wbts-line); background: var(--wbts-card); color: var(--wbts-ink); border-radius: 8px; font-size: 18px; line-height: 1; cursor: pointer; padding: 0; }

/* headings and text */
.wbts .wbts-h { font: 700 24px/1.2 var(--wbts-caps); margin: 4px 0 6px; color: var(--wbts-ink); letter-spacing: .01em; }
.wbts .wbts-h3 { font: 700 18px/1.3 var(--wbts-caps); margin: 22px 0 10px; color: var(--wbts-ink); }
.wbts h3 { font: 700 18px/1.3 var(--wbts-caps); margin: 0 0 8px; color: var(--wbts-ink); }
.wbts .wbts-intro { color: var(--wbts-muted); margin: 0 0 14px; font-size: 16px; max-width: 62ch; }
.wbts p { margin: 0; }
.wbts .wbts-dim { color: var(--wbts-muted); }
.wbts .wbts-small { font-size: 14px; color: var(--wbts-muted); margin: 8px 0 2px; }
.wbts .wbts-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* forms */
.wbts .wbts-form { display: grid; grid-template-columns: 1fr; gap: 10px 12px; margin: 0 0 14px; }
@container wbts (min-width: 520px) { .wbts .wbts-form { grid-template-columns: 1fr 1fr; } }
@container wbts (min-width: 860px) { .wbts .wbts-form { grid-template-columns: repeat(4, 1fr); } }
.wbts .wbts-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.wbts .wbts-field label { font: 600 13px/1.2 var(--wbts-caps); color: var(--wbts-muted); letter-spacing: .03em; }
.wbts input, .wbts select {
  font: 16px/1.3 var(--wbts-serif); color: var(--wbts-ink); background: var(--wbts-card); border: 1px solid var(--wbts-line);
  border-radius: 8px; padding: 8px 10px; min-height: 42px; height: auto; width: 100%; max-width: 100%; margin: 0; box-shadow: none;
}
.wbts input[type="search"] { -webkit-appearance: none; appearance: none; }
.wbts select { -webkit-appearance: none; appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
.wbts input:focus-visible, .wbts select:focus-visible, .wbts button:focus-visible, .wbts a:focus-visible, .wbts summary:focus-visible { outline: 3px solid var(--wbts-focus); outline-offset: 2px; }

/* buttons */
.wbts button { font-family: var(--wbts-serif); text-transform: none; letter-spacing: normal; box-shadow: none; text-shadow: none; width: auto; }
.wbts .wbts-btn { font: 600 15px/1.2 var(--wbts-caps); background: var(--wbts-accent); color: var(--wbts-accent-ink); border: 1px solid var(--wbts-accent); border-radius: 8px; padding: 9px 16px; min-height: 42px; cursor: pointer; }
.wbts .wbts-btn.alt { background: transparent; color: var(--wbts-accent); }
.wbts .wbts-mini { font: 600 13px/1 var(--wbts-caps); background: transparent; color: var(--wbts-muted); border: 1px solid var(--wbts-line); border-radius: 6px; padding: 6px 10px; min-height: 32px; cursor: pointer; }
.wbts .wbts-mini.on { background: var(--wbts-soft); color: var(--wbts-accent); border-color: var(--wbts-accent); }
.wbts .wbts-link { font: inherit; background: none; border: 0; padding: 0; color: var(--wbts-accent); text-decoration: underline; cursor: pointer; min-height: 0; }
.wbts .wbts-more { display: block; margin: 12px auto 0; font: 600 15px/1.2 var(--wbts-caps); background: var(--wbts-card); color: var(--wbts-ink); border: 1px solid var(--wbts-line); border-radius: 8px; padding: 10px 18px; cursor: pointer; }
.wbts .wbts-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.wbts .wbts-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.wbts a { color: var(--wbts-accent); }

/* chips */
.wbts .wbts-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.wbts .wbts-chip { display: inline-block; font: 600 12px/1.4 var(--wbts-serif); padding: 1px 8px; border-radius: 999px; background: var(--wbts-soft); color: var(--wbts-muted); white-space: nowrap; vertical-align: 1px; }
.wbts .wbts-chip.t-authentic { background: var(--wbts-auth-bg); color: var(--wbts-auth); }
.wbts .wbts-chip.t-modernised { background: var(--wbts-form-bg); color: var(--wbts-form); }
.wbts .wbts-chip.t-plausible { background: var(--wbts-plaus-bg); color: var(--wbts-plaus); }
.wbts .wbts-chip.t-later, .wbts .wbts-chip.t-mistake, .wbts .wbts-chip.rough { background: var(--wbts-later-bg); color: var(--wbts-later); }

/* phrase cards */
.wbts .wbts-count { font-size: 14px; color: var(--wbts-muted); margin: 0 0 8px; }
.wbts .wbts-results, .wbts .wbts-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@container wbts (min-width: 640px) { .wbts .wbts-results, .wbts .wbts-grid { grid-template-columns: 1fr 1fr; } }
@container wbts (min-width: 1000px) { .wbts .wbts-results, .wbts .wbts-grid { grid-template-columns: 1fr 1fr 1fr; } }
.wbts .wbts-card { background: var(--wbts-card); border: 1px solid var(--wbts-line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wbts .wbts-card.is-later { border-style: dashed; }
.wbts .wbts-me, .wbts .wbts-mefont { font-family: var(--wbts-serif); }
.wbts .wbts-me { font-size: 20px; line-height: 1.3; font-weight: 600; color: var(--wbts-ink); }
.wbts .wbts-mod { font-style: italic; color: var(--wbts-muted); font-size: 16px; }
.wbts .wbts-mean { font-size: 16px; }
.wbts .wbts-thou, .wbts .wbts-note, .wbts .wbts-alt { font-size: 15px; color: var(--wbts-muted); }
.wbts .wbts-thou b, .wbts .wbts-alt b { color: var(--wbts-ink); }
.wbts .wbts-card-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 10px; margin-top: auto; padding-top: 6px; border-top: 1px dotted var(--wbts-line); }
.wbts .wbts-src { font-size: 13px; color: var(--wbts-muted); }
.wbts .wbts-src a { color: var(--wbts-muted); }
.wbts .wbts-empty { background: var(--wbts-soft); border-radius: 10px; padding: 14px; color: var(--wbts-muted); }
.wbts .wbts-empty p + p { margin-top: 6px; }
.wbts .wbts-verdict { font: 700 15px/1.3 var(--wbts-caps); }
.wbts .wbts-verdict.no { color: var(--wbts-later); }
.wbts .wbts-verdict.yes { color: var(--wbts-auth); }

/* your list */
.wbts .wbts-yourlist { margin-top: 18px; background: var(--wbts-soft); border-radius: 10px; padding: 12px 14px; }
.wbts .wbts-yourlist[hidden] { display: none; }
.wbts .wbts-list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.wbts .wbts-list-head h3 { margin: 0; }
.wbts ul.wbts-list, .wbts ul.wbts-faces, .wbts ul.wbts-notes { list-style: none; margin: 8px 0 0; padding: 0; }
.wbts ul.wbts-list li, .wbts ul.wbts-notes li { padding: 4px 0; border-bottom: 1px dotted var(--wbts-line); margin: 0; font-size: 15px; }
.wbts ul.wbts-notes li { font-size: 14px; color: var(--wbts-muted); }

/* greeting scene */
.wbts .wbts-scene { display: flex; flex-direction: column; gap: 10px; }
.wbts .wbts-line { background: var(--wbts-card); border: 1px solid var(--wbts-line); border-radius: 12px; padding: 10px 14px; max-width: 92%; }
.wbts .wbts-line.wbts-b { align-self: flex-end; background: var(--wbts-soft); }
.wbts .wbts-who { font: 600 13px/1.3 var(--wbts-caps); color: var(--wbts-accent); letter-spacing: .03em; }
.wbts .wbts-linefoot { font-size: 13px; margin-top: 4px; }
.wbts .wbts-why { margin-top: 6px; background: var(--wbts-soft); border-radius: 10px; padding: 12px 14px; }
.wbts .wbts-why p + p { margin-top: 6px; }
.wbts .wbts-why p { font-size: 15px; }

/* letters */
.wbts .wbts-letter-wrap { display: grid; grid-template-columns: 1fr; gap: 14px; }
@container wbts (min-width: 760px) { .wbts .wbts-letter-wrap { grid-template-columns: 3fr 2fr; } }
.wbts .wbts-letter { background: var(--wbts-card); border: 1px solid var(--wbts-line); border-radius: 4px; padding: 18px 20px; box-shadow: 0 1px 0 var(--wbts-line), 0 6px 18px -12px rgba(60, 40, 20, .45); font-size: 18px; line-height: 1.55; }
.wbts .wbts-letter p + p { margin-top: 10px; }
.wbts .wbts-l-salute { font-weight: 600; }
.wbts .wbts-l-news { color: var(--wbts-muted); font-style: italic; }
.wbts .wbts-l-date { font-style: italic; }
.wbts .wbts-l-sign { text-align: right; }
.wbts .wbts-letter-mod p { font-size: 15px; color: var(--wbts-muted); }
.wbts .wbts-letter-mod p + p { margin-top: 8px; }

/* address */
.wbts .wbts-calc { background: var(--wbts-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; }
.wbts .wbts-calc .wbts-form { margin-bottom: 8px; }
.wbts .wbts-calc-out p { font-size: 16px; }
.wbts .wbts-calc-out p + p { margin-top: 4px; }
.wbts .wbts-big { font: 700 22px/1 var(--wbts-caps); color: var(--wbts-accent); }
.wbts .wbts-rules { margin-top: 10px; font-size: 15px; }
.wbts .wbts-rules summary { cursor: pointer; font: 600 15px/1.4 var(--wbts-caps); color: var(--wbts-accent); }
.wbts .wbts-rules ul { margin: 6px 0 0 18px; padding: 0; list-style: disc; }
.wbts .wbts-rules li { margin: 3px 0; }
.wbts .wbts-rank { font: 700 17px/1.3 var(--wbts-caps); margin: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.wbts .wbts-rank .wbts-dim { font: 400 14px/1 var(--wbts-serif); }
.wbts ul.wbts-faces li { margin: 2px 0; font-size: 16px; }
.wbts .wbts-dl { margin: 6px 0 0; display: grid; grid-template-columns: 1fr; gap: 0 10px; font-size: 15px; }
.wbts .wbts-dl dt { font: 600 13px/1.3 var(--wbts-caps); color: var(--wbts-muted); margin: 6px 0 0; float: none; width: auto; clear: none; padding: 0; }
.wbts .wbts-dl dd { margin: 0; padding: 0; }

/* footer */
.wbts .wbts-cta { margin-top: 18px; font-size: 16px; }
.wbts .wbts-foot { margin-top: 14px; font-size: 13px; color: var(--wbts-muted); border-top: 1px solid var(--wbts-line); padding-top: 10px; }

/* guard: undo theme styles that commonly break embedded tools */
.wbts table, .wbts td, .wbts th { border: 0; }
.wbts ul, .wbts ol { text-indent: 0; }
.wbts ul li::before, .wbts ol li::before { content: none; }
.wbts input[type="text"], .wbts input[type="search"], .wbts input[type="number"] { line-height: 1.3; }
.wbts button, .wbts input, .wbts select { float: none; display: inline-block; vertical-align: middle; }
.wbts .wbts-field input, .wbts .wbts-field select { display: block; }
.wbts .wbts-link { display: inline; vertical-align: baseline; }
.wbts .wbts-more { display: block; }
.wbts p:empty { display: none; }
.wbts h2, .wbts h3, .wbts h4 { text-transform: none; border: 0; padding: 0; background: none; }
.wbts h2::before, .wbts h2::after, .wbts h3::before, .wbts h3::after { content: none; display: none; }
.wbts svg { width: auto; height: auto; }
.wbts dl, .wbts dt, .wbts dd { float: none; }
