:root {
  /* Sketch: 丝绸之路.sketch @750px */
  --bg: #fcf7ed;
  --bg-warm: #fef7e6;
  --bg-chat: #fef8e8;
  --primary: #f56320;
  --primary-dark: #d55500;
  --primary-light: #ff8f0f;
  --accent-gold: #fda440;
  --card: #ffffff;
  --text: #381808;
  --text-brown: #854d1b;
  --text-chip: #915615;
  --text-light: #a25014;
  --text-muted: #d5a377;
  --border: #f0e2cc;
  --shadow: 0 4px 18px rgba(133, 77, 27, 0.08);
  --radius: 16px;
  --radius-sm: 12px;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --portal-min-w: 375px;
  --portal-min-h: 687px;
  --portal-max-w: 820px;
  --portal-max-h: 1055px;
  --phone-w: var(--portal-max-w);
  --hero-carousel-h: 196px;
  --portal-body-min-h: 100dvh;
  --font-display: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

@media (min-width: 600px) {
  :root {
    --hero-carousel-h: 465px;
    --portal-body-min-h: 109dvh;
  }

  .app-shell {
    height: min(109dvh, var(--portal-max-h));
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  min-width: var(--portal-min-w);
  min-height: var(--portal-min-h);
}

html, body {
  font-family: var(--font-display);
  background: #efe4d2;
  color: var(--text-brown);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-width: var(--portal-min-w);
  min-height: 100vh;
  min-height: var(--portal-body-min-h);
  display: flex;
  justify-content: center;
  align-items: center;
}

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

.app-shell {
  width: 100%;
  min-width: var(--portal-min-w);
  max-width: var(--portal-max-w);
  min-height: var(--portal-min-h);
  max-height: var(--portal-max-h);
  height: min(100vh, var(--portal-max-h));
  height: min(100dvh, var(--portal-max-h));
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar,
.status-bar {
  flex-shrink: 0;
}

.page-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.page-body.no-tab {
  padding-bottom: calc(12px + var(--safe-bottom));
}

/* status bar */
.status-bar {
  height: 28px;
  padding: 6px 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #333;
}

/* top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px 12px;
  min-height: 44px;
}

.top-bar .title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  color: #1d1d1d;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* banner / carousel */
.hero-carousel {
  margin: 0 12px 14px;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  height: var(--hero-carousel-h);
  box-shadow: 0 6px 20px rgba(133, 77, 27, 0.12);
  background: #f5e6c8;
}

.hero-carousel .carousel-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: pan-y;
}

.hero-carousel .carousel-track {
  display: flex;
  height: 100%;
  min-height: 0;
  transition: transform 0.45s ease;
  will-change: transform;
}

.hero-carousel .carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  cursor: default;
}

.hero-carousel .carousel-slide[data-link] {
  cursor: pointer;
}

.hero-carousel .carousel-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  user-select: none;
}

.hero-carousel .carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8px;
  display: flex;
  justify-content: center;
  gap: 6px;
  z-index: 2;
  pointer-events: none;
}

.hero-carousel .carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: all 0.25s ease;
}

.hero-carousel .carousel-dot.active {
  width: 14px;
  border-radius: 3px;
  background: #fff;
}

.hero-banner {
  margin: 0 12px 14px;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  height: var(--hero-carousel-h);
  box-shadow: 0 6px 20px rgba(133, 77, 27, 0.12);
  background: #f5e6c8 url('../img/sketch/479d60a05f4c3e541570627e156271a92d898c40.png') center top / cover no-repeat;
}

.hero-banner--static {
  background-color: #f5e6c8;
}

/* section header */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 12px;
}

.section-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-brown);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-head h2 .fa {
  color: var(--primary);
}

.section-head--home h2 {
  gap: 4px;
  align-items: flex-end;
}

.section-head--home .section-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.section-head--home .section-title-wrap {
  position: relative;
  display: inline-block;
  padding-top: 5px;
  padding-right: 12px;
}

.section-head--home .section-title-text {
  font-size: 17px;
  font-weight: 800;
  color: #6b3f12;
  letter-spacing: 0.3px;
  line-height: 1.1;
}

.section-head--home .section-stars {
  position: absolute;
  top: -4px;
  right: -6px;
  width: 22px;
  height: 18px;
  pointer-events: none;
  z-index: 1;
}

.section-head--home .section-star {
  display: block;
  object-fit: contain;
  position: absolute;
}

.section-head--home .section-star--lg {
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
}

.section-head--home .section-star--sm {
  top: 13px;
  left: 11px;
  width: 8px;
  height: 8px;
}

.section-head .more {
  font-size: 13px;
  color: var(--text-chip);
  font-weight: 500;
}

.section-head .more-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 5px 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff8ea 0%, #ffecc8 100%);
  border: 1px solid #f3d9a8;
  color: #a86818;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(168, 104, 24, 0.08);
}

.section-head .more-pill .fa {
  font-size: 14px;
  margin-top: 1px;
}

/* course grid (home) */
.course-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  padding: 0 12px 16px;
}

.course-card-mini {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 330 / 191;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(133, 77, 27, 0.12);
  border: 1px solid #f0dcc0;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  background-color: #f3e6d0;
  background-position: left center;
  background-size: cover;
  background-repeat: no-repeat;
}

