:root {
  color-scheme: light;
  --page-bg: #f3f4f6;
  --panel-bg: #ffffff;
  --line: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #07c160;
  --bubble-left: #ffffff;
  --bubble-right: #95ec69;
  --wechat-bg: #ededed;
}

* {
  box-sizing: border-box;
}

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

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", Arial, sans-serif;
}

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

.page {
  flex: 1 0 auto;
  width: min(1180px, calc(100vw - 32px));
  margin: 22px auto 40px;
}

.site-footer {
  flex: 0 0 auto;
  padding: 8px 16px 12px;
  color: rgba(107, 114, 128, 0.48);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: rgba(107, 114, 128, 0.72);
}

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

.account-brand {
  min-width: 0;
}

.account-brand h1,
.account-brand strong {
  display: block;
  margin: 0;
  color: #111827;
  font-size: 20px;
  line-height: 1.35;
}

.account-brand span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.account-name {
  max-width: 160px;
  overflow: hidden;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-panel {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.profile-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.profile-panel h1 {
  margin: 0;
  font-size: 20px;
}

.profile-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.generation-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.generation-empty {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.generation-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.generation-media {
  width: 124px;
  height: 158px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 13px;
}

.generation-media img,
.generation-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.generation-body {
  min-width: 0;
}

.generation-meta {
  color: var(--muted);
  font-size: 12px;
}

.generation-card h2 {
  margin: 5px 0 7px;
  color: #111827;
  font-size: 15px;
  line-height: 1.35;
}

.generation-card pre {
  max-height: 76px;
  margin: 0 0 10px;
  overflow: hidden;
  color: #374151;
  font: 12px/1.55 inherit;
  white-space: pre-wrap;
}

.generation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.generation-actions a {
  color: #047857;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.text-link-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: #047857;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.generation-actions a:hover,
.text-link-btn:hover {
  text-decoration: underline;
}

.profile-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.crumb {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

h1 {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.25;
}

.primary-btn {
  border: 0;
  border-radius: 5px;
  background: var(--green);
  color: #fff;
  padding: 11px 22px;
  min-width: 116px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(7, 193, 96, 0.22);
}

.secondary-btn {
  border: 1px solid rgba(7, 193, 96, 0.36);
  border-radius: 5px;
  background: rgba(7, 193, 96, 0.08);
  color: #0f766e;
  padding: 9px 14px;
  min-width: 92px;
  cursor: pointer;
  font-weight: 600;
}

.secondary-btn:hover {
  background: rgba(7, 193, 96, 0.14);
}

.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.compact-btn {
  min-width: 76px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
}

.workspace {
  margin-top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 18px;
  align-items: start;
}

.template-panel {
  margin-top: 18px;
}

.template-panel__title {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

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

.template-loading {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
}

.template-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.template-card h2 {
  margin: 0 0 7px;
  color: #111827;
  font-size: 15px;
  line-height: 1.35;
}

.template-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.template-card pre {
  width: 100%;
  min-height: 78px;
  margin: 0 0 12px;
  padding: 9px;
  overflow: hidden;
  border-radius: 6px;
  background: #f8fafc;
  color: #374151;
  font: 12px/1.55 inherit;
  white-space: pre-wrap;
}

.template-btn {
  width: 100%;
  height: 34px;
  border: 1px solid rgba(7, 193, 96, 0.36);
  border-radius: 5px;
  background: rgba(7, 193, 96, 0.08);
  color: #048848;
  font-weight: 600;
  cursor: pointer;
}

.template-btn:hover {
  background: rgba(7, 193, 96, 0.14);
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.panel-title {
  font-weight: 700;
  font-size: 16px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.quick-settings {
  display: grid;
  grid-template-columns: 1fr 104px 104px 112px;
  gap: 10px;
  align-items: end;
}

.title-row {
  margin-top: 12px;
}

.hidden-upload-inputs {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

label span,
.script-area > span:not(.script-area__head) {
  display: block;
  color: #374151;
  font-size: 13px;
  margin-bottom: 7px;
}

input[type="text"],
input[type="number"],
input[type="url"],
input[type="password"],
select {
  width: 100%;
  height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 0 11px;
  outline: none;
  background: #fff;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #6b7280 50%),
    linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 16px,
    calc(100% - 11px) 16px;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

.upload-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.upload-box {
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 12px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  background: #f9fafb;
}

.upload-box:hover {
  border-color: var(--green);
  background: #f3fbf7;
}

.upload-box input {
  display: none;
}

.upload-box strong {
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-upload-box {
  width: min(100%, 180px);
  min-height: 72px;
  margin-bottom: 10px;
}

.preset-board {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.preset-group {
  min-width: 0;
}

.preset-group--wide {
  grid-column: auto;
}

.preset-heading {
  margin-bottom: 8px;
  color: #374151;
  font-size: 13px;
}

.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avatar-presets {
  max-height: 188px;
  overflow-y: auto;
  padding: 3px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f8fafc;
}

.preset-option {
  position: relative;
  border: 1px solid #dbe3ea;
  border-radius: 6px;
  padding: 3px;
  background: #fff;
  cursor: pointer;
  line-height: 0;
}

.preset-option:hover {
  border-color: var(--green);
}

.preset-option.is-active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.14);
}

.preset-add {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.preset-add__icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(7, 193, 96, 0.12);
  color: var(--green);
  font-size: 19px;
  line-height: 18px;
}

.preset-add__text {
  display: block;
}

.preset-option img {
  display: block;
  object-fit: cover;
  background: #e5e7eb;
}

.avatar-presets .preset-add {
  width: 50px;
  height: 50px;
}

.avatar-presets .preset-option img {
  width: 42px;
  height: 42px;
  border-radius: 4px;
}

.background-presets .preset-add {
  width: 78px;
  height: 56px;
}

.background-presets .preset-option img {
  width: 70px;
  height: 48px;
  border-radius: 4px;
}

.message-image-presets .preset-option img {
  width: 58px;
  height: 58px;
  border-radius: 4px;
}

.preset-option__index {
  position: absolute;
  right: 4px;
  bottom: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(17, 24, 39, 0.74);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
}

.image-strip {
  margin-top: 12px;
  min-height: 1px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.image-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #dbe3ea;
  border-radius: 5px;
  padding: 6px 8px;
  background: #fff;
  font-size: 12px;
  color: #374151;
}

.image-chip img {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
}

.image-chip button {
  border: 0;
  background: #eef2f7;
  border-radius: 4px;
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.ai-generator {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

.ai-generator__head .preset-heading {
  margin-bottom: 0;
}

.ai-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-status {
  min-height: 18px;
  margin: -4px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ai-status.is-error {
  color: #dc2626;
}

.ai-status.is-success {
  color: #0f766e;
}

.ai-topic {
  display: block;
}

.ai-topic textarea {
  min-height: 96px;
}

.ai-options {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 12px;
}

.script-area {
  display: block;
  margin-top: 16px;
}

.script-area__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.script-area__head span,
.script-area__title span {
  margin-bottom: 0;
  color: #374151;
  font-size: 13px;
}

.script-area__title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.script-area__actions {
  display: flex;
  justify-content: flex-end;
}

textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 12px;
  line-height: 1.7;
  outline: none;
  background: #fff;
}

.tips {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.emoji-quick-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  margin-top: 6px;
}

.emoji-quick-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emoji-quick-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.emoji-quick-btn:hover {
  border-color: var(--green);
  background: #f0fdf4;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #0f766e;
}

.preview-panel {
  position: sticky;
  top: 16px;
}

.export-card {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.export-section + .export-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

.export-section__title {
  margin-bottom: 9px;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.export-actions {
  display: grid;
  gap: 10px;
}

.image-export-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.export-actions .primary-btn,
.export-actions .secondary-btn,
.export-video-btn {
  width: 100%;
  margin-top: 0;
}

.video-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.75fr) 128px;
  gap: 10px;
  align-items: end;
}

.export-video-btn {
  margin-top: 10px;
}

.video-option {
  display: grid;
  gap: 6px;
}

.video-option > span {
  color: #374151;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 37px;
  overflow: hidden;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
}

.segmented-control label {
  min-width: 0;
  display: grid;
  place-items: stretch;
  background: #fff;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: grid;
  place-items: center;
  padding: 8px 10px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
}

.segmented-control label + label {
  border-left: 1px solid #d1d5db;
}

.segmented-control label:has(input:checked) {
  background: #111827;
}

.segmented-control input:checked + span {
  background: #111827;
}

.segmented-control label:has(input:checked) span {
  color: #fff;
  font-weight: 700;
}

.segmented-control label:has(input:disabled) span {
  cursor: not-allowed;
  opacity: 0.55;
}

.video-speed-option.is-disabled {
  opacity: 0.52;
}

.video-speed-option select {
  height: 35px;
}

.video-status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.video-status a {
  margin-left: 10px;
  color: #047857;
  font-weight: 700;
  text-decoration: none;
}

.video-status a + a {
  margin-left: 8px;
}

.video-status a:hover {
  text-decoration: underline;
}

.video-status.is-error {
  color: #dc2626;
}

.video-status.is-success {
  color: #0f766e;
}

.phone-shell {
  box-sizing: content-box;
  width: 375px;
  height: 812px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 28px;
  border: 10px solid #111827;
  background: var(--wechat-bg);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.23);
}

.phone-status {
  height: 44px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ededed;
  color: #111827;
  font-size: 14px;
  font-weight: 600;
}

.status-icons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal {
  width: 18px;
  height: 12px;
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}

.signal i {
  width: 3px;
  border-radius: 1px;
  background: rgba(17, 24, 39, 0.22);
}

.signal i:nth-child(1) {
  height: 4px;
}

.signal i:nth-child(2) {
  height: 6px;
}

.signal i:nth-child(3) {
  height: 8px;
}

.signal i:nth-child(4) {
  height: 10px;
}

.signal[data-strength="1"] i:nth-child(-n + 1),
.signal[data-strength="2"] i:nth-child(-n + 2),
.signal[data-strength="3"] i:nth-child(-n + 3),
.signal[data-strength="4"] i:nth-child(-n + 4) {
  background: #111827;
}

.network {
  min-width: 18px;
  color: #111827;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.battery {
  position: relative;
  display: inline-block;
  width: 24px;
  height: 12px;
  border: 1.5px solid #111;
  border-radius: 3px;
}

.battery::after {
  content: "";
  position: absolute;
  right: -4px;
  top: 3px;
  width: 2px;
  height: 5px;
  border-radius: 0 2px 2px 0;
  background: #111;
}

.battery i {
  position: absolute;
  left: 2px;
  top: 2px;
  display: block;
  width: var(--battery-fill, 14px);
  max-width: 18px;
  height: 6px;
  border-radius: 2px;
  background: #111;
}

.battery.is-warning i {
  background: #f59e0b;
}

.battery.is-critical i {
  background: #ef4444;
}

.wechat-title {
  height: 48px;
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  align-items: center;
  background: #ededed;
  border-bottom: 1px solid #dcdcdc;
  color: #111827;
}

.wechat-title strong {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back,
.more {
  text-align: center;
  font-size: 31px;
  line-height: 1;
}

.more {
  font-size: 25px;
  transform: translateY(-4px);
}

.chat-window {
  height: 648px;
  overflow: auto;
  background: var(--wechat-bg);
  background-size: cover;
  background-position: center;
}

.chat-list {
  padding: 14px 12px 18px;
}

.wechat-input {
  height: 72px;
  background: #f7f7f7;
  background-image: url("./assets/wechat-footer.jpg");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  border-top: 1px solid #dcdcdc;
}

.system-message {
  text-align: center;
  margin: 11px 0 14px;
  color: #fff;
  font-size: 12px;
}

.system-message span {
  display: inline-block;
  max-width: 280px;
  padding: 3px 9px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.18);
  line-height: 1.45;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.message-row.right {
  flex-direction: row-reverse;
}

.message-fail-icon {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-top: 10px;
  border-radius: 50%;
  background: #fa5151;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.friend-verification {
  max-width: 286px;
  margin: -2px auto 15px;
  color: #8a8a8a;
  font-size: 13px;
  line-height: 1.55;
  text-align: center;
}

.friend-verification__link {
  color: #576b95;
}

.avatar {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 4px;
  overflow: hidden;
  background: linear-gradient(135deg, #4f93ff, #65d8a4);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
}

.avatar.mine {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bubble {
  position: relative;
  max-width: 238px;
  min-height: 38px;
  border-radius: 5px;
  padding: 9px 11px;
  font-size: 15px;
  line-height: 1.42;
  color: #111827;
  word-break: break-word;
}

.left .bubble {
  background: var(--bubble-left);
}

.right .bubble {
  background: var(--bubble-right);
}

.left .bubble::before,
.right .bubble::before {
  content: "";
  position: absolute;
  top: 13px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.left .bubble::before {
  left: -5px;
  border-right: 6px solid var(--bubble-left);
}

.right .bubble::before {
  right: -5px;
  border-left: 6px solid var(--bubble-right);
}

.voice-bubble {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  min-width: 96px;
}

.right .voice-bubble {
  justify-content: flex-end;
}

.voice-wave {
  flex: 0 0 auto;
  width: 20px;
  height: 22px;
  opacity: 0.84;
}

.voice-wave svg {
  display: block;
  width: 100%;
  height: 100%;
}

.right .voice-wave {
  transform: scaleX(-1);
}

.message-image {
  display: block;
  max-width: 170px;
  max-height: 230px;
  border-radius: 5px;
  object-fit: cover;
  background: #e5e7eb;
}

.image-placeholder {
  width: 150px;
  height: 110px;
  border-radius: 5px;
  background: #d8dee6;
  color: #6b7280;
  display: grid;
  place-items: center;
  font-size: 13px;
}

.red-packet {
  position: relative;
  width: 238px;
  overflow: visible;
  border-radius: 5px;
  background: #fa9b2f;
  color: #fff;
}

.left .red-packet::before,
.right .red-packet::before {
  content: "";
  position: absolute;
  top: 13px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.left .red-packet::before {
  left: -5px;
  border-right-color: #fa9b2f;
  border-right-style: solid;
  border-right-width: 6px;
}

.right .red-packet::before {
  right: -5px;
  border-left-color: #fa9b2f;
  border-left-style: solid;
  border-left-width: 6px;
}

.red-packet__main {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 8px 12px;
}

.red-packet__icon {
  flex: 0 0 auto;
  width: 38px;
  height: 44px;
  overflow: hidden;
  border-radius: 4px;
  background: #de443d;
  position: relative;
}

.red-packet__icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 24px;
  background: #ff554d;
  clip-path: path("M0 0H38V19Q19 24 0 19Z");
}

.red-packet__icon::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 14px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffd251;
  z-index: 1;
}

.red-packet__mark {
  --mark-color: #ca7a17;
  position: absolute;
  left: 50%;
  top: 24px;
  z-index: 2;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(45deg, transparent calc(50% - 1px), var(--mark-color) 0 calc(50% + 1px), transparent 0) 2px 1px / 4px 5px no-repeat,
    linear-gradient(-45deg, transparent calc(50% - 1px), var(--mark-color) 0 calc(50% + 1px), transparent 0) 6px 1px / 4px 5px no-repeat,
    linear-gradient(var(--mark-color), var(--mark-color)) 50% 5px / 2px 7px no-repeat,
    linear-gradient(var(--mark-color), var(--mark-color)) 50% 5px / 9px 2px no-repeat,
    linear-gradient(var(--mark-color), var(--mark-color)) 50% 8px / 8px 2px no-repeat;
}

.red-packet__text {
  min-width: 0;
}

.red-packet__text strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.red-packet__foot {
  height: 24px;
  padding: 2px 12px 4px;
  border-radius: 0 0 5px 5px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.wechat-transfer {
  position: relative;
  width: 238px;
  overflow: visible;
  border-radius: 5px;
  background: #fa9b2f;
  color: #fff;
}

.left .wechat-transfer::before,
.right .wechat-transfer::before {
  content: "";
  position: absolute;
  top: 13px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.left .wechat-transfer::before {
  left: -5px;
  border-right: 6px solid #fa9b2f;
}

.right .wechat-transfer::before {
  right: -5px;
  border-left: 6px solid #fa9b2f;
}

.wechat-transfer__main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 8px 12px;
}

.wechat-transfer__icon {
  position: relative;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
}

.wechat-transfer__arrow {
  position: absolute;
  border-radius: 0;
  background: #fff;
}

.wechat-transfer__arrow--top {
  left: 7px;
  top: 7px;
  width: 23px;
  height: 9px;
  clip-path: polygon(53% 0, 65% 16%, 29% 63%, 100% 63%, 100% 94%, 0 94%, 0 63%);
}

.wechat-transfer__arrow--bottom {
  left: 8px;
  top: 22px;
  width: 24px;
  height: 11px;
  clip-path: polygon(0 0, 96% 0, 100% 14%, 100% 26%, 54% 100%, 41% 88%, 80% 26%, 0 26%);
}

.wechat-transfer__amount {
  display: block;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.18;
}

.wechat-transfer__note {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 14px;
  line-height: 1.25;
}

.wechat-transfer__foot {
  height: 24px;
  padding: 2px 12px 4px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(18px);
  min-width: 180px;
  max-width: 88vw;
  padding: 10px 14px;
  border-radius: 5px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

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

.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.auth-dialog[hidden] {
  display: none;
}

.auth-dialog__panel {
  width: min(392px, 100%);
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.24);
}

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

.auth-dialog h2 {
  margin: 0;
  color: #111827;
  font-size: 18px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.auth-tab {
  height: 38px;
  border: 0;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  font-weight: 700;
}

.auth-tab + .auth-tab {
  border-left: 1px solid #d1d5db;
}

.auth-tab.is-active {
  background: #111827;
  color: #fff;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form input {
  width: 100%;
  height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  padding: 0 11px;
  outline: none;
}

.settings-dialog__panel {
  width: min(520px, 100%);
}

.settings-form {
  display: grid;
  gap: 12px;
}

.settings-form label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
}

.settings-form input,
.settings-form select {
  width: 100%;
}

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

.settings-check {
  display: flex !important;
  grid-template-columns: none;
  align-items: center;
  gap: 8px !important;
  color: #4b5563 !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

.settings-check input {
  width: auto;
}

.auth-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.auth-status.is-error {
  color: #dc2626;
}

.auth-status.is-success {
  color: #047857;
}

.auth-form .primary-btn {
  width: 100%;
}

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

  .generation-list {
    grid-template-columns: 1fr;
  }

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

  .preview-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .page {
    width: min(100vw - 20px, 1180px);
  }

  .account-bar,
  .profile-panel__head {
    align-items: stretch;
    flex-direction: column;
  }

  .account-actions {
    justify-content: flex-start;
  }

  .generation-card {
    grid-template-columns: 94px minmax(0, 1fr);
  }

  .generation-media {
    width: 94px;
    height: 128px;
  }

  .primary-btn {
    margin-top: 16px;
    width: 100%;
  }

  .export-actions .primary-btn,
  .export-actions .secondary-btn {
    margin-top: 0;
  }

  .quick-settings,
  .upload-grid,
  .ai-options,
  .export-actions,
  .video-options,
  .preset-board,
  .settings-grid,
  .template-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

  .phone-shell {
    width: min(375px, calc(100vw - 48px));
    height: calc((min(375px, calc(100vw - 48px))) * 2.165);
    border-width: 8px;
    border-radius: 24px;
  }

  .chat-window {
    height: calc(100% - 164px);
  }
}
