html {
  /* 设计画布: 1440 × 900；1rem 在该尺寸下 = 16px = Tailwind 默认 */
  /* 90 = 1440/16, 56.25 = 900/16 */
  font-size: clamp(8px, min(100vw / 90, 100vh / 56.25), 32px);
}
html, body {
  background: #000000;
  color: #E6E6FA;
  margin: 0;
  padding: 0;
}
/* Pixel-art mouse cursor (cream arrow with black outline) — applies everywhere */
body, body * {
  cursor: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 12 12' shape-rendering='crispEdges'><polygon points='1,1 1,10 4,7 6,11 7,11 5,7 9,7' fill='%23E6E6FA' stroke='black' stroke-width='1' stroke-linejoin='miter'/></svg>") 2 2, auto !important;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
.blink {
  animation: blink 1s steps(1) infinite;
}
.no-select {
  user-select: none;
  -webkit-user-select: none;
}
/* L-shaped crop marks for images viewer */
.crop-mark {
  position: absolute;
  width: 1rem;
  height: 1rem;
  border-color: #E6E6FA;
  border-style: solid;
}
.crop-mark-tl { top: 0.5rem; left: 0.5rem; border-width: 2px 0 0 2px; }
.crop-mark-tr { top: 0.5rem; right: 0.5rem; border-width: 2px 2px 0 0; }
.crop-mark-bl { bottom: 0.5rem; left: 0.5rem; border-width: 0 0 2px 2px; }
.crop-mark-br { bottom: 0.5rem; right: 0.5rem; border-width: 0 2px 2px 0; }
/* Desktop corner brackets */
.corner-bracket {
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border-color: #E6E6FA;
  border-style: solid;
  pointer-events: none;
}
/* Re-enable clicks on icon buttons whose parent column is pointer-events-none.
   The column container is now pointer-events-none so empty gaps don't block Lucky. */
.desktop-icon { pointer-events: auto; }
/* Click feedback on Lucky: a pixel-art paw print expands & fades out. */
#bg-lucky .lucky-pulse {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-origin: center;
  animation: lucky-pulse 0.5s steps(6, end) forwards;
}
#bg-lucky .lucky-pulse svg {
  width: 100%;
  height: 100%;
  display: block;
}
@keyframes lucky-pulse {
  0%   { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(1.7); opacity: 0; }
}
.corner-tl { top: 0; left: 0; border-width: 2px 0 0 2px; }
.corner-tr { top: 0; right: 0; border-width: 2px 2px 0 0; }
.corner-bl { bottom: 0; left: 0; border-width: 0 0 2px 2px; }
.corner-br { bottom: 0; right: 0; border-width: 0 2px 2px 0; }
/* Markdown typography inside .content windows (direct children only, so
   JS-rendered headings inside the Chrome shell #pf-view are not affected) */
