#tokenizer-playground {
  margin: 1.6em 0 2em;
  min-width: 0;
  font-size: 90%;
}
#tokenizer-playground *, #tokenizer-playground *::before, #tokenizer-playground *::after {
  box-sizing: border-box;
}
#tokenizer-playground .tokenizer-heading {
  background: #def;
  border-radius: 0.5em;
  padding: 0.65em 0.8em;
  color: #359;
  display: flex;
  align-items: center;
  gap: 0.8em;
  margin-bottom: 1.2em;
}
#tokenizer-playground .tokenizer-heading label { font-weight: 600; flex-shrink: 0; }
#tokenizer-playground select { min-width: 0; width: 100%; }
#tokenizer-playground :is(select, button) {
  font: inherit;
  border: 1px solid #abc;
  border-radius: 0.4em;
  background: #fff;
  padding: 0.45em 0.6em;
  color: #234;
}
#tokenizer-playground button { cursor: pointer; }
#tokenizer-playground button:disabled { color: #888; cursor: default; }
#tokenizer-playground .tokenizer-input-label { display: block; margin-bottom: 0.35em; }
#tokenizer-playground textarea {
  display: block;
  width: 100%;
  min-height: 12em;
  resize: vertical;
  padding: 0.8em;
  font-size: 100%;
  border: 1px solid #aaa;
  border-radius: 0.7em;
  background: #fff;
  color: #222;
  line-height: 1.7;
}
#tokenizer-playground :is(textarea, .tokenizer-output) {
  font-family: 'Andale Mono', Monaco, 'Courier New', 'Hiragino Kaku Gothic ProN', Meiryo, monospace;
}
#tokenizer-playground .tokenizer-toolbar { display: flex; flex-wrap: wrap; gap: 0.35em 1em; align-items: center; margin: 0.6em 0; }
#tokenizer-playground fieldset { display: flex; flex-shrink: 0; gap: 0.8em; margin: 0; padding: 0; border: 0; min-width: 0; }
#tokenizer-playground legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#tokenizer-playground input { margin: 0 0.2em 0 0; }
#tokenizer-playground label { cursor: pointer; }
#tokenizer-playground label:has(input:disabled) { color: #888; cursor: default; }
#tokenizer-playground .tokenizer-status { text-align: right; font-size: 85%; min-height: 1.8em; max-width: 100%; margin: 0 0 0 auto; color: #555; }
#tokenizer-playground .tokenizer-status progress {
  width: 4em;
  height: 0.7em;
  margin-inline-start: 0.5em;
  vertical-align: middle;
  accent-color: #359;
}
#tokenizer-playground .tokenizer-output {
  width: 100%;
  min-height: 7em;
  max-height: 32em;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: normal;
  border: 0;
  border-radius: 0.5em;
  background: #eee;
  padding: 0.8em;
  margin: 0;
  font-size: 100%;
  line-height: 1.9;
  text-align: left;
  text-autospace: no-autospace;
}
#tokenizer-playground .tokenizer-token { background: var(--tokenizer-color); padding: 0.12em 0.08em; border-radius: 0.3em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
/* Keep narrow row gaps and match the annotated mode's horizontal spacing. */
#tokenizer-playground .tokenizer-output[data-mode="text"] .tokenizer-token {
  padding-block: 0.24em;
  margin-inline-end: 0.08em;
}
#tokenizer-playground .tokenizer-color-0 { --tokenizer-color: #dcf; }
#tokenizer-playground .tokenizer-color-1 { --tokenizer-color: #dfc; }
#tokenizer-playground .tokenizer-color-2 { --tokenizer-color: #ffc; }
#tokenizer-playground .tokenizer-color-3 { --tokenizer-color: #fdc; }
#tokenizer-playground .tokenizer-color-4 { --tokenizer-color: #cdf; }
#tokenizer-playground .tokenizer-output[data-mode="both"] .tokenizer-token {
  background: none;
  padding: 0;
}
#tokenizer-playground .tokenizer-piece {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  vertical-align: bottom;
  max-width: 100%;
  margin: 0.12em 0.08em 0.12em 0;
  padding: 0.18em 0.14em 0.1em;
  border-radius: 0.3em;
  background: var(--tokenizer-color);
  line-height: 1.5;
}
#tokenizer-playground .tokenizer-token-id {
  font-size: calc(1em / 2);
  line-height: 1.2;
  text-align: center;
  color: #556;
  white-space: nowrap;
}
#tokenizer-playground .tokenizer-token-text {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#tokenizer-playground .tokenizer-whitespace { color: #778; }
#tokenizer-playground .tokenizer-byte { color: #667; }
#tokenizer-playground :is(textarea, select, button, input):focus-visible { outline: 2px solid #359; outline-offset: 3px; }
@media (max-width: 600px) {
  #tokenizer-playground .tokenizer-heading { flex-direction: column; align-items: stretch; gap: 0.4em; }
}
