/* 编程1小时 · 活动页 */
/* 开场动画播放前收起页面框架，避免先闪一下题单再出剧情 */
body.intro-pending .hour-main,
body.intro-pending .hm-header,
body.intro-pending .hm-footer {
  visibility: hidden;
}

:root {
  --hour-bg: #070916;
  --hour-panel: rgba(16, 21, 46, .84);
  --hour-line: rgba(139, 124, 246, .3);
  --hour-text: #e2e8f0;
  --hour-muted: #93a0c6;
  --hour-accent: #8b7cf6;
  --hour-gold: #fbbf24;
  --hour-green: #4ade80;
}

* { box-sizing: border-box; }
body[data-page="hour"],
body[data-page="activities"] {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--hour-text);
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(79, 70, 229, .24), transparent 60%),
    radial-gradient(900px 520px at 96% 0%, rgba(34, 211, 238, .13), transparent 55%),
    var(--hour-bg);
}
body[data-page="hour"] a,
body[data-page="activities"] a { color: inherit; }

.hour-main { width: min(1180px, calc(100% - 56px)); margin: 0 auto; padding: 40px 0 72px; }

.hour-hero {
  padding: 26px 28px 24px;
  border: 1px solid var(--hour-line);
  border-radius: 20px;
  background:
    radial-gradient(600px 260px at 8% 0%, rgba(139, 124, 246, .2), transparent 70%),
    var(--hour-panel);
}

.hour-kicker {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--hour-accent);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hour-hero h1 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: .5px;
}

.hour-hero .hour-sub {
  margin: 0 0 18px;
  max-width: 720px;
  color: var(--hour-muted);
  font-size: 14px;
  line-height: 1.8;
}

.hour-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hour-chip {
  padding: 5px 12px;
  border: 1px solid rgba(139, 124, 246, .38);
  border-radius: 999px;
  background: rgba(139, 124, 246, .1);
  color: #cfd6ff;
  font-size: 12px;
}

.hour-ended {
  margin: 0 0 18px;
  padding: 10px 14px;
  border: 1px solid rgba(248, 113, 113, .45);
  border-radius: 10px;
  background: rgba(248, 113, 113, .1);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.7;
}

/* ---------------- 活动列表页 ---------------- */
.act-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.act-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 22px 18px;
  border: 1px solid var(--hour-line);
  border-radius: 18px;
  background:
    radial-gradient(420px 200px at 10% 0%, rgba(139, 124, 246, .16), transparent 70%),
    var(--hour-panel);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.act-card:hover { border-color: var(--hour-accent); transform: translateY(-2px); }

.act-card-kicker {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--hour-accent);
}
.act-card-title { font-size: 20px; font-weight: 700; color: #fff; }
.act-card-sub { font-size: 13px; color: var(--hour-muted); line-height: 1.7; }
.act-card-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.act-card-go { margin-top: 6px; font-size: 13px; color: #c9c2ff; }
.hour-card.is-ended { opacity: .6; cursor: not-allowed; }
.hour-card.is-ended:hover { border-color: var(--hour-line); transform: none; }
.hour-card.is-locked { opacity: .45; cursor: not-allowed; }
.hour-card.is-locked:hover { border-color: var(--hour-line); transform: none; }

.hour-progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 22px 0 26px;
  padding: 18px 22px;
  border: 1px solid var(--hour-line);
  border-radius: 16px;
  background: var(--hour-panel);
}

.hour-progress-info { min-width: 200px; flex: 1; }
.hour-progress-text {
  font-size: 13px;
  color: var(--hour-muted);
  margin-bottom: 10px;
}
.hour-progress-text b { color: #fff; font-size: 16px; }

.hour-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  overflow: hidden;
}
.hour-progress-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--hour-accent), #22d3ee);
  transition: width .3s ease;
}