.content > h1 { font-size: 1.15rem; font-weight: 700; margin: 0 0 0.6rem; line-height: 1.3; }
.content > h2 { font-size: 1rem;    font-weight: 700; margin: 1rem 0 0.4rem; line-height: 1.3; }
.content > h3 { font-size: 0.85rem; font-weight: 700; margin: 0.75rem 0 0.3rem; line-height: 1.3; }
.content > h4 { font-size: 0.78rem; font-weight: 700; margin: 0.6rem 0 0.25rem; }
.content > p  { margin: 0 0 0.5rem; }
.content > ul,
.content > ol { margin: 0.25rem 0 0.6rem; padding-left: 1.1rem; }
.content > ul { list-style: square; }
.content > ol { list-style: decimal; }
.content > ul li,
.content > ol li { margin: 0.15rem 0; }
.content > hr { border: 0; border-top: 1px solid #fffcda; opacity: 0.4; margin: 0.8rem 0; }
.content > blockquote { border-left: 2px solid #fffcda; padding-left: 0.6rem; opacity: 0.85; margin: 0.5rem 0; }
.content strong { font-weight: 700; }
/* CONTACT_ME — 联系方式卡片（base64 防爬，点击显示/复制） */
.contact-card p { margin: 0 0 0.6rem; line-height: 1.6; }
.contact-card .contact-hint { font-size: 0.6875rem; opacity: 0.7; }
.contact-reveal {
  border: 2px solid #fffcda;
  background: #000;
  color: #fffcda;
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  cursor: pointer;
}
.contact-reveal:hover { background: #fffcda; color: #000; }
.contact-reveal.hidden { display: none; }
.contact-list { list-style: none; margin: 0.4rem 0 0; padding: 0; }
.contact-list.hidden { display: none; }
.contact-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 252, 218, 0.2);
}
.contact-label {
  width: 4rem;
  flex-shrink: 0;
  opacity: 0.6;
  font-size: 0.6875rem;
  text-transform: uppercase;
}
.contact-value {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  user-select: text;
  -webkit-user-select: text;
}
.contact-copy {
  flex-shrink: 0;
  border: 1px solid #fffcda;
  background: #000;
  color: #fffcda;
  font-size: 0.625rem;
  padding: 0.2em 0.6em;
  cursor: pointer;
}
.contact-copy:hover { background: #fffcda; color: #000; }
/* MY_PET — 来喜的微信入口 */
.pet-wechat-entry-wrap {
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid rgba(255, 252, 218, 0.25);
}
.pet-wechat-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 2px solid #fffcda;
  background: #000;
  color: #fffcda;
  cursor: pointer;
  width: 6.5rem;
}
.pet-wechat-entry:hover {
  background: #fffcda;
  color: #000;
}
.pet-wechat-label { font-size: 0.6875rem; }
.pet-moments-back {
  font-size: 0.6875rem;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  color: #fffcda;
  padding: 0;
}
.pet-moments-back:hover {
  background: #fffcda;
  color: #000;
}
.pet-view-moments.hidden { display: none !important; }
/* 微信朋友圈时间线 */
.moments { padding-bottom: 1rem; }
.moments-year {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 1.2rem 0 0.6rem;
  color: #fffcda;
}
.moments-year:first-child { margin-top: 0; }
.moment {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}
.moment-date {
  flex-shrink: 0;
  width: 3rem;
  text-align: left;
  line-height: 1.2;
}
.moment-day {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fffcda;
}
.moment-month {
  display: block;
  font-size: 0.625rem;
  opacity: 0.75;
}
.moment-body { flex: 1; min-width: 0; }
.moment-text {
  margin: 0 0 0.5rem;
  line-height: 1.6;
  white-space: pre-line;
  opacity: 0.92;
}
.moment-grid {
  display: grid;
  gap: 2px;
  max-width: 12rem;
  position: relative;
}
.moment-grid-1 { grid-template-columns: 1fr; }
.moment-grid-2 { grid-template-columns: repeat(2, 1fr); }
.moment-grid-3 { grid-template-columns: repeat(3, 1fr); }
.moment-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  border: 1px solid rgba(255, 252, 218, 0.35);
  cursor: pointer;
}
.moment-img:hover { outline: 2px solid #fffcda; outline-offset: -2px; }
.moment-count {
  display: block;
  font-size: 0.625rem;
  opacity: 0.55;
  margin-top: 0.25rem;
}
.moments-empty { font-style: italic; }
/* 朋友圈大图 lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.lightbox.hidden { display: none !important; }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border: 2px solid #fffcda;
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: 2px solid #fffcda;
  background: #000;
  color: #fffcda;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover {
  background: #fffcda;
  color: #000;
}
/* Hide scrollbar inside windows but allow scroll if needed */
.content::-webkit-scrollbar,
#pf-view::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-track,
#pf-view::-webkit-scrollbar-track { background: #000; }
.content::-webkit-scrollbar-thumb,
#pf-view::-webkit-scrollbar-thumb { background: #E6E6FA; border: 1px solid #000; }
/* Portfolio Chrome shell */
.pf-toolbar-btn {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid #fffcda;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  line-height: 1;
  flex-shrink: 0;
  background: #000;
  color: #fffcda;
}
.pf-toolbar-btn:hover:not(:disabled) {
  background: #fffcda;
  color: #000;
}
.pf-toolbar-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed !important;
}
.pf-omnibox {
  border: 2px solid #fffcda;
  font-size: 0.6875rem;
  background: #000;
  color: #fffcda;
}
.pf-bookmark {
  padding: 0.25rem 0.75rem;
  font-size: 0.6875rem;
  border-right: 2px solid #fffcda;
  white-space: nowrap;
  flex-shrink: 0;
  background: #000;
  color: #fffcda;
}
.pf-bookmark:hover {
  background: #fffcda;
  color: #000;
}
.pf-bookmark.is-active {
  background: #fffcda;
  color: #000;
}
.pf-bookmark-add {
  opacity: 0.45;
  cursor: default !important;
}
.pf-result {
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255, 252, 218, 0.2);
  cursor: pointer;
  text-align: left;
  width: 100%;
  background: transparent;
  color: inherit;
  border-left: none;
  border-right: none;
  border-top: none;
}
.pf-result:last-child {
  border-bottom: none;
}
.pf-result:hover .pf-result-title {
  text-decoration: underline;
  background: #fffcda;
  color: #000;
  display: inline;
}
.pf-result-preview {
  position: relative;
  width: 9rem;
  height: 6rem;
  flex-shrink: 0;
  border: 2px solid #fffcda;
  overflow: hidden;
  background: #000;
}
.pf-result-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pf-result-url {
  color: rgba(255, 252, 218, 0.55);
  font-size: 0.625rem;
  margin-bottom: 0.25rem;
}
.pf-result-title {
  font-size: 1rem;
  font-weight: bold;
  margin-bottom: 0.35rem;
  color: #fffcda;
}
.pf-detail-back {
  margin-bottom: 1rem;
  font-size: 0.6875rem;
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  color: #fffcda;
  padding: 0;
}
.pf-detail-back:hover {
  background: #fffcda;
  color: #000;
}
.pf-open-link {
  font-size: 0.6875rem;
  text-decoration: underline;
  color: #fffcda;
}
.pf-open-link:hover {
  background: #fffcda;
  color: #000;
}
.pf-code-block {
  background: #000;
  border: 2px solid #fffcda;
  padding: 8px 10px;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
  max-height: 60vh;
  color: #fffcda;
}
.pf-code-block code {
  display: block;
}
/* 文章头部（返回 / 标题 / 副标题）与正文同宽居中对齐 */
.pf-article-head {
  max-width: 42rem;
  margin: 0 auto;
}
.pf-article {
  max-width: 42rem;
  margin: 0 auto;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9375rem;
  line-height: 1.8;
  color: #fffcda;
}
/* 文章正文允许鼠标拖选文字（其余 UI 仍保持不可选） */
.pf-article,
.pf-article * {
  user-select: text;
  -webkit-user-select: text;
}
.pf-article ::selection {
  background: #fffcda;
  color: #000;
}
.pf-article > :first-child { margin-top: 0; }
.pf-article h2 {
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 1.1rem;
  font-weight: 700;
  margin: 1.4em 0 0.5em;
  border-bottom: 1px solid rgba(255, 252, 218, 0.25);
  padding-bottom: 0.2em;
}
.pf-article h3 {
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.1em 0 0.4em;
}
.pf-article p { margin: 0.7em 0; }
.pf-article a {
  color: #fffcda;
  text-decoration: underline;
}
.pf-article ul,
.pf-article ol {
  margin: 0.6em 0;
  padding-left: 1.3em;
}
.pf-article li { margin: 0.25em 0; }
.pf-article ul { list-style: square; }
.pf-article img,
.pf-article .pf-article-video {
  display: block;
  width: min(100%, 56rem);
  max-width: calc(100vw - 5rem);
  margin: 1em 0;
  border: 2px solid #fffcda;
}
.pf-article code {
  background: rgba(255, 252, 218, 0.12);
  padding: 0.1em 0.35em;
  font-family: ui-monospace, "Cascadia Mono", "Consolas", monospace;
}
.pf-article pre {
  position: relative;
  background: #000;
  border: 2px solid #fffcda;
  padding: 8px 10px;
  overflow: auto;
  margin: 1em 0;
}
.pf-article pre code {
  background: none;
  padding: 0;
  display: block;
  font-size: 11px;
  line-height: 1.55;
}
.pf-copy-code {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 1px solid #fffcda;
  background: #000;
  color: #fffcda;
  font-size: 0.625rem;
  line-height: 1;
  padding: 0.25em 0.5em;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.pf-article pre:hover .pf-copy-code,
.pf-copy-code:hover {
  opacity: 1;
}
.pf-copy-code:hover {
  background: #fffcda;
  color: #000;
}
.pf-article blockquote {
  border-left: 3px solid rgba(255, 252, 218, 0.4);
  margin: 1em 0;
  padding-left: 0.8em;
  opacity: 0.8;
}
.pf-site-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pf-site-frame {
  border: 2px solid #fffcda;
  background: #000;
  width: 100%;
  flex: 1;
  min-height: 24rem;
  display: block;
}
#pf-view.pf-view-site-mode {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.window[data-fixed-layout="true"] .title-bar {
  cursor: default;
}
/* 拖动窗口时，标题栏不触发页面滚动/手势 */
.window:not([data-fixed-layout="true"]) .title-bar {
  touch-action: none;
}

