:root {
  color-scheme: light;
  --bg: #f3efe6;
  --ink: #1a1814;
  --muted: #6f6a62;
  --line: #e4ddd0;
  --paper: #fffcf7;
  --soft: #ebe4d6;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

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

.sprite {
  display: none;
}

.icon {
  width: 24px;
  height: 24px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

main {
  width: min(100%, 420px);
  margin: 0 auto;
  min-height: 100dvh;
  padding:
    calc(20px + env(safe-area-inset-top))
    20px
    calc(28px + env(safe-area-inset-bottom));
}

.view {
  display: flex;
  flex-direction: column;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.mark {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.14em;
}

.mark img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.quiet {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 15px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  margin-left: -6px;
  font-size: 16px;
}

h1 {
  margin: 12px 0 22px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
}

.section {
  margin-top: 28px;
}

.lead {
  margin: -12px 0 4px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.recall {
  margin-bottom: 28px;
}

.recall-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: 22px;
}

.recall-list::-webkit-scrollbar {
  display: none;
}

.memory {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  /* 一屏正好放两张，多的在框里横着滑，不伸出页面 */
  width: calc((100% - 12px) / 2);
  min-width: 0;
  height: 176px;
  padding: 16px;
  border-radius: 22px;
  scroll-snap-align: start;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(26, 24, 20, 0.04);
}

.memory:only-child {
  width: 100%;
}

.memory-year {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.memory-kind {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.7);
  font-size: 13px;
}

.memory-title {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.memory-text {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.45;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tone-0 { background: #dccdb4; }
.tone-1 { background: #c9d3c3; }
.tone-2 { background: #d8c7bf; }
.tone-3 { background: #c8cdd6; }

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  min-height: 124px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(26, 24, 20, 0.04), 0 6px 18px rgba(26, 24, 20, 0.04);
}

.tile > div { min-width: 0; }

.tile .icon {
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 12px;
  background: var(--soft);
}

.tile-name {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.tile-sub {
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tile-sub.fresh {
  color: var(--ink);
  font-weight: 500;
}

.tile:active,
.row:active,
.all:active,
.memory:active {
  transform: scale(0.985);
}

.empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.all {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  margin-top: 16px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: transparent;
  font-size: 17px;
}

.all span {
  flex: 1;
}

.chevron {
  width: 20px;
  height: 20px;
  color: var(--muted);
}

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  overflow: hidden;
}

.rows:empty {
  display: none;
}

.rows li + li {
  border-top: 1px solid var(--line);
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
  padding: 0 12px 0 16px;
  font-size: 17px;
}

.row-name {
  flex: 1;
}

.start-row {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  text-align: left;
  cursor: pointer;
}

.row-sub {
  color: var(--muted);
  font-size: 14px;
}

.row-sub.live {
  color: #3d7a4f;
}

.row-actions {
  display: flex;
  gap: 4px;
}

.square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
}

.square:disabled {
  color: var(--line);
}

.square.add,
.square.remove {
  border: 1px solid var(--line);
}

.enter {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  margin-top: 28px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 18px;
}

.open-icon {
  width: 44px;
  height: 44px;
  margin-top: 24px;
}

.open-icon + h1 {
  margin-top: 12px;
}

.open-list {
  margin-top: 24px;
}

.demo {
  margin: 32px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (min-width: 800px) {
  main {
    padding-top: 8vh;
  }
}

/* 右上角自己的头像，点了进「我和设置」 */
.me-link {
  display: block;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 50%;
  background: var(--soft);
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--line);
}

.me-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 第一次来：先进哪里 */
.start-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.start-pick {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 76px;
  padding: 10px 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  font-size: 13px;
  cursor: pointer;
}

.start-pick:active {
  border-color: var(--ink);
  transform: scale(0.97);
}

/* 第一页上随手拍和提示卡放在格子上面，和格子隔开（原型里「设个密码」卡片的位置） */
#view-home .snap-entry,
#view-home .notice {
  margin: 0 0 16px;
}

#view-home .test-badge {
  align-self: flex-start;
  margin: -12px 0 22px;
}

/* 第一页的提示卡（设立自己的形象，ADR-0155 第 6 条、ADR-0157） */
.notice {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--soft);
}

.notice p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.notice-action {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 1px solid var(--ink);
  border-radius: 14px;
  color: var(--ink);
  font-size: 16px;
}

/* 返回：线条箭头加上一层的名字，各页一样。<a class="back" href="…">第一页</a> 就行，不用自己放图标 */
.back:not(:has(svg))::before {
  content: "";
  flex: none;
  width: 24px;
  height: 24px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 5-7 7 7 7'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m15 5-7 7 7 7'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
}

/* 还没有形象时右上角是剪影 */
.me-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.me-link .icon {
  width: 26px;
  height: 26px;
  margin-top: 6px;
}

.me-link.has-face {
  background: #f3e7d6;
}

.me-link .face-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
}

/* 口碑小牌子（ADR-0172）：跟在名字后面，小小一个，不抢名字 */
.kb.new, .kb.good, .kb.best {
  display: inline-block;
  overflow: visible;
  flex: none;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
  background: var(--soft);
  color: var(--muted);
}

.kb.good { background: #e6f0e4; color: #3d6b37; }
.kb.best { background: #f4ead2; color: #8a6418; }

/* 「本城实体店」小牌子（ADR-0195）：跟在口碑小牌子后面，点了到他的店 */
.sb {
  display: inline-block;
  flex: none;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  vertical-align: 1px;
  background: #e3ecf2;
  color: #2f5c78;
  cursor: pointer;
}

/* 地方小的时候：小店铺图标 + 「店」（和舞台瀑布卡片一样） */
.sb.sb-mini { display: inline-flex; align-items: center; gap: 2px; padding: 0 5px; }
.sb.sb-mini svg { width: 11px; height: 11px; flex: none; }
