:root {
  color: #1c1c1c;
  background: #f4f4f2;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.brand img { width: 32px; height: 32px; }

a.brand { color: inherit; text-decoration: none; }

.header-side,
.admin .row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin { width: min(760px, calc(100% - 32px)); margin: 24px auto 48px; }

.auth-card, .admin .block { padding: 18px; margin-bottom: 14px; }

.auth-card h1, .admin h2 { margin: 0 0 12px; font-size: 22px; }

.stack, .auth-card form { display: flex; flex-direction: column; gap: 8px; }

.admin input, .admin textarea, .admin select {
  font: inherit;
  color: inherit;
  border: 1px solid #e4e4e2;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
}

.admin textarea { width: 100%; resize: vertical; }

.logs {
  white-space: pre-wrap;
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  color: #666;
  min-height: 48px;
}

.card-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-box input {
  width: 190px;
  border: 1px solid #e4e4e2;
  background: #fff;
  border-radius: 999px;
  padding: 7px 12px;
  font: inherit;
  outline: none;
}

.balance { font-size: 14px; color: #444; }

.price {
  margin: -10px 0 16px;
  text-align: center;
  color: #888;
  font-size: 13px;
}

main {
  width: min(860px, calc(100% - 32px));
  margin: 8vh auto 48px;
}

h1 {
  margin: 0 0 22px;
  text-align: center;
  font-size: 36px;
  font-weight: 650;
}

.switch {
  width: max-content;
  margin: 0 auto 22px;
  padding: 4px;
  display: flex;
  gap: 4px;
  background: #e8e8e6;
  border-radius: 999px;
}

.switch button,
.tool,
.text-btn,
.solid,
.file,
.menu button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.switch button {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 8px 22px;
}

.switch button.on {
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.card {
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 28px;
  padding: 18px 18px 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.03);
}

textarea,
select {
  font: inherit;
  color: inherit;
  background: #fff;
}

#prompt {
  width: 100%;
  border: 0;
  resize: vertical;
  min-height: 132px;
  outline: none;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}

.chips:empty { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f3f3f1;
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
}

.chip button {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #666;
}

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #4d4d4d;
  padding: 6px 4px;
  font-size: 14px;
}

.tool select,
.line select,
#account {
  border: 0;
  background: transparent;
  outline: none;
  max-width: 240px;
}

.send {
  margin-left: auto;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #1c1c1c;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.send:disabled { opacity: 0.45; cursor: default; }

.status {
  min-height: 1.4em;
  color: #666;
  text-align: center;
}

.status.warn { color: #e23b3b; }

.progress {
  width: min(520px, calc(100% - 48px));
  height: 3px;
  margin: 0 auto 8px;
  background: #e6e6e4;
  border-radius: 99px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  width: 35%;
  background: #1c1c1c;
  animation: progress-slide 1.1s ease-in-out infinite;
}

@keyframes progress-slide {
  from { transform: translateX(-120%); }
  to { transform: translateX(320%); }
}

.results figure { margin: 0; }

.results a {
  display: inline-block;
  margin-top: 8px;
  color: #1c1c1c;
  font-size: 13px;
}

.support {
  margin: -6px 0 18px;
  text-align: center;
  color: #444;
  font-size: 14px;
}

.history { margin-top: 8px; }

.history h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 650;
}

.history article {
  margin-bottom: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 20px;
}

.history-head span { color: #888; font-size: 13px; }

.history-head p {
  margin: 4px 0 10px;
  overflow: hidden;
  color: #333;
  font-size: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.results img,
.results video {
  width: 100%;
  border-radius: 16px;
  background: #fff;
}

.menu {
  position: fixed;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 120px;
  padding: 6px;
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
}

.menu button:hover { background: #f4f4f2; }

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.28); }

.dialog-card {
  width: min(520px, calc(100vw - 32px));
  background: #fff;
  border-radius: 20px;
  padding: 16px;
}

.dialog-head,
.dialog-actions,
.line,
.check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dialog-head { justify-content: space-between; }

.hint { color: #666; font-size: 13px; }

#accountText,
#proxyText {
  width: 100%;
  border: 1px solid #ececea;
  border-radius: 12px;
  padding: 8px 10px;
  resize: none;
}

.text-btn,
.solid,
.file {
  border: 1px solid #e4e4e2;
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
}

.solid { background: #1c1c1c; color: #fff; border-color: #1c1c1c; }

.account-list {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
}

.account-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f1ef;
  font-size: 14px;
}

.account-list button {
  border: 0;
  background: transparent;
  color: #888;
  cursor: pointer;
}

.check { margin: 10px 0; }
