@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;700&family=Noto+Sans+TC:wght@400;500;700;900&display=swap");

:root {
  --bg-0: #fbf7ef;
  --bg-1: #f4efe6;
  --bg-2: #efe6d8;
  --ink: #1f1f23;
  --muted: #5e646d;
  --panel: rgba(255, 255, 255, 0.68);
  --panel-strong: rgba(255, 255, 255, 0.88);
  --line: rgba(31, 31, 35, 0.12);
  --brand: #0f766e;
  --brand-strong: #115e59;
  --brand-soft: rgba(15, 118, 110, 0.14);
  --warm: #f97316;
  --violet: #1d4ed8;
  --ok: #15803d;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-1: 0 20px 56px rgba(25, 35, 55, 0.16);
  --shadow-2: 0 14px 36px rgba(25, 35, 55, 0.13);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(15, 118, 110, 0.2), transparent 40%),
    radial-gradient(circle at 86% 80%, rgba(249, 115, 22, 0.16), transparent 34%),
    radial-gradient(circle at 55% 30%, rgba(2, 132, 199, 0.1), transparent 48%),
    linear-gradient(150deg, var(--bg-0) 0%, var(--bg-1) 56%, var(--bg-2) 100%);
  background-attachment: fixed;
  padding: 30px 18px;
}

a {
  color: inherit;
}

.page-shell {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  gap: 22px;
}

.top-banner {
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-banner p {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0f172a;
}

.top-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-links a {
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1e293b;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.75);
  transition: transform 170ms ease, background-color 170ms ease, color 170ms ease;
}

.top-links a:hover,
.top-links a.active {
  transform: translateY(-1px);
  color: #fff;
  background: linear-gradient(120deg, #0f766e 0%, #14b8a6 100%);
  border-color: transparent;
}

.glass {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(10px);
}

.home-hero {
  padding: 32px;
  display: grid;
  grid-template-columns: 1.25fr 0.9fr;
  gap: 22px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.home-hero::after {
  content: "";
  position: absolute;
  top: -140px;
  right: -90px;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 184, 166, 0.2), transparent 64%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  color: var(--brand-strong);
  font-weight: 700;
}

.home-hero h1,
.page-head h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.06;
}

.home-hero p,
.page-head p {
  margin: 12px 0 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.72;
}

