:root {
  --bg-a: #25a0c7;
  --bg-b: #12719e;
  --bg-c: #0c5878;
  --surface: rgba(6, 32, 46, 0.55);
  --surface-2: rgba(6, 32, 46, 0.75);
  --surface-3: rgba(0, 0, 0, 0.2);
  --border: rgba(255, 255, 255, 0.18);
  --text: #f7f7f7;
  --muted: #a9d3e5;
  --accent: #f7f7f7;
  --accent-dim: rgba(247, 247, 247, 0.35);
  --success: #3dd68c;
  --error: #ffb3b6;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 35% 65%, var(--bg-a) 0%, var(--bg-b) 45%, var(--bg-c) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px 64px;
}

.wrap { width: 100%; max-width: 480px; }

header { margin-bottom: 24px; }

h1 {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.lede { color: var(--muted); font-size: 13.5px; max-width: 54ch; margin: 0; }

.panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.panel-head {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }

input, select {
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 11px 12px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s ease;
}

select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0l5 6 5-6z' fill='%23a9d3e5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}

input::placeholder { color: #a9d3e5; opacity: 0.7; }
input:focus, select:focus { border-color: var(--accent); }

button {
  width: 100%;
  background: var(--accent);
  color: #0c4d68;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 13px 16px;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}

button:hover:not(:disabled) { background: #ffffff; }
button:active:not(:disabled) { transform: scale(0.99); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }

/* Token list */
.token-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.token-row:last-of-type { border-bottom: none; }

.token-radio {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  accent-color: var(--accent);
}

.token-info { flex: 1; min-width: 0; }
.token-label { font-size: 13.5px; font-weight: 500; }
.token-mask { font-size: 11.5px; color: var(--muted); font-family: ui-monospace, monospace; }

.token-remove {
  width: auto;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--error);
  font-size: 12px;
  padding: 6px 10px;
  margin: 0;
  flex-shrink: 0;
}
.token-remove:hover { background: rgba(255,179,182,0.1); }

.empty-note { font-size: 12.5px; color: var(--muted); padding: 4px 0 12px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* Colors row */
.colors-row { display: flex; gap: 12px; }
.color-group { flex: 1; }
.color-picker-wrapper { display: flex; gap: 6px; align-items: center; }

input[type="color"] {
  width: 42px;
  height: 40px;
  padding: 2px;
  flex-shrink: 0;
  cursor: pointer;
}

.color-hex-input {
  flex: 1;
  font-family: ui-monospace, monospace;
  text-transform: uppercase;
  font-size: 12.5px !important;
  padding: 10px !important;
}

/* Preview */
.preview-box {
  margin-top: 10px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 76px;
  overflow: hidden;
}

#previewText {
  font-size: 24px;
  font-weight: 700;
  direction: ltr;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-0 { font-family: 'Poppins', Arial, sans-serif; }
.font-1 { font-family: 'Baloo 2', sans-serif; }
.font-2 { font-family: 'Klee One', sans-serif; }
.font-3 { font-family: 'Bungee', sans-serif; }
.font-4 { font-family: 'Poppins', sans-serif; }
.font-5 { font-family: 'Press Start 2P', monospace; font-size: 15px !important; }
.font-6 { font-family: 'Creepster', cursive; font-size: 28px !important; }
.font-7 { font-family: 'MedievalSharp', cursive; }

.effect-solid { color: var(--c1); }

.effect-gradient {
  background: linear-gradient(90deg, var(--c1), var(--c2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.effect-neon {
  color: var(--c1);
  text-shadow: 0 0 5px var(--c1), 0 0 15px var(--c1), 0 0 30px var(--c1);
}

.effect-toon {
  color: var(--c1);
  -webkit-text-stroke: 2px var(--c2);
  paint-order: stroke fill;
}

.effect-pop {
  color: var(--c1);
  text-shadow: 3px 3px 0 var(--c2);
}

.cf-turnstile { margin-top: 4px; }

/* Multi-select dropdown */
.ms-select { position: relative; margin-bottom: 4px; }

.ms-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-weight: 500;
}
.ms-trigger .ms-chevron { font-size: 11px; color: var(--muted); margin-left: 8px; transition: transform 0.15s ease; }
.ms-trigger.open .ms-chevron { transform: rotate(180deg); }

.ms-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface-2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
  max-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ms-search { padding: 10px; border-bottom: 1px solid var(--border); }
.ms-search input { padding: 9px 10px; font-size: 13px; }

.ms-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.1s ease;
}
.ms-option:hover { background: rgba(255,255,255,0.05); }

.ms-check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 1px solid var(--accent-dim);
  border-radius: 4px;
  position: relative;
}
.ms-option.selected .ms-check {
  background: var(--accent);
  border-color: var(--accent);
}
.ms-option.selected .ms-check::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #0c4d68;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.ms-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  overflow: hidden;
}
.ms-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ms-option-name {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-all .ms-option-name { font-weight: 600; }

.ms-option-meta {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--muted);
}

.ms-divider { border-bottom: 1px solid var(--border); }

.ms-list { overflow-y: auto; }
.ms-empty { padding: 16px 12px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* Servers panel */
.manual-guild-field { margin-top: 16px; }
.manual-guild-row { display: flex; gap: 8px; }
.manual-guild-row input { flex: 1; }
.btn-inline { width: auto; flex-shrink: 0; padding: 11px 16px; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 6px 5px 12px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}
.chip button {
  width: 18px;
  height: 18px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: var(--text);
  font-size: 12px;
  line-height: 1;
}
.chip button:hover { background: rgba(255,255,255,0.25); }

/* Progress log */
#progressLog { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 12.5px;
}
.progress-row .p-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-row .p-state { flex-shrink: 0; font-weight: 600; }
.progress-row.p-pending .p-state { color: var(--accent); }
.progress-row.p-ok .p-state { color: var(--success); }
.progress-row.p-fail .p-state { color: var(--error); }

/* Status + output */
#status {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  display: none;
  border: 1px solid transparent;
}
#status.show { display: block; }
#status.ok { background: rgba(61,214,140,0.08); border-color: rgba(61,214,140,0.3); color: var(--success); }
#status.fail { background: rgba(255,179,182,0.08); border-color: rgba(255,179,182,0.3); color: var(--error); }
#status.pending { background: rgba(26,144,196,0.08); border-color: rgba(26,144,196,0.3); color: var(--accent); }

pre#out {
  margin-top: 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #eaf6fc;
  display: none;
}
pre#out.show { display: block; }

footer {
  margin-top: 32px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 380px) {
  .panel { padding: 16px; }
  .colors-row { flex-direction: column; gap: 10px; }
}
