:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --surface: #fffefa;
  --ink: #2d352f;
  --muted: #6b7368;
  --faint: #9ba195;
  --line: #dfe2d8;
  --accent: #b74e30;
  --accent-hover: #a34127;
  --soft: #f2e9df;
  --switch: #edeee6;
  --key: #fcfbf6;
  --serif: Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #202521;
  --surface: #292f2a;
  --ink: #ecebe1;
  --muted: #a8b0a4;
  --faint: #7e887d;
  --line: #414a40;
  --accent: #ed9977;
  --accent-hover: #f8ad8b;
  --soft: #41392e;
  --switch: #1e251f;
  --key: #292f2a;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 13px var(--sans);
  -webkit-font-smoothing: antialiased;
}
button,
a,
input,
textarea,
summary,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: 0;
  background: none;
}
button:disabled {
  opacity: 0.35;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
summary:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button,
summary {
  touch-action: manipulation;
}
svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.icons {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.page {
  width: 100%;
  height: 100dvh;
  min-height: 500px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
}
.site-header {
  min-height: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand h1 {
  margin: 0;
  font: 650 20px var(--sans);
  letter-spacing: -0.7px;
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 25px;
  border: 1px solid var(--accent);
  border-radius: 5px 5px 5px 1px;
  color: var(--accent);
  font: 23px/1 var(--serif);
  padding-bottom: 3px;
}
.brand-period {
  color: var(--accent);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.local-note {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: 8px;
  font-size: 11px;
  color: var(--muted);
}
.local-note svg {
  width: 12px;
  height: 12px;
}
.icon-button {
  height: 32px;
  width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 5px;
  color: var(--muted);
  flex-shrink: 0;
}
.icon-button:hover:not(:disabled),
.text-button:hover:not(:disabled) {
  background: var(--switch);
  color: var(--ink);
}
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0;
}
.workspace {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 280px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.workspace:focus-within {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
}
.editor-top {
  min-height: 46px;
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
}
.mode-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mode-switch {
  display: flex;
  padding: 3px;
  background: var(--switch);
  border-radius: 6px;
  gap: 2px;
}
.mode {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
}
.mode.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px #00000012;
}
.mode-letter {
  color: var(--muted);
  font: 15px/1 var(--serif);
}
.mode.active .mode-letter {
  color: var(--accent);
}
kbd {
  display: inline-block;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 4px;
  font: 10px var(--sans);
  white-space: nowrap;
  color: var(--muted);
}
.layout-label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  position: relative;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #7e8b67;
}
.layout-label select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  padding: 7px 20px 7px 5px;
  border-radius: 4px;
}
.layout-label select:hover {
  background: var(--switch);
}
.layout-label > svg {
  position: absolute;
  right: 57px;
  width: 11px;
  height: 11px;
  pointer-events: none;
}
.phonetic-label {
  font-size: 11px;
}
textarea {
  display: block;
  flex: 1;
  width: 100%;
  height: 0;
  min-height: 180px;
  resize: none;
  border: 0;
  padding: 16px 18px;
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  font: 21px/1.55 var(--serif);
  outline: none;
  caret-color: var(--accent);
}
textarea::placeholder {
  color: var(--faint);
}
textarea::selection {
  background: var(--soft);
  color: var(--ink);
}
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
}
.edit-tools,
.conversion-tools,
.output-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tool-divider {
  height: 17px;
  width: 1px;
  background: var(--line);
  margin: 0 5px;
}
.text-button {
  min-height: 32px;
  padding: 5px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
}
.text-button span {
  margin-right: 3px;
}
.copy-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 5px;
  margin-left: 4px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--accent);
  color: var(--surface);
}
.copy-button:hover:not(:disabled) {
  background: var(--accent-hover);
}
.copy-button:disabled {
  opacity: 0.48;
}
.copy-button svg {
  width: 14px;
  height: 14px;
}
.copy-button kbd {
  border: 0;
  background: #ffffff20;
  color: inherit;
  font-size: 9px;
  padding: 2px 4px;
  margin-left: 3px;
}
.editor-meta {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2px 12px;
  min-height: 24px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
}
.editor-meta p {
  margin: 0;
}
.draft-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  cursor: pointer;
}
.draft-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.toggle-track {
  width: 25px;
  height: 14px;
  border-radius: 9px;
  background: var(--line);
  padding: 3px;
}
.toggle-track:after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 2px #0002;
}
.draft-toggle input:checked + .toggle-track {
  background: var(--accent);
}
.draft-toggle input:checked + .toggle-track:after {
  transform: translateX(11px);
}
.draft-toggle input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.reference {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
}
.reference summary {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}
.reference summary::-webkit-details-marker {
  display: none;
}
.reference summary svg {
  width: 13px;
  height: 13px;
}
.reference[open] summary svg {
  transform: rotate(180deg);
}
.reference-body {
  padding: 0 0 2px;
}
.reference-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 5px;
}
.reference-caption p {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}
.reference-options {
  display: flex;
  gap: 6px;
}
.caps-button {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 3px 7px;
  min-height: 27px;
  color: var(--muted);
  font-size: 12px;
}
.caps-button span {
  font-size: 10px;
}
.caps-button[aria-pressed="true"] {
  background: var(--soft);
  color: var(--accent);
  border-color: var(--accent);
}
#stressed-i {
  font: 17px var(--serif);
}
#stressed-i span {
  font: 10px var(--sans);
}
.alphabet {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 4px;
}
.alphabet[data-language="bg"] {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}
.letter-key {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--key);
}
.letter-key:hover {
  background: var(--soft);
  border-color: var(--accent);
}
.letter-key .letter {
  font: 20px/1 var(--serif);
}
.letter-key .keys {
  font-size: 10px;
  color: var(--muted);
}
.reference-footnote {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  margin: 5px 0 0;
}
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translate(-50%, 10px);
  opacity: 0;
  pointer-events: none;
  max-width: calc(100vw - 24px);
  border-radius: 7px;
  padding: 10px 16px;
  font-size: 12px;
  line-height: 1.5;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 4px 20px #0002;
  transition:
    opacity 0.15s,
    transform 0.15s;
  z-index: 10;
}
.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
dialog {
  width: min(600px, calc(100% - 28px));
  max-height: 85dvh;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 28px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 80px #0003;
}
dialog::backdrop {
  background: #1a211b70;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 18px;
}
dialog dl {
  margin: 0;
}
dialog dl > div {
  margin-top: 15px;
}
dialog dt {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
dialog dd {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}
dialog dd b {
  color: var(--ink);
  font-weight: 500;
}
.dialog-close {
  position: absolute;
  right: 8px;
  top: 8px;
}
.example-button {
  margin-top: 18px;
  padding: 7px 10px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
  color: var(--accent);
}
.example-button:hover:not(:disabled) {
  background: var(--soft);
}
.help-privacy {
  margin: 18px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.noscript {
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 16px;
  text-align: center;
  background: var(--accent);
  color: var(--surface);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 700px) {
  .page {
    padding: 0 10px;
    min-height: 520px;
  }
  .copy-shortcut {
    display: none;
  }
  .esc-hint {
    display: none;
  }
  .phonetic-label {
    display: none;
  }
  .layout-label > svg {
    right: 4px;
  }
  .editor-top {
    min-height: 50px;
    padding: 5px 8px;
    gap: 4px 6px;
  }
  .mode {
    min-height: 32px;
  }
  .editor-toolbar {
    padding: 5px 6px;
    gap: 2px 6px;
  }
  .text-button {
    padding: 5px 6px;
  }
  .tool-divider {
    margin: 0 2px;
  }
  textarea {
    font-size: 20px;
    padding: 12px;
  }
  .alphabet,
  .alphabet[data-language="bg"] {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .letter-key {
    min-height: 44px;
    flex-direction: column;
    gap: 3px;
    padding: 4px 0;
  }
  .reference-footnote {
    font-size: 10px;
  }
}
@media (max-width: 480px) {
  .page {
    height: auto;
    min-height: 100dvh;
  }
  main {
    min-height: 0;
  }
  .workspace {
    flex: none;
  }
  textarea {
    flex: none;
    height: max(260px, calc(100dvh - 280px));
  }
  .editor-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .edit-tools {
    justify-content: space-between;
  }
  .conversion-tools {
    margin-left: auto;
  }
  .output-tools {
    border-top: 1px solid var(--line);
    padding-top: 4px;
    gap: 5px;
  }
  .copy-button {
    margin-left: auto;
    min-height: 36px;
  }
  .editor-toolbar .icon-button,
  .text-button {
    min-height: 36px;
  }
  .local-note {
    margin-right: 3px;
    font-size: 10px;
  }
  .caps-button span {
    display: none;
  }
  .reference-caption p {
    font-size: 10px;
  }
  .editor-meta {
    font-size: 10px;
    gap: 2px 6px;
  }
  dialog {
    padding: 24px 20px;
  }
}
@media (max-width: 350px) {
  .local-note {
    display: none;
  }
  .mode {
    padding: 5px 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    transition: none !important;
  }
}
