:root {
  color-scheme: light;
  --paper: #f4f1e8;
  --paper-deep: #e7dfcf;
  --ink: #1f2520;
  --muted: #6c7168;
  --green: #246b4f;
  --green-dark: #164832;
  --red: #bd3124;
  --gold: #c8942f;
  --line: #d5c9b5;
  --shadow: 0 18px 45px rgba(54, 45, 30, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(36, 107, 79, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(36, 107, 79, 0.07) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 24px 18px 44px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
}

.hero-copy,
.hospital-card,
.ticker,
.feature-card,
.tool-panel,
.output-card {
  border: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.86);
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  padding: 26px;
  border-radius: 6px;
}

.hero-copy::after {
  content: "A-SHARE WARD";
  position: absolute;
  right: -28px;
  bottom: 8px;
  color: rgba(189, 49, 36, 0.08);
  font-size: 72px;
  font-weight: 900;
  letter-spacing: 2px;
}

.mental-status {
  position: relative;
  z-index: 1;
  display: inline-grid;
  gap: 6px;
  margin-top: 22px;
  padding: 12px 14px;
  border: 1px solid rgba(189, 49, 36, 0.35);
  border-radius: 5px;
  background: #fff4ee;
}

.mental-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mental-status strong {
  color: var(--red);
  font-size: 24px;
  animation: pulseStatus 1.8s ease-in-out infinite;
}

.mental-status.live-flash {
  animation: liveFlash 0.5s ease;
}

@keyframes pulseStatus {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.035); filter: brightness(1.12); }
}

@keyframes liveFlash {
  0% { box-shadow: 0 0 0 rgba(189, 49, 36, 0); }
  45% { box-shadow: 0 0 0 6px rgba(189, 49, 36, 0.13); }
  100% { box-shadow: 0 0 0 rgba(189, 49, 36, 0); }
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

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

h1 {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
  font-size: clamp(42px, 9vw, 86px);
  line-height: 0.96;
  letter-spacing: 0;
}

.subtitle {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.hospital-card {
  display: flex;
  min-height: 220px;
  padding: 22px;
  border-radius: 6px;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  background: var(--green);
  color: #fffaf0;
}

.hospital-card span,
.hospital-card small {
  color: rgba(255, 250, 240, 0.72);
}

.hospital-card strong {
  font-size: 34px;
  line-height: 1.1;
}

.patient-badge {
  align-self: flex-start;
  padding: 7px 10px;
  border: 1px solid rgba(255, 250, 240, 0.42);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.12);
  color: #fffaf0;
  font-size: 14px;
  font-weight: 900;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stats-row div {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 252, 244, 0.86);
  box-shadow: var(--shadow);
}

.stats-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.stats-row strong {
  display: block;
  margin-top: 6px;
  color: var(--red);
  font-size: 30px;
  line-height: 1;
}

.ticker {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 6px;
}

.ticker span {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 3px;
  background: var(--red);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.ticker p {
  margin: 0;
  color: var(--green-dark);
  font-weight: 700;
}

.growth-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 12px;
  margin-bottom: 16px;
}

.patient-archive,
.daily-fortune {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 252, 244, 0.9);
  box-shadow: var(--shadow);
}

.patient-archive h2,
.daily-fortune h2 {
  margin-bottom: 14px;
  font-size: 24px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.archive-grid div {
  min-height: 76px;
  padding: 12px;
  border: 1px dashed rgba(36, 107, 79, 0.38);
  background: #fffdf8;
}

.archive-grid span,
.level-progress span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.archive-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--green-dark);
  font-size: 20px;
  line-height: 1.15;
}

.level-progress {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.level-progress i {
  display: block;
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(36, 107, 79, 0.3);
  border-radius: 999px;
  background: rgba(36, 107, 79, 0.08);
}

.level-progress b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 0.35s ease;
}

.fortune-paper {
  position: relative;
  min-height: 154px;
  padding: 16px;
  border: 1px solid rgba(189, 49, 36, 0.28);
  background:
    linear-gradient(transparent 27px, rgba(189, 49, 36, 0.06) 28px),
    #fff8e8;
  background-size: 100% 28px;
}

