:root {
  --paper: #f7f4ec;
  --paper-2: #fffdf8;
  --ink: #111820;
  --red: #d20a16;
  --muted: #6d6a66;
  --shadow: 0 10px 18px rgba(24, 29, 34, .17);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #ece8de; }
button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(210, 10, 22, .35); outline-offset: 3px; }

.portfolio {
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.stage {
  position: relative;
  width: min(100vw, 56.25svh, 560px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 52% 54%, rgba(255,255,255,.72), transparent 38%),
    linear-gradient(120deg, #faf8f2 0%, var(--paper) 53%, #fbf9f3 100%);
}

.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .28;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
}

.ticket-grid { position: absolute; inset: 2.1% 3.5% auto; height: 32%; z-index: 6; }
.ticket {
  position: absolute;
  width: 30%;
  height: 42%;
  padding: 8% 8% 9%;
  border: 2px solid var(--ink);
  border-radius: 7px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  background: var(--paper-2);
  box-shadow: var(--shadow);
  transition: transform .26s cubic-bezier(.2,.8,.2,1), box-shadow .26s ease;
}
.ticket::before, .ticket::after {
  content: "";
  position: absolute;
  top: 42%;
  width: 12px;
  height: 18px;
  border: 2px solid var(--ink);
  background: var(--paper);
  border-radius: 50%;
}
.ticket::before { left: -8px; }
.ticket::after { right: -8px; }
.ticket-1 { left: 0; top: 5%; transform: rotate(-5deg); }
.ticket-2 { left: 35.5%; top: 0; transform: rotate(-2deg); }
.ticket-3 { right: 0; top: 5%; transform: rotate(4deg); }
.ticket-4 { left: 16.5%; bottom: 0; transform: rotate(-3deg); }
.ticket-5 { right: 15.5%; bottom: 0; transform: rotate(3deg); }
.ticket:is(:hover,:focus-visible,.is-active) { transform: rotate(-1deg) scale(1.08); z-index: 8; box-shadow: 0 16px 23px rgba(24,29,34,.22); }
.ticket-no { display: block; color: var(--red); font-size: clamp(1.42rem, 6.2vw, 2.35rem); line-height: .9; font-weight: 900; letter-spacing: -.04em; }
.ticket-cn { position: relative; z-index: 1; display: block; width: 100%; max-width: 100%; margin-top: 6%; overflow: visible; font-family: "PingFang SC", "Microsoft YaHei", sans-serif; font-size: clamp(.76rem, 3.15vw, 1.12rem); line-height: 1.14; font-weight: 900; letter-spacing: -.045em; white-space: nowrap; }
.ticket-en { position: relative; z-index: 1; display: block; width: 100%; margin-top: 8%; padding-right: 20%; overflow: visible; color: var(--muted); font-size: clamp(.4rem, 1.5vw, .58rem); line-height: 1; letter-spacing: -.02em; white-space: nowrap; }
.barcode { position: absolute; right: 7%; bottom: 10%; width: 18%; height: 10%; opacity: .58; background: repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 3px, var(--ink) 3px 5px, transparent 5px 7px); }

.character-wrap { position: absolute; inset: 30% 14% 0; z-index: 3; display: flex; justify-content: center; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity .22s ease; }
.stage.is-ready .character-wrap { opacity: 1; }
.character { display: block; height: 97%; max-width: 100%; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 15px 14px rgba(27,30,36,.12)); transition: opacity .15s ease, transform .28s cubic-bezier(.2,.8,.2,1); }
.character.is-changing { opacity: .18; transform: translateY(4px) scale(.992); }

.identity-mark { position: absolute; left: 4.5%; top: 58%; z-index: 2; width: 33%; font-family: "STXingkai", "FZKai-Z03", "KaiTi", cursive; transform: rotate(-1deg); }
.identity-mark strong { display: block; color: var(--red); font-size: clamp(2.8rem, 13vw, 5rem); line-height: .92; font-weight: 900; letter-spacing: -.08em; }
.identity-mark span { display: block; margin-top: 7%; color: var(--ink); font-size: clamp(1.32rem, 6.5vw, 2.45rem); font-weight: 800; line-height: 1.05; white-space: nowrap; }
.identity-mark i { display: block; width: 38%; height: 4px; margin-top: 16%; background: var(--red); border-radius: 999px; }

.motto { position: absolute; right: 4%; top: 52%; z-index: 2; width: 29%; margin: 0; transform: rotate(-5deg); font-family: "STXingkai", "FZKai-Z03", "KaiTi", cursive; }
.motto strong { display: inline-block; color: var(--red); font-size: clamp(.85rem, 3.8vw, 1.35rem); transform: rotate(2deg); }
.motto span { display: block; margin-top: 14%; color: var(--ink); font-size: clamp(1.45rem, 7.2vw, 2.7rem); line-height: 1.38; white-space: nowrap; }

