:root {
  --bg: #f5efe5;
  --paper: rgba(255, 250, 243, 0.92);
  --paper-strong: #fffdf8;
  --ink: #11233b;
  --muted: #536072;
  --line: rgba(17, 35, 59, 0.14);
  --accent: #e85d2a;
  --accent-deep: #c6491d;
  --accent-alt: #0f766e;
  --shadow: 0 22px 50px rgba(17, 35, 59, 0.12);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --mono: "IBM Plex Mono", "SFMono-Regular", "Cascadia Code", monospace;
  --sans: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(232, 93, 42, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 22%),
    linear-gradient(180deg, #f8f2e9 0%, #f3ecdf 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(17, 35, 59, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 35, 59, 0.035) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 95%);
}

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

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

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

.topbar {
  position: sticky;
  top: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 248, 238, 0.85);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: fit-content;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: url("/assets/favicon.svg") center / cover no-repeat;
  color: transparent;
  font-size: 0;
  box-shadow: 0 10px 20px rgba(232, 93, 42, 0.25);
  overflow: hidden;
  user-select: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-copy strong {
  font-size: 1rem;
  letter-spacing: 0.02em;
}

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

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  flex: 1;
}

.nav-link,
.ghost-link,
.category-pill,
.hero-pills span,
.status-chip {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
}

.nav-link {
  padding: 10px 14px;
  color: var(--muted);
  transition: transform 180ms ease, border-color 180ms ease, color 180ms ease;
}

.nav-link:hover,
.ghost-link:hover,
.side-link:hover {
  transform: translateY(-1px);
  border-color: rgba(17, 35, 59, 0.22);
  color: var(--ink);
}

.ghost-link {
  padding: 10px 16px;
  color: var(--ink);
  white-space: nowrap;
}

.locale-switcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 6px 8px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.locale-switcher span {
  font-size: 0.88rem;
  white-space: nowrap;
}

.locale-switcher select {
  width: auto;
  min-width: 148px;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  border-color: rgba(17, 35, 59, 0.1);
  background: rgba(255, 255, 255, 0.94);
}

.hero,
.sub-hero {
  display: grid;
  grid-template-columns: 1.35fr 0.95fr;
  gap: 24px;
  margin-top: 28px;
}

.hero-copy,
.hero-panel,
.sub-hero,
.page-section,
.story-card,
.tool-canvas,
.tool-side .side-card,
.category-card,
.tool-card {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-panel,
.sub-hero,
.page-section,
.story-card,
.tool-canvas,
.tool-side .side-card,
.category-card,
.tool-card {
  border-radius: var(--radius-xl);
}

.hero-copy {
  padding: 40px;
}

.hero-panel {
  padding: 28px;
  display: grid;
  gap: 16px;
  align-content: start;
}

.home-hero {
  grid-template-columns: 1fr;
  gap: 18px;
}

.home-hero .hero-copy {
  padding: 34px 38px;
}

.home-hero .hero-copy h1 {
  max-width: none;
  font-size: clamp(2.2rem, 3.8vw, 3.7rem);
  line-height: 1.02;
}

.home-hero .hero-text {
  max-width: 68ch;
  font-size: 1.02rem;
}

.home-hero .hero-panel {
  padding: 24px 26px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  max-width: 12ch;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.5rem);
}

h3 {
  font-size: 1.3rem;
}

.hero-text,
.section-head p,
.story-card p,
.tool-card p,
.tool-side p,
.footer-copy p,
.footer-meta span,
.notice {
  color: var(--muted);
  line-height: 1.7;
}

.hero-text {
  margin: 18px 0 0;
  max-width: 56ch;
}

.hero-actions,
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-pills span,
.category-pill,
.status-chip {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent), #ff8b52);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(232, 93, 42, 0.24);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(232, 93, 42, 0.28);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.align-start {
  justify-content: flex-start;
}

.stat-card,
.mini-stat,
.metric-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--paper-strong);
  border: 1px solid var(--line);
}

.stat-card strong,
.mini-stat strong,
.metric-card strong {
  display: block;
  font-size: 1.6rem;
  line-height: 1.2;
  margin-top: 8px;
}

.stat-card span,
.mini-stat span,
.metric-card span,
.result-title {
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-note {
  border-radius: var(--radius-lg);
  padding: 20px;
  background: linear-gradient(180deg, rgba(17, 35, 59, 0.96), rgba(17, 35, 59, 0.9));
  color: #fff;
}

.hero-note p {
  margin: 0 0 12px;
  font-family: var(--mono);
  color: rgba(255, 255, 255, 0.72);
}

.hero-note ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
}

.category-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.category-stats span {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 0.88rem;
}

.page-section {
  margin-top: 24px;
  padding: 28px;
}

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

.section-head p {
  margin: 0;
  max-width: 34ch;
}

.tool-grid,
.category-grid,
.story-grid,
.metrics-grid,
.editor-grid,
.tool-layout {
  display: grid;
  gap: 16px;
}

.tool-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.category-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.story-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 24px;
}

.story-card {
  padding: 24px;
}

.home-time-metrics,
.home-stats-metrics {
  margin-top: 24px;
}

