:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --panel: #ffffff;
  --text: #17212b;
  --muted: #5f6f7f;
  --border: #d8e0e7;
  --accent: #136f63;
  --accent-strong: #0c534a;
  --coffee: #ffdd00;
  --coffee-text: #201b00;
  --danger: #b42318;
  --warning: #946200;
  --code-bg: #101820;
  --code-text: #edf7f6;
  --syntax-keyword: #7dd3fc;
  --syntax-section: #facc15;
  --syntax-string: #86efac;
  --syntax-variable: #f0abfc;
  --syntax-comment: #94a3b8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.version {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.actions,
.options {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

button,
select {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

button {
  padding: 0 14px;
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 650;
}

.coffee-link,
.github-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.coffee-link {
  border-color: #e7c600;
  background: var(--coffee);
  color: var(--coffee-text);
}

.coffee-link:hover {
  background: #f2d000;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  background: var(--panel);
  color: var(--text);
}

button.secondary:hover {
  background: #edf2f6;
}

select {
  padding: 0 36px 0 12px;
}

.github-link {
  background: var(--panel);
}

.github-link:hover {
  background: #edf2f6;
}

.github-link svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  flex: 0 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.editor-pane {
  display: flex;
  flex-direction: column;
  min-height: 620px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}

.editor-pane > span {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

textarea {
  width: 100%;
  flex: 1;
  resize: vertical;
  border: 0;
  outline: none;
  padding: 16px;
  background: var(--code-bg);
  color: var(--code-text);
  font: 14px/1.55 "Cascadia Code", Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}

textarea::placeholder {
  color: #8fb2b0;
}

.highlight-preview {
  border-top: 1px solid var(--border);
  background: var(--code-bg);
}

.highlight-preview > span {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #a8c6c3;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

pre {
  min-height: 180px;
  max-height: 320px;
  margin: 0;
  overflow: auto;
  padding: 16px;
  color: var(--code-text);
  font: 14px/1.55 "Cascadia Code", Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

.token-keyword {
  color: var(--syntax-keyword);
  font-weight: 700;
}

.token-section {
  color: var(--syntax-section);
  font-weight: 700;
}

.token-string {
  color: var(--syntax-string);
}

.token-variable {
  color: var(--syntax-variable);
}

.token-comment {
  color: var(--syntax-comment);
  font-style: italic;
}

.options {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.status {
  min-height: 44px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #e9f7f4;
  color: var(--accent-strong);
  font-size: 14px;
  line-height: 1.45;
}

.status.warning {
  background: #fff7df;
  color: var(--warning);
}

.status.error {
  background: #fff0ed;
  color: var(--danger);
}

.site-footer {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.site-footer a {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--accent-strong);
  color: white;
  box-shadow: 0 12px 30px rgba(16, 24, 32, 0.22);
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .editor-pane {
    min-height: 420px;
  }
}

@media (max-width: 560px) {
  .app-shell,
  .site-footer {
    width: min(100% - 20px, 1440px);
  }

  h1 {
    font-size: 26px;
  }

  .actions,
  .options {
    align-items: stretch;
    flex-direction: column;
  }

  .actions > *,
  .options > *,
  .options select,
  .options button {
    width: 100%;
  }
}
