:root {
  --page-bg: #eef0f3;
  --panel-bg: #ffffff;
  --text: #17191c;
  --muted: #8b9098;
  --line: #e7e8eb;
  --wechat-blue: #576b95;
  --wechat-panel: #f7f7f7;
  --wechat-nav: #ededed;
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(480px, 1fr);
  gap: 24px;
  align-items: start;
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto;
}

.controls {
  display: grid;
  gap: 14px;
}

.controls__header,
.control-card,
.export-card {
  border: 1px solid #dfe2e7;
  border-radius: 8px;
  background: var(--panel-bg);
  padding: 16px;
}

.controls__header h1,
.control-card h2 {
  margin: 0;
  font-weight: 600;
}

.controls__header h1 {
  font-size: 24px;
}

.controls__header p,
.export-card p {
  margin: 8px 0 0;
  color: #626975;
  font-size: 14px;
  line-height: 1.6;
}

.control-note {
  margin: 0;
  color: #626975;
  font-size: 13px;
  line-height: 1.5;
}

.tune-group {
  display: grid;
  gap: 10px;
  border-top: 1px solid #edf0f3;
  padding-top: 12px;
}

.tune-group h3 {
  margin: 0;
  color: #303744;
  font-size: 14px;
  font-weight: 600;
}

.control-card {
  display: grid;
  gap: 12px;
}

.random-config-badge {
  color: #576b95;
  font-size: 12px;
  font-weight: 600;
}

.random-toggle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.random-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #dfe2e7;
  border-radius: 6px;
  background: #f7f8fa;
  color: #343b46;
  font-size: 13px;
}

.random-toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #576b95;
}

.random-config-status {
  min-height: 39px;
  padding: 9px 10px;
  border-radius: 6px;
  background: #f4f6f8;
  color: #4f5967;
}

.random-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.random-action-row .primary-button {
  min-height: 42px;
}

.random-download-button {
  border-color: #576b95;
  background: #576b95;
}

.control-card h2 {
  font-size: 16px;
}

.template-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border: 1px solid #cdd2da;
  border-radius: 6px;
  background: #f3f4f6;
  padding: 3px;
}

.template-switch label {
  position: relative;
  cursor: pointer;
}

.template-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.template-switch span {
  display: grid;
  place-items: center;
  min-height: 36px;
  border-radius: 4px;
  color: #59616d;
  font-size: 14px;
}

.template-switch input:checked + span {
  background: #fff;
  color: #20242a;
  box-shadow: 0 1px 3px rgba(31, 41, 55, 0.14);
  font-weight: 600;
}

.template-switch--three {
  grid-template-columns: repeat(3, 1fr);
}

.android-brand-controls[hidden] {
  display: none;
}

.android-status-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.android-status-options label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.android-status-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.android-status-options span {
  display: grid;
  gap: 5px;
  min-height: 68px;
  padding: 7px;
  border: 1px solid #d7dbe1;
  border-radius: 6px;
  background: #f7f8f9;
}

.android-status-options img {
  width: 100%;
  height: 38px;
  object-fit: contain;
  background: #ededed;
}

.android-status-options small {
  overflow: hidden;
  color: #59616d;
  font-size: 12px;
  line-height: 16px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.android-status-options input:checked + span {
  border-color: #576b95;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(87, 107, 149, 0.14);
}

.android-status-options input:checked + span small {
  color: #36496f;
  font-weight: 600;
}

.status-time-tuning {
  margin-top: 2px;
}

.field,
.check-row {
  display: grid;
  gap: 7px;
  color: #4b535f;
  font-size: 14px;
}

.field > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.field output {
  min-width: 44px;
  color: #576b95;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.color-swatch {
  width: 18px;
  height: 18px;
  margin-left: auto;
  border: 1px solid #c9ced6;
  border-radius: 3px;
  background: #050505;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid #cdd2da;
  border-radius: 6px;
  background: #fff;
  padding: 9px 10px;
  color: #20242a;
}

.field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.field input[type="file"] {
  padding: 8px;
}

.field input[type="range"] {
  height: 28px;
  border: 0;
  background: transparent;
  padding: 0;
  accent-color: #576b95;
  cursor: grab;
}

.field input[type="range"]:active {
  cursor: grabbing;
}

.field-grid,
.button-row,
.card-title-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: center;
}

