:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --panel: #ffffff;
  --ink: #182026;
  --muted: #66727c;
  --line: #dce4df;
  --accent: #0e8f6e;
  --accent-strong: #07765a;
  --accent-soft: #e7f6f1;
  --blue: #2d6cdf;
  --amber: #f0aa28;
  --danger-soft: #fff1ec;
  --shadow: 0 18px 50px rgba(20, 42, 36, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(14, 143, 110, 0.12), transparent 30rem),
    linear-gradient(160deg, #f5f7f3 0%, #eef4f6 48%, #f8f2e5 100%);
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.shop-panel,
.compose-panel,
.result-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(220, 228, 223, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.shop-panel {
  order: 1;
}

.compose-panel {
  order: 2;
}

.result-panel {
  order: 3;
}

.footer-note {
  order: 4;
}

body.instant-mode .result-panel {
  order: 2;
}

body.instant-mode .compose-panel {
  order: 3;
}

.shop-panel {
  padding: 18px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(14, 143, 110, 0.95), rgba(45, 108, 223, 0.95)),
    #0e8f6e;
  position: relative;
  overflow: hidden;
}

.brand-mark span {
  position: absolute;
  display: block;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(45deg);
}

.brand-mark span:nth-child(1) {
  width: 14px;
  height: 14px;
}

.brand-mark span:nth-child(2) {
  width: 25px;
  height: 25px;
}

.brand-mark span:nth-child(3) {
  width: 36px;
  height: 36px;
}

.kicker,
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.18;
}

h2 {
  font-size: 18px;
  line-height: 1.28;
}

.shop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.shop-meta span,
.count-pill {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 13px;
  white-space: nowrap;
}

.count-pill b {
  color: var(--accent-strong);
  margin-right: 2px;
}

.compose-panel,
.result-panel {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.tag-btn {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.tag-btn:active {
  transform: scale(0.99);
}

.tag-btn[aria-pressed="true"] {
  border-color: rgba(14, 143, 110, 0.5);
  background: var(--accent-soft);
}

.tag-btn .mark {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #bfd5ce;
  color: transparent;
  background: #ffffff;
}

.tag-btn[aria-pressed="true"] .mark {
  color: #ffffff;
  border-color: var(--accent);
  background: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

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

select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
  line-height: 1.65;
}

select:focus,
textarea:focus,
.tone-tab:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(45, 108, 223, 0.18);
  border-color: var(--blue);
}

.tone-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f7;
}

.tone-tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.tone-tab.is-active {
  color: var(--accent-strong);
  background: #ffffff;
  box-shadow: 0 1px 5px rgba(16, 28, 24, 0.1);
}

.detail-field {
  margin-top: 12px;
}

.button-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.primary-btn,
.ghost-btn,
.icon-btn,
.platform-link {
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 750;
  text-decoration: none;
}

.primary-btn {
  color: #ffffff;
  background: var(--accent);
}

.primary-btn:hover {
  background: var(--accent-strong);
}

.ghost-btn,
.icon-btn {
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
}

.icon-btn {
  width: 44px;
  padding: 0;
  font-size: 20px;
}

.btn-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}

#draftText {
  min-height: 188px;
  background: #fcfdfb;
}

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

.platform-link {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
  padding: 0 10px;
}

.platform-link span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.platform-link:nth-child(2n) span {
  background: var(--blue);
}

.platform-link:nth-child(3n) span {
  background: var(--amber);
}

.platform-link.is-disabled {
  pointer-events: none;
  color: #9aa3aa;
  background: #f4f6f5;
}

.footer-note {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.footer-note span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border: 1px solid rgba(220, 228, 223, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 10;
  max-width: calc(100% - 32px);
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  padding: 11px 14px;
  color: #fff;
  background: rgba(24, 32, 38, 0.93);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

@media (min-width: 720px) {
  .app-shell {
    padding: 28px 16px;
  }

  .form-grid {
    grid-template-columns: 0.9fr 1.1fr;
  }

  .tag-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding: 10px;
  }

  h1 {
    font-size: 23px;
  }

  .tag-grid,
  .platform-list {
    grid-template-columns: 1fr;
  }

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

  .ghost-btn {
    width: 100%;
  }
}