.home-hero .home-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-time-metrics .metric-card strong,
.home-stats-metrics .metric-card strong {
  font-size: 1.18rem;
  line-height: 1.35;
  word-break: break-word;
}

.home-overview-main {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.home-overview-main .result-box {
  margin-top: 0;
}

.home-browser-box .info-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-time-box .home-time-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.home-time-box .metric-card {
  min-height: auto;
}

.home-time-box .metric-card strong {
  font-size: 1.02rem;
  line-height: 1.35;
}

.home-stats-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.home-tool-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.page-section .section-head h2 {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.category-card,
.tool-card {
  padding: 22px;
  transition: transform 180ms ease, border-color 180ms ease;
}

.category-card:hover,
.tool-card:hover {
  transform: translateY(-3px);
  border-color: rgba(17, 35, 59, 0.22);
}

.tool-card.is-planned {
  opacity: 0.85;
  cursor: default;
}

.tool-card-top {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}

.status-chip.is-live {
  color: var(--accent-alt);
}

.status-chip.is-planned {
  color: var(--muted);
}

.tool-card p,
.category-card p {
  margin: 14px 0 0;
}

.tool-card-foot {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.sub-hero {
  margin-top: 28px;
  padding: 32px;
  align-items: end;
}

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

.crumb-link,
.crumb-row span {
  color: var(--muted);
  font-size: 0.95rem;
}

.crumb-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.tool-layout {
  grid-template-columns: minmax(0, 1.45fr) 320px;
  align-items: start;
  margin-top: 24px;
}

.tool-canvas {
  padding: 28px;
}

.tool-canvas.is-soon,
.soon-panel {
  min-height: 340px;
  display: grid;
  place-items: center;
  text-align: center;
}

.tool-side {
  display: grid;
  gap: 16px;
}

.tool-side .side-card {
  padding: 22px;
}

.side-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-link {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field span {
  font-weight: 600;
  font-size: 0.95rem;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  padding: 16px;
  color: var(--ink);
}

textarea {
  min-height: 220px;
  resize: vertical;
  font-family: var(--mono);
  line-height: 1.65;
}

input,
select {
  min-height: 52px;
}

.narrow-field {
  max-width: 180px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
}

.editor-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}

.stack-grid {
  display: grid;
  gap: 16px;
}

.result-stack {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.result-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-strong);
  margin-top: 24px;
}

.compact-result {
  margin-top: 18px;
}

.code-block {
  margin: 10px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--mono);
  line-height: 1.65;
}

.metrics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
}

.metric-card {
  min-height: 120px;
}

.home-metrics .metric-card strong {
  font-size: 1.2rem;
  line-height: 1.35;
  word-break: break-word;
}

.info-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.info-item {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.info-item span {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 6px;
}

.info-item strong {
  display: block;
  line-height: 1.45;
  word-break: break-word;
}

.match-preview {
  min-height: 220px;
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--ink);
}

.match-preview mark {
  background: rgba(232, 93, 42, 0.18);
  color: var(--ink);
  padding: 0.1em 0.18em;
  border-radius: 0.35em;
}

.notice {
  margin: 18px 0 0;
}

.compact-actions {
  margin-top: 16px;
}

.home-panel-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.home-panel-footer .panel-actions {
  margin-top: 0;
}

.home-panel-footer .notice {
  margin: 0;
  flex: 1;
}

.footer-copy strong {
  font-size: 1.1rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  margin-top: 28px;
  padding: 24px 8px 0;
}

.footer-copy,
.footer-meta {
  max-width: 52ch;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.muted {
  color: var(--muted);
}

.fade-rise {
  animation: rise 520ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1040px) {
  .topbar,
  .hero,
  .sub-hero,
  .tool-layout,
  footer,
  .section-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .hero,
  .sub-hero,
  .tool-layout,
  .story-grid,
  .tool-grid,
  .category-grid,
  .editor-grid,
  .home-overview-main {
    grid-template-columns: 1fr;
  }

  .mini-stats,
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }

  .info-list {
    grid-template-columns: 1fr 1fr;
  }

  .home-hero .home-metrics,
  .home-time-box .home-time-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-browser-box .info-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .home-stats-metrics {
    grid-template-columns: 1fr;
  }

  .nav {
    justify-content: flex-start;
  }

  .locale-switcher {
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .site-shell {
    width: min(100% - 20px, 1220px);
    padding-top: 16px;
  }

  .topbar,
  .hero-copy,
  .hero-panel,
  .sub-hero,
  .page-section,
  .tool-canvas,
  .tool-side .side-card,
  .story-card,
  .category-card,
  .tool-card {
    padding: 20px;
    border-radius: 24px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .mini-stats,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .info-list {
    grid-template-columns: 1fr;
  }

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

  .home-stats-metrics {
    grid-template-columns: 1fr;
  }

  .home-hero .home-metrics,
  .home-time-box .home-time-metrics,
  .home-tool-grid,
  .home-browser-box .info-list {
    grid-template-columns: 1fr;
  }

  .panel-head {
    flex-direction: column;
  }

  .home-panel-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .ghost-link {
    width: 100%;
    text-align: center;
  }

  .locale-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .locale-switcher select {
    flex: 1;
    min-width: 0;
  }
}