.status-marker-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.status-marker-current {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  color: #5f6877;
  font-size: 13px;
}

.status-marker-current img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border: 1px solid #dde1e7;
  background: #ededed;
}

.status-marker-control button {
  border: 1px solid #c8ced8;
  border-radius: 6px;
  background: #fff;
  color: #222832;
  padding: 9px 12px;
  cursor: pointer;
}

.status-marker-actions {
  display: flex;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
}

.check-row input {
  width: 17px;
  height: 17px;
}

.card-title-row {
  grid-template-columns: 1fr auto;
}

.card-title-row span {
  color: var(--wechat-blue);
  font-size: 14px;
  font-weight: 600;
}

.button-row button,
.control-card > button,
.primary-button {
  border: 1px solid #c8ced8;
  border-radius: 6px;
  background: #fff;
  color: #222832;
  padding: 9px 12px;
  cursor: pointer;
}

.primary-button {
  width: 100%;
  border-color: #1f2937;
  background: #1f2937;
  color: #fff;
  font-weight: 600;
}

.settings-save-button {
  border-color: #576b95 !important;
  background: #576b95 !important;
  color: #fff !important;
  font-weight: 600;
}

.persistence-status {
  color: #8b9098 !important;
}

.persistence-status.is-fixed {
  color: #2f7a4d !important;
}

.like-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 8px;
  max-height: 176px;
  overflow: auto;
  padding-right: 4px;
}

.avatar-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 8px;
  max-height: 232px;
  overflow: auto;
  padding: 2px 4px 2px 2px;
}

.avatar-library-item {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: transparent;
  padding: 2px;
  cursor: pointer;
}

.avatar-library-item:hover {
  border-color: #aeb9cf;
}

.avatar-library-item.is-selected {
  border-color: var(--wechat-blue);
  background: #eef1f7;
}

.avatar-library-item img {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 5px;
  object-fit: cover;
}

.like-chip {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.like-chip img {
  display: block;
  width: 42px;
  height: 42px;
  border-radius: 5px;
  object-fit: cover;
}

.like-chip span {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.74);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.preview-panel {
  display: grid;
  justify-content: center;
  min-width: 0;
  align-self: start;
}

.preview-panel.is-fixed-preview {
  position: fixed;
  top: 16px;
  z-index: 5;
}

.wechat-canvas {
  display: block;
  width: 440px;
  height: 956px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(24, 31, 42, 0.16);
  touch-action: none;
  user-select: none;
}

.wechat-canvas.can-drag-icon {
  cursor: grab;
}

.wechat-canvas.is-dragging {
  cursor: grabbing;
}

.status-bar {
  position: relative;
  height: 50px;
  background: #f2f2f2;
  font-size: 20px;
  font-weight: 700;
}

.status-left,
.status-right {
  position: absolute;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 50px;
}

.status-left {
  left: 34px;
  gap: 6px;
}

.status-right {
  right: 24px;
  gap: 8px;
}

.mute-icon {
  position: relative;
  width: 16px;
  height: 18px;
}

.mute-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 5px;
  width: 12px;
  height: 9px;
  border-left: 5px solid #101010;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transform: skewY(-12deg);
}

.mute-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 0;
  width: 3px;
  height: 20px;
  border-radius: 3px;
  background: #101010;
  transform: rotate(-42deg);
}

.dynamic-island {
  position: absolute;
  left: 124px;
  top: 14px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 192px;
  height: 38px;
  border-radius: 999px;
  background: #000;
  padding: 8px 12px;
}

.dynamic-island img {
  width: 25px;
  height: 25px;
  border-radius: 5px;
  object-fit: cover;
  opacity: 0.7;
}

