:root {
  --bg: #f5f1e8;
  --paper: #fffdf8;
  --ink: #13231d;
  --muted: #69736d;
  --line: #e0e8df;
  --green: #0f4c3e;
  --green-2: #1f7a60;
  --green-soft: #eaf5ef;
  --orange: #f07b22;
  --orange-soft: #fff3e9;
  --purple: #8a63e6;
  --purple-soft: #f3efff;
  --blue: #287de3;
  --blue-soft: #edf6ff;
  --cyan: #1aa8a4;
  --cyan-soft: #e9fbfa;
  --gold: #d6a342;
  --shadow: 0 16px 38px rgba(31, 51, 39, 0.12);
  --radius: 8px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: #ebe5d9;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

.phone-app {
  width: min(100%, 430px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 32%),
    linear-gradient(180deg, #fbfaf6 0%, #f5f1e8 54%, #fffdf8 100%);
  overflow: hidden;
}

.home-screen,
.tool-screen,
.upload-screen {
  min-height: 100vh;
  min-height: 100dvh;
}

.home-screen {
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 72px;
  padding: max(14px, env(safe-area-inset-top)) 18px 12px;
  border-bottom: 1px solid rgba(19, 35, 29, 0.08);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.leaf-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  color: var(--green);
}

.leaf-mark path {
  fill: currentColor;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.leaf-mark path[fill="none"] {
  fill: none;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
  line-height: 1.14;
}

.brand-lockup strong {
  color: var(--green);
  font-size: 17px;
  font-weight: 900;
}

.brand-lockup small {
  margin-top: 5px;
  color: #68645c;
  font-size: 14px;
  font-weight: 900;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.portal-home-button,
.library-button,
.avatar-button {
  min-height: 42px;
  border: 0;
  background: rgba(244, 241, 233, 0.9);
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(31, 51, 39, 0.08);
}

.portal-home-button,
.library-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.portal-home-button svg,
.library-button svg {
  width: 18px;
  height: 18px;
}

.portal-home-button path,
.library-button path,
.avatar-button path {
  fill: none;
  stroke: var(--green);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.library-button path,
.avatar-button path {
  fill: var(--green);
  stroke: none;
}

.avatar-button {
  display: grid;
  width: 42px;
  place-items: center;
  border-radius: 50%;
}

.avatar-button svg {
  width: 22px;
  height: 22px;
}

.hero-card {
  position: relative;
  min-height: 226px;
  padding: 34px 20px 20px;
  background:
    linear-gradient(90deg, rgba(249, 245, 235, 0.98) 0%, rgba(249, 245, 235, 0.9) 34%, rgba(249, 245, 235, 0.42) 64%, rgba(249, 245, 235, 0.12) 100%),
    url("assets/mobile-tea-hero.png") center right / cover no-repeat;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 56px;
  background: linear-gradient(180deg, rgba(245, 241, 232, 0), rgba(245, 241, 232, 1));
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 220px;
  text-align: left;
}

.hero-copy h1 {
  margin: 0;
  color: var(--green);
  font-size: clamp(18px, 5vw, 24px);
  font-weight: 900;
  line-height: 1.32;
  letter-spacing: 0;
  text-align: left;
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.hero-points span {
  position: relative;
  padding-left: 20px;
  color: #34433d;
  font-size: 15px;
  font-weight: 800;
}

.hero-points span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e7f2e9;
}

.hero-points span::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 7px;
  width: 5px;
  height: 8px;
  border: solid #76a678;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.hint-bar {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: calc(100% - 32px);
  min-height: 56px;
  margin: -10px auto 18px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  color: #59625c;
  box-shadow: var(--shadow);
  text-align: left;
  font-size: 15px;
  font-weight: 800;
}

.hint-bar span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--gold);
}

.hint-bar svg path {
  fill: currentColor;
}

.hint-bar i {
  color: #7d8982;
  font-size: 27px;
  font-style: normal;
  line-height: 1;
}

.canvas-entry-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: calc(100% - 32px);
  min-height: 82px;
  margin: 0 auto 18px;
  padding: 13px 14px;
  border: 1px solid rgba(31, 122, 96, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(15, 76, 62, 0.98), rgba(31, 122, 96, 0.94)),
    #0f4c3e;
  color: #fffdf8;
  text-decoration: none;
  box-shadow: 0 16px 32px rgba(15, 76, 62, 0.22);
}

.canvas-entry-card:active {
  transform: translateY(2px);
}

.canvas-entry-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
}

