/* ============================================================
   Gemini Pass — 学生认证
   Mobile-first. 480px shell, ticket layout.
   ============================================================ */

@font-face {
  font-family: "Pass Display";
  src: url("assets/heading.ttf") format("truetype");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}
@font-face {
  font-family: "Pass Italic";
  src: url("assets/gemini-lettering.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --bg: #f7f7f2;
  --cream: #faf0db;
  --cream-2: #f4ead6;
  --blue: #2448c7;
  --blue-deep: #1a37a8;
  --orange: #f67c39;
  --ink: #21221e;
  --ink-2: #21221e;
  --muted: #62655d;
  --line: #d6d7cd;
  --green: #12a412;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 0 0 40px;
}

.shell {
  width: 100%;
  max-width: 480px;
  padding: 0 12px;
}

/* ---------------- nav ---------------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 4px 14px;
}

.brand { display: flex; align-items: center; gap: 8px; }
.spark { width: 26px; height: 26px; flex: 0 0 auto; display: block; }

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: var(--ink);
}
.brand-name em {
  font-style: normal;
  color: var(--blue);
}

.nav-actions { display: flex; align-items: center; gap: 6px; }

.ic {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: none; border: 0; padding: 0;
  color: var(--ink);
  cursor: pointer;
  border-radius: 50%;
}
.ic svg { width: 19px; height: 19px; }
.ic.round { border: 1.4px solid #dcdcd6; }

.login {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 14px 0 11px;
  margin-left: 4px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.login svg { width: 16px; height: 16px; }

/* ---------------- notice ---------------- */

.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 9px;
  background: #faf4e6;
  margin-bottom: 14px;
}
.notice .nstar { width: 13px; height: 13px; flex: 0 0 auto; }
.notice p {
  flex: 1;
  margin: 0;
  font-size: 12.5px;
  color: #6d6455;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notice .nchev { width: 14px; height: 14px; flex: 0 0 auto; }

/* ---------------- ticket ---------------- */

.ticket {
  position: relative;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 2px 14px rgba(60, 50, 30, .07);
}

/* --- top: cream --- */

.tk-top {
  position: relative;
  display: flex;
  background-color: var(--cream);
  background-image: url("assets/paper.png");
  background-size: 100px 100px;
  background-blend-mode: multiply;
  border-radius: 22px 22px 0 0;
  padding: 26px 0 30px 22px;
  min-height: 292px;
  overflow: hidden;
}

.hero { position: relative; z-index: 3; flex: 1; min-width: 0; }

.script {
  font-family: "Pass Italic", "Snell Roundhand", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 52px;
  line-height: .98;
  letter-spacing: -.5px;
  color: var(--ink-2);
  margin-left: 2px;
}

.cn {
  position: relative;
  margin: 2px 0 0;
  font-family: "Pass Display", "PingFang SC", var(--sans);
  font-size: 42px;
  font-weight: 900;
  line-height: 1.02;
  letter-spacing: -.5px;
  color: var(--blue);
}
.cn .dot { color: var(--orange); -webkit-text-stroke: 0; }

.scribble {
  display: block;
  width: 176px;
  height: 14px;
  margin: 4px 0 0 1px;
  overflow: visible;
}

.sub {
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: #4d4a42;
}

/* --- art --- */

.art {
  position: absolute;
  right: 30px;
  top: 12px;
  width: 176px;
  height: 264px;
  z-index: 2;
  pointer-events: none;
}

.ring {
  position: absolute;
  left: -14px;
  top: 20px;
  width: 172px;
  height: 216px;
  opacity: .85;
}

.bag {
  position: absolute;
  right: -12px;
  top: 14px;
  width: 196px;
  height: auto;
  filter: drop-shadow(0 8px 14px rgba(20, 30, 100, .16));
}

.idtag {
  position: absolute;
  right: 52px;
  top: 94px;
  width: 42px;
  height: auto;
  transform: rotate(-6deg);
  filter: drop-shadow(0 3px 5px rgba(20, 30, 100, .2));
}

.sp { position: absolute; }
.sp-orange { left: -4px; top: 34px; width: 24px; height: 24px; }
.sp-blue   { right: 16px; top: 4px;  width: 20px; height: 20px; }
.sp-green  { right: 2px; bottom: 30px; width: 22px; height: 22px; }

/* --- stub --- */

.stub {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 34px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 10px;
  border-left: 1.5px dashed #cfc6b2;
  background: var(--cream-2);
  border-radius: 0 22px 0 0;
}

.stub-badge {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--green);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.stub-badge svg { width: 13px; height: 13px; }

.stub-text {
  flex: 1;
  min-height: 0;
  writing-mode: vertical-rl;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 5.8px;
  letter-spacing: 1.1px;
  overflow: hidden;
  color: #6b6252;
  margin: 10px 0;
  white-space: nowrap;
}

.barcode {
  width: 15px;
  height: 38px;
  flex: 0 0 auto;
  background-image: repeating-linear-gradient(
    90deg,
    #1a1a1a 0 1px, transparent 1px 2px,
    #1a1a1a 2px 4px, transparent 4px 5px,
    #1a1a1a 5px 6px, transparent 6px 8px
  );
}

/* --- perforation --- */

.perf {
  position: relative;
  height: 0;
  border-top: 1.6px dashed #d9d1be;
  z-index: 5;
}
.perf::before, .perf::after {
  content: "";
  position: absolute;
  top: -11px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
}
.perf::before { left: -11px; }
.perf::after  { right: -11px; }

/* --- bottom: white --- */

.tk-bottom {
  position: relative;
  background: #fff;
  border-radius: 0 0 22px 22px;
  padding: 22px 20px 24px;
}

.form-title {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.3px;
  color: var(--ink);
}

.field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 54px;
  padding: 0 6px 0 14px;
  border: 1.4px solid #e2e2dc;
  border-radius: 13px;
  background: #fff;
  transition: border-color .15s;
}
.field:focus-within { border-color: var(--blue); }