.course-card-mini__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 45%;
  box-sizing: border-box;
  padding: 10px 5px 22px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
}

.course-card-mini__content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.course-card-mini__brand {
  font-size: 13px;
  font-weight: 800;
  color: #ef7a1a;
  line-height: 1;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
  width: 100%;
}

.course-card-mini__tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  max-width: 100%;
  min-width: 52px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0 10px 1px;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: none;
  text-shadow: 0 1px 0 rgba(120, 20, 0, 0.12);
}

/* 丝带底图仅作形状蒙版，颜色由 background-color / coverTextColor 控制 */
.tag-ribbon-mask {
  background-color: #dc451b;
  background-image: none;
  -webkit-mask-image: url('../img/home/tag-ribbon.png');
  mask-image: url('../img/home/tag-ribbon.png');
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.course-card-mini__tag--red.tag-ribbon-mask {
  background-color: #dc451b;
}

.course-card-mini__tag--blue.tag-ribbon-mask {
  background-color: #2696ac;
}

.course-card-mini__tag--orange.tag-ribbon-mask {
  background-color: #f39800;
}

.course-card-mini__tag--teal.tag-ribbon-mask {
  background-color: #2a9d8f;
}

.course-card-mini .desc {
  font-size: 10px;
  color: #9a6535;
  line-height: 1.25;
  margin: 2px 0 0;
  max-width: 100%;
  width: 100%;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-card-mini .link-start {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 10px;
  font-weight: 700;
  color: #f56320;
  white-space: nowrap;
  line-height: 1;
  z-index: 2;
}

.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  border: none;
  background: linear-gradient(180deg, #ff9a3d, var(--accent-gold));
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245, 99, 32, 0.28);
}

.course-card-mini.placeholder {
  cursor: default;
  background-color: #fff8ee;
}

.course-card-mini.placeholder:not([style*="background-image"]) {
  background-image: linear-gradient(180deg, #fffdf9 0%, #fff8ee 100%);
}

.course-card-mini.placeholder[style*="background-image"] .course-card-mini__panel {
  background: linear-gradient(90deg, rgba(255, 253, 249, 0) 0%, rgba(255, 253, 249, 0.88) 24%, rgba(255, 248, 238, 0.98) 100%);
}

.course-card-mini.placeholder .course-card-mini__panel {
  width: 60%;
  padding-bottom: 10px;
}

.course-card-mini.placeholder .placeholder-title {
  font-size: 12px;
  font-weight: 800;
  color: #8a5a28;
  line-height: 1.35;
  text-align: left;
  margin-bottom: 6px;
}

.course-card-mini.placeholder .btn-soon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  border: none;
  background: #ececec;
  color: #888;
  font-size: 10px;
  font-weight: 600;
}

.course-card-mini.placeholder .btn-soon .fa {
  font-size: 11px;
}

.course-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 12px;
  color: var(--text-light);
  font-size: 14px;
}

.locofy-courses-empty {
  padding: 48px 16px;
  text-align: center;
}

/* course list — 课程一览（Locofy 750px 设计稿换算） */
.courses-page.app-shell {
  background: #fcf6eb;
}

.course-list {
  padding: 2px 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.course-card-lg {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: none;
  border-radius: 17px;
  box-shadow: 0 2px 6px rgba(232, 219, 195, 0.45);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  min-height: 127px;
  box-sizing: border-box;
}

.course-card-lg__thumb {
  position: relative;
  flex: 0 0 41%;
  width: 41%;
  height: 100px;
  border-radius: 12px;
  background-color: #f3e6d0;
  background-size: cover;
  background-position: left center;
  background-repeat: no-repeat;
  overflow: hidden;
}

.course-card-lg__thumb-text {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 58%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 0 4px 0 0;
  box-sizing: border-box;
}

.course-card-lg__thumb-text .thumb-brand {
  font-size: 18px;
  font-weight: 700;
  color: #d55500;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.course-card-lg__thumb-text .thumb-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 50px;
  height: 20px;
  margin-top: 3px;
  padding: 0 10px 1px;
  box-sizing: border-box;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(120, 20, 0, 0.12);
}

.course-card-lg__thumb-text .thumb-tag.tag-ribbon-mask {
  display: inline-flex;
}

.course-card-lg__thumb-text .thumb-brief {
  font-size: 12px;
  font-weight: 500;
  color: #dc451b;
  line-height: 1.2;
  margin-top: 3px;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-card-lg__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2px 0;
}

.course-card-lg__title {
  font-size: 16px;
  font-weight: 700;
  color: #2f2f2f;
  line-height: 1.25;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-card-lg__desc {
  font-size: 12px;
  font-weight: 350;
  color: #888;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-card-lg__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.course-card-lg .meta {
  font-size: 13px;
  font-weight: 350;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.course-card-lg .meta .fa {
  font-size: 13px;
}

.course-card-lg .btn-start-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 25px;
  padding: 0 12px;
  border-radius: 18px;
  border: none;
  background: #feaf05;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(254, 175, 5, 0.35);
}

/* detail */
.video-player {
  margin: 0 12px 16px;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/10;
  background: linear-gradient(160deg, #c4a06a, #8b6914);
  position: relative;
  box-shadow: var(--shadow);
}

.video-player .cover-bg {
  position: absolute;
  inset: 0;
  background-color: #8b6914;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.video-player .cover-char {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 80px;
  opacity: .9;
}

.video-player .video-hero-title {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 44px;
  z-index: 2;
  pointer-events: none;
}

.video-player .video-hero-title .hero-course-name {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  color: #ff8f0f;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.video-player .video-hero-title .hero-course-sub {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 600;
  color: #ff8f0f;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.video-player .play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  border: none;
  font-size: 22px;
  color: var(--primary);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  z-index: 3;
}

.video-player .detail-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 2;
}

.video-player .progress-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 11px;
  z-index: 3;
}

.video-player .progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,.35);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  touch-action: none;
}

