:root {
  color-scheme: light;
  --bg: #82d2a7;
  --bg-deep: #5cb89a;
  --panel: #fff8ec;
  --panel-soft: #fdfdf5;
  --text: #794f27;
  --text-deep: #62452e;
  --muted: #9f927d;
  --muted-soft: #a89776;
  --line: #e8dcc8;
  --line-strong: #aaa69d;
  --primary: #19c8b9;
  --primary-strong: #008077;
  --primary-soft: #e6f9f6;
  --accent: #f1e26f;
  --accent-warm: #e59266;
  --teal: #19c8b9;
  --teal-dark: #008077;
  --warning: #f5c31c;
  --button-shadow: #bdaea0;
  --shadow: 0 10px 0 rgba(121, 79, 39, 0.16), 0 26px 60px rgba(56, 105, 81, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 6%, rgba(255, 248, 236, 0.28), transparent 20%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.1), transparent 44%),
    linear-gradient(180deg, #a8e0c6 0%, var(--bg) 60%, var(--bg-deep) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Nunito", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    url("data:image/svg+xml,%3Csvg width='150' height='150' viewBox='0 0 150 150' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%234c9c78' stroke-width='7' stroke-linecap='round' opacity='.22'%3E%3Cpath d='M52 20c39 8 58 38 51 82-41-6-66-30-66-67 0-9 6-15 15-15Z'/%3E%3Cpath d='M54 32c16 24 25 46 27 67M50 49l26 8M46 68l31 9M49 86l31 11'/%3E%3Cpath d='M114 30c16 4 24 17 20 35-18-3-29-14-29-29 0-4 4-7 9-6Z'/%3E%3Cpath d='M117 38c7 9 11 18 12 27'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 170px 170px;
  opacity: 0.62;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 46px;
}

.intro {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  margin-bottom: 26px;
  min-height: 150px;
}

.intro p {
  margin: 0 0 8px;
  color: rgba(98, 69, 46, 0.78);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 248, 236, 0.5);
}

.intro h1 {
  margin: 0;
  max-width: 620px;
  color: #fff8ec;
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 900;
  line-height: 1.08;
  text-shadow: 0 5px 0 rgba(98, 69, 46, 0.22);
}

.mascot-scene {
  position: relative;
  width: min(260px, 28vw);
  min-width: 190px;
  height: 150px;
}

.leaf {
  position: absolute;
  border-radius: 70% 12% 70% 12%;
  background: #fff8ec;
  opacity: 0.94;
  transform: rotate(-24deg);
  box-shadow: 0 8px 0 rgba(98, 69, 46, 0.12);
}

.leaf::after {
  content: "";
  position: absolute;
  inset: 18% 48% 12% auto;
  width: 3px;
  border-radius: 999px;
  background: rgba(98, 69, 46, 0.25);
  transform: rotate(-12deg);
}

.leaf-a {
  left: 8px;
  top: 48px;
  width: 84px;
  height: 54px;
}

.leaf-b {
  right: 2px;
  top: 18px;
  width: 66px;
  height: 44px;
  background: #b8e6cb;
  transform: rotate(28deg);
}

.mascot {
  position: absolute;
  left: 80px;
  top: 18px;
  width: 118px;
  height: 126px;
}

.mascot span {
  position: absolute;
  display: block;
}

.mascot .ear {
  top: 0;
  width: 32px;
  height: 32px;
  border: 7px solid #7e4f36;
  border-radius: 50%;
  background: #efa8a0;
}

.mascot .ear.left {
  left: 12px;
}

.mascot .ear.right {
  right: 12px;
}

.mascot .face {
  left: 15px;
  top: 15px;
  width: 88px;
  height: 78px;
  border-radius: 48% 48% 44% 44%;
  background: #a76b44;
  box-shadow: 0 8px 0 rgba(98, 69, 46, 0.16);
}

.mascot .eye {
  top: 42px;
  width: 19px;
  height: 28px;
  border: 5px solid #fff8ec;
  border-radius: 50%;
  background: #5faee2;
}

.mascot .eye.left {
  left: 32px;
}

.mascot .eye.right {
  right: 32px;
  background: #73513b;
}

.mascot .nose {
  left: 50px;
  top: 70px;
  width: 20px;
  height: 14px;
  border-radius: 50%;
  background: #4a3024;
}

.mascot .body {
  left: 24px;
  top: 88px;
  width: 72px;
  height: 38px;
  border-radius: 18px 18px 28px 28px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.82) 0 7px, transparent 7px 14px),
    #62c9aa;
  box-shadow: 0 8px 0 rgba(98, 69, 46, 0.16);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(360px, 0.92fr);
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 2.5px solid rgba(121, 79, 39, 0.14);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 24px;
}

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

.panel-header h2,
.section-title {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
}

.panel-header span {
  color: var(--muted);
  font-size: 14px;
  text-align: right;
  font-weight: 700;
}

.section-title {
  margin-top: 26px;
  margin-bottom: 16px;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--panel-soft);
  color: var(--text);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input,
select {
  height: 44px;
  padding: 0 14px;
}

textarea {
  min-height: 170px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

button {
  min-height: 45px;
  border: 2px solid var(--line-strong);
  border-radius: 999px;
  background: #f8f8f0;
  color: var(--text);
  padding: 0 22px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 5px 0 var(--button-shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 0 var(--button-shadow);
}

button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--button-shadow);
}

button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff8ec;
  box-shadow: 0 5px 0 var(--primary-strong);
}

button.primary:hover {
  background: #3dd4c6;
  border-color: #3dd4c6;
  box-shadow: 0 6px 0 var(--primary-strong);
}