.hero-actions {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-metrics {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hero-metrics article {
  border-radius: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.hero-metrics span {
  display: block;
  color: #475569;
  font-size: 0.76rem;
  margin-bottom: 3px;
}

.hero-metrics strong {
  font-size: 0.92rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.pill.primary {
  background: linear-gradient(120deg, var(--brand) 0%, #14b8a6 100%);
  color: #fff;
  border: none;
}

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

.flow-panel {
  display: grid;
  gap: 14px;
}

.flow-panel h2,
.panel h2 {
  margin: 0;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.flow-item {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  padding: 14px;
}

.flow-item span {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(15, 118, 110, 0.12);
  color: #115e59;
}

.flow-item h3 {
  margin: 10px 0 6px;
  font-size: 1.02rem;
}

.flow-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.58;
}

.ai-panel {
  display: grid;
  gap: 12px;
}

.ai-subtitle {
  margin: 0;
  color: var(--muted);
  line-height: 1.66;
}

.ai-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

.ai-hint {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: #475569;
}

.ai-mode {
  margin: 10px 0 0;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.26);
  background: rgba(15, 118, 110, 0.12);
  color: #115e59;
  font-size: 0.8rem;
  font-weight: 700;
}

.ai-answer-wrap {
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
  min-height: 100%;
}

.ai-answer-title {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #334155;
  font-weight: 700;
}

.ai-answer {
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: rgba(248, 250, 252, 0.95);
  padding: 12px;
  min-height: 160px;
  white-space: pre-wrap;
  line-height: 1.62;
  color: #1e293b;
}

.ai-answer.is-loading {
  border-color: rgba(2, 132, 199, 0.28);
  background: rgba(224, 242, 254, 0.8);
  color: #0c4a6e;
}

.ai-answer.is-error {
  border-color: rgba(220, 38, 38, 0.3);
  background: rgba(254, 226, 226, 0.8);
  color: #7f1d1d;
}

.ai-answer.is-success {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(236, 253, 245, 0.9);
  color: #14532d;
}

.home-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--panel-strong);
  box-shadow: var(--shadow-2);
  display: grid;
  gap: 10px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.home-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 44px rgba(21, 36, 51, 0.18);
}

.compare-table-wrap {
  margin-top: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  padding: 14px;
}

.compare-table-wrap h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.compare-table th,
.compare-table td {
  text-align: left;
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
  padding: 10px 8px;
  vertical-align: top;
}

.compare-table th {
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #334155;
}

.home-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.home-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.64;
}

.card-meta {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(17, 94, 89, 0.24);
  color: var(--brand-strong);
  background: var(--brand-soft);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 10px;
}

.go-link {
  width: fit-content;
  text-decoration: none;
  color: #fff;
  border-radius: 999px;
  background: linear-gradient(120deg, #0f766e 0%, #14b8a6 100%);
  padding: 10px 14px;
  font-weight: 700;
}

.iphone-wrap {
  width: min(300px, 90%);
  margin: 0 auto;
}

.iphone {
  position: relative;
  aspect-ratio: 433 / 882;
  border-radius: 54px;
  padding: 14px;
  background: linear-gradient(150deg, #0f172a 0%, #1e293b 52%, #0f172a 100%);
  box-shadow: 0 32px 52px rgba(15, 23, 42, 0.45);
}

.iphone::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 42%;
  height: 26px;
  border-radius: 0 0 14px 14px;
  background: #020617;
  z-index: 3;
}

.iphone-screen {
  position: relative;
  height: 100%;
  border-radius: 40px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background:
    radial-gradient(circle at 80% 22%, rgba(96, 165, 250, 0.4), transparent 46%),
    radial-gradient(circle at 18% 82%, rgba(45, 212, 191, 0.35), transparent 40%),
    linear-gradient(170deg, #f8fafc 0%, #dbeafe 52%, #ecfeff 100%);
  padding: 66px 18px 18px;
}

.phone-chip-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.phone-chip {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  font-size: 0.76rem;
  font-weight: 700;
}

.phone-card {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 12px;
  margin-bottom: 10px;
}

.phone-card strong {
  display: block;
  font-size: 0.94rem;
  margin-bottom: 4px;
}

.phone-card p {
  margin: 0;
  font-size: 0.8rem;
  color: #334155;
  line-height: 1.5;
}

.page-head {
  padding: 28px;
  display: grid;
  gap: 12px;
}

.page-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-hero-meta span {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
  background: rgba(15, 118, 110, 0.14);
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 999px;
  padding: 6px 10px;
}

.quick-switch {
  display: grid;
  gap: 10px;
}

.quick-switch-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-switch-links a {
  text-decoration: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
  border-radius: 999px;
  color: #1e293b;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  transition: transform 170ms ease, background-color 170ms ease, color 170ms ease;
}

.quick-switch-links a:hover,
.quick-switch-links a.active {
  transform: translateY(-1px);
  background: linear-gradient(120deg, #0f766e 0%, #14b8a6 100%);
  border-color: transparent;
  color: #fff;
}

.highlight-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.highlight-card {
  padding: 14px;
  border-radius: var(--radius-lg);
  animation: fadeSlideUp 420ms ease both;
}

.highlight-card span {
  display: block;
  color: #475569;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.highlight-card strong {
  font-size: 0.95rem;
  line-height: 1.4;
}

.back-link {
  width: fit-content;
  text-decoration: none;
  color: var(--brand-strong);
  font-weight: 700;
  border: 1px solid rgba(17, 94, 89, 0.22);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.7);
}

.workspace {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

textarea,
select,
button {
  font: inherit;
}

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

textarea {
  min-height: 120px;
  line-height: 1.58;
  resize: vertical;
}

.row {
  margin-top: 14px;
}

.actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

button.primary {
  color: #fff;
  background: linear-gradient(120deg, var(--brand) 0%, #14b8a6 100%);
}

button.secondary {
  color: #1e293b;
  background: rgba(15, 23, 42, 0.08);
}

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

.metric {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 4px;
}

.metric strong {
  font-size: 1.1rem;
}

.result {
  margin-top: 14px;
  border: 1px solid rgba(21, 128, 61, 0.2);
  border-radius: 14px;
  background: rgba(220, 252, 231, 0.6);
  color: #166534;
  padding: 12px;
  line-height: 1.64;
  word-break: break-word;
}

.preview-panel {
  padding: 18px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.preview-panel h2 {
  margin: 0;
  font-size: 1.08rem;
}

.preview-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.algo-info {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.95rem;
}

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

.complexity-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.75);
  padding: 10px;
}

.complexity-item span {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.complexity-item strong {
  font-size: 0.96rem;
}

.step-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.step-controls button {
  font-size: 0.86rem;
  padding: 8px 12px;
}

.step-controls .neutral {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.step-box {
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 12px;
  background: rgba(219, 234, 254, 0.44);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.step-box p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.56;
}

.step-index {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(2, 132, 199, 0.28);
  background: rgba(34, 211, 238, 0.18);
  color: #0c4a6e;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.bar-grid {
  display: grid;
  gap: 8px;
}

.bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(120deg, #06b6d4 0%, #2563eb 100%);
  opacity: 0.84;
}

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

@media (max-width: 960px) {
  .home-hero {
    grid-template-columns: 1fr;
  }

  .ai-layout {
    grid-template-columns: 1fr;
  }

  .hero-metrics,
  .flow-grid,
  .highlight-strip {
    grid-template-columns: 1fr;
  }

  .compare-table {
    font-size: 0.86rem;
  }

  .compare-table th,
  .compare-table td {
    padding: 8px 6px;
  }

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

  .iphone-wrap {
    width: min(280px, 82vw);
  }
}

@media (max-width: 700px) {
  body {
    padding: 16px 12px;
  }

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

  .top-banner {
    padding: 12px;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-links {
    justify-content: flex-start;
  }

  .glass {
    border-radius: 20px;
  }

  .home-hero,
  .page-head,
  .panel,
  .preview-panel {
    padding: 18px;
  }

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

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

  .compare-table-wrap {
    overflow-x: auto;
  }
}
