:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #5b6876;
  --line: #d9dee5;
  --accent: #1667d9;
  --accent-dark: #0f4ea8;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

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

.shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.brand {
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
}

.link {
  color: var(--accent);
  text-decoration: none;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 12px 28px rgba(23, 32, 42, 0.06);
}

.narrow {
  max-width: 440px;
  margin: 56px auto 0;
}

h1 {
  margin: 0 0 20px;
  font-size: 28px;
  line-height: 1.25;
}

.form,
.upload {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

input[type="text"],
input[type="password"],
input:not([type]) {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--text);
  font-size: 16px;
}

.dropzone {
  min-height: 180px;
  place-items: center;
  border: 1px dashed #9aa7b5;
  border-radius: 8px;
  background: #fbfcfd;
  cursor: pointer;
}

.dropzone span {
  color: var(--text);
  font-size: 18px;
  font-weight: 650;
}

.dropzone input {
  max-width: 92%;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  font-size: 15px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--accent-dark);
}

.secondary {
  background: #fff;
  color: var(--accent);
}

.secondary:hover {
  background: #eef5ff;
}

.hint {
  color: var(--muted);
  margin: 14px 0 0;
}

.error {
  color: var(--danger);
  background: #fff2f0;
  border: 1px solid #ffccc7;
  border-radius: 6px;
  padding: 10px 12px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.markdown {
  width: 100%;
  min-height: 64vh;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  font: 14px/1.65 Consolas, "SFMono-Regular", Menlo, monospace;
  color: #111827;
  background: #fbfcfd;
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1120px);
    padding-top: 14px;
  }

  .panel {
    padding: 18px;
  }

  .result-head {
    display: grid;
  }

  .actions {
    justify-content: stretch;
  }

  .button,
  button {
    width: 100%;
  }
}