.video-player .progress-track::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  bottom: -12px;
}

.video-player .progress-fill {
  width: 0%;
  height: 100%;
  background: var(--primary-light);
  border-radius: 2px;
  pointer-events: none;
}

.detail-section {
  margin: 0 12px 16px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.detail-section h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-brown);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-section .intro-text {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-brown);
}

/* detail page — Locofy 750px design */
.detail-page.app-shell {
  background: #fcf6eb;
}

.detail-page .page-body.no-tab {
  padding-bottom: calc(72px + var(--safe-bottom));
}

.detail-page .top-bar .title {
  color: #895009;
  font-size: 18px;
}

.detail-page .video-player {
  margin: 0 10px 12px;
  border-radius: 20px;
  aspect-ratio: 730 / 400;
  background: #d8d8d8;
  box-shadow: 0 4px 12px rgba(246, 194, 104, 0.28);
}

.detail-page .video-player .cover-bg {
  background-position: center;
}

.detail-page .video-player .video-hero-title {
  left: 38%;
  right: 10px;
  bottom: 52px;
  text-align: left;
}

.detail-page .video-player .video-hero-title .hero-brand {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.15;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.detail-page .video-player .video-hero-title .hero-course-name {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.08;
  color: #ff8f0f;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  margin-top: 4px;
}

.detail-page .video-player .video-hero-title .hero-course-sub {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 500;
  color: #ff8f0f;
  line-height: 1.2;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.28);
}

.detail-page .video-player .play-btn {
  width: 72px;
  height: 72px;
  font-size: 26px;
  color: var(--primary);
  box-shadow: 0 4px 8px rgba(246, 194, 104, 0.45);
}

.detail-page .video-player .progress-bar {
  padding: 10px 14px 12px;
  font-size: 14px;
  font-weight: 350;
}

.detail-page .video-player .progress-track {
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.29);
}

.detail-page .video-player .progress-fill {
  background: #fcebca;
  border-radius: 4px;
}

.detail-page .detail-section {
  margin: 0 10px 12px;
  padding: 18px 16px 20px;
  background: linear-gradient(180deg, #fef7e6 0%, #fdf6e6 100%);
  border-radius: 17px;
  border: 1px solid #fff;
  box-shadow: 0 2px 6px 4px rgba(255, 233, 182, 0.45);
}

.detail-page .detail-section h3 {
  font-size: 20px;
  font-weight: 700;
  color: #854d1b;
  margin-bottom: 12px;
}

.detail-page .detail-section .intro-text {
  font-size: 16px;
  line-height: 1.65;
  color: #854d1b;
}

.detail-page .ai-block {
  margin: 0 10px 12px;
  padding: 16px 14px 14px;
  background: linear-gradient(180deg, #feefc9 0%, #fdf6e6 100%);
  border-radius: 17px;
  border: 1px solid #fff;
  box-shadow: 0 2px 6px 4px rgba(255, 233, 182, 0.45);
}

.detail-page .ai-block .ai-head {
  font-size: 18px;
  margin-bottom: 10px;
}

.detail-page .detail-chat-messages .msg-bubble {
  font-size: 14px;
  line-height: 1.55;
}

.detail-page .chip-list {
  gap: 10px;
  margin-bottom: 10px;
}

.detail-page .chip-list .chip {
  padding: 14px 20px;
  border-radius: 19px;
  border: none;
  background: #fefbe4;
  font-size: 15px;
  color: #915615;
}

.detail-page .chat-input-bar.standalone {
  padding: 8px 10px calc(12px + var(--safe-bottom));
  background: transparent;
  border-top: none;
}

.detail-page .chat-input-bar.standalone input {
  height: 48px;
  border-radius: 21px;
  border: 1px solid #f0e2cc;
  background: #fffdf7;
  font-size: 15px;
  color: #915615;
  padding: 12px 18px;
}

.detail-page .chat-input-bar.standalone .btn-send {
  width: 48px;
  height: 48px;
  border-radius: 21px;
  background: #febc29;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(254, 188, 41, 0.35);
}

/* AI block on detail */
.ai-block {
  margin: 0 12px 16px;
  background: var(--bg-warm);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid #f5e8d0;
}

.ai-block .ai-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-brown);
}

.detail-chat-messages {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.detail-chat-messages .msg-row {
  margin-bottom: 10px;
}

.ai-course-picker {
  padding: 10px 12px 0;
}

.ai-course-picker label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.ai-course-picker select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
}

