:root {
  --ink: #172033;
  --muted: #637087;
  --line: #dfe5ee;
  --paper: #f7f9fc;
  --white: #ffffff;
  --blue: #166fb7;
  --gold: #f1bd26;
  --navy: #203a63;
  --shadow: 0 20px 60px rgba(24, 38, 66, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f4f8fd 0%, #ffffff 44%, #f7f9fc 100%);
}

body.is-secure-mode {
  -webkit-user-select: none;
  user-select: none;
}

body.has-watermark::after {
  content: var(--watermark);
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  display: grid;
  place-items: center;
  color: rgba(32, 58, 99, 0.08);
  font-size: 28px;
  font-weight: 900;
  transform: rotate(-24deg);
  white-space: nowrap;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: var(--blue);
  color: #fff;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  touch-action: manipulation;
}

button:hover {
  filter: brightness(0.97);
}

.secondary-button,
.ghost-button {
  background: #eef3f8;
  color: var(--navy);
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
}

.app-shell {
  min-height: 100vh;
}

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px;
}

.screen.is-active {
  display: block;
}

.screen-login {
  display: none;
  place-items: center;
  background:
    radial-gradient(circle at 28% 24%, rgba(22, 111, 183, 0.12), transparent 30%),
    radial-gradient(circle at 76% 34%, rgba(241, 189, 38, 0.18), transparent 28%),
    linear-gradient(180deg, #f4f8fd 0%, #ffffff 52%, #f7f9fc 100%);
}

.screen-login.is-active {
  display: grid;
}

.login-panel {
  width: min(560px, 100%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(223, 229, 238, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 36px;
  backdrop-filter: blur(14px);
}

.brand-logo {
  display: block;
  width: min(220px, 66%);
  height: auto;
  margin-bottom: 24px;
}

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

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

h1 {
  margin-bottom: 14px;
  font-size: 34px;
  line-height: 1.22;
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.25;
}

.lead {
  color: var(--muted);
  line-height: 1.7;
}

.login-form {
  margin-top: 28px;
}

.login-form label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

.name-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.name-row input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  width: min(1180px, 100%);
  margin: 0 auto 18px;
}

.review-home-button {
  flex: 0 0 auto;
  min-height: 40px;
  width: auto;
  margin-top: 10px;
  padding: 0 16px;
}

.top-logo {
  width: 150px;
  max-width: 22vw;
  height: auto;
  flex: 0 0 auto;
}

.student-chip {
  min-width: 88px;
  text-align: center;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy);
  background: #fff;
  font-weight: 800;
}

.notice {
  width: min(1180px, 100%);
  margin: 0 auto 18px;
  padding: 14px 18px;
  border-left: 4px solid var(--gold);
  background: #fff8df;
  color: #6c5720;
  border-radius: 6px;
  font-weight: 700;
}

.model-layout {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(420px, 0.92fr) minmax(420px, 1.08fr);
  gap: 26px;
  align-items: start;
}

.model-layout-home {
  width: min(680px, 100%);
  grid-template-columns: 1fr;
}

.model-board {
  position: sticky;
  top: 24px;
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.model-board::before {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(32, 58, 99, 0.08);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(22, 111, 183, 0.08), transparent 48%, rgba(241, 189, 38, 0.1)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(247, 249, 252, 0.7));
  opacity: 1;
}

.center-hex {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 150px;
  height: 130px;
  transform: translate(-50%, -50%);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.28;
}

.dimension-node {
  position: absolute;
  width: 172px;
  min-height: 78px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  color: #fff;
  box-shadow: 0 16px 32px rgba(24, 38, 66, 0.14);
}

.dimension-node strong {
  display: block;
  font-size: 18px;
}

.dimension-node span {
  display: block;
  margin-top: 6px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.node-top {
  left: 50%;
  top: 66px;
  transform: translateX(-50%);
  background: #8f73b8;
}

.node-right-top {
  right: 42px;
  top: 178px;
  background: #dfbf52;
}

.node-right-bottom {
  right: 42px;
  bottom: 126px;
  background: #b85f5d;
}

.node-bottom {
  left: 50%;
  bottom: 50px;
  transform: translateX(-50%);
  background: #729a85;
}

.node-left-bottom {
  left: 42px;
  bottom: 126px;
  background: #d9a15e;
}

.node-left-top {
  left: 42px;
  top: 178px;
  background: #66a4cc;
}

.ability-panel,
.detail-card,
.selected-card,
.review-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.ability-panel {
  padding: 22px;
}

.detail-card {
  width: min(900px, 100%);
  margin: 0 auto 18px;
  padding: 30px;
}

.dimension-detail-card {
  display: grid;
  gap: 20px;
}

.ability-detail-card {
  display: grid;
  gap: 22px;
}

.detail-section p:last-child {
  margin-bottom: 0;
}

.detail-section > p:not(.eyebrow),
.evidence-grid p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.85;
  font-size: 17px;
  overflow-wrap: anywhere;
}

#abilityDone,
#abilityMissed {
  white-space: pre-line;
}

