/* 念念 — Shared UI components & phone shell */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--nn-ink);
  background: var(--nn-canvas-a);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

a { color: var(--nn-teal-600); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--nn-teal-400);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* —— Atmosphere background —— */
.nn-atmosphere {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(127, 184, 171, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 45% at 95% 15%, rgba(122, 155, 184, 0.22), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(244, 240, 234, 0.9), transparent 55%),
    linear-gradient(165deg, var(--nn-canvas-a) 0%, var(--nn-canvas-b) 45%, var(--nn-canvas-c) 100%);
  background-attachment: fixed;
}

.nn-atmosphere::before {
  content: '';
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* —— Phone frame —— */
.phone {
  position: relative;
  width: var(--phone-w);
  height: var(--phone-h);
  max-height: min(844px, 92vh);
  border-radius: var(--r-phone);
  overflow: hidden;
  background: var(--nn-surface);
  box-shadow:
    0 0 0 1px rgba(44, 42, 40, 0.08),
    0 12px 40px rgba(44, 42, 40, 0.14);
  display: flex;
  flex-direction: column;
  z-index: 1;
}

.phone__notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 28px;
  background: #1a1918;
  border-radius: 20px;
  z-index: 50;
  pointer-events: none;
}

.phone__status {
  height: var(--safe-top);
  padding: 14px 22px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--nn-ink);
  flex-shrink: 0;
  position: relative;
  z-index: 40;
  background: transparent;
}

.phone__status-icons {
  display: flex;
  gap: 5px;
  align-items: center;
  opacity: 0.75;
}

.phone__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  background:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(216, 235, 230, 0.55), transparent 60%),
    var(--nn-surface-2);
}

.screen {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  animation: screenIn var(--dur-normal) var(--ease-out);
}

.screen.is-active {
  display: flex;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes tabPop {
  from { transform: scale(0.92); opacity: 0.6; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes btnPress {
  0% { transform: scale(1); }
  50% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.btn-press:active {
  animation: btnPress var(--dur-fast) var(--ease-out);
}

/* —— Header —— */
.nn-header {
  height: var(--header-h);
  padding: 0 var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
  border-bottom: 1px solid transparent;
}

.nn-header--solid {
  background: rgba(255, 252, 249, 0.82);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--nn-line-soft);
}

.nn-header__title {
  flex: 1;
  font-family: var(--font-ui);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.nn-header__brand {
  font-family: var(--font-brand);
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--nn-teal-600);
  line-height: 1;
}

.nn-header__sub {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
  font-weight: 400;
  margin-top: 2px;
}

/* —— 对话顶栏：切换朋友 / 居中「对话」 / 切换会话 —— */
.nn-header--chat {
  background: rgba(255, 252, 249, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--nn-line-soft);
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
}

.chat-header-center {
  flex: 1;
  min-width: 0;
  text-align: center;
  pointer-events: none;
}

.chat-header-center__title {
  font-family: var(--font-brand);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--nn-teal-600);
  line-height: 1.2;
}

.chat-header-center__sub {
  font-size: 11px;
  color: var(--nn-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.chat-switch {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 96px;
  height: 34px;
  padding: 0 8px 0 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--nn-line-soft);
  background: var(--nn-surface);
  color: var(--nn-ink);
  cursor: pointer;
  font-family: var(--font-ui);
  flex-shrink: 0;
}

.chat-switch--end {
  padding: 0 6px 0 8px;
  max-width: 72px;
}

.chat-switch:active {
  transform: scale(0.97);
}

.chat-switch__label {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-switch__chev {
  width: 14px;
  height: 14px;
  stroke: var(--nn-muted);
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

.nn-row.is-selected {
  border-color: var(--nn-teal-300);
  background: var(--nn-teal-50);
  box-shadow: inset 0 0 0 1px var(--nn-teal-200);
}

.nn-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: var(--r-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--nn-ink-soft);
  transition: background var(--dur-fast);
}

.nn-icon-btn:hover { background: rgba(44, 42, 40, 0.05); }
.nn-icon-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* —— Buttons —— */
.nn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: none;
  border-radius: var(--r-md);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
  user-select: none;
}

.nn-btn:active { transform: scale(0.98); }

.nn-btn--primary {
  background: var(--nn-teal-500);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset;
}
.nn-btn--primary:hover { background: var(--nn-teal-600); }

.nn-btn--secondary {
  background: var(--nn-surface);
  color: var(--nn-ink);
  border: 1px solid var(--nn-line);
}
.nn-btn--secondary:hover { background: var(--nn-surface-2); }

.nn-btn--ghost {
  background: transparent;
  color: var(--nn-teal-600);
  min-height: 40px;
}
.nn-btn--ghost:hover { background: rgba(47, 125, 110, 0.08); }

.nn-btn--danger {
  background: var(--nn-danger-soft);
  color: var(--nn-danger);
}
.nn-btn--danger-solid {
  background: var(--nn-danger);
  color: #fff;
}

.nn-btn--block { width: 100%; }
.nn-btn--sm { min-height: 36px; padding: 0 14px; font-size: var(--fs-sm); border-radius: var(--r-sm); }

.nn-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* —— Forms —— */
.nn-field { margin-bottom: var(--sp-4); }

.nn-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--nn-ink-soft);
  margin-bottom: var(--sp-2);
}

.nn-input,
.nn-textarea,
.nn-select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--nn-line);
  border-radius: var(--r-md);
  background: var(--nn-surface);
  font-size: var(--fs-base);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.nn-input:focus,