.ai-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ff9a3d, var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.ai-bubble {
  background: #f5f0e8;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 10px;
}

.chip-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  display: block;
  padding: 11px 16px;
  border-radius: 22px;
  border: 1px solid #f0e0c8;
  background: var(--bg-chat);
  font-size: 13px;
  color: var(--text-chip);
  text-align: left;
  cursor: pointer;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: var(--card);
  border-top: 1px solid var(--border);
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-bottom));
  width: 100%;
  max-width: var(--phone-w);
  z-index: 90;
}

.chat-input-bar.standalone {
  bottom: 0;
}

.chat-input-bar input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 13px;
  outline: none;
  background: #fffdf8;
}

.btn-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(180deg, #ff9a3d, var(--accent-gold));
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(245, 99, 32, 0.25);
}

/* map – layout from Locofy reference (750×1674) */
.map-immersive.app-shell {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-immersive .map-page-body {
  flex: 1;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.map-top-bar {
  flex-shrink: 0;
  background: #fcf6eb;
}

.map-immersive .map-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: #fcf6eb;
  padding-bottom: 12px;
}

.map-canvas {
  position: relative;
  width: 100%;
  line-height: 0;
}

.map-bg {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.map-nodes {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.map-empty,
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #92480b;
  font-size: 15px;
  font-weight: 500;
  z-index: 3;
}

.map-node {
  position: absolute;
  transform: translate(-50%, -55%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: inherit;
  z-index: 2;
}

.map-node-marker {
  display: block;
  width: clamp(88px, 20vw, 152px);
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(56, 24, 8, 0.18));
}

.map-node-num {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: clamp(22px, 5.5vw, 42px);
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.map-node-pin {
  position: relative;
  display: block;
}

.map-node-label {
  margin-top: 2px;
  max-width: 120px;
  text-align: center;
  color: #583718;
  font-size: clamp(11px, 3vw, 20px);
  font-weight: 500;
  line-height: 1.25;
  word-break: break-all;
}

.map-node.watched .map-node-label {
  color: #92480b;
  font-size: clamp(12px, 3.4vw, 26px);
}

.map-node.unwatched .map-node-marker {
  filter: grayscale(0.9) brightness(0.92) drop-shadow(0 4px 10px rgba(56, 24, 8, 0.12));
  opacity: 0.82;
}

.map-node.unwatched .map-node-num {
  color: #f0ebe3;
}

/* legacy map (unused) */
.map-page {
  padding: 0 12px 16px;
  min-height: calc(100vh - 120px);
}

.map-scene {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  min-height: 520px;
  background: linear-gradient(180deg, #fcf6eb 0%, #f3e4c8 45%, #e8d2a8 100%);
  box-shadow: var(--shadow);
}

#mapNodes {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.map-scene .sea {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 35%;
  background: linear-gradient(90deg, transparent, #6bb8e8 30%, #4a9fd4);
  opacity: .85;
}

.map-path {
  position: absolute;
  left: 28%;
  top: 8%;
  bottom: 8%;
  width: 8px;
  background: repeating-linear-gradient(180deg, #c9a86c 0px, #c9a86c 8px, transparent 8px, transparent 16px);
  border-radius: 4px;
  transform: translateX(-50%);
}

.map-empty,
.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 14px;
  z-index: 3;
}

.level-node {
  position: absolute;
  left: 28%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

a.level-node {
  text-decoration: none;
  color: inherit;
}

.level-node .dot {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.level-node.watched .dot {
  background: linear-gradient(145deg, #ff9a3d, var(--accent-gold));
}

.level-node.unwatched .dot {
  background: #b8b0a4;
  color: #f5f5f5;
}

.level-node .label {
  font-size: 11px;
  font-weight: 700;
  color: #583718;
  background: rgba(255,255,255,.9);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

/* profile */
.profile-page {
  background: #fcf6eb;
  --footprint-item-size: clamp(72px, 18vw, 86px);
}

.profile-page .page-body {
  padding-bottom: 12px;
}

.profile-top-bar {
  padding: 8px 10px 4px;
  background: #fcf6eb;
}

.profile-page .profile-panel {
  margin: 0 12px 16px;
  background: #fcf7ed;
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  border: 1px solid #f0e2cc;
}

.profile-page .profile-card.profile-panel {
  display: flex;
  gap: clamp(12px, 3.5vw, 20px);
  align-items: center;
  padding: 16px;
  text-decoration: none;
  color: inherit;
}

.profile-page .profile-card .avatar-lg {
  width: clamp(88px, 19.2vw, 144px);
  height: clamp(88px, 19.2vw, 144px);
  border-radius: clamp(14px, 2.4vw, 20px);
  font-size: clamp(36px, 8vw, 56px);
}

.profile-card-body {
  flex: 1;
  min-width: 0;
}

.profile-page .profile-card .name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(20px, 4.8vw, 36px);
  font-weight: 500;
  margin-bottom: clamp(8px, 2vw, 14px);
  color: #854d1b;
}

.profile-inline-icon {
  width: clamp(18px, 4.8vw, 28px);
  height: clamp(18px, 4.8vw, 28px);
  object-fit: contain;
  flex-shrink: 0;
}

.profile-inline-icon--vip {
  width: clamp(16px, 4vw, 24px);
  height: clamp(16px, 4vw, 24px);
}

.profile-page .badge-vip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  font-size: clamp(13px, 3.7vw, 28px);
  font-weight: 350;
  color: #854d1b;
}

.profile-title-icon {
  width: clamp(20px, 5.3vw, 32px);
  height: clamp(20px, 5.3vw, 32px);
  object-fit: contain;
  flex-shrink: 0;
}

.profile-page .profile-section.profile-panel {
  padding: 14px;
}

.profile-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(17px, 4.27vw, 32px);
  font-weight: 500;
  color: #854d1b;
  margin: 0 0 clamp(10px, 2.4vw, 16px);
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(12px, 3vw, 18px);
  padding: 0;
}

.profile-section-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(17px, 4.27vw, 32px);
  font-weight: 500;
  color: #854d1b;
  margin: 0;
}

.profile-section-meta {
  font-size: clamp(12px, 3.2vw, 24px);
  color: #a25014;
  font-weight: 350;
  white-space: nowrap;
}

.footprint-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin: 0;
  padding: 0 0 4px;
  width: 100%;
}

.footprint-scroll::-webkit-scrollbar {
  display: none;
}

.profile-page .footprint-grid {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  width: max-content;
  min-width: 100%;
}

.profile-page .footprint-item {
  flex: 0 0 var(--footprint-item-size, 76px);
  width: var(--footprint-item-size, 76px);
  min-width: var(--footprint-item-size, 76px);
}

.profile-page .footprint-thumb {
  width: 100%;
  height: var(--footprint-item-size, 76px);
  min-height: var(--footprint-item-size, 76px);
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.profile-page .footprint-name {
  font-size: 10px;
}

.profile-page .footprint-item--unwatched .footprint-name {
  color: #bebebe;
}

.profile-page .about-banner,
.profile-page a.about-banner {
  position: relative;
  margin: 0 12px 16px;
  min-height: clamp(100px, 21.7vw, 154px);
  border-radius: var(--radius);
  background: #fcf7ed;
  box-shadow: var(--shadow);
  border: 1px solid #f0e2cc;
  padding: 14px;
  padding-right: clamp(110px, 38vw, 220px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(6px, 1.6vw, 12px);
  color: #854d1b;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.profile-page a.about-banner:active {
  opacity: 0.92;
}

.profile-page .about-banner-art {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: clamp(110px, 36vw, 200px);
  max-width: 52%;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.profile-page .about-banner-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(17px, 4.27vw, 32px);
  font-weight: 500;
  color: #854d1b;
  margin: 0 0 clamp(10px, 2.4vw, 16px);
  width: 100%;
}

.profile-page .about-banner-text {
  position: relative;
  z-index: 1;
  margin: 0;
  width: 100%;
  max-width: 100%;
  font-size: clamp(12px, 3.2vw, 22px);
  font-weight: 350;
  color: #854d1b;
  line-height: 1.45;
}

.profile-page .contact-row {
  padding: 0;
  font-size: clamp(14px, 3.7vw, 28px);
  font-weight: 350;
  color: #854d1b;
}

.profile-page .contact-content {
  margin-left: 32px;
}

.contact-phone-link {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.contact-phone-link:active {
  opacity: 0.72;
}

@media (hover: none) and (pointer: coarse) {
  .contact-phone-link {
    text-decoration: underline;
    text-decoration-color: rgba(196, 90, 40, 0.45);
    text-underline-offset: 3px;
  }
}

.profile-logout-wrap {
  text-align: center;
  padding: 8px 12px 16px;
}

.profile-logout-link {
  font-size: 13px;
  color: var(--primary);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.profile-page .footprint-empty {
  flex: 1 1 100%;
  min-width: 100%;
  text-align: center;
  padding: 20px 12px;
  color: var(--text-light);
  font-size: 14px;
}

.profile-card {
  margin: 0 12px 16px;
  background: #fcf7ed;
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
  border: 1px solid #f0e2cc;
}

.profile-card .avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffe0a8, #f5a840);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
  overflow: hidden;
}

a.profile-card {
  text-decoration: none;
  color: inherit;
  display: flex;
}

.profile-menu-link {
  margin: 0 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  font-size: 15px;
  font-weight: 600;
}

.profile-menu-link .fa-angle-right {
  color: var(--text-light);
  font-size: 18px;
}

.profile-edit-body {
  padding: 12px;
}

.profile-avatar-edit {
  text-align: center;
  padding: 20px 0 8px;
}

.profile-avatar-edit .avatar-lg {
  width: 88px;
  height: 88px;
  margin: 0 auto 8px;
  border-radius: 20px;
  font-size: 40px;
  cursor: pointer;
}

.profile-avatar-edit .hint {
  font-size: 12px;
  color: var(--text-light);
  margin: 0;
}

.profile-edit-form {
  margin-top: 8px;
}

.action-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}

.action-sheet.open {
  display: block;
}

.action-sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.action-sheet-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.action-sheet-item {
  display: block;
  width: 100%;
  padding: 16px;
  border: 0;
  background: var(--card);
  text-align: center;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.action-sheet-item:last-child {
  border-bottom: 0;
}

.action-sheet-cancel {
  margin-top: 8px;
  border-radius: 14px;
  font-weight: 600;
}

.profile-card .name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-brown);
}

.badge-vip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  background: linear-gradient(90deg, #fff6e8, #ffe8c8);
  font-size: 11px;
  color: var(--text-brown);
  font-weight: 600;
}

.footprint-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.footprint-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 20px 12px;
  color: var(--text-light);
  font-size: 14px;
}

.footprint-item {
  display: block;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.footprint-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 6px;
  background: linear-gradient(145deg, #e8d4a8, #c4a06a);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

.footprint-item--unwatched .footprint-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  pointer-events: none;
  z-index: 1;
}

.footprint-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.35);
  z-index: 2;
}

.footprint-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffb84d, var(--primary));
  border-radius: 0 2px 2px 0;
  transition: width .2s ease;
}