/* ===== 移动端 / 窄屏适配 =====
   桌面那套「1440×900 画布等比缩放」在窄屏会把根字号压到 8px，几乎没法读，
   且左右图标+视频强制横排会挤成一团、窗口固定宽度会溢出。
   这里在窄屏改成：可读字号 + 竖排可滚动布局 + 窗口近全屏。 */
@media (max-width: 768px) {
  html {
    font-size: clamp(13px, 4vw, 17px);
  }
  /* 用 dvh 规避移动端地址栏导致的 100vh 溢出 */
  body { height: 100dvh; }
  #desktop { height: calc(100dvh - 2.5rem) !important; }

  #status-bar { padding-left: 0.75rem; padding-right: 0.75rem; }
  #status-date, #status-time { width: 4.5rem; }
  #status-bar .deco-bars { display: none; }
  #status-bar .flex-1 { white-space: nowrap; }

  /* 竖排：上排 3 图标 / 视频 / 下排 3 图标，整体可纵向滚动 */
  #desktop-layout {
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem 0.75rem 4.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
  }
  #center-video-frame {
    order: 1;
    flex: none;
    width: 100%;
    max-width: none;
    max-height: none;
  }
  .icon-col {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    gap: 0.75rem;
  }
  .icon-col-left { order: 0; }
  .icon-col-right { order: 2; }
  .desktop-icon { width: 5.5rem; padding: 0.4rem; }
  .desktop-icon svg { width: 3rem; height: 3rem; }

  /* 背景小狗缩小，减少在窄屏遮挡内容 */
  #bg-lucky { width: 3.5rem !important; height: 3.5rem !important; }

  /* 浮动横幅：缩小并限制宽度，避免横向溢出 */
  .floating-banner {
    bottom: 0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    max-width: calc(100vw - 1.5rem);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* 移动端：弹窗全屏（铺满状态栏以下区域，无边距） */
  .window {
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
  }

  /* 浏览器型结果项：缩小预览图，给标题/摘要更多空间 */
  .pf-result { gap: 0.6rem; padding: 0.75rem 0; }
  .pf-result-preview { width: 6rem; height: 4rem; }
  .pf-result-title { font-size: 0.85rem; }

  /* 文章/站点 iframe 在窄屏降低最小高度 */
  .pf-site-frame { min-height: 16rem; }
}
