/* ========== 画像页：内容直接铺在三叠纸上 ========== */

.portrait-stacks {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  width: 100%;
}

.paper-sheet--portrait {
  /* padding 在 base.css；这里只保证内容块不撑开 */
  overflow: visible;
}

.paper-sheet--footprint {
  padding: 1.35rem 1.1rem 1.1rem;
}

.portrait-footprint-map {
  width: 100%;
  height: auto;
  aspect-ratio: 2.85 / 1;
  min-height: 220px;
  max-height: 360px;
  margin: 0;
}

.portrait-view {
  flex: 0 0 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* 不再套内层卡片，只做布局容器 */
.portrait-board {
  width: 100%;
  height: auto;
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.portrait-board::after {
  display: none;
}

/* 同级标题：阅读画像 | 时间维度 */
.portrait-board-head {
  display: grid;
  grid-template-columns: minmax(160px, 190px) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 0.85rem;
  align-items: baseline;
  margin-bottom: 1rem;
  padding: 0;
}

.portrait-board-title {
  margin: 0;
  padding-left: 0.1rem;
  font-size: 1.05rem;
  font-weight: 620;
  letter-spacing: 0.06em;
  color: #2A342A;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  grid-column: 1 / 3;
}

.portrait-board-title--side {
  grid-column: 3;
  padding-left: 1.1rem;
}

/* 三列直接落在纸面 */
.portrait-board-body {
  display: grid;
  grid-template-columns: minmax(160px, 190px) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 0.85rem;
  align-items: start;
  min-height: 0;
}

/* 时间维度前柔和分隔（非卡片边框） */
.portrait-aside {
  position: relative;
  min-width: 0;
  padding-left: 1.1rem;
}

.portrait-aside::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12%;
  bottom: 12%;
  width: 1px;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(120, 130, 115, 0.16) 18%,
    rgba(120, 130, 115, 0.16) 82%,
    transparent 100%
  );
  pointer-events: none;
}

.portrait-section-title {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #1A221A;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

/* ----- 阅读偏好：纸上的内容块，高度随内容 ----- */
.portrait-prefs {
  display: flex;
  flex-direction: column;
  min-width: 0;
  align-self: start;
  height: auto;
}

.portrait-prefs-inner {
  display: flex;
  flex-direction: column;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  height: auto;
  box-sizing: border-box;
}

.portrait-pref-list {
  display: flex;
  flex-direction: column;
  gap: 0.78rem;
}

.portrait-pref-row {
  display: grid;
  grid-template-columns: 0.45rem 3.4rem minmax(0, 1fr) 1.85rem;
  align-items: center;
  column-gap: 0.4rem;
}

.portrait-pref-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
}

