:root {
  --mobile-preview-accent: #c5ff18;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: clip;
}

img,
video,
canvas,
svg {
  max-width: 100%;
}

.mobile-preview-launcher {
  position: fixed;
  z-index: 980;
  right: 18px;
  bottom: 68px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid rgba(197, 255, 24, .58);
  border-radius: 999px;
  color: var(--mobile-preview-accent);
  background: rgba(2, 8, 7, .88);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .42);
  backdrop-filter: blur(16px);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  cursor: pointer;
}

.mobile-preview-launcher::before {
  content: "";
  width: 10px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 3px;
  box-shadow: inset 0 -3px 0 rgba(197, 255, 24, .25);
}

.mobile-preview-shell {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 4, 3, .88);
  backdrop-filter: blur(22px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .24s ease, visibility .24s ease;
}

.mobile-preview-shell.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  max-width: calc(100vw - 36px);
  max-height: calc(100dvh - 36px);
}

.mobile-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 6px 7px 6px 14px;
  border: 1px solid rgba(197, 255, 24, .28);
  border-radius: 12px;
  color: #f4f8f5;
  background: rgba(3, 12, 9, .96);
}

.mobile-preview-toolbar strong {
  color: var(--mobile-preview-accent);
  font: 700 11px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .1em;
}

.mobile-preview-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mobile-preview-actions button {
  min-width: 38px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 7px;
  color: rgba(244, 248, 245, .76);
  background: rgba(255, 255, 255, .04);
  font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  cursor: pointer;
}

.mobile-preview-actions button:hover,
.mobile-preview-actions button.is-active {
  border-color: var(--mobile-preview-accent);
  color: #071008;
  background: var(--mobile-preview-accent);
}

.mobile-preview-device {
  position: relative;
  box-sizing: border-box;
  width: 375px;
  height: min(812px, calc(100dvh - 112px));
  max-width: calc(100vw - 36px);
  max-height: calc(100dvh - 112px);
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 34px;
  background: #111;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .7), 0 0 0 1px rgba(197, 255, 24, .1);
  transition: width .28s ease, height .28s ease;
}

.mobile-preview-device::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 14px;
  left: 50%;
  width: 72px;
  height: 18px;
  border-radius: 999px;
  background: #050505;
  transform: translateX(-50%);
  pointer-events: none;
}

.mobile-preview-device iframe {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 25px;
  background: #020807;
}

.mobile-preview-child .mobile-preview-launcher,
.mobile-preview-child .mobile-preview-shell {
  display: none !important;
}

/* Desktop device preview only: keep scrolling, hide the Windows iframe scrollbar. */
html.mobile-preview-child,
html.mobile-preview-child body {
  scrollbar-width: none;
  -ms-overflow-style: none;
  scrollbar-gutter: auto;
}

html.mobile-preview-child::-webkit-scrollbar,
html.mobile-preview-child body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

