* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

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

.hero {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  max-width: 100%;
  margin: 0;
  font-size: clamp(3rem, 8vw, 5.8rem);
  line-height: 0.94;
  overflow-wrap: break-word;
}

.hero p:last-child {
  max-width: 640px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.tool {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgb(19 45 35 / 8%);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

button,
.file-load {
  display: inline-flex;
  min-height: 42px;
  min-width: 0;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--text-inverse);
  font-weight: 800;
  cursor: pointer;
}

.secondary-button,
.file-load {
  border: 1px solid var(--accent);
  background: var(--panel);
  color: var(--accent-strong);
}

.secondary-button:hover,
.file-load:hover {
  background: var(--accent-soft);
}

.file-load {
  position: relative;
  overflow: hidden;
}

.file-load input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--muted);
  font-size: 0.92rem;
}

.options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

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

.editor-grid label,
.preview-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

textarea {
  display: block;
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--bg-subtle);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  resize: vertical;
}

textarea[readonly] {
  background: var(--panel);
}

.preview-panel {
  grid-column: 1 / -1;
}

.preview-panel iframe {
  width: 100%;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.status {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
}

.status[data-tone="error"] {
  color: var(--danger);
}

.status[data-tone="warn"] {
  color: var(--warn);
}

.status[data-tone="ok"] {
  color: var(--accent-strong);
}

@media (max-width: 760px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .shell {
    width: calc(100% - 24px);
    padding: 28px 0;
  }

  h1 {
    font-size: clamp(2.35rem, 13vw, 3.25rem);
    line-height: 0.98;
  }

  .hero p:last-child {
    font-size: 1rem;
  }

  .tool {
    padding: 14px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar > * {
    min-width: 0;
  }

  .toolbar button,
  .toolbar .file-load {
    width: 100%;
    padding: 0 10px;
    white-space: normal;
    text-align: center;
  }

  textarea,
  .preview-panel iframe {
    min-height: 240px;
  }

  .options {
    display: grid;
    grid-template-columns: 1fr;
    font-size: 0.88rem;
  }

  .options label {
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .toolbar {
    grid-template-columns: 1fr;
  }
}