.fortune-paper span {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 8px;
  background: var(--red);
  color: #fffaf0;
  font-size: 13px;
  font-weight: 900;
}

.fortune-paper strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.25;
}

.fortune-paper p {
  margin: 10px 0 0;
  color: var(--green-dark);
  font-weight: 800;
  line-height: 1.55;
}

.daily-fortune .secondary-action {
  width: 100%;
  margin-top: 12px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.feature-card {
  min-height: 112px;
  padding: 16px;
  border-radius: 6px;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.feature-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.feature-card strong {
  display: block;
  font-size: 19px;
  line-height: 1.25;
}

.feature-card em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.feature-card.active,
.feature-card:hover {
  transform: translateY(-2px);
  border-color: var(--green);
  background: #f8fff3;
}

.workspace {
  margin-bottom: 16px;
}

.tool-panel {
  display: none;
  padding: 22px;
  border-radius: 6px;
}

.tool-panel.active {
  display: block;
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.panel-head h2 {
  margin-bottom: 8px;
  font-size: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

label,
.single-field {
  display: grid;
  gap: 8px;
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 800;
}

.wide,
.single-field {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 48px;
  padding: 0 12px;
}

textarea {
  min-height: 106px;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 107, 79, 0.12);
}

.primary-action,
.secondary-action {
  border: 0;
  border-radius: 5px;
  font-weight: 900;
}

.primary-action {
  width: 100%;
  height: 60px;
  margin-top: 18px;
  background: var(--red);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 14px 0 #7f1d16, 0 22px 28px rgba(189, 49, 36, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.primary-action:hover {
  filter: brightness(1.04);
}

.primary-action:active {
  transform: translateY(6px);
  box-shadow: 0 8px 0 #7f1d16, 0 12px 18px rgba(189, 49, 36, 0.22);
}

.primary-action.emergency {
  position: relative;
  overflow: hidden;
}

.primary-action.emergency::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 0 38%, rgba(255, 255, 255, 0.32) 45%, transparent 54% 100%);
  transform: translateX(-100%);
}

.primary-action.emergency:hover::after {
  animation: sweep 1.1s ease;
}

@keyframes sweep {
  to {
    transform: translateX(100%);
  }
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.68;
}

.woodfish-stage {
  position: relative;
  display: grid;
  width: min(360px, 100%);
  height: 250px;
  margin: 4px auto 22px;
  place-items: end center;
  isolation: isolate;
}

.woodfish-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 250px;
  height: 38px;
  border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(53, 34, 18, 0.28), transparent 70%);
  filter: blur(1px);
}

.woodfish-stage.gold-burst::after {
  content: "";
  position: absolute;
  inset: 18px 42px 28px;
  z-index: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 87, 0.42), rgba(255, 214, 87, 0.12) 42%, transparent 70%);
  animation: goldBurst 0.48s ease-out forwards;
  pointer-events: none;
}

@keyframes goldBurst {
  from {
    opacity: 0.85;
    transform: scale(0.72);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: scale(1.28);
    filter: blur(7px);
  }
}

.woodfish {
  position: relative;
  display: grid;
  width: 210px;
  height: 150px;
  margin: 0 auto 22px;
  place-items: center;
  border: 0;
  border-radius: 52% 52% 46% 46% / 60% 60% 40% 40%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 214, 137, 0.75) 0 9%, transparent 10%),
    radial-gradient(circle at 70% 32%, rgba(255, 214, 137, 0.22) 0 8%, transparent 9%),
    repeating-radial-gradient(ellipse at 50% 55%, rgba(255, 210, 128, 0.13) 0 3px, transparent 4px 12px),
    linear-gradient(135deg, #9b5b24 0%, #6e3d1d 42%, #432514 100%);
  color: #ffe2a2;
  font-size: 44px;
  font-weight: 900;
  box-shadow:
    inset 0 16px 24px rgba(255, 219, 148, 0.22),
    inset 0 -18px 26px rgba(35, 18, 7, 0.42),
    0 18px 0 #2f1b0e,
    0 28px 34px rgba(55, 34, 16, 0.26);
  transform-origin: 50% 78%;
}