@media (max-width: 767px) {
  body {
    min-width: 0;
  }

  button,
  a,
  summary,
  input,
  [role="button"] {
    touch-action: manipulation;
  }

  button,
  a.cover-button,
  a.back-link {
    min-height: 44px;
  }

  .mobile-preview-launcher,
  .mobile-preview-shell {
    display: none !important;
  }

  .cover-primary-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .cover-button {
    min-width: min(100%, 150px);
  }

  .works-carousel-stage {
    max-width: 100%;
  }

  .works-carousel-editor,
  .portfolio-data-manager,
  .portfolio-save-status {
    max-width: calc(100vw - 20px);
  }

  .commerce-section,
  .workflow-section,
  .works-carousel-section,
  .resume-reference,
  .profile-layout-final {
    overflow-wrap: anywhere;
  }

  .commerce-feature-copy h3,
  .commerce-heading h2,
  .ai-commerce-copy h3 {
    text-wrap: balance;
  }

  /* 手机端使用独立节奏，不再沿用桌面端的大面积留白与横向预览墙。 */
  .nona-hero-scroll {
    height: 300svh;
  }

  .nona-hero-sticky {
    min-height: 100svh;
  }

  .nona-hero-intro-title {
    font-size: clamp(38px, 13vw, 56px);
    line-height: .9;
  }

  .cover-final-content {
    padding-top: 18px;
  }

  .cover-final-content .nona-hero-overlay-title {
    font-size: clamp(46px, 15vw, 64px);
    line-height: .84;
    letter-spacing: .025em;
  }

  .cover-final-content .nona-hero-overlay-text {
    max-width: 30rem;
    font-size: 13px;
    line-height: 1.65;
  }

  .cover-primary-actions {
    margin-top: 16px;
  }

  .experience-section,
  .experience-section-symmetric,
  .resume-poster,
  .resume-reference,
  .profile-layout-final {
    padding-inline: 16px;
  }

  .works-carousel-section {
    min-height: auto;
    padding: 64px 14px 72px;
  }

  .works-carousel-heading {
    padding-inline: 2px;
  }

  .works-carousel-heading h2 {
    font-size: clamp(32px, 9.5vw, 44px);
    line-height: .94;
  }

  .works-carousel-stage {
    height: min(650px, 79svh);
    min-height: 560px;
    margin-bottom: 74px;
    overflow: visible;
    border-radius: 16px;
  }

  .works-carousel-slider {
    overflow: hidden;
    border-radius: inherit;
  }

  .works-carousel-item:nth-child(n) {
    display: block !important;
    top: 0;
    right: auto;
    bottom: auto;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    filter: blur(5px);
    pointer-events: none;
    transform: translate3d(9%, 0, 0) scale(.985);
    transition:
      opacity .58s ease,
      filter .58s ease,
      transform .72s cubic-bezier(.2, .82, .2, 1);
  }

  .works-carousel-item:nth-child(1) {
    z-index: 1;
    transform: translate3d(-9%, 0, 0) scale(.985);
  }

  .works-carousel-item:nth-child(2) {
    z-index: 2;
    opacity: 1;
    filter: none;
    pointer-events: auto;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .works-carousel-stage.is-moving .works-carousel-item:nth-child(2) {
    animation: mobile-card-wave .72s cubic-bezier(.2, .82, .2, 1);
  }

  .works-carousel-content {
    top: 30px;
    left: 18px;
    width: calc(100% - 36px);
  }

  .works-carousel-content h3 {
    font-size: clamp(28px, 8.5vw, 38px);
    line-height: .98;
  }

  .works-carousel-content p {
    max-width: 31rem;
    font-size: 13px;
  }

  .works-carousel-nav {
    z-index: 20;
    right: auto;
    bottom: -62px;
    left: 50%;
    justify-content: center;
    width: 138px;
    padding: 7px;
    border: 1px solid rgba(197, 255, 24, .42);
    border-radius: 999px;
    background: rgba(2, 8, 7, .92);
    box-shadow: 0 14px 34px rgba(0, 0, 0, .38);
    transform: translateX(-50%);
  }

  .works-carousel-nav button {
    width: 48px;
    height: 42px;
    border-color: rgba(197, 255, 24, .68);
    color: #c5ff18;
    background: rgba(197, 255, 24, .06);
    font-size: 20px;
  }

  .works-carousel-nav button:active {
    color: #071008;
    background: #c5ff18;
  }

  .works-carousel-editor {
    display: none !important;
  }

  .workflow-section {
    width: calc(100% - 28px);
    padding-block: 64px 76px;
  }

  .workflow-heading h2 {
    font-size: clamp(36px, 11vw, 48px);
    line-height: 1;
  }

  .workflow-list {
    gap: 62px;
  }

  .workflow-image {
    aspect-ratio: 4 / 3;
  }

  .commerce-section {
    padding-block: 68px;
  }

  .commerce-heading h2,
  .ai-commerce-copy h3 {
    font-size: clamp(38px, 12vw, 54px);
    line-height: .98;
  }

  .commerce-feature {
    gap: 22px;
  }

  .commerce-feature-media,
  .image-slot--wide {
    min-height: 0;
    aspect-ratio: 4 / 3;
  }

  .commerce-feature-copy {
    padding-block: 8px 28px;
  }

  .commerce-supporting-grid {
    gap: 16px;
  }

  .ai-commerce-copy {
    min-height: 0;
    padding-block: 12px 28px;
  }

  .accordion-gallery {
    height: min(650px, 80svh);
    min-height: 560px;
  }
}

@keyframes mobile-card-wave {
  0% { transform: translate3d(7%, 0, 0) scale(.975); filter: blur(4px); }
  58% { transform: translate3d(-1.5%, 0, 0) scale(1.008); filter: blur(0); }
  100% { transform: translate3d(0, 0, 0) scale(1); filter: none; }
}

@media (max-width: 430px) {
  .cover-final-content {
    width: calc(100vw - 24px);
  }

  .cover-primary-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cover-button {
    width: 100%;
  }

  .portfolio-data-manager {
    display: none;
  }

  .portfolio-save-status {
    display: none;
  }

  .portfolio-data-manager summary {
    padding: 8px 11px;
    font-size: 9px;
  }

  /* 个人经历：手机端使用更轻松的标题、留白与照片比例。 */
  .resume-reference {
    padding: 54px 20px 76px;
  }

  .resume-reference-heading {
    padding-bottom: 18px;
  }

  .resume-reference-heading h2 {
    max-width: 10ch;
    font-size: clamp(34px, 10vw, 40px);
    line-height: .98;
    letter-spacing: -.035em;
  }

  .resume-reference-heading h2 span {
    margin-left: .06em;
    font-size: .72em;
  }

  .resume-reference-heading p {
    margin-top: 11px;
    font-size: 12px;
  }

  .resume-reference-profile {
    gap: 30px;
    margin-top: 24px;
  }

  .resume-reference-photo {
    width: 88%;
    max-width: 310px;
    margin-inline: auto;
  }

  .resume-reference-photo .experience-photo-button {
    aspect-ratio: 4 / 5;
    border-radius: 16px;
  }

  .resume-reference-about > h3 {
    margin-top: 12px;
    font-size: clamp(32px, 9.5vw, 40px);
    line-height: 1.04;
  }

  .resume-reference-intro {
    margin-top: 15px;
    font-size: 12.5px;
    line-height: 1.72;
  }

  .resume-reference-info {
    margin-top: 22px;
  }

  .resume-reference-directions,
  .resume-reference-tools {
    margin-top: 24px;
  }

  .resume-reference-career {
    margin-top: 52px;
  }

  .cover-marquee-group {
    gap: 10px;
    padding: 8px 6px;
    font-size: 8.5px;
    letter-spacing: .09em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-preview-shell,
  .mobile-preview-device {
    transition: none;
  }
}
/* Unified mobile type scale: denser headings, calmer body copy. */
@media (max-width: 767px) {
  body { font-size: 13px; line-height: 1.65; }
  .nona-hero-intro-title {
    font-size: clamp(34px, 10.8vw, 46px);
    line-height: .94;
    letter-spacing: .01em;
  }
  .cover-final-content .nona-hero-overlay-title {
    font-size: clamp(38px, 12vw, 50px);
    line-height: .9;
    letter-spacing: .015em;
  }
  .cover-final-content .nona-hero-overlay-text {
    font-size: 12.5px;
    line-height: 1.72;
  }
  .works-carousel-heading h2 {
    font-size: clamp(28px, 8.2vw, 36px);
    line-height: 1;
  }
  .works-carousel-content h3 {
    font-size: clamp(25px, 7.6vw, 32px);
    line-height: 1.02;
  }
  .works-carousel-content p {
    font-size: 12.5px;
    line-height: 1.68;
  }
  .workflow-heading h2 {
    font-size: clamp(30px, 9vw, 40px);
    line-height: 1.02;
  }
  .commerce-heading h2,
  .ai-commerce-copy h3 {
    font-size: clamp(32px, 9.6vw, 44px);
    line-height: 1;
  }
  .resume-reference-tools-grid {
    justify-items: stretch;
    column-gap: 20px;
  }
  .resume-reference-tools-grid article {
    justify-items: center;
    text-align: center;
  }
}

@media (max-width: 430px) {
  .resume-reference-heading h2 {
    font-size: clamp(30px, 8.8vw, 36px);
    line-height: 1.02;
  }
  .resume-reference-heading p { font-size: 11.5px; }
  .resume-reference-about > h3 {
    font-size: clamp(28px, 8.2vw, 34px);
    line-height: 1.06;
  }
  .resume-reference-intro {
    font-size: 12px;
    line-height: 1.72;
  }
}