.footprint-progress-text {
  margin-top: 2px;
  font-size: 9px;
  color: var(--primary);
  font-weight: 700;
}

.footprint-name {
  font-size: 10px;
  line-height: 1.3;
  color: var(--text);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 4px;
  font-size: 14px;
  color: var(--text);
}

/* login – Locofy reference 750×1633 */
.login-page {
  background: #fcf6eb;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.login-top-bar {
  flex-shrink: 0;
  padding: 8px 10px 4px;
  background: #fcf6eb;
}

.login-visual {
  flex-shrink: 0;
  line-height: 0;
}

.login-hero-img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.login-form {
  flex: 1;
  margin-top: clamp(-28px, -5.3vw, -40px);
  background: #fcf7ed;
  border-radius: clamp(28px, 6.5vw, 49px) clamp(28px, 6.5vw, 49px) 0 0;
  border: 1px solid #fff;
  padding: clamp(24px, 9.3vw, 70px) clamp(16px, 10.4vw, 78px) calc(24px + var(--safe-bottom));
  box-shadow: 0 -4px 16px rgba(251, 240, 220, 0.55);
}

.login-form .input-group {
  display: flex;
  align-items: center;
  gap: 10px;
  height: clamp(52px, 10.9vw, 82px);
  border: none;
  border-radius: 41px;
  padding: 0 clamp(16px, 5.5vw, 26px);
  margin-bottom: clamp(14px, 3.7vw, 30px);
  background: #fefdfd;
  box-shadow: 0 4px 8px rgba(251, 240, 220, 0.79);
}