.woodfish::before,
.woodfish::after {
  content: "";
  position: absolute;
  bottom: -13px;
  width: 60px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(#5b3218, #2e1a0e);
}

.woodfish::before {
  left: 34px;
}

.woodfish::after {
  right: 34px;
}

.woodfish-mouth {
  position: absolute;
  top: 48px;
  width: 110px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #1f120b 0 44%, #5a3117 45% 70%, transparent 71%);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.55);
}

.woodfish-core {
  position: relative;
  z-index: 2;
  transform: translateY(22px);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}

.woodfish-shine {
  position: absolute;
  inset: 15px 32px auto auto;
  width: 54px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 225, 166, 0.18);
  transform: rotate(22deg);
}

.woodfish.hit {
  animation: woodfishHit 0.22s cubic-bezier(0.2, 0.85, 0.26, 1.35);
}

.woodfish.hit::after {
  filter: brightness(1.18);
}

@keyframes woodfishHit {
  0% {
    transform: scale(1) rotate(0);
  }
  38% {
    transform: scale(0.94, 0.9) translateY(8px) rotate(-1.5deg);
  }
  72% {
    transform: scale(1.035, 1.02) translateY(-3px) rotate(1deg);
  }
  100% {
    transform: scale(1) translateY(0) rotate(0);
  }
}

.mallet {
  position: absolute;
  right: 42px;
  top: 8px;
  z-index: 3;
  width: 132px;
  height: 128px;
  transform: rotate(-28deg);
  transform-origin: 92px 110px;
  pointer-events: none;
}

.mallet::before {
  content: "";
  position: absolute;
  right: 16px;
  top: 52px;
  width: 104px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6e421f, #c1843c 48%, #593216);
  box-shadow: 0 3px 0 rgba(48, 24, 8, 0.45);
}

.mallet span {
  position: absolute;
  right: 0;
  top: 31px;
  width: 48px;
  height: 48px;
  border-radius: 15px;
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 220, 145, 0.5), transparent 30%),
    linear-gradient(135deg, #9b612d, #4f2b13);
  box-shadow: inset 0 -9px 12px rgba(27, 14, 6, 0.34), 0 8px 18px rgba(45, 28, 13, 0.24);
}

.mallet.hit {
  animation: malletHit 0.24s cubic-bezier(0.24, 0.92, 0.34, 1);
}

@keyframes malletHit {
  0% {
    transform: rotate(-28deg) translateY(0);
  }
  42% {
    transform: rotate(-7deg) translate(-20px, 62px);
  }
  100% {
    transform: rotate(-28deg) translateY(0);
  }
}

.merit-float-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}

.merit-pop {
  position: absolute;
  left: 50%;
  bottom: 122px;
  padding: 4px 8px;
  border: 1px solid rgba(189, 49, 36, 0.24);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.92);
  color: var(--red);
  font-size: 16px;
  font-weight: 900;
  transform: translateX(-50%);
  animation: meritPop 0.86s ease-out forwards;
  white-space: nowrap;
}

@keyframes meritPop {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.82);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift, 0px)), -76px) scale(1.08);
  }
}

.sound-ring {
  position: absolute;
  left: 50%;
  bottom: 82px;
  width: 80px;
  height: 80px;
  border: 2px solid rgba(200, 148, 47, 0.5);
  border-radius: 50%;
  transform: translateX(-50%);
  animation: soundRing 0.55s ease-out forwards;
  pointer-events: none;
}

@keyframes soundRing {
  to {
    width: 220px;
    height: 220px;
    opacity: 0;
    transform: translate(-50%, 18px);
  }
}

