/* Tendy — landing + dev tools
   Palette: deep ink + warm sand accent (天地感，避免俗套「科技藍」) */

:root {
  --color-bg: #f7faff;
  --color-bg-elevated: #eef4ff;
  --color-surface: #ffffff;
  --color-border: rgba(34, 76, 143, 0.14);
  --color-text: #112a57;
  --color-text-muted: #4d648f;
  --color-accent: #1f67d2;
  --color-accent-soft: rgba(31, 103, 210, 0.16);
  --color-link: #1f67d2;
  --color-orange: #ff7a1a;
  --color-danger: #c5221f;
  --color-primary: #1f67d2;
  --color-primary-hover: #1b5bb8;
  --font-sans: "Noto Sans TC", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-soft: 0 24px 80px rgba(0, 0, 0, 0.45);
  --header-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* OAuth callback & legacy pages */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 20px 64px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 8px 12px;
  background: var(--color-accent);
  color: #111;
  z-index: 1000;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

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

.tendy-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(16px);
  z-index: 2000;
  max-width: min(92vw, 420px);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-weight: 500;
  color: #f7faff;
  background: rgba(17, 42, 87, 0.92);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.tendy-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  border-bottom: 1px solid var(--color-border);
  background: rgba(247, 250, 255, 0.9);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand__logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 18px rgba(33, 86, 170, 0.16);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 2px;
  min-width: 0;
}

.brand__row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
}

.brand__name {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.brand__meta {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  min-width: 0;
  max-width: min(52vw, 380px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand__tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b82ac;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.site-nav a:hover {
  color: var(--color-text);
}

.site-nav__admin {
  color: var(--color-accent);
  font-weight: 600;
}

/* Hero */
.hero {
  position: relative;
  padding: clamp(48px, 10vw, 96px) 20px 72px;
  overflow: hidden;
}

.hero--admin {
  padding-bottom: 56px;
}

.hero--admin .hero__title {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
}

.hero__glow {
  position: absolute;
  inset: -40% -20% auto;
  height: 70%;
  background: radial-gradient(ellipse at 50% 0%, rgba(31, 103, 210, 0.2), transparent 58%);
  pointer-events: none;
}

.hero__inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
}

.hero__eyebrow {
  margin: 0 0 12px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.hero__title {
  margin: 0 0 20px;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

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

.hero__logo-up {
  width: clamp(160px, 20vw, 250px);
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 20px rgba(31, 103, 210, 0.2));
}

.hero__accent {
  color: var(--color-accent);
}

.hero__break {
  display: none;
}

@media (min-width: 640px) {
  .hero__break {
    display: inline;
  }
}

@media (max-width: 640px) {
  .hero__headline {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero__logo-up {
    width: clamp(110px, 30vw, 180px);
  }
}

.hero__lead {
  margin: 0 0 28px;
  max-width: 38rem;
  font-size: 1.05rem;
  color: var(--color-text-muted);
}

.hero__lead strong {
  color: var(--color-text);
  font-weight: 600;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.hero__hint {
  margin: 0 0 28px;
  min-height: 1.25em;
}

.hero__trust-note {
  margin: 0 0 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1f67d2;
}

.hero__badges {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero__badges li {
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #f6f9ff;
}

/* Sections */
.section {
  padding: 64px 20px;
}

.section--muted {
  background: var(--color-bg-elevated);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.section__inner {
  max-width: 1100px;
  margin: 0 auto;
}

.section__title {
  margin: 0 0 16px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section__intro {
  margin: 0 0 36px;
  max-width: 42rem;
  color: var(--color-text-muted);
  font-size: 1.05rem;
}

.section__intro--sm {
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.section__note {
  margin: 28px 0 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.section__note code {
  font-size: 0.85em;
  padding: 2px 6px;
  background: var(--color-surface);
  border-radius: var(--radius-sm);
}

.value__headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.value__headline-text {
  flex: 1 1 auto;
  min-width: 0;
}

.value__logo-share {
  width: clamp(120px, 18vw, 220px);
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 8px 20px rgba(31, 103, 210, 0.18));
}

@media (max-width: 720px) {
  .value__headline {
    flex-direction: column;
    align-items: flex-start;
  }

  .value__logo-share {
    width: clamp(110px, 34vw, 170px);
  }
}

/* Grid */
.grid {
  display: grid;
  gap: 20px;
}

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

@media (min-width: 720px) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  padding: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.feature-card__title {
  margin: 0 0 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-accent);
}

.feature-card__text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Steps */
.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.steps__item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: start;
  padding: 24px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.steps__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(135deg, var(--color-accent), #2e85ff);
  border-radius: 12px;
}

.steps__heading {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 600;
}

.steps__item p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* Principles */
.principles {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--color-text-muted);
}

.principles li {
  margin-bottom: 12px;
}

.principles li:last-child {
  margin-bottom: 0;
}

.principles strong {
  color: var(--color-text);
}

/* CTA band */
.section--cta {
  padding: 56px 20px;
  background: linear-gradient(160deg, rgba(31, 103, 210, 0.12), rgba(255, 122, 26, 0.08) 50%, transparent 78%);
  border-top: 1px solid var(--color-border);
}

.section__inner--cta {
  text-align: center;
  max-width: 560px;
}

.cta__title {
  margin: 0 0 12px;
  font-size: 1.6rem;
  font-weight: 700;
}

.cta__text {
  margin: 0 0 24px;
  color: var(--color-text-muted);
}

/* Dev cards */
.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-top: 16px;
  background: var(--color-surface);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  margin-bottom: 16px;
}

.admin-toolbar__meta {
  margin: 0;
}

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: top;
}

.admin-table thead th {
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-bg-elevated);
}

.admin-table tbody tr:hover td {
  background: rgba(31, 103, 210, 0.04);
}

.admin-table__empty {
  color: var(--color-text-muted);
  text-align: center;
  padding: 20px 12px;
}

.dashboard-grid,
.workspace-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 920px) {
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
  }

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

.panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  padding: 18px;
}

.panel__title {
  margin: 0 0 10px;
  font-size: 1rem;
}

.panel__desc {
  margin: 0 0 14px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.panel__status {
  margin: 0;
  font-weight: 600;
  color: var(--color-accent);
}

.panel--example {
  align-self: start;
}

.delegate-example {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.delegate-example__block {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(31, 103, 210, 0.06);
  border: 1px dashed rgba(31, 103, 210, 0.22);
}

.delegate-example__type {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-accent);
}

.delegate-example__task-title {
  margin: 0 0 8px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.45;
}

.delegate-example__body {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.55;
}

.item__target-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin: 0.35rem 0 0;
}

.item__target-link {
  font-weight: 600;
}

.item__target-reward {
  font-size: 0.88rem;
  color: var(--color-text-muted);
}

.metric-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.metric-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--color-border);
  padding: 8px 0;
}