.nn-textarea:focus,
.nn-select:focus {
  outline: none;
  border-color: var(--nn-teal-400);
  box-shadow: 0 0 0 3px rgba(47, 125, 110, 0.15);
}

.nn-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: var(--lh-snug);
}

/* 提醒时间：整行可点开日期时间选择器 */
.nn-datetime-row {
  position: relative;
  cursor: pointer;
  border-radius: var(--r-md);
}

.nn-datetime-row:focus-visible {
  outline: 2px solid var(--nn-teal-400);
  outline-offset: 2px;
}

.nn-input--datetime {
  position: relative;
  display: block;
  width: 100%;
  min-height: 48px;
  cursor: pointer;
  color-scheme: light;
}

.nn-input--datetime::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.nn-hint {
  font-size: var(--fs-xs);
  color: var(--nn-muted);
  margin-top: var(--sp-2);
}

.nn-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-sm);
  color: var(--nn-ink-soft);
  cursor: pointer;
}

.nn-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--nn-teal-500);
  flex-shrink: 0;
}

/* —— Scroll area —— */
.nn-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-4);
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nn-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.nn-scroll--pad-tab {
  padding-bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px);
}

/* —— Tab bar —— */
.nn-tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  box-sizing: border-box;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding: 6px 0 var(--safe-bottom);
  display: none; /* 由 .is-show 控制显示 */
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  background: rgba(255, 252, 249, 0.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--nn-line-soft);
  z-index: 30;
}

.nn-tabbar.is-show {
  display: grid;
}

/* 三栏等分均布：左 / 中 / 右各占 1/3，内容居中 */
.nn-tabbar--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nn-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--nn-faint);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: color var(--dur-fast);
}

.nn-tab svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nn-tab.is-active {
  color: var(--nn-teal-600);
  animation: tabPop var(--dur-normal) var(--ease-out);
}

.nn-tab.is-active svg { stroke-width: 2.1; }

/* —— List rows —— */
.nn-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.nn-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px var(--sp-4);
  background: var(--nn-surface);
  border: 1px solid var(--nn-line-soft);
  border-radius: var(--r-lg);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.nn-row:hover {
  border-color: var(--nn-teal-200);
  background: #fff;
}

.nn-row__body { flex: 1; min-width: 0; }

