:root {
  --background: #17181a;
  --foreground: #fafafa;
  --primary: #f7f7f5;
  --primary-foreground: #141516;
  --accent: #303238;
  --border: #37393e;
  --input: #414349;
  --radius: 0.375rem;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, a, input { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid #ced8f0;
  outline-offset: 4px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: #dfdfdc; }
.btn-ghost { color: #d3d5da; }
.btn-ghost:hover { background: var(--accent); color: #fff; }
.btn-outline { border-color: var(--input); background: var(--background); color: var(--foreground); }
.btn-outline:hover { background: var(--accent); color: #fff; }

.portfolio-shell { max-width: 1920px; margin: 0 auto; padding: 0 3.25vw 1.25rem; }
.masthead {
  min-height: 102px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid #36383d;
}
.identity { display: flex; align-items: center; gap: 18px; }
.monogram {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #71747b;
  font-size: 15px;
  letter-spacing: -0.09em;
}
.identity h1 { font-size: 16px; letter-spacing: 0.095em; font-weight: 600; margin: 0 0 5px; }
.identity h1 span { font-size: 14px; margin-left: 12px; font-weight: 400; letter-spacing: 0.03em; color: #d0d2d7; }
.identity p { color: #a4a7ae; margin: 0; font-size: 13px; letter-spacing: 0.035em; }
.download-button { border-radius: 5px; min-height: 44px; padding: 0 20px; font-size: 14px; }
.file-size { font-size: 12px; margin-left: 6px; color: #5c6067; }

.reader-topline { display: flex; align-items: center; justify-content: space-between; min-height: 63px; gap: 12px; }
.reader-topline p { margin: 0; font-size: 13px; letter-spacing: 0.13em; color: #c2c5cb; }
.reader-topline p span { margin-left: 13px; letter-spacing: 0.05em; color: #a4a7ae; }
.zoom-button { font-size: 14px; color: #d3d5da; min-height: 40px; }

.page-stage {
  width: 100%;
  min-height: 180px;
  position: relative;
  background: #25272b;
  overflow: auto;
  border-radius: 2px;
}
.portfolio-page {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  background: #fff;
  object-fit: contain;
}
.page-stage.is-zoomed { max-height: calc(100dvh - 220px); }
.is-zoomed .portfolio-page { width: 3840px; max-width: none; }
.page-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  background: #25272b;
  color: #d8dbe2;
  font-size: 15px;
}
.page-message.error { flex-direction: column; }
.page-message[hidden] { display: none; }

.reader-footer {
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.keyboard-tip { color: #a4a7ae; font-size: 13px; }
.page-navigation { display: flex; align-items: center; width: auto; }
.page-navigation button { min-height: 44px; padding: 0 20px; font-size: 14px; }
.page-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 10px;
  color: #a4a7ae;
  white-space: nowrap;
  font-size: 14px;
}
.page-counter input {
  width: 44px;
  height: 36px;
  border: 1px solid #55585f;
  border-radius: 4px;
  background: #222428;
  text-align: center;
  color: #fff;
  font-size: 16px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.page-counter input::-webkit-inner-spin-button,
.page-counter input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.open-pdf { justify-self: end; font-size: 14px; color: #d4d6dc; padding: 12px 0; text-underline-offset: 5px; }
.open-pdf:hover { text-decoration: underline; }

@media (min-width: 1700px) {
  .page-stage:not(.is-zoomed) {
    width: min(100%, calc((100dvh - 254px) * 16 / 9));
    margin: auto;
  }
}
@media (max-width: 720px) {
  .portfolio-shell { padding: 0 16px 16px; }
  .masthead { min-height: 132px; flex-wrap: wrap; align-content: center; gap: 14px; padding: 18px 0; }
  .identity { gap: 12px; }
  .monogram { width: 38px; height: 38px; font-size: 13px; }
  .identity h1 { font-size: 14px; }
  .identity p { font-size: 12px; }
  .download-button { width: 100%; }
  .reader-topline { min-height: 58px; }
  .page-stage { min-height: 120px; }
  .reader-footer { grid-template-columns: 1fr auto; gap: 8px; padding-top: 8px; }
  .keyboard-tip { display: none; }
  .page-navigation { margin-left: 0; }
  .page-navigation button { padding: 0 10px; }
  .page-counter { margin: 0 4px; gap: 5px; }
  .open-pdf { font-size: 13px; }
  .page-stage.is-zoomed { max-height: 65dvh; }
}
@media (max-width: 380px) {
  .reader-footer { display: flex; flex-direction: column; }
  .page-navigation { margin: auto; }
  .open-pdf { padding: 0 12px 12px; }
}