.metric-list li span {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.metric-list li strong {
  font-size: 1rem;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-stack label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.form-stack input,
.form-stack select,
.form-stack textarea {
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--color-text);
  background: #f9fbff;
}

.form-stack input:focus,
.form-stack select:focus,
.form-stack textarea:focus {
  outline: 2px solid rgba(31, 103, 210, 0.3);
  border-color: rgba(31, 103, 210, 0.5);
}

.item-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #f9fbff;
  padding: 12px;
}

.item h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.item p {
  margin: 0 0 8px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
}

.item__meta span {
  background: #eef4ff;
  border: 1px solid var(--color-border);
  padding: 3px 8px;
  border-radius: 999px;
}

.item__actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card__title {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 600;
}

.code-block {
  margin: 12px 0 16px;
  background: #f8fbff;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  line-height: 1.5;
  border: 1px solid var(--color-border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: linear-gradient(135deg, var(--color-primary), #2f8cff);
  color: #ffffff;
}

.btn--primary:hover {
  background: linear-gradient(135deg, var(--color-primary-hover), #2674d6);
}

.btn--secondary {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--secondary:hover {
  background: var(--color-surface);
}

.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  padding: 8px 14px;
  font-size: 0.875rem;
}

.btn--ghost:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.btn--danger {
  background: transparent;
  color: #b72a25;
  border: 1px solid rgba(183, 42, 37, 0.35);
}

.btn--danger:hover {
  background: rgba(183, 42, 37, 0.08);
}

.btn--lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-md);
}

/* Footer */
.site-footer {
  padding: 32px 20px 40px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.site-footer__inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.site-footer__brand {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.site-footer__legacy {
  margin: 0 auto 10px;
  max-width: 680px;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--color-text);
}

.site-footer__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  margin: 0 0 10px;
}

.site-footer__nav a {
  color: var(--color-link);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}

.site-footer__nav a:hover {
  text-decoration: underline;
}

.site-footer__meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

/* Share card landing (.share-landing — SSR 頁與主站樣式共用) */
.share-landing {
  max-width: 40rem;
  margin: 0 auto;
  padding: 28px 20px 48px;
  min-height: calc(100vh - var(--header-h) - 120px);
}

.share-landing__state {
  margin: 2rem 0;
  color: var(--color-text-muted);
  text-align: center;
}

.share-landing__state--error {
  color: var(--color-danger);
}

.share-landing__card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px 24px;
  box-shadow: 0 12px 40px rgba(17, 42, 87, 0.08);
}

.share-landing__eyebrow {
  margin: 0 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.share-landing__title {
  margin: 0 0 12px;
  font-size: 1.45rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--color-text);
}

.share-landing__meta {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--color-accent);
  font-weight: 600;
}

.share-landing__body {
  margin: 0 0 24px;
  font-size: 0.98rem;
  line-height: 1.65;
  color: var(--color-text);
  white-space: pre-wrap;
}

.share-landing__cta-wrap {
  margin: 0 0 12px;
}

.share-landing__fineprint {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--color-text-muted);
}

/* Legacy / utilities */
.hint {
  color: #b63e34;
  font-size: 0.9rem;
}

.footer__logo {
  width: 54px;
  height: 54px;
  object-fit: contain;
  margin: 0 auto 10px;
  display: block;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 8px 24px rgba(33, 86, 170, 0.14);
}