
:root {
  --green: #07C160;
  --green-dark: #06a552;
  --bg: #F2F2F7;
  --card: #FFFFFF;
  --text: #1C1C1E;
  --text2: #8E8E93;
  --line: #E5E5EA;
  --orange: #FF9500;
  --red: #FF3B30;
  --radius: 16px;
}

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

.hidden { display: none !important; }

.btn[hidden], .login-row[hidden], .school-list[hidden], .loading-mask[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }

.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 8px;
  padding-top: env(safe-area-inset-top);
  background: rgba(249, 249, 249, 0.94);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 0.5px solid var(--line);
}
.nav-back {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--text); cursor: pointer;
  text-decoration: none;
}
.nav-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  margin-right: 44px;
}
.nav-title.left { text-align: left; margin-left: 8px; margin-right: 0; }

.page { padding: 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.card-pad { padding: 16px; }
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text2);
  padding: 16px 16px 8px;
  margin: 0;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 0.5px solid var(--line);
  font-size: 16px;
}
.row:last-child { border-bottom: 0; }
.row .label { color: var(--text2); flex: 0 0 auto; }
.row .value {
  color: var(--text);
  text-align: right;
  word-break: break-all;
  flex: 1;
}
.row .value.strong { font-weight: 600; }

.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  height: 50px;
  border: 0;
  border-radius: 25px;
  background: var(--green);
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  font-family: inherit;
}
.btn:active { opacity: .82; }
.btn[disabled], .btn.disabled { background: #C7C7CC; pointer-events: none; }
.btn-ghost {
  background: transparent;
  color: var(--green);
  height: 46px;
  font-weight: 500;
}
.btn-wrap { padding: 8px 16px 24px; }

.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.input::placeholder { color: #C7C7CC; }
textarea.input {
  height: 96px;
  padding: 12px 14px;
  resize: none;
  line-height: 1.5;
}
.field { padding: 12px 16px; border-bottom: 0.5px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field-label { font-size: 13px; color: var(--text2); margin-bottom: 8px; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.grid-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform .12s;
}
.grid-item:active { transform: scale(.97); }
.grid-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(7, 193, 96, .1);
  color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700;
}
.grid-name { font-size: 16px; font-weight: 600; }
.grid-desc { font-size: 12px; color: var(--text2); }

.nav-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(7, 193, 96, .12);
  color: var(--green);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  margin-right: 12px;
}

.hello { padding: 6px 4px 16px; }
.hello-name { font-size: 26px; font-weight: 700; letter-spacing: -0.4px; }
.hello-sub { font-size: 14px; color: var(--text2); margin-top: 4px; }

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  padding: 18px;
  background: linear-gradient(135deg, #07C160 0%, #00A65A 100%);
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 10px 26px rgba(7, 193, 96, .24);
  cursor: pointer;
  transition: transform .12s;
}
.hero:active { transform: scale(.985); }
.hero::after {
  content: '';
  position: absolute;
  right: -46px; top: -56px;
  width: 150px; height: 150px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  pointer-events: none;
}
.hero::before {
  content: '';
  position: absolute;
  right: 22px; bottom: -58px;
  width: 96px; height: 96px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .09);
  pointer-events: none;
}
.hero-top {
  display: flex; justify-content: space-between;
  font-size: 12px; opacity: .88;
  position: relative; z-index: 1;
}
.hero-title {
  font-size: 21px; font-weight: 700;
  margin: 16px 0 18px;
  line-height: 1.3;
  position: relative; z-index: 1;
  word-break: break-all;
}
.hero-foot {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.hero-status {
  padding: 4px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .22);
  font-size: 12px; font-weight: 600;
}
.hero-status.done { background: rgba(255, 255, 255, .92); color: #06A552; }
.hero-status.idle { background: rgba(255, 255, 255, .14); font-weight: 500; }
.hero-go { font-size: 13px; opacity: .92; display: flex; align-items: center; gap: 2px; }
.hero-chev { font-size: 17px; line-height: 1; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: transform .12s;
}
.tile:active { transform: scale(.97); }
.tile-icon {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.tile-icon svg { width: 22px; height: 22px; }
.tile-icon.blue { background: rgba(0, 122, 255, .10); color: #007AFF; }
.tile-icon.orange { background: rgba(255, 149, 0, .10); color: #FF9500; }
.tile-icon.purple { background: rgba(175, 82, 222, .10); color: #AF52DE; }
.tile-icon.teal { background: rgba(50, 173, 230, .10); color: #32ADE6; }
.tile-name { font-size: 16px; font-weight: 600; }
.tile-desc { font-size: 12px; color: var(--text2); margin-top: 3px; }

.me-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 12px;
}
.me-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #07C160, #00A65A);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 600;
  flex: 0 0 auto;
}
.me-info { flex: 1; min-width: 0; }
.me-name { font-size: 19px; font-weight: 700; }
.me-school { font-size: 13px; color: var(--text2); margin-top: 4px; }
.me-arrow { color: #C7C7CC; font-size: 22px; line-height: 1; }

.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.tag-green { background: rgba(7, 193, 96, .12); color: var(--green); }
.tag-orange { background: rgba(255, 149, 0, .12); color: var(--orange); }
.tag-gray { background: rgba(142, 142, 147, .12); color: var(--text2); }

.upload {
  margin: 16px;
  height: 160px;
  border: 1.5px dashed #D1D1D6;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text2);
  font-size: 14px;
  cursor: pointer;
  background: #FAFAFA;
  overflow: hidden;
  position: relative;
}
.upload:active { background: #F0F0F0; }
.upload .plus { font-size: 32px; line-height: 1; color: #C7C7CC; }
.upload img { width: 100%; height: 100%; object-fit: cover; }

.countdown {
  margin: 0 16px 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(7, 193, 96, .08);
  color: var(--green);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 90px 24px;
  text-align: center;
  color: var(--text2);
  font-size: 15px;
}
.empty .big { font-size: 40px; margin-bottom: 12px; color: #D1D1D6; }

.notice {
  background: #FFF8E6;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  line-height: 1.72;
  color: #8A6D00;
  white-space: pre-wrap;
  word-break: break-word;
}

.time-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  line-height: 1.5;
}
.time-bar .tb-icon {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff; font-weight: 700;
}
.time-bar .tb-text { flex: 1; }

.time-bar .tb-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-weight: 700;
  letter-spacing: .4px;
}

.time-bar.waiting { background: #FFF6E6; color: #8A5A00; }
.time-bar.waiting .tb-icon { background: var(--orange); }

.time-bar.active { background: #E8F8EF; color: #0A6B3C; }
.time-bar.active .tb-icon { background: var(--green); }

.time-bar.active.urgent { animation: tbPulse 1.6s ease-in-out infinite; }
@keyframes tbPulse { 50% { background: #D6F5E4; } }

.time-bar.expired { background: #FDECEC; color: #A11C17; }
.time-bar.expired .tb-icon { background: var(--red); }

.time-bar.done { background: #E8F8EF; color: #0A6B3C; }
.time-bar.done .tb-icon { background: var(--green); }

.done {
  padding: 64px 24px 40px;
  text-align: center;
}
.done-badge {
  width: 84px; height: 84px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(7, 193, 96, .28);
  animation: donePop .42s cubic-bezier(.2, .9, .3, 1.4);
}

.done-badge::after {
  content: '';
  width: 24px; height: 42px;
  border: solid #fff;
  border-width: 0 4px 4px 0;
  border-radius: 2px;
  transform: rotate(45deg) translate(-3px, -4px);
}
@keyframes donePop {
  0% { transform: scale(.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.done-title {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .3px;
  margin-bottom: 8px;
}
.done-sub {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.7;
}
.done-card {
  margin: 24px 0 0;
  text-align: left;
}
.done-actions { margin-top: 28px; }
.done-actions .btn { height: 48px; }
.done-actions .btn-ghost { margin-top: 10px; }

.login {
  min-height: 100vh;
  
  padding: max(56px, 8vh) 24px calc(40px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background: linear-gradient(180deg, #EAFBF1 0%, var(--bg) 42%);
}
.login-logo {
  width: 68px; height: 68px;
  border-radius: 18px;
  background: var(--green);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(7, 193, 96, .28);
}
.login-title { font-size: 24px; font-weight: 700; text-align: center; margin: 0 0 6px; }
.login-sub { font-size: 14px; color: var(--text2); text-align: center; margin: 0 0 32px; }
.login-form { background: var(--card); border-radius: var(--radius); padding: 8px 16px; margin-bottom: 20px; }
.login-row { display: flex; align-items: center; border-bottom: 0.5px solid var(--line); }

.login-row:last-child { border-bottom: 0; }
.login-row .input { background: transparent; padding: 0 4px; height: 52px; }
.code-btn {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 15px;
  font-weight: 500;
  padding: 8px 4px 8px 12px;
  font-family: inherit;
  cursor: pointer;
}
.code-btn[disabled] { color: #C7C7CC; }
.login-tip { font-size: 12px; color: var(--text2); text-align: center; line-height: 1.6; }

.login-tabs {
  display: flex;
  background: #EDEDF0;
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 18px;
}
.login-tabs button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 8px 4px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text2);
  cursor: pointer;
  transition: background .16s, color .16s;
}
.login-tabs button.on {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
.login-pane { display: block; }
.login-pane[hidden] { display: none; }

.login-form-pick { position: relative; }
.school-list {
  border-top: 0.5px solid var(--line);
  max-height: 218px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.school-list[hidden] { display: none; }
.school-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 0;
  border-bottom: 0.5px solid var(--line);
  background: transparent;
  padding: 13px 4px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.school-item:last-child { border-bottom: 0; }
.school-item:active { background: #F7F7FA; }
.school-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.school-tag {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--text2);
  background: #F2F2F7;
  border-radius: 5px;
  padding: 1px 6px;
}
.school-empty { padding: 14px 4px; font-size: 13px; color: var(--text2); }

.cap-img {
  flex: 0 0 auto;
  height: 40px;
  width: 96px;
  object-fit: contain;
  margin-left: 8px;
  border-radius: 6px;
  background: #F2F2F7;
  cursor: pointer;
}

.qr-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px 16px 16px;
  text-align: center;
  margin-bottom: 18px;
}
.qr-canvas {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;          
  
  border: 1px dashed var(--line);
  border-radius: 12px;
  
  background: #FAFAFA;
}
.qr-canvas img,
.qr-canvas canvas { display: block; }
.qr-ph {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.6;
  padding: 0 12px;
}

.qr-tap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 22px;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: rgba(7, 193, 96, .08);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform .12s ease, background .12s ease;
}

.qr-tap::before {
  content: "+";
  font-size: 15px;
  font-weight: 400;
  line-height: 1;
  margin-top: -1px;
}
.qr-tap:active {
  transform: scale(.96);
  background: rgba(7, 193, 96, .16);
}
.qr-status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text2);
  min-height: 20px;
}

.qr-timer {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text2);
  min-height: 18px;
  text-align: center;
}

.qr-timer.warn {
  color: var(--orange);
  font-weight: 500;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  max-width: 76vw;
  padding: 11px 18px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 90;
  backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 95;
  backdrop-filter: blur(2px);
}
.loading-mask[hidden] { display: none; }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; font-size: 14px; }

.lazy {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 72px 0;
  color: var(--text2);
  font-size: 14px;
}
.lazy-spinner {
  width: 26px; height: 26px;
  border: 2.5px solid var(--line);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

.skel {
  background: linear-gradient(90deg, #EDEDF0 25%, #F7F7F9 37%, #EDEDF0 63%);
  background-size: 400% 100%;
  animation: skelShine 1.3s ease-in-out infinite;
  border-radius: 8px;
  height: 14px;
}
@keyframes skelShine {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

.soon {
  min-height: calc(100vh - 44px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text2);
  padding: 0 32px;
  text-align: center;
}
.soon-badge {
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(255, 149, 0, .12);
  color: var(--orange);
  font-size: 13px;
  font-weight: 600;
}
.soon-title { font-size: 18px; font-weight: 600; color: var(--text); }
.soon-desc { font-size: 14px; line-height: 1.7; }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(50px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: rgba(249, 249, 249, .96);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 0.5px solid var(--line);
  z-index: 30;
}
.tabbar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text2);
  cursor: pointer;
}
.tabbar-item.active { color: var(--green); }
.tabbar-icon { font-size: 18px; line-height: 1; }

.has-tabbar { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
