:root {
  --ink: #162033;
  --muted: #637086;
  --paper: #f4f7fb;
  --white: #ffffff;
  --line: #d9e2ee;
  --blue: #2367c7;
  --teal: #0b8f88;
  --green: #477a3d;
  --gold: #b27b24;
  --orange: #e87817;
  --red: #bd3d37;
  --violet: #6954a5;
  --shadow: 0 16px 44px rgba(22, 32, 51, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "Noto Sans TC", "PingFang TC", Arial, sans-serif;
  line-height: 1.55;
}

.report-hero {
  min-height: 46vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding: 72px clamp(20px, 6vw, 88px) 44px;
  color: var(--white);
  background:
    linear-gradient(rgba(7, 17, 30, 0.78), rgba(7, 17, 30, 0.54)),
    url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1800&q=80");
  background-size: cover;
  background-position: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.report-hero .eyebrow {
  color: #8be5df;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 14px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.18;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 22px;
}

.lede {
  max-width: 860px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 21px;
}

.hero-actions {
  display: grid;
  gap: 10px;
}

button,
.hero-actions a {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

button:hover,
.hero-actions a:hover {
  border-color: var(--teal);
  color: var(--teal);
}

main {
  padding: 26px clamp(16px, 5vw, 72px) 72px;
}

.control-panel,
.panel,
.kpi,
.ability-report,
.ability-card {
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 12px;
  padding: 18px;
  margin-bottom: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

select,
input {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  min-height: 124px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.kpi strong {
  font-size: 30px;
  line-height: 1;
}

.dashboard-layout,
.ability-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel,
.ability-card {
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef6ff;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
}

.retention-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.cohort-card {
  padding: 14px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.cohort-card strong {
  display: block;
  margin-bottom: 8px;
}

.cohort-bar,
.funnel-bar,
.dna-track,
.benchmark-track {
  height: 18px;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
}

.cohort-fill,
.funnel-fill,
.dna-fill,
.benchmark-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.action-list,
.risk-table,
.funnel-chart,
.dna-bars,
.unlock-grid,
.task-grid {
  display: grid;
  gap: 12px;
}

.action-card,
.risk-row,
.unlock-card,
.task-card {
  padding: 14px;
  border-left: 5px solid var(--teal);
  background: var(--paper);
}

.action-card strong,
.risk-row strong,
.unlock-card strong,
.task-card strong {
  display: block;
  margin-bottom: 5px;
}

.action-card span,
.risk-row span,
.unlock-card span,
.task-card span {
  color: var(--muted);
  font-weight: 800;
}

.funnel-row,
.dna-row,
.benchmark-row {
  display: grid;
  grid-template-columns: 130px 1fr 64px;
  gap: 10px;
  align-items: center;
}

.risk-row {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 10px;
  align-items: center;
}

.risk-tag {
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--white);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.ability-report {
  padding: 24px;
  margin-top: 18px;
}

.main-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(11, 143, 136, 0.14), rgba(35, 103, 199, 0.12)),
    var(--white);
}

.main-card::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -90px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(35, 103, 199, 0.1);
}

.avatar-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.avatar-token {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  border: 4px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: var(--white);
  box-shadow: 0 14px 34px rgba(22, 32, 51, 0.18);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0;
}

.score-band {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--white);
}

.game-score-band {
  position: relative;
  z-index: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score-band span {
  color: var(--muted);
  font-weight: 900;
}

.score-band strong {
  font-size: 48px;
  line-height: 1;
}

.game-score-band div {
  display: grid;
  gap: 4px;
}

.game-score-band div strong {
  font-size: 36px;
}

.xp-panel {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.xp-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 900;
}

.xp-head strong {
  color: var(--ink);
}

.xp-track {
  height: 18px;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.benchmark {
  display: grid;
  gap: 14px;
}

.unlock-grid,
.task-grid,
.badge-grid,
.role-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.role-panel {
  margin-bottom: 16px;
}

.role-grid {
  display: grid;
  gap: 12px;
}

.role-card {
  min-height: 142px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  display: grid;
  align-content: space-between;
  gap: 12px;
}

.role-card.unlocked {
  border-color: rgba(11, 143, 136, 0.38);
  background: #f0fffc;
}

.role-card.current {
  border-color: rgba(35, 103, 199, 0.5);
  background: #eef6ff;
  box-shadow: inset 0 0 0 2px rgba(35, 103, 199, 0.18);
}

.role-token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.role-token {
  width: 48px;
  height: 48px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  background: #e7edf5;
  color: var(--muted);
  font-weight: 900;
}

.role-card.unlocked .role-token,
.role-card.current .role-token {
  background: linear-gradient(135deg, var(--blue), var(--teal));
  color: var(--white);
}

.role-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.role-card h3 {
  margin-bottom: 4px;
  font-size: 18px;
}

.role-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.unlock-card {
  min-height: 132px;
  border-left-color: var(--blue);
}

.unlock-card strong::before {
  content: "◆ ";
  color: var(--blue);
}

.unlock-card.locked {
  border-left-color: var(--orange);
  opacity: 0.76;
}

.unlock-card.locked strong::before {
  color: var(--orange);
}

.task-card {
  min-height: 150px;
  border-left-color: var(--violet);
}

.badge-panel {
  margin-top: 16px;
}

.badge-grid {
  display: grid;
  gap: 12px;
}

.badge-card {
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  display: grid;
  gap: 8px;
}

.badge-card.unlocked {
  border-color: rgba(11, 143, 136, 0.36);
  background: #f0fffc;
}

.badge-token {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: #e7edf5;
  color: var(--muted);
  font-weight: 900;
}

.badge-card.unlocked .badge-token {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: var(--white);
}

.badge-card strong {
  display: block;
}

.badge-card span {
  color: var(--muted);
  font-weight: 800;
}

.prescription-panel {
  margin-top: 16px;
}

@media (max-width: 1120px) {
  .report-hero,
  .dashboard-layout,
  .ability-layout {
    grid-template-columns: 1fr;
  }

  .control-panel,
  .kpi-grid,
  .retention-grid,
  .unlock-grid,
  .task-grid,
  .badge-grid,
  .role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .control-panel,
  .kpi-grid,
  .retention-grid,
  .unlock-grid,
  .task-grid,
  .badge-grid,
  .role-grid,
  .avatar-layout {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .score-band,
  .xp-head {
    display: grid;
  }

  .funnel-row,
  .dna-row,
  .benchmark-row,
  .risk-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  .report-hero,
  .control-panel,
  #copyReport,
  #printReport {
    display: none !important;
  }

  body,
  main {
    background: var(--white);
  }

  main {
    padding: 0;
  }

  .panel,
  .ability-report,
  .ability-card,
  .kpi {
    box-shadow: none;
  }
}