.flink { width: 19px; height: 19px; flex: 0 0 auto; }

.field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
}
.field input::placeholder { color: #a5a5a0; }

.paste {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 40px;
  padding: 0 12px;
  border: 1.4px solid #e2e2dc;
  border-radius: 9px;
  background: #fafaf7;
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  color: #3a3a36;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background .15s;
}
.paste:active { background: #f0f0ea; }
.paste svg { width: 16px; height: 16px; }

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 54px;
  margin-top: 12px;
  border: 0;
  border-radius: 13px;
  background: var(--blue);
  color: #fff;
  font-size: 16.5px;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: .5px;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--blue-deep);
  transition: transform .1s, box-shadow .1s;
}
.cta:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--blue-deep);
}
.cta svg { width: 20px; height: 20px; }
.cta[disabled] { opacity: .6; cursor: default; }

.status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
  background: #f4f6ff;
  color: #2b3a6b;
  border: 1px solid #dfe4f7;
}
.status.err { background: #fff4f1; color: #a33b1c; border-color: #f7ddd4; }
.status.ok  { background: #f2fbf2; color: #1f6b26; border-color: #d5eed6; }

.rule {
  margin-top: 20px;
  padding-top: 16px;
  padding-right: 108px;
  border-top: 1.6px dashed #e2ded4;
  position: relative;
}
.rule h3 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}
.rule h3 i {
  display: block;
  width: 17px;
  height: 4.5px;
  border-radius: 2px;
  background: var(--orange);
  flex: 0 0 auto;
}
.rule p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #6a6a64;
}

.card-art {
  position: absolute;
  right: -4px;
  bottom: -30px;
  width: 100px;
  height: auto;
  pointer-events: none;
}

.foot {
  margin-top: 18px;
  text-align: center;
  font-size: 11px;
  color: #a8a8a0;
  letter-spacing: .5px;
}

/* ---------------- small screens ---------------- */

@media (max-width: 380px) {
  .script { font-size: 40px; }
  .cn { font-size: 30px; }
  .art { right: 26px; width: 180px; }
  .bag { width: 168px; }
  .idtag { right: 78px; width: 38px; }
  .tk-top { min-height: 214px; padding-left: 18px; }
}