.login-form:not(.profile-edit-form) .input-group .ico {
  display: none;
}

.login-form .input-group input {
  flex: 1;
  border: none;
  outline: none;
  font-size: clamp(14px, 3.7vw, 28px);
  font-weight: 350;
  background: transparent;
  color: #381808;
}

.login-form .input-group input::placeholder {
  color: #d5a377;
}

.login-form .input-group .toggle-pwd {
  border: none;
  background: none;
  font-size: clamp(16px, 4.5vw, 22px);
  cursor: pointer;
  color: #eec290;
  padding: 4px;
}

.login-form .forgot-link {
  text-align: right;
  font-size: clamp(13px, 3.7vw, 28px);
  font-weight: 350;
  color: #a25014;
  margin: clamp(-4px, -0.5vw, 0) 0 clamp(16px, 4vw, 28px);
  display: block;
}

.login-form .btn-login {
  width: 100%;
  height: clamp(54px, 11.6vw, 87px);
  padding: 0;
  border: none;
  border-radius: 41px;
  background: linear-gradient(180deg, #fcb04e 0%, #fe9d37 100%);
  color: #fff;
  font-size: clamp(17px, 5vw, 38px);
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(251, 240, 220, 0.79);
}

.login-form .agreement {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: clamp(18px, 5.5vw, 42px);
  font-size: clamp(12px, 3.2vw, 24px);
  color: #a25014;
  line-height: 1.5;
  font-weight: 350;
}

.login-form .agreement a {
  color: #a25014;
  text-decoration: underline;
}

.login-form .agreement input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: clamp(20px, 4.4vw, 33px);
  height: clamp(20px, 4.4vw, 33px);
  margin-top: 2px;
  border-radius: 50%;
  border: 1px solid #a25014;
  background: #fff;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}

.login-form .agreement input[type="checkbox"]:checked {
  background: #a25014;
  border-color: #a25014;
}

.login-form .agreement input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 45%;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* legacy login hero (unused) */
.login-hero {
  display: none;
}

.login-hero .scene {
  display: none;
}

.login-hero .scene span {
  font-size: 48px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.15));
}

.login-hero h1 {
  display: none;
}

.login-hero p {
  display: none;
}

/* portal AI page — align with course detail AI assistant */
.portal-ai-page.app-shell {
  background: #fcf6eb;
}

.portal-ai-page .page-body {
  padding-bottom: 12px;
}

.portal-ai-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 16px 4px;
}

.portal-ai-robot {
  width: 72px;
  height: 82px;
  object-fit: contain;
  flex-shrink: 0;
}