.ability-list-detail {
  margin-top: 12px;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.evidence-grid section {
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.confirm-strip {
  padding: 16px 18px;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: #fff8df;
  color: #6c5720;
  font-weight: 900;
}

.page-actions {
  width: min(900px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 12px;
}

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

.ability-group {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.ability-group h3 {
  margin-bottom: 12px;
  color: var(--dimension-color);
  font-size: 18px;
}

.ability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ability-button {
  background: #f5f7fa;
  color: var(--ink);
  border: 1px solid var(--line);
  font-weight: 700;
  line-height: 1.35;
  white-space: normal;
}

.ability-button.is-personal {
  background: #e7f2fb;
  border-color: #9ecae9;
  color: #145f9d;
}

.ability-button.is-team {
  background: #fff2c5;
  border-color: #f0cb54;
  color: #7b5c00;
}

.summary-grid {
  width: min(900px, 100%);
  margin: 44px auto 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.summary-grid-single {
  width: min(560px, 100%);
  grid-template-columns: 1fr;
}

.selected-card {
  min-height: 220px;
  padding: 28px;
}

.selected-card p {
  color: var(--muted);
  font-weight: 800;
}

.selected-card h3 {
  font-size: 32px;
  margin-bottom: 18px;
}

.selected-card span {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: #eef3f8;
  color: var(--navy);
  font-weight: 800;
}

.summary-actions {
  width: min(900px, 100%);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.review-tabs {
  width: min(900px, 100%);
  margin: 24px auto 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tab-button {
  height: auto;
  min-height: 66px;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.tab-button.is-active {
  border-color: var(--blue);
  background: #eaf5fc;
}

.tab-button span,
.tab-button strong {
  display: block;
}

.tab-button span {
  color: var(--muted);
  font-size: 13px;
}

.tab-button strong {
  margin-top: 5px;
  font-size: 18px;
}

.review-card {
  width: min(900px, 100%);
  min-height: 300px;
  margin: 0 auto 18px;
  padding: 28px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  align-content: start;
  gap: 12px;
  background:
    linear-gradient(135deg, rgba(22, 111, 183, 0.08), rgba(241, 189, 38, 0.12)),
    #fff;
}

.card-kicker {
  color: var(--blue);
  margin-bottom: 0;
  font-weight: 900;
}

.review-card h3 {
  align-self: center;
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.42;
}

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

.card-nav {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.card-nav-button {
  width: 48px;
  min-height: 40px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.attribution-card,
.meta-card-panel {
  width: min(900px, 100%);
  margin: 0 auto 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(24, 38, 66, 0.1);
}

.attribution-card {
  border-left: 4px solid var(--gold);
  background: #fffaf0;
}

.attribution-card h3,
.meta-card-panel h3 {
  margin-bottom: 10px;
  font-size: 22px;
  line-height: 1.35;
}

.inline-definition-button {
  width: auto;
  min-height: 38px;
  margin: 0 0 12px;
  padding: 0 14px;
  border: 1px solid #f0cb54;
  background: #fff2c5;
  color: #6c5720;
}

.attribution-card p:last-child {
  margin-bottom: 0;
  color: #6c5720;
  font-size: 17px;
  line-height: 1.8;
}

.meta-card-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.meta-card-button {
  height: auto;
  min-height: 92px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  text-align: left;
  background: #f6f8fb;
  color: var(--ink);
  border: 1px solid var(--line);
}

.meta-card-button strong,
.meta-card-button span {
  display: block;
}

.meta-card-button strong {
  min-height: 42px;
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.35;
}

.meta-card-button span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.meta-question-list {
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--ink);
  line-height: 1.75;
}

.definition-evidence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.definition-evidence section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.definition-evidence strong {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
}

.definition-evidence p {
  margin-bottom: 0;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(10, 20, 36, 0.45);
  z-index: 10;
}

.overlay[hidden] {
  display: none !important;
}

.overlay-card {
  width: min(560px, 100%);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  padding: 28px;
}

.overlay-card h3 {
  font-size: 28px;
}

.overlay-body {
  color: var(--muted);
  line-height: 1.8;
}

.value-box {
  display: grid;
  gap: 6px;
  margin: 16px 0;
  padding: 14px;
  border-radius: 6px;
  background: #f3f7fb;
  color: var(--ink);
}

.confirm-copy {
  color: var(--ink);
  font-weight: 800;
}

.tap-hint {
  font-size: 13px;
  color: #8793a8;
}

.overlay-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.expired-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f7f9fc;
}

.expired-logo {
  position: fixed;
  top: 28px;
  left: 50%;
  width: min(220px, 66vw);
  transform: translateX(-50%);
}

.expired-card {
  width: min(520px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.expired-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.8;
}

.admin-body {
  background: #f7f9fc;
}

.admin-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-card {
  width: min(680px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.admin-logo {
  width: 180px;
  max-width: 60%;
  height: auto;
  margin-bottom: 18px;
}

.admin-form {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.admin-form label,
.toggle-line {
  font-weight: 800;
}

.admin-form input[type="text"],
.admin-form input[type="password"],
.admin-form input[type="datetime-local"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.toggle-line input {
  width: 18px;
  height: 18px;
}

.admin-panel {
  margin-top: 20px;
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.status-pill {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e7f6ed;
  color: #17643a;
  font-weight: 900;
}

.status-pill.is-disabled {
  background: #f9e8e8;
  color: #9b2929;
}

.admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.admin-message {
  min-height: 22px;
  margin: 0;
  color: #17643a;
  font-weight: 800;
}

.admin-message.is-error {
  color: #9b2929;
}

.admin-help {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.admin-help p {
  margin-bottom: 8px;
  font-weight: 900;
}

.admin-help code {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--navy);
  font-weight: 800;
}

@media (max-width: 920px) {
  .screen {
    padding: 18px 18px 96px;
  }

  .topbar,
  .model-layout,
  .summary-grid,
  .review-tabs,
  .evidence-grid,
  .meta-card-list {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }

  .model-layout {
    display: grid;
  }

  .model-board {
    position: relative;
    top: auto;
    min-height: 500px;
  }

  .dimension-node {
    width: 142px;
    min-height: 68px;
  }

  .dimension-node strong {
    font-size: 16px;
  }

  .node-right-top,
  .node-right-bottom {
    right: 18px;
  }

  .node-left-top,
  .node-left-bottom {
    left: 18px;
  }

  .summary-grid,
  .review-tabs {
    display: grid;
  }
}

@media (max-width: 560px) {
  body {
    background: #f7f9fc;
  }

  button {
    width: 100%;
    min-height: 48px;
  }

  .screen {
    padding: 14px 14px 88px;
  }

  h1 {
    font-size: 27px;
  }

  h2 {
    font-size: 22px;
    line-height: 1.32;
  }

  .login-panel {
    padding: 22px;
    box-shadow: 0 12px 36px rgba(24, 38, 66, 0.12);
  }

  .name-row {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
  }

  .screen-review .topbar {
    grid-template-columns: 1fr;
  }

  .review-home-button {
    width: 100%;
    justify-self: start;
  }

  .top-logo {
    grid-row: 1;
    justify-self: start;
    width: 132px;
    max-width: 46vw;
  }

  .student-chip {
    justify-self: start;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .notice {
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.55;
  }

  .model-layout-home {
    width: 100%;
  }

  .model-board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    min-height: 0;
    padding: 14px;
    overflow: visible;
    box-shadow: 0 10px 28px rgba(24, 38, 66, 0.12);
  }

  .model-board::before {
    display: none;
  }

  .center-hex {
    position: static;
    transform: none;
    grid-column: 1 / -1;
    justify-self: center;
    width: 136px;
    height: 118px;
    margin: 4px 0 8px;
    font-size: 18px;
  }

  .dimension-node,
  .node-top,
  .node-right-top,
  .node-right-bottom,
  .node-bottom,
  .node-left-bottom,
  .node-left-top {
    position: static;
    transform: none;
    width: 100%;
    min-height: 74px;
    padding: 12px 8px;
  }

  .dimension-node strong {
    font-size: 16px;
  }

  .detail-card,
  .selected-card,
  .review-card,
  .attribution-card,
  .meta-card-panel {
    border-radius: 8px;
    box-shadow: 0 10px 28px rgba(24, 38, 66, 0.1);
  }

  .detail-card {
    padding: 20px;
  }

  .detail-section > p:not(.eyebrow),
  .evidence-grid p:not(.eyebrow) {
    font-size: 16px;
    line-height: 1.75;
  }

  .ability-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .ability-button {
    justify-content: center;
    min-height: 50px;
    padding: 10px 12px;
  }

  .evidence-grid section {
    min-height: 0;
    padding: 16px;
  }

  .confirm-strip {
    font-size: 15px;
    line-height: 1.6;
  }

  .page-actions,
  .summary-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: calc(100% + 28px);
    margin: 0 -14px -88px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(247, 249, 252, 0.94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }

  #dimensionBackBtn {
    grid-column: 1 / -1;
  }

  .summary-grid {
    margin: 22px auto 18px;
  }

  .selected-card {
    min-height: 0;
    padding: 22px;
  }

  .selected-card h3 {
    font-size: 26px;
  }

  .review-tabs {
    margin: 14px auto 12px;
  }

  .tab-button {
    min-height: 60px;
  }

  .review-card {
    min-height: 240px;
    padding: 22px;
  }

  .review-card h3 {
    font-size: 23px;
    line-height: 1.5;
  }

  .card-nav-button {
    width: 48px;
    min-height: 40px;
  }

  .attribution-card,
  .meta-card-panel {
    padding: 18px;
  }

  .attribution-card h3,
  .meta-card-panel h3 {
    font-size: 19px;
  }

  .attribution-card p:last-child {
    font-size: 16px;
  }

  .inline-definition-button {
    width: 100%;
    min-height: 44px;
  }

  .meta-card-list {
    gap: 8px;
  }

  .definition-evidence {
    grid-template-columns: 1fr;
  }

  .meta-card-button {
    min-height: 84px;
  }

  .overlay {
    align-items: end;
    padding: 14px;
  }

  .overlay-card {
    padding: 22px;
  }

  .overlay-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-shell {
    padding: 14px;
  }

  .admin-card {
    padding: 22px;
  }

  .admin-row,
  .admin-actions,
  .status-line {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-actions {
    gap: 10px;
  }
}