.hour-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hour-btn {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(139, 124, 246, .55);
  background: rgba(139, 124, 246, .18);
  color: #e6e9ff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.hour-btn:hover { background: rgba(139, 124, 246, .3); }
.hour-btn.is-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #8b7cf6, #6d5ae0);
  color: #fff;
  font-weight: 700;
}
.hour-btn.is-gold {
  border-color: transparent;
  background: linear-gradient(135deg, #facc15, #f59e0b);
  color: #1a1400;
  font-weight: 700;
}
.hour-btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  filter: grayscale(.4);
}

.hour-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 30px 0 14px;
}
.hour-section-head h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: .5px;
}
.hour-section-head span { font-size: 12px; color: var(--hour-muted); }

.hour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.hour-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 14px;
  border: 1px solid var(--hour-line);
  border-radius: 14px;
  background: var(--hour-panel);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.hour-card:hover { border-color: var(--hour-accent); transform: translateY(-2px); }
.hour-card.is-done { border-color: rgba(74, 222, 128, .38); }
.hour-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hour-card-no {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #c9c2ff;
}
.hour-card.is-done .hour-card-no { color: var(--hour-green); }
.hour-card-state { font-size: 11px; color: var(--hour-muted); letter-spacing: .06em; }
.hour-card.is-done .hour-card-state { color: var(--hour-green); }
.hour-card-name { font-size: 14px; color: #fff; }
.hour-card-tag { font-size: 11.5px; color: var(--hour-muted); }
.hour-card-stars { font-size: 13px; color: var(--hour-gold); letter-spacing: 2px; }
.hour-card-stars .off { color: rgba(255, 255, 255, .18); }

.hour-cert {
  margin-top: 34px;
  padding: 24px 26px;
  border: 1px dashed rgba(251, 191, 36, .38);
  border-radius: 18px;
  background: rgba(251, 191, 36, .05);
}
.hour-cert h2 { margin: 0 0 10px; font-size: 18px; }
.hour-cert p { margin: 0 0 16px; color: var(--hour-muted); font-size: 13.5px; line-height: 1.8; }
.hour-cert-tip { font-size: 12px; color: var(--hour-muted); }

.hour-note {
  margin-top: 26px;
  font-size: 12px;
  color: var(--hour-muted);
  line-height: 1.9;
}
.hour-note b { color: #cfd6ff; }

.hour-empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--hour-muted);
  font-size: 13px;
  line-height: 1.9;
}

/* ---------------- 证书弹窗 ---------------- */
.hour-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(3, 6, 22, .78);
}
.hour-mask.is-on { display: grid; }

.hour-dialog {
  width: min(860px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(251, 191, 36, .3);
  border-radius: 18px;
  background: linear-gradient(180deg, #12162f, #090c1f);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}

.hour-dialog h3 { margin: 0 0 6px; font-size: 18px; }
.hour-dialog .hour-dialog-sub { margin: 0 0 18px; color: var(--hour-muted); font-size: 12.5px; line-height: 1.7; }

.hour-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.hour-field label { font-size: 12.5px; color: #cfd6ff; }
.hour-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(139, 124, 246, .4);
  border-radius: 10px;
  background: rgba(8, 11, 28, .9);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.hour-field input:focus { border-color: var(--hour-accent); }
.hour-field-error { min-height: 16px; color: #f87171; font-size: 12px; }

.hour-dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }

.hour-preview { margin-top: 18px; display: none; }
.hour-preview.is-on { display: block; }
.hour-preview img {
  width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: #05071a;
}

.hour-print-layer { display: none; }

@media (max-width: 720px) {
  .hour-main { padding: 24px 0 56px; }
  .act-list { grid-template-columns: 1fr; }
  .hour-hero { padding: 20px; }
  .hour-progress { padding: 16px; }
  .hour-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .hour-dialog { padding: 18px; }
}

/* ---------------- 打印：A4 横向满版 ---------------- */
@media print {
  @page { size: A4 landscape; margin: 0; }
  body[data-page="hour"] { background: #fff; }
  body[data-page="hour"] > *:not(.hour-print-layer) { display: none !important; }
  .hour-print-layer {
    display: block !important;
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 0;
    background: #fff;
  }
  .hour-print-layer img {
    display: block;
    width: 100vw;
    height: 100vh;
    object-fit: contain;
  }
}