.portal-ai-head-text {
  flex: 1;
  min-width: 0;
  padding-top: 4px;
}

.portal-ai-title {
  font-size: 20px;
  font-weight: 700;
  color: #854d1b;
  font-family: "Source Han Sans CN", "PingFang SC", sans-serif;
}

.portal-ai-opening {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
  color: #854d1b;
  font-weight: 350;
  font-family: "Source Han Sans CN", "PingFang SC", sans-serif;
}

.portal-ai-page .ai-course-picker {
  padding: 10px 16px 0;
}

.portal-ai-page .chat-page {
  margin: 8px 12px 12px;
  padding: 12px;
  min-height: 200px;
  background: transparent;
  border-radius: 0;
}

.portal-ai-page .msg-row.ai .msg-bubble {
  background: #fff9e8;
  border: 1px solid #f6e6c8;
  color: #915615;
  border-radius: 20px;
  border-top-left-radius: 6px;
}

.portal-ai-page .msg-row.user .msg-bubble {
  background: #feaf05;
  color: #fff;
  border: none;
  border-radius: 20px;
  border-top-right-radius: 6px;
}

.portal-ai-page .msg-avatar--ai {
  background: transparent;
  width: 40px;
  height: 40px;
}

.portal-ai-page .msg-avatar-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.portal-ai-page .msg-avatar--user {
  background: linear-gradient(145deg, #ffd08a, var(--accent-gold));
}

.portal-ai-page .msg-avatar--user.msg-avatar--photo {
  background: transparent;
  overflow: hidden;
}

.portal-ai-page .msg-avatar-img--user {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.portal-ai-input-wrap {
  position: relative;
  left: auto;
  transform: none;
  bottom: auto;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  z-index: 90;
  padding: 8px 12px calc(10px + var(--safe-bottom));
  background: #fcf6eb;
  box-sizing: border-box;
  padding-bottom: 33px;
}

.portal-ai-composer {
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(240, 217, 168, 0.75);
  box-shadow: 0 4px 16px rgba(133, 77, 27, 0.08);
  overflow: hidden;
}

.portal-ai-composer-input {
  padding: 12px 14px 6px;
}

.portal-ai-composer-input input {
  display: block;
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.45;
  color: #854d1b;
  padding: 0;
}

.portal-ai-composer-input input::placeholder {
  color: #b8956a;
}

.portal-ai-composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 10px 10px;
}

.portal-ai-actions {
  display: flex;
  flex: 1;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.portal-ai-actions::-webkit-scrollbar {
  display: none;
}

.portal-ai-action-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 6px 12px;
  border: 1px solid #ebebeb;
  border-radius: 16px;
  background: #f7f7f8;
  color: #444;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
}

.portal-ai-action-btn i {
  font-size: 13px;
  color: #888;
}

.portal-ai-action-btn.is-selected {
  border-color: #febc29;
  background: #fff9e8;
  color: #854d1b;
}

.portal-ai-action-btn.is-selected i {
  color: #c98a2e;
}

.portal-ai-action-btn.is-active {
  border-color: #febc29;
  background: linear-gradient(145deg, #ffe08a, #febc29);
  color: #fff;
  box-shadow: 0 2px 8px rgba(254, 188, 41, 0.25);
}

.portal-ai-action-btn.is-active i {
  color: #fff;
}

.portal-ai-send.btn-send {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: #febc29;
  color: #fff;
  box-shadow: 0 2px 8px rgba(254, 188, 41, 0.35);
  font-size: 16px;
  flex-shrink: 0;
}

.portal-ai-page .portal-ai-chat.chat-page {
  padding-bottom: 130px;
  margin-bottom: 0;
}

.portal-ai-course-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.portal-ai-course-modal[hidden] {
  display: none;
}

.portal-ai-course-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.portal-ai-course-modal-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  max-height: 70vh;
  background: #fff;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
}

.portal-ai-course-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.portal-ai-course-modal-head button {
  border: none;
  background: transparent;
  color: #999;
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
}

.portal-ai-course-list {
  list-style: none;
  margin: 0;
  padding: 8px 0 calc(12px + var(--safe-bottom));
  overflow-y: auto;
  max-height: calc(70vh - 52px);
}

.portal-ai-course-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 14px 20px;
  font-size: 15px;
  color: #333;
  cursor: pointer;
}

.portal-ai-course-item.is-active,
.portal-ai-course-item:active {
  background: #fff9e8;
  color: #854d1b;
}

body.portal-ai-modal-open {
  overflow: hidden;
}

/* chat page */
.chat-page {
  padding: 12px;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-warm);
  border-radius: var(--radius);
  margin: 0 12px 12px;
  min-height: 360px;
}

.msg-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.msg-row.user {
  flex-direction: row-reverse;
}