/* ---------------- dark ---------------- */

body.dark {
  --bg: #14161a;
  --cream: #23211c;
  --cream-2: #1c1a16;
  --ink: #f2f1ec;
  --ink-2: #f2f1ec;
  --muted: #8b8b85;
  --line: #2c2f36;
}
body.dark .ticket { background: #191b20; box-shadow: 0 2px 14px rgba(0,0,0,.4); }
body.dark .tk-bottom { background: #191b20; }
body.dark .notice { background: #1e1c17; }
body.dark .notice p { color: #a49c8b; }
body.dark .sub { color: #a5a199; }
body.dark .field { background: #202329; border-color: #2e323a; }
body.dark .field input { color: var(--ink); }
body.dark .paste { background: #262a31; border-color: #33373f; color: #d8d8d2; }
body.dark .rule { border-color: #2a2d34; }
body.dark .rule p { color: #96968e; }
body.dark .perf::before, body.dark .perf::after { background: var(--bg); }
body.dark .stub { border-color: #3a372e; }
body.dark .stub-text { color: #9a9182; }

/* ============================================================
   逻辑层 UI：额度 / 战报 / 历史 / 弹窗
   ============================================================ */

.form-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.form-head .form-title { margin: 0; }

.quota {
  font-size: 11.5px;
  color: var(--muted);
  background: #f3f4ef;
  border: 1px solid #e4e6dd;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.quota b { color: var(--blue); font-weight: 700; }

/* ---- 面板 ---- */

.panel {
  margin-top: 12px;
  background: #fff;
  border-radius: 18px;
  padding: 16px 18px 18px;
  box-shadow: 0 2px 12px rgba(60, 50, 30, .05);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.panel-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -.2px;
}
.panel-sub { font-size: 11px; color: var(--muted); }

.mini {
  border: 1px solid #e2e4dc;
  background: #fafaf7;
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--muted);
  font-family: inherit;
  cursor: pointer;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.stat {
  text-align: center;
  padding: 8px 2px;
  border-radius: 10px;
  background: #fafaf6;
}
.stat b {
  display: block;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 10.5px; color: var(--muted); }
.stat.ok b { color: #1f8a3b; }
.stat.bad b { color: #c2502a; }

.dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 2.5px;
  background: #e6e8df;
}
.dot.done { background: #4fbf6a; }
.dot.stopped { background: #e0996b; }

/* ---- 历史 ---- */

.history { list-style: none; margin: 0; padding: 0; }
.history li {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-top: 1px solid #f0f1ea;
  font-size: 12px;
}
.history li:first-child { border-top: 0; }
.history .tag {
  flex: 0 0 auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 600;
}
.tag.verified { background: #e8f8ec; color: #1f7a37; }
.tag.failed   { background: #fdeee8; color: #b0472a; }
.tag.running  { background: #eef1fd; color: #2c3f8f; }
.tag.queued   { background: #f2f2ec; color: #7b7d72; }
.history .id {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.history .time { flex: 0 0 auto; font-size: 10.5px; color: #a9aa9f; }
.history .empty {
  color: #a9aa9f;
  font-size: 12px;
  padding: 6px 0;
  justify-content: center;
}

/* ---- 弹窗 ---- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 26, 20, .42);
  backdrop-filter: blur(3px);
  animation: fadeIn .18s var(--ease-out, ease-out);
}
.modal[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

.modal-card {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 20px;
  padding: 22px 20px 18px;
  box-shadow: 0 18px 50px rgba(20, 16, 8, .28);
  animation: pop .22s cubic-bezier(.23,1,.32,1);
}
@keyframes pop {
  from { transform: translateY(10px) scale(.97); opacity: 0 }
  to   { transform: none; opacity: 1 }
}

.modal-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -.3px;
}
.modal-sub {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}
.modal-body {
  font-size: 12.5px;
  line-height: 1.7;
  color: #4a4a44;
  white-space: pre-line;
  margin-bottom: 16px;
}

.mfield { display: block; margin-bottom: 11px; }
.mfield span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 5px;
}
.mfield span i { font-style: normal; opacity: .6; }
.mfield input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1.4px solid #e2e2dc;
  border-radius: 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  outline: none;
  background: #fff;
}
.mfield input:focus { border-color: var(--blue); }

.modal-err {
  font-size: 12px;
  color: #b0472a;
  margin: -4px 0 10px;
}

.ghost {
  width: 100%;
  margin-top: 8px;
  height: 40px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.modal .cta { margin-top: 4px; height: 50px; }

body.dark .panel { background: #191b20; }
body.dark .stat { background: #21242a; }
body.dark .stat b { color: #eceae4; }
body.dark .quota { background: #22252b; border-color: #2e323a; color: #9a9d94; }
body.dark .history li { border-color: #24272d; }
body.dark .modal-card { background: #1d2026; }
body.dark .modal-card h3 { color: #f0eee8; }
body.dark .modal-body { color: #b9b8b0; }
body.dark .mfield input { background: #22252b; border-color: #2e323a; color: #eceae4; }
body.dark .dot { background: #2a2e35; }

/* ---- Google 登录 ---- */

.gbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 50px;
  border: 1.5px solid #e0e1da;
  border-radius: 13px;
  background: #fff;
  color: #2c2c28;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: background .14s, border-color .14s;
}
.gbtn:hover { background: #fafaf6; border-color: #cfd0c7; }
.gbtn:active { background: #f4f4ee; }
.gbtn svg { width: 19px; height: 19px; flex: 0 0 auto; }

.or {
  position: relative;
  text-align: center;
  margin: 14px 0 12px;
}
.or::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: #eceee6;
}
.or span {
  position: relative;
  padding: 0 10px;
  background: #fff;
  font-size: 11.5px;
  color: #a9aa9f;
}

.cta.alt {
  background: #f2f3ec;
  color: #3a3a34;
  box-shadow: none;
  font-size: 14px;
  height: 46px;
}
.cta.alt:active { transform: none; box-shadow: none; background: #e8e9e1; }

/* 已登录的头像 */
.login.logged { padding-left: 6px; }
.login .avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

body.dark .gbtn { background: #22252b; border-color: #33373f; color: #e8e6e0; }
body.dark .or span { background: #1d2026; }
body.dark .cta.alt { background: #262a31; color: #d8d6d0; }

/* ---- 学校 ID 查询 ---- */

.schools {
  position: relative;
  z-index: 3;
  background: #fff;
  margin-top: 18px;
  border-top: 1.6px dashed #e2ded4;
  padding-top: 12px;
}
.schools summary {
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.schools summary::-webkit-details-marker { display: none; }
.schools summary::before {
  content: "+";
  display: inline-block;
  width: 14px;
  text-align: center;
  color: var(--blue);
  font-weight: 700;
}
.schools[open] summary::before { content: "−"; }
.schools summary i {
  font-style: normal;
  font-size: 10.5px;
  color: #a9aa9f;
}

.sch-body { padding-top: 10px; }
.sch-row { display: flex; gap: 6px; }
.sch-row input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1.4px solid #e2e2dc;
  border-radius: 9px;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}
.sch-row input:focus { border-color: var(--blue); }
.sch-row select {
  width: 66px;
  height: 38px;
  border: 1.4px solid #e2e2dc;
  border-radius: 9px;
  font-size: 12.5px;
  font-family: inherit;
  background: #fff;
  outline: none;
}
.sch-row button {
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}

.sch-list { list-style: none; margin: 10px 0 0; padding: 0; }
.sch-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid #f2f2ec;
  font-size: 12px;
  cursor: pointer;
}
.sch-list li:hover { background: #fafaf6; }
.sch-list .sid {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--blue);
  flex: 0 0 auto;
  min-width: 54px;
}
.sch-list .sname { flex: 1; min-width: 0; color: #3a3a34; }
.sch-list .empty { color: #a9aa9f; justify-content: center; cursor: default; }