.portrait-pref-name {
  font-size: 0.7rem;
  color: #1A221A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

.portrait-pref-track {
  height: 0.42rem;
  border-radius: 999px;
  background: rgba(200, 195, 180, 0.35);
  overflow: hidden;
}

.portrait-pref-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.portrait-pref-hours {
  font-size: 0.66rem;
  color: #3E4A3C;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

/* ----- 雷达：无自身边框，直接画在纸上 ----- */
.portrait-radar-mid,
.portrait-aside {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.portrait-radar-host {
  width: 220px;
  height: 220px;
  max-width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  position: relative;
}

.portrait-radar-wrap {
  position: relative;
  width: 100%;
  height: 100%;
}

.portrait-radar-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.portrait-radar-hit {
  cursor: pointer;
}

.portrait-radar-tip {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, calc(-100% - 8px));
  max-width: min(220px, 70vw);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  background: rgba(26, 34, 26, 0.92);
  color: #F1EFDD;
  font-size: 0.72rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.portrait-radar-tip[hidden] {
  display: none !important;
}

/* ----- 书籍足迹世界地图 ----- */
.portrait-footprint {
  width: 100%;
}

.portrait-footprint-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  margin-bottom: 0.25rem;
}

.portrait-footprint-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 620;
  letter-spacing: 0.04em;
  color: #1A221A;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

.portrait-footprint-stat {
  margin: 0;
  font-size: 0.72rem;
  color: #6A7468;
  letter-spacing: 0.02em;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

.portrait-footprint-fallback {
  margin: 2rem 0;
  text-align: center;
  color: #7A8478;
  font-size: 0.85rem;
}

.portrait-footprint-legend {
  display: flex;
  align-items: center;
  margin-top: 0.25rem;
}

/* ----- 阅读热力图（GitHub / 读迹风格） ----- */
.portrait-heatmap {
  width: 100%;
  --hm-cell: 11px;
  --hm-gap: 3px;
  --hm-dow: 1.1rem;
}

.portrait-heatmap-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.55rem 0.9rem;
  margin-bottom: 0.85rem;
}

.portrait-heatmap-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 620;
  letter-spacing: 0.04em;
  color: #2A342A;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

.portrait-heatmap-stat {
  margin: 0;
  font-size: 0.78rem;
  color: #8A9286;
  letter-spacing: 0.02em;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

.portrait-year-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(120, 130, 110, 0.4);
  border-radius: 999px;
  background-color: rgba(255, 252, 245, 0.7);
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236E7F4E' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 0.6rem auto;
  color: #3A5A3E;
  font-size: inherit;
  font-weight: inherit;
  font-family: inherit;
  padding: 0.05rem 1.6rem 0.05rem 0.7rem;
  cursor: pointer;
  outline: none;
  accent-color: #3A5A3E;
}

.portrait-year-select option {
  background-color: #fff;
  color: #3A5A3E;
}

.portrait-year-select:hover,
.portrait-year-select:focus-visible {
  border-color: #6E7F4E;
}

.portrait-heatmap-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.15rem;
  -webkit-overflow-scrolling: touch;
}

.portrait-heatmap-chart {
  display: inline-flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: max-content;
}

.portrait-heatmap-months {
  position: relative;
  height: 1.85rem;
  margin-left: var(--hm-dow);
}

.portrait-heatmap-month {
  position: absolute;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  line-height: 1;
  font-size: 0.68rem;
  color: #6A7468;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.portrait-heatmap-month small {
  font-size: 0.58rem;
  color: #9AA294;
  line-height: 1;
}

.portrait-heatmap-body {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
}

.portrait-heatmap-dow {
  width: var(--hm-dow);
  display: grid;
  grid-template-rows: repeat(7, var(--hm-cell));
  gap: var(--hm-gap);
  align-items: center;
  justify-items: start;
  font-size: 0.62rem;
  color: #7A8478;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
  line-height: 1;
  padding-top: 0;
}

.portrait-heatmap-weeks {
  display: flex;
  gap: var(--hm-gap);
}

.portrait-heatmap-week {
  display: grid;
  grid-template-rows: repeat(7, var(--hm-cell));
  gap: var(--hm-gap);
}

.portrait-heatmap-cell {
  width: var(--hm-cell);
  height: var(--hm-cell);
  border-radius: 2px;
  box-sizing: border-box;
}

/* 空格：已过偏深，未过偏浅（有阅读强度时由 level-* 覆盖） */
.portrait-heatmap-cell.is-future,
.portrait-heatmap-cell.level-0.is-future {
  background: rgba(180, 175, 160, 0.12);
}

.portrait-heatmap-cell.is-past,
.portrait-heatmap-cell.level-0.is-past {
  background: rgba(150, 145, 130, 0.42);
}

.portrait-heatmap-cell.level-1 {
  background: #C5D4B8;
}

.portrait-heatmap-cell.level-2 {
  background: #8FAE7A;
}

.portrait-heatmap-cell.level-3 {
  background: #5A8A52;
}

.portrait-heatmap-cell.level-4 {
  background: #2F5A3A;
}

.portrait-heatmap-cell {
  cursor: pointer;
}

.portrait-heatmap-cell:hover {
  opacity: 0.82;
}

.portrait-heatmap-cell.is-selected {
  outline: 2px solid #1F2E1F;
  outline-offset: 1px;
}

.portrait-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  margin-top: 0.75rem;
  font-size: 0.62rem;
  color: #8A9286;
  font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif;
}

.portrait-heatmap-swatch {
  width: var(--hm-cell);
  height: var(--hm-cell);
  border-radius: 2px;
  display: inline-block;
}

.portrait-heatmap-swatch.level-0 {
  background: rgba(180, 175, 160, 0.22);
}

.portrait-heatmap-swatch.level-1 {
  background: #C5D4B8;
}

.portrait-heatmap-swatch.level-2 {
  background: #8FAE7A;
}

.portrait-heatmap-swatch.level-3 {
  background: #5A8A52;
}

.portrait-heatmap-swatch.level-4 {
  background: #2F5A3A;
}

@media (max-width: 900px) {
  .paper-sheet--portrait {
    padding: 2rem 1.6rem 1.6rem;
  }

  .portrait-heatmap {
    --hm-cell: 10px;
    --hm-gap: 2px;
  }

  .portrait-footprint-map {
    min-height: 180px;
    max-height: 260px;
    aspect-ratio: 2.5 / 1;
  }

  .paper-sheet--footprint {
    padding: 1.2rem 0.9rem 1rem;
  }

  .portrait-board-head,
  .portrait-board-body {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .portrait-board-title,
  .portrait-board-title--side {
    grid-column: 1;
    padding-left: 0.1rem;
  }

  .portrait-aside {
    padding-left: 0;
    padding-top: 0.5rem;
  }

  .portrait-aside::before {
    left: 8%;
    right: 8%;
    top: 0;
    bottom: auto;
    width: auto;
    height: 1px;
    background: linear-gradient(
      to right,
      transparent 0%,
      rgba(120, 130, 115, 0.16) 18%,
      rgba(120, 130, 115, 0.16) 82%,
      transparent 100%
    );
  }

  .portrait-radar-host {
    width: min(100%, 220px);
    height: auto;
  }
}
