* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: #1f2328;
  background: #ffffff;
  line-height: 1.6;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

.admin .container {
  max-width: 960px;
}

h1.page-title {
  font-size: 24px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #d1d9e0;
}

/* ---------- 代码块样式（展示页核心） ---------- */
.block {
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  margin-bottom: 20px;
  overflow: hidden;
}

.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Courier New", monospace;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 10px 8px 16px;
  background: #eff2f5;
  border-bottom: 1px solid #d0d7de;
}

.copy-btn {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  font-weight: 400;
  font-size: 13px;
  padding: 4px 10px;
  background: #ffffff;
}

.copy-btn:hover {
  background: #f0f3f6;
}

.block-content {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-tip {
  color: #8c959f;
  text-align: center;
  padding: 32px 0;
}

/* ---------- 管理页 ---------- */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  border-bottom: 1px solid #d0d7de;
  margin-bottom: 20px;
}

.tab-btn {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  padding: 8px 14px;
}

.tab-btn:hover {
  background: #f6f8fa;
}

.tab-btn.active {
  border-bottom-color: #0969da;
  font-weight: 600;
}

.new-category {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.new-category input {
  flex: 1;
}

input[type="text"],
textarea {
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-family: inherit;
  background: #fff;
}

textarea {
  width: 100%;
  resize: none;
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Courier New", monospace;
}

input:focus,
textarea:focus {
  outline: 2px solid #0969da;
  outline-offset: -1px;
}

button {
  font-size: 14px;
  padding: 7px 14px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  background: #f6f8fa;
  color: #1f2328;
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  background: #eef1f4;
}

button.primary {
  background: #0969da;
  border-color: #0969da;
  color: #fff;
}

button.primary:hover {
  background: #0757ba;
}

button.danger {
  color: #cf222e;
}

.category-card {
  border: 1px solid #d0d7de;
  border-radius: 8px;
  margin-bottom: 28px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: #f6f8fa;
  border-bottom: 1px solid #d0d7de;
  border-radius: 8px 8px 0 0;
}

.category-name {
  font-size: 17px;
  font-weight: 600;
}

.category-link {
  font-size: 13px;
  color: #0969da;
  text-decoration: none;
}

.category-link:hover {
  text-decoration: underline;
}

.spacer {
  flex: 1;
}

.category-body {
  padding: 16px;
}

.block-editor {
  border: 1px solid #e4e8ec;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 14px;
}

.block-editor-top {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.block-editor-top input[type="text"]:first-child {
  flex: 1;
}

.block-editor .date-input {
  width: 130px;
  flex: none;
}

.block-editor input[type="text"] {
  font-weight: 600;
}

.editor-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.add-block-row {
  margin-top: 4px;
}

.block-editor input[readonly],
.block-editor textarea[readonly] {
  background: #f6f8fa;
}

.block-editor .date-input[readonly] {
  background: #f6f8fa;
}

/* ---------- 登录页 ---------- */
.login {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #f6f8fa;
}

.login-container {
  width: 100%;
  max-width: 360px;
  padding: 32px;
  background: #fff;
  border: 1px solid #d0d7de;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.login-title {
  font-size: 20px;
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #d1d9e0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: #1f2328;
}

.form-group input {
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  font-family: inherit;
  background: #fff;
}

.form-group input:focus {
  outline: 2px solid #0969da;
  outline-offset: -1px;
}

.form-error {
  color: #cf222e;
  font-size: 13px;
  min-height: 18px;
}

.login-btn {
  width: 100%;
  padding: 8px 16px;
  font-size: 15px;
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