.canvas-entry-icon img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.canvas-entry-card strong,
.canvas-entry-card small {
  display: block;
  min-width: 0;
}

.canvas-entry-card strong {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.22;
}

.canvas-entry-card small {
  margin-top: 5px;
  color: rgba(255, 253, 248, 0.82);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.42;
}

.canvas-entry-card b {
  font-size: 30px;
  line-height: 1;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 0 16px;
}

.feature-card {
  display: grid;
  min-height: 206px;
  padding: 16px 14px;
  border: 1px solid rgba(15, 76, 62, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.feature-card:active {
  transform: translateY(2px);
}

.feature-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: var(--radius);
  margin-bottom: 13px;
}

.feature-icon svg {
  width: 34px;
  height: 34px;
}

.feature-icon path,
.feature-icon circle {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.feature-card strong {
  color: var(--ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.18;
}

.feature-card small {
  display: block;
  min-height: 48px;
  margin-top: 9px;
  color: #4d5c55;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.55;
}

.feature-card em {
  align-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  margin-top: 14px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 15px;
  font-style: normal;
  font-weight: 900;
}

.feature-card.green {
  color: #48a552;
}

.feature-card.green .feature-icon,
.feature-card.green em {
  background: var(--green-soft);
  color: #35a14a;
  border: 1px solid #cde8d4;
}

.feature-card.orange {
  color: var(--orange);
}

.feature-card.orange .feature-icon,
.feature-card.orange em {
  background: var(--orange-soft);
  color: var(--orange);
  border: 1px solid #ffd8bb;
}

.feature-card.purple {
  color: var(--purple);
}

.feature-card.purple .feature-icon,
.feature-card.purple em {
  background: var(--purple-soft);
  color: var(--purple);
  border: 1px solid #ded0ff;
}

.feature-card.blue {
  color: var(--blue);
}

.feature-card.blue .feature-icon,
.feature-card.blue em {
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid #cbe3ff;
}

.feature-card.cyan {
  color: var(--cyan);
}

.feature-card.cyan .feature-icon,
.feature-card.cyan em {
  background: var(--cyan-soft);
  color: var(--cyan);
  border: 1px solid #c6ecea;
}

.usage-panel,
.example-panel {
  margin: 18px 16px 0;
  padding: 16px;
  border: 1px solid rgba(15, 76, 62, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.section-title strong {
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
}

.section-title span,
.section-title button {
  border: 0;
  background: transparent;
  color: #8b928d;
  font-size: 14px;
  font-weight: 800;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.usage-grid div {
  min-height: 108px;
  padding: 12px 10px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(250, 247, 240, 0.96), rgba(255, 255, 255, 0.92));
  text-align: center;
}

.mini-icon {
  display: inline-block;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
}

.green-dot {
  background: var(--green-soft);
}

.orange-dot {
  background: var(--orange-soft);
}

.purple-dot {
  background: var(--purple-soft);
}

.blue-dot {
  background: var(--blue-soft);
}

.usage-grid strong,
.usage-grid small,
.usage-grid em {
  display: block;
}

.usage-grid strong {
  margin-top: 4px;
  color: #111d18;
  font-size: 31px;
  font-weight: 900;
  line-height: 1;
}

.usage-grid small {
  margin-top: 7px;
  color: #26332d;
  font-size: 13px;
  font-weight: 900;
}

.usage-grid em {
  margin-top: 5px;
  color: #369f52;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.example-panel {
  box-shadow: none;
  background: transparent;
  border: 0;
  padding: 0;
}

.example-list {
  display: grid;
  gap: 10px;
}

.example-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  text-align: left;
}

.example-item .feature-icon {
  width: 36px;
  height: 36px;
  margin: 0;
}

.example-item .feature-icon svg {
  width: 22px;
  height: 22px;
}

.example-item strong {
  display: block;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
}

.example-item small {
  display: block;
  margin-top: 2px;
  color: #2c332f;
  font-size: 13px;
  font-weight: 800;
}

.example-item b {
  color: currentColor;
  font-size: 22px;
}

.tip-line {
  margin: 18px 16px 0;
  padding: 12px;
  border: 1px solid #d5e9d8;
  border-radius: var(--radius);
  background: #f0f8ef;
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.home-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 16px 0;
  color: #89908c;
  font-size: 12px;
  font-weight: 800;
}

.tool-screen,
.upload-screen {
  padding: max(16px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}

.screen-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 4px 0 18px;
}

.back-button {
  min-width: 74px;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--green);
  font-size: 19px;
  font-weight: 900;
}

h1 {
  margin: 0;
  color: var(--green);
  font-size: 29px;
  font-weight: 900;
  line-height: 1.18;
  text-align: right;
}

.main-input,
.upload-picker {
  display: grid;
  gap: 10px;
}

.main-input span,
.upload-picker span,
.uploaded-list strong {
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
}

textarea,
.upload-picker input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(42, 33, 20, 0.08);
  outline: none;
}

textarea {
  min-height: 238px;
  padding: 16px;
  resize: vertical;
  font-size: 21px;
  line-height: 1.55;
}

textarea:focus,
.upload-picker input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(24, 61, 50, 0.12);
}

.generate-button {
  width: 100%;
  min-height: 68px;
  margin-top: 16px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--green-2), var(--green));
  color: #fffdf8;
  box-shadow: 0 16px 28px rgba(24, 61, 50, 0.26);
  font-size: 26px;
  font-weight: 900;
}

