/* ==========================================================================
   Kami Design System - 轨迹采集 App 极简纸张下载页
   Reference: https://github.com/tw93/Kami
   Principles: warm parchment canvas, ink-blue accent, serif hierarchy,
               warm neutrals, zero noisy decorations.
   ========================================================================== */

:root {
  /* Kami Palette */
  --parchment:     #f5f4ed;   /* Page canvas - warm cream */
  --ivory:         #faf9f5;   /* Sheet paper surface */
  --warm-sand:     #e8e6dc;   /* Interactive/button subtle fill */
  --inline-code-bg:#f0eee6;   /* Annotation code fill */
  
  --brand:         #1B365D;   /* Ink Blue - the single accent */
  --brand-light:   #2D5A8A;
  --tag-bg:        #E4ECF5;   /* Registered solid ink-tint for tag */

  --near-black:    #141413;   /* Primary text - warm olive undertone */
  --dark-warm:     #3d3d3a;   /* Secondary text */
  --olive:         #504e49;   /* Subtext & description */
  --stone:         #6b6a64;   /* Tertiary & notes */

  --border:        #e8e6dc;   /* Primary warm border */
  --border-soft:   #e5e3d8;   /* Subtle divider */

  /* Typography */
  --serif: Charter, Georgia, "Source Han Serif SC", "Noto Serif CJK SC", "Noto Serif SC", "Songti SC", "STSong", serif;
  --mono: "SF Mono", "Fira Code", Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --parchment:     #141413;   /* Dark page canvas */
    --ivory:         #1e1e1c;   /* Dark sheet surface */
    --warm-sand:     #2a2a27;
    --inline-code-bg:#262623;

    --brand:         #4A82BA;   /* Softer ink blue for dark */
    --brand-light:   #689fd6;
    --tag-bg:        #1d2a3d;

    --near-black:    #f0eee6;
    --dark-warm:     #d8d6ce;
    --olive:         #aba9a1;
    --stone:         #85837c;

    --border:        #2b2b28;
    --border-soft:   #242421;
  }
}

/* 基础重置 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--serif);
  background-color: var(--parchment);
  color: var(--near-black);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

/* 纸张容器 */
.paper-container {
  width: 100%;
  max-width: 520px;
  margin-inline: auto;
}

/* 纸张卡片 (Kami Sheet) */
.kami-sheet {
  background: var(--ivory);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: clamp(1.75rem, 5vw, 2.75rem);
  box-shadow: 
    0 1px 2px rgba(20, 20, 19, 0.03),
    0 8px 24px -4px rgba(20, 20, 19, 0.05);
  position: relative;
}

/* 顶部标识区 */
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 1.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand-icon {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.brand-name {
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  color: var(--dark-warm);
  font-weight: 500;
}

.tag-status {
  font-size: 0.725rem;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--brand);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* 纸张主体 */
.sheet-body {
  text-align: center;
}

.app-title {
  font-size: clamp(1.6rem, 4vw, 1.85rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--near-black);
  margin-bottom: 0.35rem;
  line-height: 1.25;
}

.app-desc {
  font-size: 0.9rem;
  color: var(--olive);
  letter-spacing: 0.02em;
  margin-bottom: 0.85rem;
}

.app-meta {
  font-size: 0.8rem;
  color: var(--stone);
  font-family: var(--mono);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.75rem;
}

.meta-dot {
  opacity: 0.5;
}

/* 核心下载操作 */
.action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: #faf9f5;
  font-family: var(--serif);
  font-size: 0.925rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 0.65rem 1.75rem;
  border-radius: 6px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: opacity 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

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

.btn-primary:active {
  transform: translateY(0);
}


/* 二维码区域 */
.qr-section {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  cursor: pointer;
}

.qr-frame {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 10px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(20, 20, 19, 0.04);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.qr-frame:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.qr-frame img,
.qr-frame canvas {
  display: block;
  width: 124px !important;
  height: 124px !important;
}

.qr-caption {
  font-size: 0.775rem;
  color: var(--stone);
  letter-spacing: 0.02em;
  margin-top: 0.65rem;
}

/* 附注说明 */
.install-tip {
  font-size: 0.775rem;
  color: var(--stone);
  letter-spacing: 0.02em;
  line-height: 1.5;
  border-top: 1px solid var(--border-soft);
  padding-top: 1.25rem;
  text-align: center;
}

/* 纸张底部落款 */
.sheet-footer {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--border-soft);
  text-align: center;
}

.footer-sign {
  font-size: 0.825rem;
  color: var(--stone);
  letter-spacing: 0.08em;
  font-style: normal;
}

/* 二维码展开弹窗 */
.qr-dialog {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--ivory);
  color: var(--near-black);
  margin: auto;
  max-width: 340px;
  width: 90vw;
  padding: 1.75rem 1.25rem;
  box-shadow: 0 16px 36px -6px rgba(20, 20, 19, 0.18);
}

.qr-dialog::backdrop {
  background: rgba(20, 20, 19, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.dialog-content {
  position: relative;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dialog-close {
  position: absolute;
  top: -1rem;
  right: -0.5rem;
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--stone);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
}

.dialog-close:hover {
  color: var(--near-black);
}

.dialog-qr-wrapper {
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 0.85rem;
}

.dialog-qr-wrapper img,
.dialog-qr-wrapper canvas {
  display: block;
  width: 200px !important;
  height: 200px !important;
}

.dialog-caption {
  font-size: 0.825rem;
  color: var(--olive);
  margin-bottom: 0.4rem;
}

.dialog-url {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--stone);
  word-break: break-all;
  background: var(--inline-code-bg);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  max-width: 100%;
}

/* 简约 Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--near-black);
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  padding: 0.45rem 1rem;
  border-radius: 4px;
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  pointer-events: none;
  z-index: 999;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