.dynamic-island span {
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 8px 0 rgba(255, 255, 255, 0.35), 16px 0 rgba(255, 255, 255, 0.25);
}

.cell-bars {
  display: inline-grid;
  grid-auto-flow: column;
  align-items: end;
  gap: 3px;
  width: 25px;
  height: 22px;
}

.cell-bars i {
  display: block;
  width: 5px;
  border-radius: 2px;
  background: #050505;
}

.cell-bars i:nth-child(1) {
  height: 8px;
}

.cell-bars i:nth-child(2) {
  height: 12px;
}

.cell-bars i:nth-child(3) {
  height: 17px;
}

.cell-bars i:nth-child(4) {
  height: 21px;
}

.wifi-icon {
  display: none;
  width: 23px;
  height: 17px;
  border: 4px solid #050505;
  border-bottom: 0;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 22px 22px 0 0;
}

.network-text {
  font-size: 18px;
  letter-spacing: 0;
}

.battery {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 17px;
  border-radius: 5px;
  background: #d9d9d9;
  color: #151515;
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

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

.battery b {
  position: absolute;
  left: 0;
  top: 0;
  width: 42%;
  height: 100%;
  border-radius: 5px 0 0 5px;
  background: #ffd32a;
}

.battery em {
  position: relative;
  z-index: 1;
  font-style: normal;
}

.top-nav {
  position: relative;
  display: grid;
  grid-template-columns: 70px 1fr 70px;
  align-items: center;
  height: 51px;
  background: var(--wechat-nav);
}

.top-nav strong {
  justify-self: center;
  font-size: 19px;
  font-weight: 600;
}

.back-icon {
  width: 17px;
  height: 17px;
  margin-left: 20px;
  border-left: 2px solid #1a1a1a;
  border-bottom: 2px solid #1a1a1a;
  transform: rotate(45deg);
}

.more-dot {
  justify-self: end;
  margin-right: 20px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  transform: translateY(-3px);
}

.post {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  padding: 16px 12px 0;
}

.publisher-avatar {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}

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

.publisher-name {
  color: var(--wechat-blue);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.2;
}

.post-text {
  margin: 7px 0 12px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.48;
}

.link-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  width: 322px;
  min-height: 57px;
  border-radius: 7px;
  background: #f6f6f6;
  padding: 6px;
}

.link-card img {
  width: 48px;
  height: 48px;
  border-radius: 3px;
  object-fit: cover;
}

.link-card div {
  font-size: 16px;
  line-height: 1.45;
}

.source-line {
  margin-top: 9px;
  color: var(--wechat-blue);
  font-size: 16px;
  line-height: 1.4;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: #9c9c9c;
  font-size: 16px;
  line-height: 1.2;
}

.meta-row .place {
  color: var(--wechat-blue);
}

.trash {
  position: relative;
  flex: 0 0 auto;
  width: 16px;
  height: 18px;
  margin-left: 2px;
  border: 3px solid var(--wechat-blue);
  border-top: 0;
  border-radius: 0 0 3px 3px;
}

.trash::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -5px;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--wechat-blue);
}

.post-menu {
  margin-left: auto;
  width: 34px;
  height: 20px;
  border-radius: 5px;
  background: #f7f7f7;
  color: var(--wechat-blue);
  font-size: 18px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
}

.reaction-panel {
  position: relative;
  margin: 8px 12px 0;
  border-radius: 8px;
  background: var(--wechat-panel);
  overflow: hidden;
}

.likes-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 6px;
  min-height: 144px;
  padding: 8px 8px 11px 0;
}

.heart-outline {
  position: relative;
  justify-self: center;
  width: 22px;
  height: 20px;
  margin-top: 9px;
  transform: rotate(-45deg);
}

.heart-outline::before,
.heart-outline::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 24px;
  border: 2px solid var(--wechat-blue);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  background: transparent;
}

.heart-outline::before {
  left: 0;
  transform: rotate(45deg);
}

