/* 配色沿用小程序实测值，来源见 workbuddy应用/today-star-web/DESIGN.md */
:root {
  --blue: #287dff;
  --orange: #ff6b00;
  --text: #101423;
  --muted: #797c86;
  --faint: #aeb0bb;
  --line: #e7e9f0;
  --card: #fff;
  --page: #f4f5f8;
  --sky-top: #c7d8f5;
  --sky-mid: #dde5f5;
  --red-soft: #feeeee;
  --red-text: #b4232a;
  --orange-soft: #fff0e5;
  --orange-text: #b24a00;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.shell { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

.home-bg { background: linear-gradient(180deg, var(--sky-top) 0, var(--sky-mid) 300px, var(--page) 560px) no-repeat; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 68px; }

.brand { font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif; font-size: 25px; letter-spacing: 1px; }

.topnav { display: flex; gap: 24px; font-size: 14px; color: #454a5c; }
.topnav a:hover { color: var(--blue); }

.hero { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; }

.card { background: var(--card); border-radius: var(--radius); }

.star-card { padding: 26px 28px 0; background: linear-gradient(135deg, #fffaf5, #fff 70%); display: flex; flex-direction: column; }
.star-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.star-line { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.star-value { font-size: 50px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.star-name { font-size: 18px; font-weight: 600; margin-top: 4px; }
.star-meta { font-size: 13px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

.stars { position: relative; display: inline-block; font-size: 22px; letter-spacing: 0; color: #dfe1e8; line-height: 1; white-space: nowrap; }
.stars i { position: absolute; left: 0; top: 0; overflow: hidden; color: var(--orange); font-style: normal; }

.remind {
  flex: none; border: 0; border-radius: 999px; background: var(--orange); color: #fff;
  font: inherit; font-weight: 600; font-size: 14px; padding: 10px 20px; cursor: pointer;
}
.remind:hover { background: #e96200; }

.remind-tip { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--orange-soft); font-size: 13px; color: var(--orange-text); }
.remind-tip p { margin: 0 0 8px; }
.remind-tip img { display: block; margin-bottom: 8px; border-radius: 8px; background: #fff; }
.remind-tip img[hidden] { display: none; }
.remind-tip button { border: 1px solid currentColor; border-radius: 8px; background: #fff; color: inherit; font: inherit; padding: 5px 12px; cursor: pointer; }
.remind-tip code { display: block; word-break: break-all; user-select: all; }
.remind-tip[hidden] { display: none; }

.card-link {
  display: flex; justify-content: space-between; align-items: center; margin: 18px -28px 0; padding: 14px 28px;
  border-top: 1px solid var(--line); font-size: 14px; color: #454a5c; border-radius: 0 0 var(--radius) var(--radius);
}
.card-link:hover { color: var(--blue); }

.live-card { padding: 26px 28px; display: flex; flex-direction: column; }
.live-tag { font-size: 13px; color: var(--muted); font-weight: 500; }
.live-tag.on { color: #d4322c; }
.live-title { font-size: 19px; font-weight: 600; line-height: 1.45; margin: 8px 0 6px; }
.live-meta { font-size: 13px; color: var(--muted); }
.live-points { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; font-size: 13px; color: #454a5c; }
.live-points:empty { display: none; }
.live-points li { position: relative; padding-left: 12px; }
.live-points li::before { content: ""; position: absolute; left: 0; top: .62em; width: 4px; height: 4px; border-radius: 50%; background: var(--faint); }
.live-actions { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 20px; font-size: 14px; }
.live-primary { color: var(--blue); font-weight: 500; }
.live-secondary { color: #454a5c; }
.live-actions a:hover { color: var(--blue); text-decoration: underline; }

.section-title { font-size: 19px; font-weight: 600; margin: 32px 0 14px; display: flex; justify-content: space-between; align-items: baseline; }
.section-title small { font-size: 13px; font-weight: 400; color: var(--muted); }

.products { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.product { padding: 16px; transition: transform .15s ease; }
.product:hover { transform: translateY(-2px); }
.product svg { width: 26px; height: 26px; color: var(--blue); display: block; margin-bottom: 10px; }
.product b { display: block; font-size: 15px; font-weight: 600; }
.product span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

.val-main { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.val-feature { display: block; border-radius: var(--radius); padding: 20px 22px; transition: transform .15s ease; }
.val-feature:hover { transform: translateY(-2px); }
.val-feature b { display: block; font-size: 18px; font-weight: 600; }
.val-feature span { display: block; font-size: 13px; margin-top: 3px; }
.val-feature.red { background: var(--red-soft); }
.val-feature.red b, .val-feature.red span { color: var(--red-text); }
.val-feature.orange { background: var(--orange-soft); }
.val-feature.orange b, .val-feature.orange span { color: var(--orange-text); }

.val-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.val-item { padding: 14px 12px; }
.val-item:hover b { color: var(--blue); }
.val-item b { display: block; font-size: 15px; font-weight: 500; }
.val-item span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.val-item span.warn { color: var(--orange-text); }

.footer { margin: 36px 0 0; padding: 20px 0 32px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); line-height: 1.8; }

/* 站内外壳 */
.shell-body { height: 100vh; height: 100dvh; display: flex; overflow: hidden; }
.sidebar { flex: none; width: 200px; background: #fff; border-right: 1px solid var(--line); padding: 18px 12px 24px; overflow-y: auto; }
.sidebar .brand { display: block; padding: 0 10px 14px; }
.side-title { padding: 16px 10px 6px; font-size: 12px; color: var(--muted); }
.side-link { display: block; padding: 7px 10px; border-radius: 8px; font-size: 14px; color: #33384a; }
.side-link:hover { background: var(--page); }
.side-link[aria-current="page"] { background: #eaf2ff; color: var(--blue); font-weight: 600; }
.side-ext { color: var(--faint); font-size: 12px; }
.workspace { flex: 1; min-width: 0; position: relative; }
.view-home { height: 100%; overflow-y: auto; padding-top: 24px; }
.app-view { height: 100%; display: flex; flex-direction: column; }
.app-view[hidden], .view-home[hidden] { display: none; }
.app-toolbar { flex: none; height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line); font-size: 14px; }
.app-toolbar b { font-weight: 600; }
.app-actions { display: flex; align-items: center; gap: 4px; font-size: 13px; color: #454a5c; }
.app-actions button, .app-actions a { border: 0; background: none; font: inherit; color: inherit; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.app-actions button:hover, .app-actions a:hover { background: var(--page); color: var(--blue); }
.app-stack { flex: 1; min-height: 0; position: relative; background: var(--page); }
.app-frame { position: absolute; inset: 0; visibility: hidden; }
.app-frame.on { visibility: visible; }
.app-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.app-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--page); color: var(--muted); font-size: 14px; }
.app-loading a { color: var(--blue); margin-left: 4px; }

/* 查看页 */
.viewer-top { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line); }
.viewer-top .inner { display: flex; align-items: center; gap: 24px; height: 58px; padding: 0 24px; }
.viewer-top .brand { font-size: 21px; flex: none; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: 6px 12px; border-radius: 8px; font-size: 14px; color: #454a5c; }
.tabs a:hover { background: var(--page); }
.tabs a[aria-current="page"] { background: #eaf2ff; color: var(--blue); font-weight: 600; }
.home-link { flex: none; font-size: 13px; color: var(--muted); }
.home-link:hover { color: var(--blue); }

.viewer-main { padding: 20px 24px 8px; max-width: 1960px; margin: 0 auto; }
.pages.stack { display: flex; flex-direction: column; gap: 20px; }
.pages.stack .sheet { width: 100%; margin: 0 auto; }
.pages.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 408px)); justify-content: center; gap: 20px; align-items: start; }
.sheet { background: #fff; border-radius: var(--radius); min-width: 0; }
.sheet-head { position: sticky; top: 58px; z-index: 3; background: #fff; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; padding: 11px 18px; }
.sheet-title { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; color: var(--muted); }
.sheet-title b { color: var(--text); font-weight: 600; font-size: 14px; }
.sheet-title span { flex: none; font-variant-numeric: tabular-nums; }
.jumps { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-top: 8px; }
.jumps::-webkit-scrollbar { display: none; }
.jumps button { flex: none; border: 0; border-radius: 6px; background: var(--page); color: #454a5c; font: inherit; font-size: 12px; padding: 4px 10px; cursor: pointer; }
.jumps button:hover { background: #eaf2ff; color: var(--blue); }
.sheet-scroll { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
.sheet-fit { margin: 0 auto; overflow: hidden; }
.sheet-fit iframe { display: block; border: 0; transform-origin: 0 0; }
.sheet-note { margin: 0; padding: 8px 18px; background: var(--orange-soft); color: var(--orange-text); font-size: 13px; }
.to-top { position: fixed; right: 24px; bottom: 28px; z-index: 6; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: #454a5c; font-size: 18px; cursor: pointer; }
.to-top:hover { color: var(--blue); }
.history-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; padding: 10px 14px; background: #fff; border-radius: var(--radius); font-size: 14px; }
.history-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.history-picker label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.history-picker input { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font: inherit; font-variant-numeric: tabular-nums; }
.history-picker button { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #33384a; font: inherit; cursor: pointer; }
.history-picker button:hover:not(:disabled) { background: var(--page); }
.history-picker button:disabled { color: var(--faint); cursor: default; }
.history-views { display: flex; padding: 3px; border-radius: 9px; background: var(--page); }
.history-views button { height: 28px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.history-views button[aria-pressed="true"] { background: #fff; color: var(--blue); font-weight: 600; }
.history-note { margin: -4px 0 12px; padding: 8px 14px; border-radius: 10px; background: var(--orange-soft); color: var(--orange-text); font-size: 13px; }
.data-body { padding: 4px 18px 18px; }
.data-empty { margin: 0; padding: 28px 0; text-align: center; color: var(--muted); font-size: 14px; }
.data-block h3 { margin: 16px 0 8px; font-size: 14px; font-weight: 600; color: var(--text); }
.data-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.data-table th { background: var(--page); color: var(--muted); font-weight: 500; }
.embed .viewer-top { display: none; }
.embed .sheet-head { top: 0; }
.notice { padding: 48px 24px; text-align: center; color: var(--muted); background: #fff; border-radius: var(--radius); }
.viewer-main .footer { max-width: none; }

.mobile-brand, .mobile-tabs, .sheet-mask { display: none; }
.scroll-hint { margin: 0; padding: 6px 12px; background: #eaf2ff; color: #2a5db0; font-size: 12px; }
.scroll-hint[hidden] { display: none; }

@media (max-width: 760px) {
  .shell-body { flex-direction: column; }
  .sidebar { display: none; }
  .workspace { flex: 1; min-height: 0; }
  .view-home { padding-top: 0; -webkit-overflow-scrolling: touch; }
  .mobile-brand { display: block; padding: 14px 0 12px; font-size: 22px; }
  .app-toolbar { height: 42px; padding: 0 6px 0 14px; }
  .app-actions a, .app-actions button { padding: 6px 8px; }

  .mobile-tabs { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tab-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 54px; border: 0; background: none; font: inherit; font-size: 11px; color: var(--muted); cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tab-link svg { width: 23px; height: 23px; }
  .tab-link[aria-current="page"], .tab-link.on { color: var(--blue); font-weight: 600; }

  .sheet-mask:not([hidden]) { display: flex; position: fixed; inset: 0; z-index: 20; align-items: flex-end; background: rgba(16, 20, 35, .45); }
  .nav-sheet { width: 100%; max-height: 75dvh; overflow-y: auto; background: #fff; border-radius: 16px 16px 0 0; padding: 6px 16px calc(18px + env(safe-area-inset-bottom)); }
  .nav-sheet-head { display: flex; align-items: center; justify-content: space-between; height: 48px; font-size: 16px; }
  .nav-sheet-head b { font-weight: 600; }
  .nav-sheet-head button { width: 40px; height: 40px; margin-right: -10px; border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; }
  .nav-sheet-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .sheet-link { display: flex; align-items: center; min-height: 48px; padding: 8px 14px; border-radius: 10px; background: var(--page); font-size: 15px; color: #33384a; }
  .sheet-link[aria-current="page"] { background: #eaf2ff; color: var(--blue); font-weight: 600; }

  /* 单数卡片时，最后一张占满一行，避免落单 */
  .products > :last-child:nth-child(odd), .val-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .section-title { margin: 24px 0 12px; font-size: 17px; }
  .product { padding: 14px; }
  .val-feature { padding: 16px 18px; }
  .footer { margin-top: 24px; padding-bottom: 20px; }

  /* 估值页 */
  .sheet-title { flex-direction: column; gap: 1px; }
  .sheet-head { padding: 9px 12px; }
  .sheet { border-radius: 10px; }
  .sheet-head { border-radius: 10px 10px 0 0; }
  .sheet-scroll { -webkit-overflow-scrolling: touch; border-radius: 0 0 10px 10px; }
  .embed .viewer-main { padding: 8px 8px 4px; }
  .embed .footer { margin-top: 16px; padding: 12px 4px 16px; }
  .to-top { width: 40px; height: 40px; right: 12px; bottom: 14px; }
}

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
  .products { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .val-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .topnav { display: none; }
}

@media (max-width: 560px) {
  .shell { padding: 0 16px; }
  .products, .val-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stars { flex: none; }
  .star-meta { font-size: 12px; }
  .val-main { grid-template-columns: 1fr; }
  .star-card, .live-card { padding: 20px; }
  .star-card { padding-bottom: 0; }
  .card-link { margin: 16px -20px 0; padding: 12px 20px; }
  .star-value { font-size: 40px; }
  .star-line { gap: 8px; flex-wrap: wrap; }
  .stars { font-size: 17px; }
  .remind { padding: 8px 14px; font-size: 13px; }
  .viewer-top .inner { gap: 12px; padding: 0 16px; }
  .viewer-top .brand, .home-link { display: none; }
  .viewer-main { padding: 12px 12px 4px; }
  .pages.columns { grid-template-columns: minmax(0, 408px); }
  .sheet-head { top: 58px; padding: 10px 12px; }
  .live-points { grid-template-columns: 1fr; }
  .to-top { right: 16px; bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