.nn-row__title {
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--nn-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nn-row__meta {
  font-size: var(--fs-sm);
  color: var(--nn-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nn-row__aside {
  font-size: var(--fs-xs);
  color: var(--nn-faint);
  flex-shrink: 0;
}

/* —— 管理朋友卡片 —— */
.friend-manage-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.friend-card {
  background: var(--nn-surface);
  border: 1px solid var(--nn-line-soft);
  border-radius: var(--r-md);
  padding: var(--sp-3);
}

.friend-card--archived {
  opacity: 0.85;
  background: var(--nn-surface-2);
}

.friend-card__main {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.friend-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.friend-card__actions .nn-btn {
  flex: 1 1 auto;
  min-width: 72px;
}

.nn-chevron {
  color: var(--nn-faint);
  flex-shrink: 0;
}

/* —— Avatar —— */
.nn-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--fs-md);
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.nn-avatar--sm { width: 36px; height: 36px; font-size: var(--fs-sm); }
.nn-avatar--xs { width: 28px; height: 28px; font-size: 11px; }
.nn-avatar--lg { width: 72px; height: 72px; font-size: var(--fs-xl); }

.nn-avatar--sage { background: linear-gradient(145deg, #5a9a8c, #3d7a6e); }
.nn-avatar--sky { background: linear-gradient(145deg, #7a9bb8, #5a7f9c); }
.nn-avatar--sand { background: linear-gradient(145deg, #c4a574, #a68655); }
.nn-avatar--rose { background: linear-gradient(145deg, #c48a84, #a66a64); }
.nn-avatar--slate { background: linear-gradient(145deg, #8a8e96, #6a6e76); }

.nn-avatar-pick {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nn-avatar-pick button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.nn-avatar-pick button.is-selected {
  border-color: var(--nn-teal-500);
  box-shadow: 0 0 0 2px rgba(47, 125, 110, 0.2);
}

/* —— Empty state —— */
.nn-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  flex: 1;
  min-height: 280px;
}

.nn-empty__mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--nn-teal-100), var(--nn-mist-100));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-5);
  color: var(--nn-teal-600);
}

.nn-empty__mark svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nn-empty__text {
  font-size: var(--fs-base);
  color: var(--nn-ink-soft);
  max-width: 280px;
  line-height: var(--lh-snug);
  margin-bottom: var(--sp-6);
}

/* —— Chips / filters —— */
.nn-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 var(--sp-4) var(--sp-3);
  scrollbar-width: none;
  flex-shrink: 0;
}
.nn-chips::-webkit-scrollbar { display: none; }

.nn-chip {
  flex-shrink: 0;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--nn-line);
  background: var(--nn-surface);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--nn-ink-soft);
  cursor: pointer;
  transition: all var(--dur-fast);
  font-family: var(--font-ui);
}

.nn-chip.is-active {
  background: var(--nn-teal-500);
  border-color: var(--nn-teal-500);
  color: #fff;
}

/* 待办筛选：三等分铺满 */
#todos .nn-chips,
#todos-empty .nn-chips {
  overflow: hidden;
  gap: 6px;
}
#todos .nn-chip,
#todos-empty .nn-chip {
  flex: 1 1 0;
  min-width: 0;
  padding: 0 8px;
  text-align: center;
  justify-content: center;
  display: inline-flex;
  align-items: center;
}

/* —— Auth screens —— */
.auth-screen {
  padding: var(--sp-4) var(--sp-6) var(--sp-8);
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.auth-hero {
  padding: var(--sp-8) 0 var(--sp-6);
  text-align: center;
}

.auth-hero__brand {
  font-family: var(--font-brand);
  font-size: var(--fs-3xl);
  font-weight: 700;
  color: var(--nn-teal-600);
  letter-spacing: 0.06em;
  margin-bottom: var(--sp-3);
}

.auth-hero__tagline {
  font-size: var(--fs-sm);
  color: var(--nn-muted);
  line-height: var(--lh-snug);
  max-width: 260px;
  margin: 0 auto;
}

.auth-footer-note {
  margin-top: auto;
  padding-top: var(--sp-6);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--nn-muted);
  line-height: var(--lh-snug);
}

.auth-switch {
  text-align: center;
  margin-top: var(--sp-5);
  font-size: var(--fs-sm);
  color: var(--nn-muted);
}

/* —— Chat —— */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.chat-messages::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.chat-day {
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--nn-faint);
  margin: 4px 0 8px;
}

.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: var(--r-bubble);
  font-size: var(--fs-base);
  line-height: var(--lh-snug);
  animation: bubbleIn var(--dur-slow) var(--ease-out);
}

.bubble--friend {
  align-self: flex-start;
  background: var(--nn-bubble-friend);
  color: var(--nn-bubble-friend-text);
  border: 1px solid var(--nn-bubble-friend-border);
  border-bottom-left-radius: 6px;
}

.bubble--me {
  align-self: flex-end;
  background: var(--nn-bubble-me);
  color: var(--nn-bubble-me-text);
  border-bottom-right-radius: 6px;
}

.bubble--streaming::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--nn-teal-400);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.9s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.bubble__time {
  display: block;
  font-size: 10px;
  opacity: 0.55;
  margin-top: 4px;
}

.chat-composer {
  flex-shrink: 0;
  padding: 8px var(--sp-3) calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 252, 249, 0.95);
  border-top: 1px solid var(--nn-line-soft);
}

.chat-composer--tab {
  padding-bottom: calc(10px + var(--tab-h) + var(--safe-bottom));
}

.create-type-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.create-type-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--nn-line-soft);
  background: var(--nn-surface);
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--nn-ink);
}

.create-type-card:hover {
  border-color: var(--nn-teal-200);
  background: #fff;
}

.create-type-card strong {
  font-family: var(--font-ui);
  font-size: var(--fs-base);
}

.create-type-card > span:last-child {
  font-size: var(--fs-sm);
  color: var(--nn-muted);
}

.chat-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 8px;
}