.merit-board {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.merit-board div {
  padding: 16px;
  border: 1px dashed var(--green);
  border-radius: 5px;
  background: #f8fff3;
}

.merit-board span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.merit-board strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.woodfish-line {
  margin: 0;
  color: var(--green-dark);
  text-align: center;
  font-size: 18px;
  font-weight: 900;
}

.persona-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.persona {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fffdf8;
  color: var(--ink);
  font-weight: 900;
}

.persona.active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.output-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: 6px;
  background:
    linear-gradient(transparent 31px, rgba(36, 107, 79, 0.08) 32px),
    rgba(255, 252, 244, 0.92);
  background-size: 100% 32px;
}

.output-card::after {
  content: "诊断专用";
  position: absolute;
  right: 28px;
  bottom: 34px;
  color: rgba(189, 49, 36, 0.08);
  font-size: 56px;
  font-weight: 900;
  transform: rotate(-10deg);
  pointer-events: none;
}

.output-card.printing .report-row {
  animation: printLine 0.38s ease both;
}

.output-card.printing .report-row:nth-child(2) {
  animation-delay: 0.1s;
}

.output-card.printing .report-row:nth-child(3) {
  animation-delay: 0.2s;
}

.output-card.printing .report-row:nth-child(4) {
  animation-delay: 0.3s;
}

.output-card.printing .report-row:nth-child(5) {
  animation-delay: 0.4s;
}

.output-card.printing .report-row:nth-child(6) {
  animation-delay: 0.5s;
}

@keyframes printLine {
  from {
    transform: translateY(-8px);
    opacity: 0;
    filter: blur(2px);
  }
  to {
    transform: translateY(0);
    opacity: 1;
    filter: blur(0);
  }
}

.diagnosis-console {
  margin-bottom: 16px;
  border: 1px solid #1b3f2f;
  border-radius: 6px;
  overflow: hidden;
  background: #07130e;
  box-shadow: var(--shadow);
}

.console-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(128, 255, 185, 0.2);
  color: #9ff1bd;
  font-size: 13px;
}

.console-title span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #bd3124;
}

.console-title span:nth-child(2) {
  background: #c8942f;
}

.console-title span:nth-child(3) {
  background: #38a36b;
  margin-right: 8px;
}

.console-lines {
  min-height: 118px;
  padding: 14px;
  color: #9ff1bd;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.8;
}

.console-lines p {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin: 0;
  text-shadow: 0 0 8px rgba(159, 241, 189, 0.3);
}

.console-lines em {
  color: #f3cc71;
  font-style: normal;
  letter-spacing: 1px;
  white-space: nowrap;
}

.screen-shake {
  animation: shake 0.28s linear;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.stamp {
  position: absolute;
  top: 20px;
  right: -30px;
  width: 150px;
  padding: 8px 0;
  transform: rotate(28deg);
  background: var(--red);
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

.output-card h2 {
  margin-bottom: 14px;
  font-size: 30px;
}

.output-body {
  display: grid;
  gap: 12px;
}

.report-row {
  padding: 13px 14px;
  border-left: 4px solid var(--green);
  background: #fffdf8;
}

.report-row strong {
  display: block;
  margin-bottom: 5px;
  color: var(--red);
}

.output-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.feedback-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.feedback-row button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdf8;
  color: var(--green-dark);
  font-weight: 900;
}

.feedback-row button:hover {
  border-color: var(--green);
  background: #f8fff3;
}

.secondary-action {
  min-height: 46px;
  border: 1px solid var(--green);
  background: #f8fff3;
  color: var(--green-dark);
}

.risk-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

#shareCanvas {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 999px;
  transform: translate(-50%, 18px);
  background: var(--ink);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

@media (max-width: 780px) {
  .app-shell {
    padding: 14px 12px 30px;
  }

  .hero,
  .growth-row,
  .stats-row,
  .feature-grid,
  .form-grid,
  .merit-board,
  .persona-list,
  .output-actions {
    grid-template-columns: 1fr;
  }

  .archive-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-copy,
  .hospital-card {
    min-height: auto;
  }

  .feature-card {
    min-height: 88px;
  }

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

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