button.primary:active {
  background: #50b9ab;
  box-shadow: 0 1px 0 var(--primary-strong);
}

.result-panel {
  position: sticky;
  top: 18px;
}

.result-card {
  position: relative;
  border: 2px solid rgba(121, 79, 39, 0.14);
  border-radius: 28px;
  background: #fff8ec;
  padding: 22px 22px 18px;
  box-shadow: 0 6px 0 rgba(121, 79, 39, 0.08);
  overflow: hidden;
}

.result-card.is-calculated::before {
  content: "已计算";
  position: absolute;
  right: 18px;
  top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px 0 36px;
  border-radius: 999px;
  background: #fdfdf5;
  border: 1.5px solid rgba(121, 79, 39, 0.14);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

.result-card.is-calculated::after {
  content: "";
  position: absolute;
  right: 80px;
  top: 22px;
  width: 24px;
  height: 24px;
  background: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='5.5' cy='5.5' r='3.4' fill='%238b5a3c'/%3E%3Ccircle cx='18.5' cy='5.5' r='3.4' fill='%238b5a3c'/%3E%3Ccircle cx='5.5' cy='6' r='1.8' fill='%23f4a8b8'/%3E%3Ccircle cx='18.5' cy='6' r='1.8' fill='%23f4a8b8'/%3E%3Ccircle cx='12' cy='13' r='8.5' fill='%23a06a3c'/%3E%3Cellipse cx='12' cy='15.2' rx='4.4' ry='3.4' fill='%23f4e0c2'/%3E%3Ccircle cx='9' cy='11.5' r='1.6' fill='%23ffffff'/%3E%3Ccircle cx='15' cy='11.5' r='1.6' fill='%23ffffff'/%3E%3Ccircle cx='9.3' cy='11.8' r='0.85' fill='%231a3d6e'/%3E%3Ccircle cx='15.3' cy='11.8' r='0.85' fill='%231a3d6e'/%3E%3Cellipse cx='12' cy='14.4' rx='1.4' ry='1.1' fill='%23111111'/%3E%3Cpath d='M10.5 17 Q12 18 13.5 17' stroke='%23111111' stroke-width='0.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.result-topline {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding-right: 130px;
}

.result-topline span,
.result-topline strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-topline strong {
  border-radius: 999px;
  background: #fdfdf5;
  border: 1.4px solid var(--accent-warm);
  color: var(--accent-warm);
  padding: 6px 14px;
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
}

.value {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin: 20px 0 14px;
  color: var(--teal-dark);
  font-size: 52px;
  font-weight: 900;
  line-height: 1;
}

.value::after {
  content: "";
  position: absolute;
  left: 2px;
  right: -4px;
  bottom: -8px;
  height: 8px;
  z-index: -1;
  background: url("data:image/svg+xml,%3Csvg width='200' height='10' viewBox='0 0 200 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 5 Q10 -3 20 5 T40 5 T60 5 T80 5 T100 5 T120 5 T140 5 T160 5 T180 5 T200 5' stroke='%23f1e26f' stroke-width='4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left bottom / 80px 10px;
}

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

.metrics div {
  position: relative;
  min-height: 74px;
  border: 2px dashed #e0d5bf;
  border-radius: 20px;
  background: #faf8f2;
  padding: 12px 14px 12px 30px;
}

.metrics div::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

dt {
  color: var(--muted-soft);
  font-size: 13px;
  font-weight: 700;
}

dd {
  margin: 6px 0 0;
  color: var(--text);
  font-weight: 900;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.details {
  display: grid;
  gap: 6px;
  margin: 22px 0 0;
  padding-top: 20px;
  background:
    url("data:image/svg+xml,%3Csvg width='297' height='14' viewBox='0 0 297 14' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 10.42L33 11 28.002 0zM10 6.97L0 3l.858 9zM43 1l.613 11L53 5.585zm89 13l11-5.867L133.507 1zm67-3.58l13 .58-4.998-11zm-10-3.45L179 3l.858 9zM90.634 1L88 13l12-4.39zM155 13l12-2.4-8.47-9.6zM110 3l2.057 9L118 6.292zm-47 8.215L76 14 71.048 1zM222 1l.613 11L232 5.585zm47.634 0L267 13l12-4.39zM289 3l2.057 9L297 6.292zm-48 8.215L254 14l-4.952-13z' fill='%23d8d0c3' fill-rule='evenodd'/%3E%3C/svg%3E") center 0 / 200px 14px repeat-x;
}

.details div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed rgba(121, 79, 39, 0.12);
  padding: 8px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.details div:last-child {
  border-bottom: 0;
}

.details dd {
  color: var(--text);
  text-align: right;
  font-weight: 800;
  font-size: 14px;
}

.export-actions {
  margin-bottom: 18px;
}

.markdown-box {
  margin-top: 0;
}

.status-error {
  color: #b04a37 !important;
}

.status-ok {
  color: var(--primary) !important;
}

.status-warn {
  color: var(--warning) !important;
}

.site-footer {
  width: min(1180px, calc(100% - 32px));
  margin: -22px auto 28px;
  color: rgba(255, 248, 236, 0.88);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 0 rgba(98, 69, 46, 0.16);
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

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

  .mascot-scene {
    width: 210px;
    min-width: 170px;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 20px 0;
  }

  .panel {
    border-radius: 22px;
    padding: 16px;
  }

  .intro {
    min-height: 0;
  }

  .mascot-scene {
    display: none;
  }

  .field-grid,
  .metrics {
    grid-template-columns: 1fr;
  }

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

  .panel-header span {
    text-align: left;
  }

  .value {
    font-size: 38px;
  }
}