.msg-row .msg-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.msg-row.ai .msg-avatar { background: linear-gradient(145deg, #ff9a3d, var(--primary)); }
.msg-row.user .msg-avatar { background: linear-gradient(145deg, #ffd08a, var(--accent-gold)); }

.msg-bubble {
  max-width: 75%;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.55;
}

.msg-row.ai .msg-bubble {
  background: var(--bg-chat);
  border: 1px solid #f3e4cc;
  color: var(--text-brown);
  border-top-left-radius: 4px;
}

.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, #fff8ee, #ffeccc);
  color: var(--text-brown);
  border-top-right-radius: 4px;
}

.msg-bubble img,
.msg-bubble .ai-chat-image {
  width: 100%;
  border-radius: 8px;
  margin-top: 8px;
  display: block;
}

.ai-chat-image {
  cursor: zoom-in;
}

.msg-bubble .ai-login-link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

.msg-bubble .ai-login-link:active {
  opacity: 0.85;
}

.ai-image-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ai-image-modal.open {
  display: flex;
}

.ai-image-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.ai-image-modal-body {
  position: relative;
  z-index: 1;
  max-width: min(92vw, 720px);
  max-height: 86vh;
}

.ai-image-modal-body img {
  display: block;
  max-width: 100%;
  max-height: 86vh;
  border-radius: 12px;
  background: #fff;
}

.ai-image-modal-close {
  position: absolute;
  top: -12px;
  right: -8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.map-img-placeholder {
  width: 100%;
  height: 120px;
  border-radius: 8px;
  background: linear-gradient(135deg, #d4c4a0, #8b7355);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  margin-top: 8px;
}

/* bottom tab */
.tab-bar {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: transparent;
  border-top: none;
  display: flex;
  z-index: 100;
  overflow: visible;
  box-shadow: none;
  margin-top: -23px;
}

.tab-bar-bg {
  position: absolute;
  left: 0;
  right: 0;
  top: -16px;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  filter: drop-shadow(0 -2px 8px rgba(56, 24, 8, 0.06));
}

.tab-bar-curve {
  width: 100%;
  height: 100%;
  display: block;
}

.tab-bar-fill {
  fill: #fff;
}

.tab-bar-line {
  stroke: #f0e6d6;
  stroke-width: 1.2px;
  vector-effect: non-scaling-stroke;
}

.tab-item {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--text);
  padding-top: 6px;
}

.tab-item .tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tab-item .tab-icon-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
  margin: 0 auto 2px;
}

.tab-item .tab-icon-placeholder {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto 2px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.08);
}

.tab-item.active {
  color: var(--primary);
  font-weight: 600;
}

.tab-item.active .tab-icon {
  transform: scale(1.08);
}

.tab-item--ai {
  position: relative;
}

.tab-item--ai .tab-icon-img {
  width: 42px;
  height: 42px;
  margin-top: -15px;
  margin-bottom: 0;
}

.tab-item--ai span {
  margin-top: 2px;
}

.home-page .page-body {
  padding-top: 2px;
}
/* portal-icon-patch */
.hero-chars span {
  width: 42px; height: 52px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; color: #fff;
  background: rgba(255,255,255,.35); border: 2px solid rgba(255,255,255,.5);
}
.login-hero .scene { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; padding-top: 20px; }
.login-hero .scene span {
  font-size: 28px; font-weight: 700; color: #fff;
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.25);
}
.course-card-lg .thumb span,
.cover-char,
.avatar-lg span,
.char-icon span {
  font-size: 22px; font-weight: 700; color: #a06800;
}
.tab-item .tab-icon { font-size: 20px; display: block; margin-bottom: 2px; }
.msg-avatar .fa { font-size: 18px; color: #fff; }
.ai-avatar .fa { font-size: 20px; color: #fff; }

/* legal document pages (user agreement / privacy policy) */
.legal-page {
  background: #fcf6eb;
}

.legal-top-bar {
  background: #fcf6eb;
  padding-top: 4px;
}

.legal-top-spacer {
  visibility: hidden;
  pointer-events: none;
}

.legal-body {
  padding: 0 0 calc(20px + var(--safe-bottom));
}

.legal-document {
  margin: 4px 14px 0;
  padding: 22px 18px 28px;
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 6px 20px rgba(133, 77, 27, 0.1);
  color: #381808;
  font-size: 15px;
  line-height: 1.78;
  word-break: break-word;
}

.legal-document h1,
.legal-document h2,
.legal-document h3,
.legal-document h4 {
  color: #2a1208;
  font-weight: 700;
  line-height: 1.45;
  margin: 22px 0 10px;
}

.legal-document h2:first-child,
.legal-document h3:first-child {
  margin-top: 0;
}

.legal-document h2 {
  font-size: 17px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f3e8d6;
}

.legal-document p {
  margin: 0 0 12px;
}

.legal-document ul,
.legal-document ol {
  margin: 0 0 14px;
  padding-left: 1.35em;
}

.legal-document li {
  margin-bottom: 6px;
}

.legal-document strong {
  color: #2a1208;
  font-weight: 700;
}

.legal-document a {
  color: #c45a28;
  text-decoration: underline;
}

.legal-document img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border-radius: 10px;
}

.legal-document .exhibition-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 18px;
}

.legal-document .exhibition-image-grid img {
  width: 100%;
  margin: 0;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.legal-document blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 3px solid #e8c99a;
  background: #fdf8f0;
  color: #5c4030;
}

.legal-status {
  text-align: center;
  color: #b8956e;
  padding: 48px 12px;
  font-size: 14px;
}

.login-form .agreement a {
  color: #c45a28;
  text-decoration: underline;
}

