@import url("https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=Noto+Serif+SC:wght@500;700;900&display=swap");

:root {
  color-scheme: light;
  --bg: #061d18;
  --bg-2: #0b3129;
  --card: #fff8e8;
  --card-2: #fffdf5;
  --cream: #f7ecd0;
  --ink: #17352d;
  --deep: #072b22;
  --deep-2: #0d3d30;
  --muted: #6e7e71;
  --gold: #e1b35f;
  --gold-2: #ffe0a0;
  --orange: #d96d2f;
  --green: #286a4f;
  --danger: #dc2626;
  --danger-dark: #991b1b;
  --danger-soft: #fff1f2;
  --line: rgba(23, 53, 45, 0.14);
  --line-strong: rgba(23, 53, 45, 0.22);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Noto Serif SC", "PingFang SC", "Microsoft YaHei", serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% -8%, rgba(225, 179, 95, 0.28), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(73, 154, 120, 0.22), transparent 28%),
    linear-gradient(160deg, #061d18 0%, #0b3129 48%, #04110f 100%);
  padding: 0 0 calc(92px + var(--safe-bottom));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image:
    linear-gradient(30deg, rgba(255, 255, 255, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.08) 87.5%, rgba(255, 255, 255, 0.08)),
    linear-gradient(150deg, rgba(255, 255, 255, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(255, 255, 255, 0.08) 87.5%, rgba(255, 255, 255, 0.08));
  background-size: 86px 50px;
}

button,
input { font: inherit; }

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

a { color: inherit; }

.app-frame {
  width: min(430px, 100%);
  margin: 0 auto;
}

.topbar {
  position: relative;
  z-index: 30;
  padding: max(14px, env(safe-area-inset-top, 0px)) 14px 0;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 22px;
  padding: 12px 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(12px);
}

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

.brand::before {
  content: "";
  width: 4px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-2), var(--orange));
  box-shadow: 0 0 18px rgba(225, 179, 95, 0.38);
  flex: 0 0 auto;
}

.brand img { display: none; }

.brand-title {
  margin: 0;
  color: #fff;
  font-size: 18px;
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1.35;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.version-pill {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--deep);
  background: var(--gold-2);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

main { padding: 0 14px; }

.hero,
.emergency-hero {
  position: relative;
  margin: 14px 0 14px;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.hero-alert {
  position: relative;
  min-height: 184px;
  padding: 18px 10px 46px;
  color: #fff;
  background: transparent;
  overflow: hidden;
}

.hero-alert::after {
  content: "急";
  position: absolute;
  right: -8px;
  top: -30px;
  z-index: 0;
  color: rgba(255, 255, 255, 0.08);
  font-family: "Ma Shan Zheng", cursive;
  font-size: 142px;
  line-height: 1;
  transform: rotate(-10deg);
}

body[data-guide="snake"] .hero-alert::after { content: "蛇"; }
body[data-guide="cpr"] .hero-alert::after { content: "救"; }
body[data-guide="hot"] .hero-alert::after { content: "暑"; }
body[data-guide="sos"] .hero-alert::after { content: "安"; }
body[data-guide="fishbone"] .hero-alert::after { content: "刺"; }
body[data-guide="bleeding"] .hero-alert::after { content: "血"; }
body[data-guide="cold"] .hero-alert::after { content: "冷"; }
body[data-guide="electric"] .hero-alert::after { content: "电"; }

.hero-alert > * { position: relative; z-index: 1; }

.hero-alert-row { display: block; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  border: 1px solid rgba(225, 179, 95, 0.55);
  border-radius: 999px;
  padding: 6px 11px;
  color: var(--gold-2);
  background: rgba(225, 179, 95, 0.14);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.hero-kicker::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #69e0a7;
  box-shadow: 0 0 18px #69e0a7;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: 34px;
  line-height: 1.12;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.hero-alert p:not(.hero-kicker) {
  margin: 13px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  line-height: 1.85;
  font-weight: 700;
}

.hero-alert strong { color: #fff; }

.hero-body {
  position: relative;
  z-index: 3;
  margin-top: -30px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 28px;
  padding: 18px;
  background: linear-gradient(180deg, var(--card-2), var(--cream));
  box-shadow: var(--shadow);
}

.primary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 13px;
  padding: 5px;
  border-radius: 17px;
  background: rgba(23, 53, 45, 0.08);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.button:active { transform: translateY(1px); }

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--danger), var(--danger-dark));
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.22);
  font-size: 16px;
}