.intro-layer { position: absolute; inset: 0; z-index: 10; pointer-events: none; opacity: 1; transition: opacity .16s ease; }
.intro-layer img { display: block; width: 100%; height: 100%; object-fit: cover; }
.intro-layer.is-finished { opacity: 0; }
.intro-layer.is-hidden { display: none; }

.utility { position: absolute; z-index: 12; min-width: 48px; min-height: 36px; padding: 8px 12px; border: 1.5px solid var(--ink); border-radius: 999px; color: var(--ink); background: rgba(255,253,248,.9); box-shadow: 0 5px 12px rgba(24,29,34,.1); cursor: pointer; font-size: .82rem; }
.utility-share { right: 3%; bottom: 2.3%; display: none; }
.stage.is-ready .utility-share { display: block; }

.toast { position: absolute; left: 50%; bottom: 8%; z-index: 14; opacity: 0; transform: translate(-50%, 8px); padding: 8px 13px; border-radius: 999px; color: #fff; background: rgba(17,24,32,.9); font-size: .78rem; pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.resume-dialog { width: min(92vw, 680px); max-height: 88svh; margin: auto; padding: 0; border: 0; background: transparent; overflow: visible; }
.resume-dialog::backdrop { background: rgba(17,24,32,.58); backdrop-filter: blur(5px); }
.dialog-card { position: relative; max-height: 86svh; overflow-x: hidden; overflow-y: auto; padding: clamp(25px,5vw,44px); border: 2px solid var(--ink); border-radius: 14px; color: var(--ink); background: var(--paper-2); box-shadow: 0 22px 48px rgba(0,0,0,.28); }
.dialog-card::before, .dialog-card::after { content:""; position:absolute; top:80px; width:24px; height:36px; border:2px solid var(--ink); border-radius:50%; background:#4b4f51; }
.dialog-card::before { left:-15px; }
.dialog-card::after { right:-15px; }
.dialog-close { position: sticky; float: right; top: 0; z-index: 2; width: 42px; height: 42px; border: 2px solid var(--ink); border-radius: 50%; color: var(--ink); background: var(--paper-2); cursor: pointer; font-size: 1.5rem; line-height: 1; }
.dialog-index { margin: 0 0 4px; color: var(--red); font-weight: 900; letter-spacing: .08em; }
.dialog-card h2 { margin: 0 48px 22px 0; font-size: clamp(1.8rem,5vw,2.7rem); line-height: 1; }
.dialog-body { font-size: 1rem; line-height: 1.78; }
.dialog-body section + section { margin-top: 25px; padding-top: 22px; border-top: 1px solid rgba(17,24,32,.18); }
.dialog-body h3 { margin: 0 0 5px; font-size: 1.12rem; }
.dialog-body time { display: block; margin-bottom: 8px; color: var(--red); font-size: .88rem; font-weight: 700; }
.dialog-body ul { margin: 8px 0 0; padding-left: 1.25rem; }
.dialog-body li + li { margin-top: 7px; }
.dialog-body .paper { padding-left: 15px; border-left: 3px solid var(--red); }
.internship-materials, .project-materials, .honor-materials, .photo-materials, .research-materials { padding-bottom: 4px; }
.research-links button:last-child { grid-column: 1 / -1; }
.material-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.material-links button { min-height: 45px; padding: 8px; border: 2px solid var(--ink); border-radius: 8px; color: var(--ink); background: var(--paper); cursor: pointer; font-weight: 800; line-height: 1.25; transition: color .16s ease, background-color .16s ease, transform .16s ease; }
.material-links button.is-selected { color: white; background: var(--ink); transform: translateY(-1px); }
.material-preview { min-height: 46px; padding: 12px; border: 1px dashed rgba(17,24,32,.35); border-radius: 8px; color: var(--muted); text-align: center; font-size: .9rem; }
.material-preview figure { margin: 0; }
.material-preview img { display: block; width: 100%; max-height: 58svh; object-fit: contain; margin: 0 auto; border-radius: 5px; background: #f1eee6; }
.material-preview figcaption { margin-top: 8px; color: var(--ink); font-weight: 700; }

.share-card { text-align: center; }
.share-card .dialog-index, .share-card h2 { text-align: left; }
.qr { display: block; width: min(68vw, 290px); aspect-ratio: 1; margin: 12px auto 22px; border: 10px solid white; background: white; }
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.share-actions button { min-height: 46px; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper-2); cursor: pointer; font-weight: 700; }
.share-actions button:first-child { color: white; background: var(--ink); }

@media (max-width: 420px) {
  .ticket { border-width: 1.5px; padding: 8% 8% 9%; }
  .ticket::before, .ticket::after { width: 9px; height: 14px; border-width: 1.5px; }
  .ticket::before { left: -6px; } .ticket::after { right: -6px; }
  .dialog-body { font-size: .96rem; }
  .ticket-no { font-size: clamp(1.35rem, 5.9vw, 2.05rem); }
  .ticket-cn { font-size: clamp(.74rem, 3.1vw, 1rem); }
  .ticket-en { font-size: clamp(.38rem, 1.42vw, .53rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .intro-layer { display: none; }
}
