:root {
  --ink: #1a1410;
  --paper: #f3ebe1;
  --muted: #7a6a5c;
  --accent: #e85d2c;
  --accent-2: #2f6f5e;
  --tile: rgba(255, 252, 247, 0.92);
  --line: rgba(26, 20, 16, 0.08);
  --shadow: 0 18px 40px rgba(26, 20, 16, 0.12);
  --radius: 22px;
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: "ZCOOL XiaoWei", "Noto Sans SC", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 93, 44, 0.35), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(47, 111, 94, 0.28), transparent 50%),
    linear-gradient(165deg, #241a14 0%, #1a1410 45%, #12100e 100%);
}

.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath fill='none' stroke='%23f3ebe1' stroke-opacity='0.06' d='M0 60h120M60 0v120'/%3E%3C/svg%3E");
  pointer-events: none;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  min-height: 100vh;
}

.hero {
  padding: 18px 4px 8px;
}

.brand {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  letter-spacing: 0.04em;
  color: var(--paper);
  line-height: 1.05;
}

.tagline {
  margin: 14px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: #f7d8c8;
}

.sub {
  margin: 10px 0 0;
  max-width: 34em;
  color: rgba(243, 235, 225, 0.72);
  font-size: 0.95rem;
  line-height: 1.55;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn.primary {
  background: var(--accent);
  color: #fff8f4;
  box-shadow: 0 10px 24px rgba(232, 93, 44, 0.35);
}

.btn.ghost {
  background: rgba(243, 235, 225, 0.1);
  color: var(--paper);
  border: 1px solid rgba(243, 235, 225, 0.18);
}

.guide {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(243, 235, 225, 0.1);
  border: 1px solid rgba(243, 235, 225, 0.16);
  color: rgba(243, 235, 225, 0.88);
  font-size: 0.9rem;
  line-height: 1.5;
}

.guide-title {
  margin: 0 0 8px;
  font-weight: 700;
  color: #fff4ec;
}

.guide ol {
  margin: 0;
  padding-left: 1.2em;
}

.section {
  margin-top: 34px;
}

.section-title {
  margin: 0 0 14px;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(243, 235, 225, 0.55);
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head .section-title {
  margin: 0;
}

.text-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #f0c2a8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (min-width: 560px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.tool {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 148px;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--tile);
  box-shadow: var(--shadow);
  text-decoration: none;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 900;
  color: #fff;
}

.tool-icon.orange {
  background: linear-gradient(145deg, #f0783a, #d94a1c);
}

.tool-icon.teal {
  background: linear-gradient(145deg, #3d8f78, #245f50);
}

.tool-icon.ink {
  background: linear-gradient(145deg, #3a322c, #1f1915);
}

.tool-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.tool-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.badge {
  margin-top: auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent-2);
}

.badge.ext {
  color: var(--accent);
}

.empty {
  grid-column: 1 / -1;
  padding: 24px;
  color: rgba(243, 235, 225, 0.55);
  text-align: center;
}

.foot {
  margin-top: 40px;
  color: rgba(243, 235, 225, 0.4);
  font-size: 0.78rem;
  text-align: center;
}

body.sheet-open {
  overflow: hidden;
}

.sheet {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  background: rgba(10, 8, 6, 0.55);
  display: none;
  align-items: flex-end;
  padding: 12px;
}

.sheet.is-open {
  display: flex !important;
}

.sheet[hidden] {
  display: none !important;
}

.sheet-panel {
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  border-radius: 22px 22px 18px 18px;
  background: #f7f1ea;
  color: var(--ink);
  padding: 16px 16px 22px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
  -webkit-overflow-scrolling: touch;
}

.sheet-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.sheet-bar h2 {
  margin: 0;
  font-size: 1.15rem;
}

.sheet-close {
  appearance: none;
  border: 0;
  background: rgba(26, 20, 16, 0.08);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sheet-tip {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.sheet-actions .btn.ghost,
.form-actions .btn.ghost {
  color: var(--ink);
  border: 1px solid rgba(26, 20, 16, 0.12);
  background: rgba(26, 20, 16, 0.04);
}

.sheet-actions .btn.primary,
.form-actions .btn.primary {
  color: #fff8f4;
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manage-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(26, 20, 16, 0.06);
}

.manage-main {
  display: flex;
  gap: 12px;
  align-items: center;
}

.manage-name {
  margin: 0;
  font-weight: 700;
}

.manage-meta {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}

.manage-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.manage-ops button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(26, 20, 16, 0.06);
  cursor: pointer;
}

.tool-icon.sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.form,
.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form label,
.form-label {
  margin-bottom: 12px;
  font-size: 0.88rem;
  font-weight: 700;
}

.form input,
.form select,
.form textarea,
.form-label textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid rgba(26, 20, 16, 0.12);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  font-weight: 400;
  background: #fff;
  color: var(--ink);
}

.form textarea,
.form-label textarea {
  resize: vertical;
  line-height: 1.45;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.82rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.btn.danger {
  background: #b42318;
  color: #fff;
}

.run-result {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid rgba(26, 20, 16, 0.08);
  font-size: 0.82rem;
  word-break: break-all;
  white-space: pre-wrap;
}