.chat-tool {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--nn-line);
  background: var(--nn-surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--nn-muted);
  cursor: pointer;
  font-family: var(--font-ui);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chat-tool.is-on {
  background: var(--nn-success-soft);
  border-color: var(--nn-teal-200);
  color: var(--nn-teal-700);
}

.chat-tool.is-p1 {
  opacity: 0.7;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-attach {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--nn-line);
  background: var(--nn-surface);
  color: var(--nn-ink-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-attach svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-attach:active {
  transform: scale(0.96);
  background: var(--nn-surface-2);
}

.chat-composer.is-generating .chat-attach {
  opacity: 0.45;
  pointer-events: none;
}

.chat-attach-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 0 4px 8px;
}

.chat-attach-preview[hidden] {
  display: none !important;
}

.chat-attach-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chat-attach.is-full {
  opacity: 0.4;
  pointer-events: none;
}

.chat-attach-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--nn-line-soft);
  flex-shrink: 0;
}

.chat-attach-meta {
  font-size: 11px;
  color: var(--nn-muted);
  padding: 0 4px 6px;
  line-height: 1.35;
}

.chat-attach-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bubble__media {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}

.bubble__media img {
  max-width: min(160px, 42vw);
  max-height: 160px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(0, 0, 0, 0.06);
}

.chat-attach-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(44, 42, 40, 0.65);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.attach-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.attach-pick {
  position: relative;
  cursor: pointer;
}

.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  border: 1px solid var(--nn-line);
  border-radius: var(--r-lg);
  background: var(--nn-surface);
  resize: none;
  font-size: var(--fs-base);
}

.chat-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: var(--nn-surface-2);
}

/* 发送 / 停止 同一按钮切换 */
.chat-action {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--nn-teal-500);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.chat-action__icon {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-action__icon--stop {
  display: none;
  fill: currentColor;
  stroke: none;
  width: 14px;
  height: 14px;
}

.chat-action[data-chat-action="stop"] {
  background: var(--nn-ink-soft);
}

.chat-action[data-chat-action="stop"] .chat-action__icon--send {
  display: none;
}

.chat-action[data-chat-action="stop"] .chat-action__icon--stop {
  display: block;
}

.chat-composer.is-generating .chat-tools {
  opacity: 0.55;
  pointer-events: none;
}

/* 兼容旧类名 */
.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--nn-teal-500);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-send svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* —— Sheet —— */
.nn-overlay {
  position: absolute;
  inset: 0;
  background: rgba(44, 42, 40, 0.35);
  z-index: 60;
  display: none;
  align-items: flex-end;
}
.nn-overlay.is-open { display: flex; }

.nn-sheet {
  width: 100%;
  max-height: 72%;
  background: var(--nn-surface);
  border-radius: var(--r-sheet);
  box-shadow: var(--shadow-sheet);
  padding: var(--sp-4) var(--sp-5) calc(var(--sp-6) + 8px);
  animation: sheetUp var(--dur-slow) var(--ease-out);
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.nn-sheet::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.nn-sheet__handle {
  width: 36px;
  height: 4px;
  background: var(--nn-line);
  border-radius: 2px;
  margin: 0 auto var(--sp-4);
}

.nn-sheet__title {
  font-family: var(--font-ui);
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: var(--sp-2);
}

.nn-sheet__desc {
  font-size: var(--fs-sm);
  color: var(--nn-muted);
  margin-bottom: var(--sp-5);
}

.suggest-card {
  padding: var(--sp-4);
  background: var(--nn-surface-2);
  border: 1px solid var(--nn-line-soft);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
}

.suggest-card__type {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--nn-teal-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  font-family: var(--font-ui);
}

.suggest-card__title {
  font-weight: 600;
  font-size: var(--fs-base);
  margin-bottom: 4px;
}

.suggest-card__meta {
  font-size: var(--fs-sm);
  color: var(--nn-muted);
}

.suggest-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: var(--sp-5);
}

/* —— Banner / toast —— */
.nn-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--nn-warn-bg);
  border-bottom: 1px solid var(--nn-warn-border);
  color: var(--nn-warn-text);
  font-size: var(--fs-sm);
  flex-shrink: 0;
}

.nn-banner__actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.nn-toast {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 18px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 48px);
  background: var(--nn-ink);
  color: #f7f4ef;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  box-shadow: none;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  z-index: 55;
  font-size: var(--fs-xs);
  line-height: 1.35;
  text-align: center;
  opacity: 0.5;
  pointer-events: none;
  animation: toastIn var(--dur-fast) var(--ease-out);
}

.nn-toast.is-show { display: flex; }

.nn-toast:has(#toastAction:not([hidden])) {
  pointer-events: auto;
}

