:root {
  --bg: #f6f7f6;
  --bg-soft: rgba(255, 255, 255, 0.8);
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: #ffffff;
  --line: rgba(23, 25, 28, 0.08);
  --line-strong: rgba(23, 25, 28, 0.14);
  --text: #17191c;
  --muted: #6f7680;
  --accent: #1f7a5a;
  --accent-strong: #131619;
  --accent-soft: #e7f4ee;
  --success: #1f7a5a;
  --danger: #c74a4a;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --container: 1240px;
  --font-sans:
    "SF Pro Text",
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    "Noto Sans SC",
    "Helvetica Neue",
    sans-serif;
  --font-display: var(--font-sans);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(31, 122, 90, 0.06), transparent 20%),
    linear-gradient(180deg, #fafbfa 0%, #f3f5f4 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

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

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #131619;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong,
.brand-copy small {
  display: block;
  line-height: 1.1;
}

.brand-copy small,
.topbar-link {
  color: var(--muted);
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  min-width: 44px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef1f3;
  color: var(--muted);
  font-size: 12px;
}

.topbar-pill strong {
  font-size: 15px;
  line-height: 1;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}

.topbar-search {
  width: min(240px, 42vw);
}

.topbar-search input {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: none;
  font-size: 13px;
}

.topbar-search input::placeholder {
  color: #8b9199;
}

.topbar-search input:focus {
  border-color: var(--line);
  box-shadow: 0 0 0 3px rgba(23, 25, 28, 0.04);
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.topbar-link:hover {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.tool-shell,
.toolbar-card,
.tool-card,
.result-card,
.note-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

.home-main,
.tool-layout {
  display: grid;
  gap: 24px;
  margin-top: 4px;
}

.toolbar-card,
.tool-shell {
  border-radius: var(--radius-xl);
}

.toolbar-card {
  padding: 20px;
}

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

.section-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.muted,
.tool-intro {
  color: var(--muted);
  line-height: 1.65;
}

.field {
  display: grid;
  gap: 10px;
}

.field span {
  font-size: 14px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(31, 122, 90, 0.08);
}

textarea {
  min-height: 140px;
  padding: 12px 14px;
  resize: vertical;
}

.tool-grid {
  display: grid;
  gap: 18px;
}

.tool-group {
  display: grid;
  gap: 12px;
}

.tool-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(23, 25, 28, 0.08);
}

.tool-group-head h3 {
  margin: 0;
  font-size: 1rem;
}

.tool-group-head span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tool-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.tool-card {
  display: grid;
  gap: 10px;
  padding: 16px 16px 15px;
  border-radius: var(--radius-lg);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.tool-card:hover {
  transform: translateY(-1px);
  border-color: rgba(23, 25, 28, 0.16);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.tool-card-link {
  text-decoration: none;
  color: inherit;
}

.tool-card h4 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
  color: var(--text);
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.button-row,
.action-row,
.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
  background: #fff;
  color: var(--text);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: #131619;
  color: #fff;
  border-color: #131619;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.tool-shell {
  padding: 22px;
  animation: rise 0.5s ease both;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 22px;
}

.page-title {
  font-size: clamp(1.8rem, 2.8vw, 2.8rem);
}

.tool-grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 22px;
}

.result-stack {
  display: grid;
  gap: 18px;
}

.form-card,
.result-card,
.note-card {
  padding: 20px;
  border-radius: var(--radius-lg);
}

.form-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.field.full {
  grid-column: 1 / -1;
}

.hint {
  margin: -4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.quick-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0 2px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8f9f8;
}

.quick-panel-label {
  font-size: 13px;
  color: var(--muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip-btn {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.chip-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: var(--accent-soft);
}

.inline-feedback {
  min-height: 24px;
  margin-top: 10px;
  font-size: 14px;
}

.inline-feedback.error {
  color: var(--danger);
}

.inline-feedback.success {
  color: var(--success);
}

.result-card {
  background: rgba(255, 255, 255, 0.92);
}

.result-label {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-main {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.4vw, 2.25rem);
  line-height: 1.2;
}

.timer-main {
  font-family: ui-monospace, "SFMono-Regular", "SF Mono", Consolas, monospace;
  letter-spacing: -0.04em;
  font-size: clamp(2.4rem, 5vw, 4rem);
}

.result-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #f8f9f8;
  border: 1px solid var(--line);
}

.result-item span:first-child {
  color: var(--muted);
}

.result-item strong {
  text-align: right;
  word-break: break-word;
}

.list-panel {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8f9f8;
}

.list-row.is-done .list-row-text {
  color: var(--muted);
  text-decoration: line-through;
}

.list-row-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.list-row-text {
  overflow-wrap: anywhere;
}

.icon-btn-lite {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 32px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.wheel-display {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin-top: 6px;
  border-radius: 20px;
  border: 1px dashed rgba(31, 122, 90, 0.28);
  background: linear-gradient(180deg, rgba(231, 244, 238, 0.9), rgba(255, 255, 255, 0.9));
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
  padding: 16px;
}

.wheel-display.is-spinning {
  animation: pulse-wheel 0.22s linear infinite;
}

.output-panel,
.preview-panel {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8f9f8;
  min-height: 140px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3,
.markdown-preview p,
.markdown-preview ul,
.markdown-preview ol,
.markdown-preview pre,
.markdown-preview blockquote {
  margin: 0 0 12px;
}

.markdown-preview ul,
.markdown-preview ol {
  padding-left: 20px;
}

.markdown-preview code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(23, 25, 28, 0.06);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.markdown-preview pre {
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: auto;
}

.markdown-preview pre code {
  padding: 0;
  background: transparent;
}

.shadow-preview,
.qr-panel {
  margin-top: 14px;
  min-height: 140px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 16px;
}

.qr-panel img {
  width: 220px;
  max-width: 100%;
  height: auto;
  display: block;
}

.qr-panel canvas {
  width: 220px;
  max-width: 100%;
  height: auto;
  display: block;
}

.qr-preview-image {
  display: block;
  width: min(240px, 100%);
  height: auto;
  margin: 0 auto 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

@keyframes pulse-wheel {
  0% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

.note-card {
  background: rgba(255, 255, 255, 0.9);
}

.note-card h2,
.form-card h2 {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 1.1rem;
}

.note-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.empty-state {
  padding: 28px 12px 12px;
  text-align: center;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 920px) {
  .tool-grid-layout {
    grid-template-columns: 1fr;
  }

  .tool-header,
  .section-head {
    flex-direction: column;
    align-items: start;
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(calc(100% - 20px), var(--container));
    padding-top: 18px;
    padding-bottom: 36px;
  }

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

  .topbar-meta {
    width: 100%;
    justify-content: space-between;
  }

  .topbar-search {
    flex: 1 1 220px;
    width: auto;
  }

  .toolbar-card,
  .tool-shell {
    padding: 18px;
    border-radius: 20px;
  }

  .tool-card,
  .form-card,
  .result-card,
  .note-card {
    padding: 16px;
  }

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

  .btn {
    width: 100%;
  }
}
