:root {
  color-scheme: light;
  --paper: #f7f9f4;
  --surface: #ffffff;
  --surface-strong: #edf4ee;
  --ink: #18231f;
  --muted: #62706a;
  --line: #d9e2d7;
  --moss: #2f6b4f;
  --moss-dark: #214b38;
  --teal: #357d7e;
  --sky: #dbeaf2;
  --amber: #d8942d;
  --amber-soft: #fff0cf;
  --coral: #c95d4f;
  --coral-soft: #ffe2dd;
  --shadow: 0 20px 60px rgba(23, 44, 35, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(47, 107, 79, 0.08), transparent 42%),
    linear-gradient(315deg, rgba(53, 125, 126, 0.1), transparent 38%),
    var(--paper);
  overflow-x: hidden;
}

button,
select,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) clamp(16px, 3vw, 32px) 14px;
  background: rgba(247, 249, 244, 0.86);
  border-bottom: 1px solid rgba(217, 226, 215, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand > div {
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--moss);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.08;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.language-control {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(24, 35, 31, 0.08);
}

.language-button {
  min-width: 44px;
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.language-button.is-active {
  background: var(--moss);
  color: #fff;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--moss-dark);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(24, 35, 31, 0.08);
}

.icon-button:hover,
.icon-button:focus-visible {
  outline: 0;
  border-color: var(--moss);
  color: var(--moss);
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 44px;
}

.review-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid rgba(47, 107, 79, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
  font-size: 13px;
}

.review-strip > div {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #44aa71;
  box-shadow: 0 0 0 4px rgba(68, 170, 113, 0.15);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 24px;
  min-height: 238px;
  margin-top: 18px;
  padding: clamp(22px, 4vw, 40px);
  border: 1px solid rgba(47, 107, 79, 0.2);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(237, 244, 238, 0.82)),
    var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy {
  align-self: center;
  min-width: 0;
  max-width: 720px;
}

.hero-copy h2 {
  margin-bottom: 12px;
  max-width: 100%;
  font-size: 58px;
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.hero-copy h2:lang(zh-CN),
:lang(zh-CN) .hero-copy h2 {
  word-break: break-all;
}

.hero-copy h2 span {
  display: block;
}

.hero-copy p:last-child {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.hero-visual {
  position: relative;
  min-height: 170px;
  align-self: stretch;
  display: grid;
  place-items: center;
}

.block-stack {
  position: relative;
  width: min(260px, 54vw);
  height: 178px;
}

.cube {
  position: absolute;
  width: 82px;
  height: 82px;
  border-radius: 8px;
  box-shadow: 0 18px 34px rgba(24, 35, 31, 0.2);
}

.cube::before,
.cube::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.cube::before {
  transform: translate(10px, -10px);
  opacity: 0.72;
}

.cube::after {
  transform: translate(20px, -20px);
  opacity: 0.36;
}

.cube.grass {
  left: 28px;
  bottom: 12px;
  background: #4d9f65;
}

.cube.grass::before,
.cube.grass::after {
  background: #8bc26f;
}

.cube.wood {
  left: 102px;
  bottom: 48px;
  background: #a96938;
}

.cube.wood::before,
.cube.wood::after {
  background: #d99b62;
}

.cube.water {
  left: 152px;
  bottom: 6px;
  background: #3b91b4;
}

.cube.water::before,
.cube.water::after {
  background: #8cd5e0;
}

.cube.glow {
  left: 66px;
  bottom: 104px;
  background: #e0ad42;
}

.cube.glow::before,
.cube.glow::after {
  background: #f5da8a;
}

.path-line {
  position: absolute;
  right: 6%;
  bottom: 20px;
  width: 62%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(47, 107, 79, 0.35), transparent);
}

.controls-row,
.view-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}

.student-tabs,
.period-control,
.view-tabs {
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
}

.student-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.student-button,
.period-button,
.view-tab {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
}

.student-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.student-avatar {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--moss-dark);
  font-size: 12px;
}

.period-control {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 5px;
}

.period-button {
  padding: 0 16px;
}

.view-tabs {
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
}

.view-tabs::-webkit-scrollbar {
  display: none;
}

.view-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
}

.student-button.is-active,
.period-button.is-active,
.view-tab.is-active {
  background: var(--moss);
  color: #fff;
}

.view {
  display: none;
  margin-top: 18px;
}

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

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