.heart-outline::after {
  left: 7px;
  transform: rotate(135deg);
}

.likes-grid {
  display: grid;
  grid-template-columns: repeat(9, 36px);
  grid-auto-rows: 36px;
  gap: 9px 6px;
}

.likes-grid img {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  object-fit: cover;
}

.comments-fixed {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 13px 8px 14px 0;
}

.comment-icon {
  position: relative;
  justify-self: center;
  width: 20px;
  height: 16px;
  margin-top: 13px;
  border: 2px solid var(--wechat-blue);
  border-radius: 2px;
}

.comment-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  bottom: -6px;
  width: 8px;
  height: 8px;
  border-left: 2px solid var(--wechat-blue);
  border-bottom: 2px solid var(--wechat-blue);
  transform: skewX(-25deg);
  background: var(--wechat-panel);
}

.comment-list {
  display: grid;
  gap: 12px;
}

.comment-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
}

.comment-item img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}

.comment-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.comment-head b,
.comment-content p span {
  color: var(--wechat-blue);
  font-size: 17px;
  font-weight: 600;
}

.comment-head span {
  margin-left: auto;
  color: #777;
  font-size: 15px;
}

.comment-content p {
  margin: 4px 0 0;
  font-size: 17px;
  line-height: 1.3;
}

.comment-divider {
  height: 1px;
  background: var(--line);
}

.comment-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr 42px 42px;
  gap: 10px;
  align-items: center;
  height: 74px;
  background: #f7f7f7;
  padding: 9px 10px 17px;
}

.comment-input {
  display: flex;
  align-items: center;
  height: 42px;
  border-radius: 5px;
  background: #fff;
  color: #b2b2b2;
  padding: 0 10px;
  font-size: 17px;
}

.smile-icon,
.image-icon {
  position: relative;
  display: block;
  width: 29px;
  height: 29px;
  color: #191919;
}

.smile-icon {
  border: 2px solid currentColor;
  border-radius: 999px;
}

.smile-icon::before,
.smile-icon::after {
  content: "";
  position: absolute;
  top: 9px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.smile-icon::before {
  left: 8px;
}

.smile-icon::after {
  right: 8px;
}

.smile-icon {
  background:
    radial-gradient(ellipse at center, transparent 45%, currentColor 46%, currentColor 52%, transparent 54%) 6px 14px / 15px 9px no-repeat;
}

.image-icon {
  border: 2px solid currentColor;
}

.image-icon::before {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 5px;
  width: 18px;
  height: 13px;
  background:
    linear-gradient(135deg, transparent 46%, currentColor 47%, currentColor 53%, transparent 54%),
    linear-gradient(45deg, transparent 44%, currentColor 45%, currentColor 54%, transparent 55%);
}

.image-icon::after {
  content: "";
  position: absolute;
  right: 5px;
  top: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-apple-classic .dynamic-island,
.status-android .dynamic-island {
  display: none;
}

.status-apple-classic .wifi-icon {
  display: inline-block;
}

.status-apple-classic .network-text {
  display: none;
}

.status-android .status-left {
  left: 24px;
  font-size: 18px;
  font-weight: 700;
}

.status-android .status-right {
  right: 27px;
  gap: 7px;
}

.status-android .wifi-icon {
  display: inline-block;
  width: 21px;
  height: 15px;
}

.status-android .network-text {
  font-size: 12px;
  font-weight: 800;
}

.status-android .battery {
  width: 32px;
  height: 15px;
  border: 2px solid #101010;
  background: transparent;
  font-size: 12px;
}

.status-android .battery::after {
  right: -5px;
  top: 4px;
  width: 3px;
  height: 5px;
  background: #101010;
}

.status-android .battery b {
  background: #101010;
  opacity: 0.18;
}

.status-android .battery em {
  color: #101010;
}

.is-hidden {
  display: none;
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    order: -1;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .preview-panel {
    overflow-x: auto;
    justify-content: start;
  }

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