:root {
  color-scheme: dark;
  --page: #171411;
  --shell: #20211f;
  --panel: #2d302e;
  --panel-soft: #242624;
  --key: #fafaf6;
  --key-active: #f2ffd4;
  --ink: #10120f;
  --text: #f7f7ef;
  --muted: #aeb5ad;
  --line: rgba(255, 255, 255, 0.1);
  --lime: #d7ff2f;
  --lime-soft: rgba(215, 255, 47, 0.18);
  --silver: #b8c0cd;
  --pink: #ff9ec4;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% 0%, rgba(215, 255, 47, 0.08), transparent 30%),
    linear-gradient(180deg, #181512 0%, #100e0d 100%);
  color: var(--text);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

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

.phone-frame {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--shell);
  box-shadow: var(--shadow);
}

.wechat-bar {
  display: grid;
  grid-template-columns: 42px 1fr 38px 42px 42px;
  align-items: center;
  gap: 9px;
  padding: max(12px, env(safe-area-inset-top)) 12px 12px;
  background: rgba(23, 20, 17, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.round-icon,
.plain-icon,
.bubble-icon {
  border: 0;
  background: transparent;
  color: #ececec;
}

.round-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid #d9d9d9;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
}

.plain-icon {
  width: 34px;
  min-height: 38px;
  color: #f4f4ef;
  font-size: 15px;
}

.wechat-input {
  min-height: 46px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #2b2b2d;
  padding: 0 12px;
  box-shadow: inset 3px 0 0 #29dc77;
}

#draftLine {
  min-width: 0;
  overflow: hidden;
  color: #f2f2f2;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assistant-pad {
  min-height: calc(100vh - 72px);
  padding: 16px 12px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 32%),
    var(--panel);
}

.pad-head,
.brand-wrap,
.head-actions,
.result-title-row,
.pad-footer {
  display: flex;
  align-items: center;
}

.pad-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-wrap {
  min-width: 0;
  gap: 10px;
}

.head-actions {
  flex: none;
  gap: 8px;
}

.brand-badge {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #111;
  color: #fff;
  font-size: 15px;
  font-weight: 950;
  transform: rotate(-12deg);
  box-shadow: inset -7px -6px 0 var(--lime);
}

.brand-pill {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--lime), #f4ff54);
  color: #151515;
  padding: 0 18px;
  font-size: 20px;
  font-weight: 950;
  box-shadow: 0 10px 26px rgba(215, 255, 47, 0.18);
}

.brand-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.bubble-icon,
.heart {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 950;
}

.bubble-icon {
  background: #fff;
  color: #202020;
  font-size: 18px;
}

.heart {
  background: linear-gradient(135deg, #ff8fba, #ffc7d8);
  color: #fff;
  transform: rotate(-9deg);
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.16);
}

.compose-card {
  display: grid;
  grid-template-columns: 1fr 94px;
  gap: 10px;
  margin-bottom: 10px;
}

#messageInput {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 0;
  border-radius: 11px;
  outline: none;
  background: #fff;
  color: #141414;
  padding: 18px 14px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.45;
}

#messageInput::placeholder {
  color: #9fd600;
  font-weight: 950;
  text-align: center;
}

#pasteButton {
  min-height: 84px;
  border: 0;
  border-radius: 11px;
  background: var(--lime);
  color: #151515;
  padding: 0 10px;
  font-size: 18px;
  font-weight: 950;
  line-height: 1.12;
  box-shadow: 0 10px 24px rgba(215, 255, 47, 0.18);
}

.meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.meta-row select {
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #202320;
  color: #f7f7ef;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}

.keyboard-grid {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 8px;
  margin-bottom: 12px;
}

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

.tone-grid button,
.side-actions button {
  min-width: 0;
  min-height: 58px;
  border: 0;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.18;
}

.tone-grid button {
  background: var(--key);
  color: var(--ink);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.tone-grid button.active {
  background: var(--key-active);
  outline: 3px solid var(--lime);
  box-shadow: 0 0 0 1px rgba(215, 255, 47, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

.side-actions {
  display: grid;
  grid-template-rows: repeat(3, minmax(58px, 1fr));
  gap: 8px;
}

.side-actions button {
  background: var(--silver);
  color: #222834;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.08);
}

#sendButton {
  background: linear-gradient(135deg, #cfd9ea, #aeb8c8);
}

.result-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(22, 24, 22, 0.72);
  padding: 12px;
}

.result-title-row {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

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

h1 {
  font-size: 16px;
}

#copyBestButton,
#modelBadge {
  flex: none;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

#copyBestButton {
  min-height: 32px;
  border: 0;
  background: var(--lime);
  color: #111;
  padding: 0 12px;
}

#modelBadge {
  max-width: 112px;
  overflow: hidden;
  color: var(--lime);
  background: var(--lime-soft);
  padding: 7px 9px;
  text-overflow: ellipsis;
}

.results {
  display: grid;
  gap: 8px;
}

.results.empty {
  min-height: 76px;
  align-items: center;
  color: #d6d9d2;
  font-size: 13px;
  line-height: 1.55;
}

.reply-card {
  border-radius: 11px;
  background: #fbfbf7;
  color: #111;
  padding: 11px;
}

.reply-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
}

.reply-card h3 {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-card p {
  font-size: 15px;
  line-height: 1.55;
}

.reply-card button {
  flex: none;
  min-width: 52px;
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: var(--lime);
  color: #111;
  font-size: 13px;
  font-weight: 950;
}

.reply-note {
  margin-top: 7px;
  color: #63645f;
  font-size: 12px;
  line-height: 1.45;
}

.pad-footer {
  justify-content: space-between;
  margin-top: 16px;
}

.pad-footer button {
  border: 0;
  background: transparent;
  color: #f3f3ee;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 800;
}

.pad-footer span {
  width: 30px;
  height: 4px;
  border-radius: 99px;
  background: #fff;
}

dialog {
  width: min(92vw, 430px);
  border: 0;
  border-radius: 14px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.settings-card {
  display: grid;
  gap: 13px;
  border-radius: 14px;
  background: #fbfbf7;
  color: #111;
  padding: 18px;
  box-shadow: var(--shadow);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-head h2 {
  font-size: 19px;
}

.close-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #ecece6;
  font-size: 22px;
}

.hint {
  color: #62635f;
  font-size: 13px;
  line-height: 1.55;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: #555;
  font-size: 13px;
  font-weight: 850;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d8d8d0;
  border-radius: 9px;
  background: #fff;
  color: #111;
  padding: 0 12px;
}

.save-button {
  min-height: 50px;
  border: 0;
  border-radius: 9px;
  background: var(--lime);
  color: #111;
  font-weight: 950;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(14px);
  max-width: min(88vw, 340px);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  transition: 160ms ease;
}

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

@media (max-width: 380px) {
  .phone-frame {
    width: 100%;
  }

  .assistant-pad {
    padding-left: 10px;
    padding-right: 10px;
  }

  .keyboard-grid {
    grid-template-columns: 1fr 78px;
  }

  .compose-card {
    grid-template-columns: 1fr 82px;
  }

  .tone-grid button,
  .side-actions button {
    min-height: 54px;
    font-size: 13px;
  }

  .head-actions {
    gap: 6px;
  }

  .bubble-icon,
  .heart {
    width: 38px;
    height: 38px;
  }
}