.panel {
  min-width: 0;
  min-height: 196px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 32px rgba(24, 35, 31, 0.08);
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-12 {
  grid-column: span 12;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-heading h3 {
  margin-bottom: 0;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
}

.panel-icon.green {
  color: var(--moss-dark);
  background: var(--surface-strong);
}

.panel-icon.amber {
  color: #8a5814;
  background: var(--amber-soft);
}

.panel-icon.coral {
  color: #8d382e;
  background: var(--coral-soft);
}

.panel-icon.blue {
  color: #23636c;
  background: var(--sky);
}

.large-metric {
  margin-bottom: 6px;
  font-size: 42px;
  font-weight: 850;
  line-height: 1;
}

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

.mini-timeline {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-top: 18px;
}

.day-chip {
  min-width: 0;
  min-height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f9fbf8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.day-chip.is-open {
  border-color: rgba(47, 107, 79, 0.45);
  background: var(--surface-strong);
  color: var(--moss-dark);
}

.day-chip.is-today {
  border-color: var(--amber);
  background: var(--amber-soft);
  color: #7f5014;
}

.progress-ring {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  margin-top: 12px;
  border-radius: 50%;
  background: conic-gradient(var(--amber) var(--ring-value, 0deg), #edf0e7 0);
}

.progress-ring span {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-weight: 850;
}

.attention-list,
.pipeline-list {
  margin: 0;
  padding-left: 19px;
}

.attention-list li,
.pipeline-list li {
  margin-bottom: 10px;
  line-height: 1.45;
}

.attention-list li::marker {
  color: var(--coral);
}

.signal-bars {
  display: grid;
  gap: 13px;
}

.signal-row {
  display: grid;
  grid-template-columns: minmax(92px, 144px) minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
}

.signal-title {
  font-weight: 760;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #eef1eb;
  overflow: hidden;
}

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

.signal-value {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
}

.conversation-list,
.timeline-list,
.task-list,
.rule-list,
.next-step-list {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.list-item strong {
  display: block;
  margin-bottom: 4px;
}

.list-item p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.timeline-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-time {
  color: var(--moss);
  font-size: 13px;
  font-weight: 850;
}

.task-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-top: 8px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--moss-dark);
  font-size: 12px;
  font-weight: 850;
}

.form-grid,
.search-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
  color: var(--ink);
}

.field input:focus {
  outline: 0;
  border-color: var(--moss);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.14);
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: var(--radius);
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--moss);
  background: var(--moss);
  color: #fff;
}

.secondary-button {
  margin-top: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--moss-dark);
}

.primary-button:disabled,
.secondary-button:disabled,
.field input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.player-results,
.binding-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.player-result,
.binding-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.player-meta,
.binding-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.meta-chip {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--moss-dark);
  font-size: 12px;
  font-weight: 850;
}

.meta-chip.is-offline {
  background: #eef1eb;
  color: var(--muted);
}

.section-label {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.boundary-grid p {
  margin-bottom: 0;
  padding: 14px;
  border-left: 4px solid var(--moss);
  border-radius: var(--radius);
  background: #fbfcfa;
  color: var(--muted);
  line-height: 1.6;
}

.fact-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.fact-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.fact-row:last-child {
  border-bottom: 0;
}

.fact-row dt {
  color: var(--muted);
  font-weight: 750;
}

.fact-row dd {
  margin: 0;
  font-weight: 760;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 18px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .hero-copy h2 {
    font-size: 44px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 130px;
  }

  .span-4,
  .span-5,
  .span-6,
  .span-7 {
    grid-column: span 12;
  }

  .controls-row {
    align-items: stretch;
    flex-direction: column;
  }

  .period-control {
    width: 100%;
  }

  .period-button {
    flex: 1;
  }

  .boundary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100vw - 20px, 1180px);
    padding-bottom: 96px;
  }

  .app-header {
    padding-left: 10px;
    padding-right: 10px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .brand {
    flex: 1 1 100%;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  h1 {
    font-size: 21px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .language-control {
    padding: 3px;
  }

  .language-button {
    min-width: 38px;
    min-height: 30px;
    font-size: 12px;
  }

  .hero-panel {
    padding: 20px;
  }

  .hero-copy h2 {
    font-size: 32px;
    line-height: 1.08;
  }

  .hero-copy p:last-child {
    font-size: 16px;
  }

  .large-metric {
    font-size: 34px;
  }

  .review-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .student-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .view-tabs {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 25;
    justify-content: space-around;
    box-shadow: 0 16px 40px rgba(24, 35, 31, 0.18);
  }

  .view-tab {
    min-width: 68px;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    font-size: 12px;
  }

  .player-result,
  .binding-item {
    grid-template-columns: 1fr;
  }

  .signal-row {
    grid-template-columns: 1fr 42px;
  }

  .bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

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