.generate-button:disabled {
  opacity: 0.72;
}

.friendly-note {
  min-height: 28px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.result-box,
.uploaded-list {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.copy-button {
  width: 100%;
  min-height: 64px;
  border: 0;
  border-radius: var(--radius);
  background: #c98b34;
  color: #fffdf8;
  font-size: 24px;
  font-weight: 900;
}

pre {
  margin: 14px 0 0;
  white-space: pre-wrap;
  color: #20251f;
  font-family: inherit;
  font-size: 20px;
  line-height: 1.62;
}

.upload-picker {
  padding: 16px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.upload-picker input {
  padding: 14px;
  font-size: 18px;
}

.uploaded-list ul {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 12px 0 0;
  list-style: none;
}

.uploaded-list li {
  padding: 12px;
  border-radius: var(--radius);
  background: #f5efe4;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 50;
  width: min(390px, calc(100vw - 28px));
  padding: 14px 16px;
  border-radius: var(--radius);
  background: #171b18;
  color: #fffdf8;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 18px;
  font-weight: 800;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 360px) {
  .app-topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .leaf-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .brand-lockup strong {
    font-size: 15px;
  }

  .brand-lockup small {
    font-size: 12px;
  }

  .library-button {
    padding: 0 10px;
    font-size: 12px;
  }

  .portal-home-button {
    width: 42px;
    justify-content: center;
    padding: 0;
    font-size: 0;
  }

  .avatar-button {
    display: none;
  }

  .hero-copy h1 {
    font-size: 18px;
  }

  .feature-card {
    min-height: 198px;
    padding: 14px 12px;
  }

  .feature-card strong {
    font-size: 17px;
  }

  .feature-card small {
    font-size: 13px;
  }
}

@media (min-width: 760px) {
  body {
    background:
      linear-gradient(90deg, rgba(24, 61, 50, 0.06) 1px, transparent 1px),
      linear-gradient(rgba(24, 61, 50, 0.06) 1px, transparent 1px),
      #e8dfd0;
    background-size: 36px 36px;
  }

  .phone-app {
    margin-top: 22px;
    margin-bottom: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 26px 60px rgba(42, 33, 20, 0.18);
  }
}
