:root {
  --green: #28bd8c;
  --text: #15181c;
  --muted: #9a9da3;
  --line: #edf0f2;
  --shadow: 0 5px 18px rgba(22, 39, 68, 0.12);
  --topbar-h: clamp(54px, 11.8vw, 70px);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: #fff;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
a {
  font: inherit;
}

button,
a {
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.page {
  position: relative;
  width: 100%;
  min-width: 320px;
  height: 100dvh;
  overflow: hidden;
  background: #fff;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--topbar-h);
  background: #fff;
  color: #111;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(16px, 3.75vw, 24px);
  line-height: 1;
  font-weight: 500;
}

.back-button {
  position: absolute;
  left: clamp(9px, 3.7vw, 22px);
  top: 50%;
  width: clamp(32px, 7.2vw, 44px);
  height: clamp(32px, 7.2vw, 44px);
  transform: translateY(-50%);
}

.back-button svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.content {
  height: calc(100dvh - var(--topbar-h));
  overflow-y: auto;
  padding: clamp(14px, 4.2vw, 26px) clamp(18px, 4.35vw, 34px) clamp(24px, 5.5vw, 42px);
  scrollbar-width: none;
}

.content::-webkit-scrollbar {
  display: none;
}

.internship-banner {
  display: block;
  width: 100%;
  height: clamp(93px, 20.7vw, 132px);
  overflow: hidden;
  border-radius: clamp(6px, 1.45vw, 10px);
  background: #d8d1ef;
}

.internship-banner img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collect-card {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: clamp(66px, 15.2vw, 94px);
  margin-top: clamp(16px, 3.5vw, 24px);
  padding: 0 clamp(28px, 6.3vw, 46px) 0 clamp(28px, 6.3vw, 46px);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: left;
}

.collect-card::after {
  content: "";
  position: absolute;
  left: 22%;
  bottom: -8px;
  width: 18px;
  height: 18px;
  background: #fff;
  transform: rotate(45deg);
  box-shadow: 5px 5px 12px rgba(22, 39, 68, 0.08);
}

.scan-icon {
  display: inline-grid;
  place-items: center;
  width: clamp(25px, 5.4vw, 36px);
  height: clamp(25px, 5.4vw, 36px);
  margin-right: clamp(14px, 3.1vw, 22px);
  color: #4d9bff;
}

.scan-icon svg,
.chevron {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.collect-card > span:nth-child(2) {
  flex: 1;
  font-size: clamp(17px, 3.9vw, 24px);
}

.chevron {
  width: clamp(22px, 5vw, 32px);
  height: clamp(22px, 5vw, 32px);
  color: #8f9499;
}

.student-card {
  position: relative;
  min-height: clamp(244px, 53vw, 344px);
  margin-top: clamp(26px, 5.6vw, 38px);
  padding: clamp(26px, 5.8vw, 40px) clamp(20px, 4.6vw, 34px) clamp(22px, 5vw, 36px);
  border-radius: clamp(7px, 1.45vw, 12px);
  background: linear-gradient(160deg, #28bd8c 0%, #33c895 100%);
  box-shadow: var(--shadow);
  color: #fff;
}

.photos {
  display: flex;
  gap: clamp(15px, 3.4vw, 24px);
}

.photo-button,
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: clamp(60px, 13.05vw, 84px);
  color: #fff;
}

.photo-button img,
.photo-placeholder > .avatar-shape {
  width: clamp(60px, 13.05vw, 84px);
  height: clamp(78px, 16.7vw, 110px);
  border-radius: 6px;
}

.photo-button img {
  display: block;
  object-fit: cover;
  object-position: center 32%;
  background: #e9f0f4;
}

.photo-button span,
.photo-placeholder span {
  margin-top: 7px;
  font-size: clamp(11px, 2.5vw, 16px);
  font-weight: 600;
  white-space: nowrap;
}

.photo-placeholder > .avatar-shape {
  position: relative;
  overflow: hidden;
  background: #f2f5f6;
}

.avatar-shape::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 24%;
  width: 40%;
  height: 31%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #d9dcdf;
}

.avatar-shape::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 15%;
  width: 68%;
  height: 38%;
  transform: translateX(-50%);
  border-radius: 50% 50% 12px 12px;
  background: #d9dcdf;
}

.summary {
  position: absolute;
  left: clamp(170px, 38vw, 260px);
  top: clamp(36px, 7.9vw, 54px);
  color: #fff;
}

.summary h2 {
  margin: 0;
  font-size: clamp(23px, 5vw, 34px);
  line-height: 1.2;
  font-weight: 600;
}

.summary p {
  display: flex;
  gap: clamp(16px, 3.6vw, 24px);
  margin: clamp(7px, 1.5vw, 10px) 0 0;
  font-size: clamp(15px, 3.35vw, 22px);
  line-height: 1.3;
  font-weight: 600;
}

.level-pill {
  position: absolute;
  right: clamp(20px, 4.6vw, 34px);
  top: clamp(155px, 34vw, 220px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(50px, 10.8vw, 72px);
  height: clamp(31px, 6.5vw, 45px);
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(0, 130, 96, 0.33);
  color: #fff;
  font-size: clamp(14px, 3.15vw, 20px);
  white-space: nowrap;
}

.school-line {
  margin-top: clamp(30px, 6.9vw, 48px);
  color: #fff;
  font-size: clamp(25px, 5.4vw, 36px);
  line-height: 1.25;
  font-weight: 500;
}

.major-line {
  display: flex;
  gap: clamp(12px, 2.8vw, 18px);
  margin-top: clamp(14px, 3.2vw, 22px);
  color: #fff;
  font-size: clamp(18px, 4vw, 27px);
  line-height: 1.35;
  font-weight: 600;
}

.detail-list {
  padding: clamp(24px, 5.4vw, 40px) 0 clamp(18px, 4vw, 32px);
}

.detail-row {
  display: grid;
  grid-template-columns: minmax(98px, 38%) 1fr;
  align-items: baseline;
  min-height: clamp(37px, 8.05vw, 54px);
  color: var(--text);
  font-size: clamp(16px, 3.55vw, 23px);
  line-height: 1.35;
}

.detail-row span {
  color: #9a9da3;
  text-align: right;
  padding-right: clamp(22px, 5vw, 34px);
}

.detail-row strong {
  color: #1e242b;
  font-weight: 400;
}

.report-button {
  display: block;
  width: 100%;
  height: clamp(58px, 12.4vw, 82px);
  margin-top: clamp(10px, 2.2vw, 16px);
  background: var(--green);
  color: #fff;
  font-size: clamp(19px, 4.15vw, 28px);
  line-height: clamp(58px, 12.4vw, 82px);
  text-align: center;
}

.editor-mask {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 14px;
  background: rgba(0, 0, 0, 0.34);
}

.editor-mask[hidden],
.qr-mask[hidden] {
  display: none;
}

.editor {
  width: min(100%, 620px);
  max-height: min(82dvh, 760px);
  overflow-y: auto;
  padding: 20px 18px 16px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.editor h2 {
  margin: 0 0 14px;
  font-size: 21px;
  font-weight: 600;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px 10px;
}

.editor label span {
  display: block;
  margin-bottom: 6px;
  color: #60656b;
  font-size: 13px;
}

.editor input {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #dfe4e8;
  border-radius: 7px;
  color: #222;
  outline: none;
}

.editor input:focus {
  border-color: var(--green);
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.cancel-button,
.save-button {
  min-width: 76px;
  height: 38px;
  border-radius: 19px;
  font-size: 15px;
}

.cancel-button {
  background: #f1f3f5;
  color: #555b61;
}

.save-button {
  background: var(--green);
  color: #fff;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  max-width: calc(100% - 48px);
  transform: translate(-50%, 10px);
  padding: 9px 14px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 13px;
  line-height: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.qr-mask {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: clamp(22px, 6vw, 42px);
  background: rgba(0, 0, 0, 0.68);
}

.qr-dialog {
  position: relative;
  width: min(100%, 760px);
  max-height: calc(100dvh - 72px);
  overflow-y: auto;
  padding: clamp(34px, 7vw, 54px) clamp(30px, 7vw, 58px) clamp(28px, 6vw, 46px);
  border-radius: clamp(10px, 2.4vw, 16px);
  background: #fff;
  color: #222;
  text-align: center;
}

.qr-close {
  position: absolute;
  top: clamp(16px, 3.5vw, 28px);
  right: clamp(18px, 4vw, 32px);
  width: 42px;
  height: 42px;
  color: #d6d6d6;
  font-size: 48px;
  line-height: 36px;
  font-weight: 200;
}

.qr-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: clamp(26px, 5.8vw, 42px);
  color: #151515;
}

.chsi-logo {
  display: block;
  width: clamp(30px, 6.9vw, 48px);
  height: clamp(35px, 8vw, 55px);
  margin-right: 8px;
  object-fit: contain;
}

.chsi-text {
  margin-right: clamp(12px, 2.8vw, 20px);
  color: #383838;
  font-size: clamp(22px, 5.3vw, 36px);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.qr-title strong {
  font-size: clamp(36px, 8.7vw, 62px);
  line-height: 1;
  font-weight: 800;
}

.qr-info {
  width: min(100%, 520px);
  margin: 0 auto clamp(24px, 5.8vw, 42px);
}

.qr-info div {
  display: grid;
  grid-template-columns: minmax(104px, 36%) 1fr;
  align-items: center;
  min-height: clamp(50px, 11vw, 74px);
}

.qr-info dt {
  color: #aeb2b8;
  font-size: clamp(20px, 4.8vw, 32px);
  line-height: 1.25;
  text-align: left;
}

.qr-info dd {
  margin: 0;
  color: #242424;
  font-size: clamp(20px, 4.8vw, 32px);
  line-height: 1.25;
  text-align: left;
  word-break: break-all;
}

.qr-frame {
  width: min(100%, 548px);
  margin: 0 auto clamp(24px, 5.8vw, 42px);
  padding: clamp(12px, 2.8vw, 20px);
  border: clamp(3px, 0.75vw, 5px) solid #28b98d;
  background: #fff;
}

#collection-qr {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  background: #fff;
}

.qr-note {
  width: min(100%, 560px);
  margin: 0 auto clamp(28px, 6.2vw, 44px);
  color: #b0b0b0;
  font-size: clamp(20px, 4.7vw, 32px);
  line-height: 1.55;
}

.qr-save-tip {
  color: #28b98d;
  font-size: clamp(24px, 5.8vw, 40px);
  line-height: 1.2;
  font-weight: 700;
}

@media (max-width: 420px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .summary {
    left: 168px;
  }

  .detail-row {
    grid-template-columns: 118px 1fr;
  }
}

/* Mobile layout follows the saved reference (10rem viewport). */
@media (max-width: 767px) {
  .page {
    --mobile-unit: 10vw;
    --topbar-h: calc(var(--mobile-unit) * 1.173);
  }

  .topbar h1 {
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
  }

  .back-button {
    left: 16px;
    width: 18px;
    height: 24px;
  }

  .content {
    padding: calc(var(--mobile-unit) * .32) calc(var(--mobile-unit) * .427)
      max(24px, env(safe-area-inset-bottom));
  }

  .internship-banner {
    height: calc(var(--mobile-unit) * 2.133);
    border-radius: calc(var(--mobile-unit) * .16);
  }

  .collect-card {
    height: calc(var(--mobile-unit) * 1.227);
    margin-top: calc(var(--mobile-unit) * .32);
    padding: 0 calc(var(--mobile-unit) * .533);
  }

  .scan-icon {
    width: calc(var(--mobile-unit) * .533);
    height: calc(var(--mobile-unit) * .533);
    margin-right: calc(var(--mobile-unit) * .32);
  }

  .collect-card > span:nth-child(2) {
    font-size: calc(var(--mobile-unit) * .373);
  }

  .chevron {
    width: 18px;
    height: 18px;
  }

  .student-card {
    display: grid;
    grid-template-columns: 37.5% minmax(0, 1fr) auto;
    align-items: start;
    min-height: 0;
    margin-top: calc(var(--mobile-unit) * .267);
    padding: calc(var(--mobile-unit) * .533) calc(var(--mobile-unit) * .427);
    border-radius: calc(var(--mobile-unit) * .16);
    background: linear-gradient(180deg, #1faf7f, #3fcb92);
    box-shadow: 0 calc(var(--mobile-unit) * .107) calc(var(--mobile-unit) * .213) rgba(63, 203, 146, .4);
  }

  .photos {
    grid-column: 1;
    gap: 0;
    width: 100%;
  }

  .photo-button,
  .photo-placeholder {
    width: 50%;
    align-items: flex-start;
  }

  .photo-button img,
  .photo-placeholder > .avatar-shape {
    width: 77.17%;
    height: auto;
    aspect-ratio: 3 / 4;
    border: 1px solid #c0e8db;
    border-radius: calc(var(--mobile-unit) * .107);
  }

  .photo-button span,
  .photo-placeholder span {
    width: 85.74%;
    margin-top: 3px;
    font-size: calc(var(--mobile-unit) * .267);
    line-height: 1.5;
    font-weight: 400;
    text-align: center;
    transform: scale(.9);
    transform-origin: 0 0;
  }

  .summary {
    position: static;
    grid-column: 2 / 4;
    min-width: 0;
    padding-top: calc(var(--mobile-unit) * .133);
  }

  .summary h2 {
    font-size: calc(var(--mobile-unit) * .427);
    line-height: 1.5;
    font-weight: 700;
  }

  .summary p {
    flex-wrap: wrap;
    gap: 0 calc(var(--mobile-unit) * .32);
    margin-top: 1px;
    font-size: calc(var(--mobile-unit) * .32);
    line-height: 1.5;
    font-weight: 400;
  }

  .school-line {
    grid-column: 1 / 3;
    grid-row: 2;
    min-width: 0;
    margin-top: calc(var(--mobile-unit) * .48);
    padding-right: calc(var(--mobile-unit) * .267);
    font-size: calc(var(--mobile-unit) * .48);
    line-height: calc(var(--mobile-unit) * .667);
    overflow-wrap: anywhere;
  }

  .level-pill {
    position: static;
    grid-column: 3;
    grid-row: 2;
    min-width: 0;
    height: calc(var(--mobile-unit) * .533);
    margin-top: calc(var(--mobile-unit) * .587);
    padding: 0 calc(var(--mobile-unit) * .213);
    border-radius: calc(var(--mobile-unit) * .267);
    background: #1da36e;
    font-size: calc(var(--mobile-unit) * .32);
    line-height: calc(var(--mobile-unit) * .533);
  }

  .major-line {
    display: block;
    grid-column: 1 / -1;
    margin-top: calc(var(--mobile-unit) * .24);
    font-size: calc(var(--mobile-unit) * .347);
    line-height: calc(var(--mobile-unit) * .48);
    font-weight: 400;
    overflow-wrap: anywhere;
  }

  .major-line > span:nth-child(2) {
    margin: 0 1em;
  }

  .detail-list {
    margin: calc(var(--mobile-unit) * .533) 0;
    padding: 0;
  }

  .detail-row {
    grid-template-columns: 37.5% minmax(0, 1fr);
    align-items: start;
    min-height: 0;
    padding: calc(var(--mobile-unit) * .187) 0;
    font-size: calc(var(--mobile-unit) * .373);
    line-height: calc(var(--mobile-unit) * .533);
    overflow-wrap: anywhere;
  }

  .detail-row span {
    padding-right: 0;
    color: #999;
  }

  .detail-row strong {
    min-width: 0;
    padding-left: calc(var(--mobile-unit) * .533);
    color: #333;
  }

  .report-button {
    height: calc(var(--mobile-unit) * 1.227);
    margin-top: 0;
    background: #26b887;
    font-size: calc(var(--mobile-unit) * .427);
    line-height: calc(var(--mobile-unit) * 1.227);
  }
}