.button-dark,
.button-accent {
  color: var(--gold-2);
  background: var(--deep);
  box-shadow: 0 8px 18px rgba(23, 53, 45, 0.18);
}

.button-ghost,
.button-soft {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line-strong);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 13px;
}

.action-card {
  min-height: 116px;
  padding: 12px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.52);
}

.action-number {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-bottom: 8px;
  border-radius: 12px;
  color: var(--gold-2);
  background: var(--deep);
  font-size: 14px;
  font-weight: 900;
}

.action-card strong {
  display: block;
  color: var(--deep);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 900;
}

.action-card p {
  margin: 7px 0 0;
  color: #40594e;
  font-size: 13px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.do-not {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 13px;
}

.do-not span {
  border: 1px solid rgba(217, 109, 47, 0.2);
  border-radius: 15px;
  padding: 9px 8px;
  color: #8a3b17;
  background: rgba(217, 109, 47, 0.1);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  font-weight: 900;
}

.status-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.54);
}

.status-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  border-bottom: 1px solid rgba(23, 53, 45, 0.1);
}

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

.status-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.status-value {
  margin: 4px 0 0;
  color: var(--deep);
  font-size: 15px;
  line-height: 1.42;
  font-weight: 900;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.status-action {
  min-width: 58px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 8px 10px;
  color: var(--deep);
  background: rgba(255, 255, 255, 0.68);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.quick-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px 0 14px;
  padding: 2px 0 6px;
  scrollbar-width: none;
}

.quick-nav::-webkit-scrollbar { display: none; }

.quick-nav a {
  flex: 0 0 auto;
  border: 1px solid rgba(225, 179, 95, 0.45);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--gold-2);
  background: rgba(225, 179, 95, 0.12);
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.card {
  position: relative;
  margin: 14px 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 28px;
  padding: 18px;
  background: linear-gradient(180deg, var(--card-2), var(--cream));
  box-shadow: var(--shadow);
}

.section-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}

main { counter-reset: guide-section; }
main > .card { counter-increment: guide-section; }

.section-head::before {
  content: counter(guide-section, decimal-leading-zero);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 14px;
  color: var(--gold-2);
  background: var(--deep);
  font-size: 16px;
  font-weight: 900;
}

.section-kicker { display: none; }

.section-head h2,
.card h2 {
  margin: 0;
  color: var(--deep);
  font-size: 22px;
  line-height: 1.25;
  font-weight: 900;
}

.card h3 {
  margin: 0 0 9px;
  color: var(--deep);
  font-size: 17px;
  line-height: 1.35;
  font-weight: 900;
}

