:root {
  color-scheme: light;
  --ink: #19201c;
  --muted: #5d665f;
  --line: #cbd4cc;
  --panel: #f8faf7;
  --paper: #fffefb;
  --accent: #0d6b63;
  --accent-ink: #ffffff;
  --soft: #e6f2ef;
  --warning: #8a4e00;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(13, 107, 99, 0.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(13, 107, 99, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  min-height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 0.85rem;
  color: var(--ink);
  background: #ffffff;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  width: min(1280px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 9px 0 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand-icon {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}

.brand-prefix {
  color: var(--muted);
  opacity: 0.55;
  font-weight: 600;
  margin-right: 0.18em;
}

.brand-suffix {
  font-size: 0.3em;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.55;
  vertical-align: middle;
  letter-spacing: 0.02em;
  margin-left: 0.08em;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 0.95;
}

h2 {
  font-size: 1rem;
}

.brand p,
.hint {
  color: var(--muted);
}

.topbar-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.github-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
}

.github-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.status-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  color: var(--accent);
  background: #ffffff;
  font-size: 0.9rem;
}

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.actions {
  display: flex;
  gap: 8px;
}

.editor {
  display: block;
  width: 100%;
  min-height: 440px;
  resize: vertical;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  color: var(--ink);
  background: transparent;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
  outline: none;
  tab-size: 2;
  white-space: pre;
}

.editor:focus {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.output {
  background: #fbfffd;
}

.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  color: var(--muted);
}

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

.hint,
.warnings {
  min-height: 48px;
  padding: 13px 14px;
  font-size: 0.94rem;
}

.warnings {
  margin: 0;
  color: var(--warning);
}

.preview-panel {
  margin-top: 18px;
}

.preview {
  padding: 16px;
  overflow-x: auto;
}

.preview > :first-child {
  margin-top: 0;
}

.preview h1,
.preview h2,
.preview h3 {
  font-size: 1.05rem;
  line-height: 1.3;
  margin: 1.2em 0 0.5em;
}

.preview table {
  border-collapse: collapse;
  max-width: 100%;
  margin: 0.4em 0 1.2em;
  font-size: 0.94rem;
}

.preview th,
.preview td {
  border: 1px solid var(--line);
  padding: 7px 12px;
  text-align: left;
}

.preview thead th {
  background: var(--soft);
  font-weight: 600;
}

.preview tbody tr:nth-child(even) td {
  background: rgba(13, 107, 99, 0.03);
}

@media (max-width: 840px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-right {
    align-items: flex-start;
  }

  .status-strip {
    justify-content: flex-start;
  }

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

  .editor {
    min-height: 320px;
  }
}