.nn-toast button {
  border: none;
  background: transparent;
  color: #fff;
  font-size: var(--fs-xs);
  text-decoration: underline;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
}

/* —— Settings —— */
.nn-section-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--nn-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--sp-4) var(--sp-1) var(--sp-2);
  font-family: var(--font-ui);
}

.nn-settings-group {
  background: var(--nn-surface);
  border: 1px solid var(--nn-line-soft);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--sp-4);
}

.nn-settings-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  background: transparent;
  border-bottom: 1px solid var(--nn-line-soft);
  cursor: pointer;
  text-align: left;
  font-size: var(--fs-base);
  color: var(--nn-ink);
}
.nn-settings-item:last-child { border-bottom: none; }
.nn-settings-item:hover { background: rgba(47, 125, 110, 0.04); }
.nn-settings-item__label { flex: 1; }
.nn-settings-item__value {
  font-size: var(--fs-sm);
  color: var(--nn-muted);
}

.nn-switch {
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: var(--nn-line);
  position: relative;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: background var(--dur-fast);
}
.nn-switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform var(--dur-fast) var(--ease-out);
}
.nn-switch.is-on {
  background: var(--nn-teal-500);
}
.nn-switch.is-on::after {
  transform: translateX(18px);
}

/* —— Steps (iOS install) —— */
.nn-steps {
  counter-reset: step;
  list-style: none;
}
.nn-steps li {
  position: relative;
  padding: 12px 0 12px 40px;
  border-bottom: 1px solid var(--nn-line-soft);
  font-size: var(--fs-sm);
  color: var(--nn-ink-soft);
  line-height: var(--lh-snug);
}
.nn-steps li:last-child { border-bottom: none; }
.nn-steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--nn-teal-100);
  color: var(--nn-teal-700);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nn-diag {
  padding: 12px 14px;
  background: var(--nn-surface-2);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nn-diag__ok { color: var(--nn-success); font-weight: 600; }
.nn-diag__warn { color: var(--nn-warn-text); font-weight: 600; }

.nn-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-ui);
  background: var(--nn-teal-100);
  color: var(--nn-teal-700);
}
.nn-badge--warn {
  background: var(--nn-warn-bg);
  color: var(--nn-warn-text);
}
.nn-badge--muted {
  background: var(--nn-surface-2);
  color: var(--nn-muted);
}

.nn-fab {
  position: absolute;
  right: 16px;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 16px);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--nn-teal-500);
  color: #fff;
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 25;
}
.nn-fab svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

.memory-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--nn-mist-100);
  color: var(--nn-mist-500);
  margin-right: 4px;
  font-weight: 500;
}

.pin-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nn-sand, #c4a574);
  display: inline-block;
  margin-right: 4px;
  background: #c4a574;
}

/* Gallery index helpers */
.gallery-page {
  padding: 40px 24px 80px;
  position: relative;
  z-index: 1;
}

.gallery-header {
  max-width: 1100px;
  margin: 0 auto 40px;
}

.gallery-header h1 {
  font-family: var(--font-brand);
  font-size: 2.5rem;
  color: var(--nn-teal-600);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.gallery-header p {
  color: var(--nn-muted);
  max-width: 520px;
  font-size: var(--fs-md);
}

.gallery-actions {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.gallery-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.gallery-card {
  display: block;
  padding: 18px 16px;
  background: rgba(255, 252, 249, 0.85);
  border: 1px solid var(--nn-line-soft);
  border-radius: var(--r-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast);
}

.gallery-card:hover {
  border-color: var(--nn-teal-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
}

.gallery-card__num {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--nn-teal-500);
  margin-bottom: 6px;
}

.gallery-card__title {
  font-weight: 600;
  font-size: var(--fs-base);
  margin-bottom: 4px;
}

.gallery-card__desc {
  font-size: var(--fs-sm);
  color: var(--nn-muted);
  line-height: var(--lh-snug);
}

.demo-stage {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 40px;
  gap: 20px;
  position: relative;
  z-index: 1;
}

.demo-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 420px;
}

.demo-nav a,
.demo-nav button {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--nn-line);
  background: rgba(255,252,249,0.9);
  color: var(--nn-ink-soft);
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-ui);
}

.demo-nav a:hover,
.demo-nav button:hover {
  border-color: var(--nn-teal-300);
  color: var(--nn-teal-700);
}

.demo-hint {
  font-size: 13px;
  color: var(--nn-muted);
  text-align: center;
}

@media (max-width: 440px) {
  .phone {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
  .demo-stage { padding: 0; }
  .phone__notch { display: none; }
}