.lead {
  margin: 0 0 13px;
  color: #40594e;
  font-size: 15px;
  line-height: 1.85;
  font-weight: 700;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.two-col,
.signal-grid,
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.signal-card,
.info-card,
.snake-card,
.call-script,
.warning-box,
.source-list {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.signal-card.high,
.signal-card.warn {
  border-color: rgba(217, 109, 47, 0.2);
  background: rgba(217, 109, 47, 0.08);
}

.signal-card strong,
.info-card strong,
.snake-card strong {
  display: block;
  color: var(--deep);
  font-size: 16px;
  line-height: 1.4;
  font-weight: 900;
}

.signal-card p,
.info-card p,
.snake-card p {
  margin: 7px 0 0;
  color: #40594e;
  font-size: 14px;
  line-height: 1.75;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.check-list,
.dont-list {
  margin: 0;
  padding-left: 21px;
  color: #40594e;
  font-size: 14px;
  line-height: 1.85;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.check-list li,
.dont-list li { margin: 5px 0; }

.dont-list strong,
.check-list strong { color: var(--orange); }

.warning-box {
  margin-top: 12px;
  color: #7c2d12;
  background: rgba(217, 109, 47, 0.1);
  border-color: rgba(217, 109, 47, 0.2);
  font-size: 14px;
  line-height: 1.75;
  font-weight: 800;
}

.helper-actions,
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 13px;
}

.call-script {
  display: grid;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.script-line {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 13px;
  border-bottom: 1px solid rgba(23, 53, 45, 0.1);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.script-line:last-child { border-bottom: 0; }

.script-line strong {
  color: var(--deep);
  font-weight: 900;
}

.script-line span {
  color: #40594e;
  line-height: 1.65;
}

.source-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.source-list a {
  color: #40594e;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

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

.toolbox-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  text-decoration: none;
}

.toolbox-card:active {
  transform: translateY(1px);
}

.toolbox-card img {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  padding: 8px;
  background: rgba(23, 53, 45, 0.08);
}

.toolbox-card strong {
  display: block;
  color: var(--deep);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 900;
}

.toolbox-card p {
  margin: 5px 0 0;
  color: #40594e;
  font-size: 13px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.toolbox-card span {
  border-radius: 999px;
  padding: 6px 9px;
  color: #8a3b17;
  background: rgba(217, 109, 47, 0.1);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.toolbox-note {
  margin: 14px 0 0;
  border: 1px solid rgba(217, 109, 47, 0.2);
  border-radius: 20px;
  padding: 13px 14px;
  color: #7c2d12;
  background: rgba(217, 109, 47, 0.1);
  font-size: 14px;
  line-height: 1.75;
  font-weight: 800;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

footer {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 8px 18px 22px;
  color: rgba(255, 255, 255, 0.64);
  text-align: center;
  font-size: 12px;
  line-height: 1.75;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

footer a { color: rgba(255, 255, 255, 0.82); }

.bottom-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  padding: 10px 12px calc(10px + var(--safe-bottom));
  background: rgba(6, 29, 24, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(18px);
}

.bottom-actions-inner {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr 0.76fr;
  gap: 9px;
  width: min(430px, 100%);
  margin: 0 auto;
}

.bottom-actions .button {
  min-height: 48px;
  border-radius: 16px;
  padding: 10px 8px;
  font-size: 14px;
}

.bottom-actions .button-ghost {
  color: var(--deep);
  background: var(--cream);
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 18px;
  background: rgba(4, 17, 15, 0.72);
  align-items: center;
  justify-content: center;
}

.modal.show { display: flex; }

.modal-content {
  width: min(100%, 390px);
  max-height: min(82vh, 760px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  background: linear-gradient(180deg, var(--card-2), var(--cream));
  box-shadow: var(--shadow);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px;
  background: rgba(255, 253, 245, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.modal-head h2 {
  margin: 0;
  color: var(--deep);
  font-size: 20px;
  font-weight: 900;
}

.close-button {
  border: 0;
  border-radius: 999px;
  width: 34px;
  height: 34px;
  color: var(--deep);
  background: rgba(23, 53, 45, 0.1);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-body { padding: 15px; }

.check-group { margin-top: 13px; }

.check-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(23, 53, 45, 0.1);
  color: #40594e;
  font-size: 14px;
  line-height: 1.55;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.check-item input {
  width: 20px;
  height: 20px;
  margin-top: 1px;
  accent-color: var(--green);
}

.result-box {
  display: none;
  margin-top: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-line;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

.result-box.show { display: block; }

.modal-actions {
  position: sticky;
  bottom: -15px;
  padding: 10px 0 15px;
  background: linear-gradient(180deg, rgba(255, 253, 245, 0.75), var(--cream) 40%);
}

.offline-warning {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(10px + env(safe-area-inset-top, 0px));
  z-index: 90;
  width: min(calc(100% - 24px), 406px);
  margin: 0 auto;
  border: 1px solid rgba(217, 109, 47, 0.2);
  border-radius: 999px;
  padding: 10px 14px;
  color: #7c2d12;
  background: #fff8e8;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 380px) {
  .topbar { padding-left: 10px; padding-right: 10px; }
  main { padding-left: 10px; padding-right: 10px; }
  h1 { font-size: 31px; }
  .hero-alert { min-height: 174px; padding-left: 4px; padding-right: 4px; }
  .hero-body,
  .card { padding: 15px; border-radius: 24px; }
  .action-grid { grid-template-columns: 1fr; }
  .action-card { min-height: 0; }
  .helper-actions,
  .modal-actions { grid-template-columns: 1fr; }
  .script-line { grid-template-columns: 1fr; gap: 4px; }
}
