:root {
  color-scheme: dark;
  --background: #1A1932;
  --surface: #2C2C51;
  --foreground: #2C2C51;
  --ink: #f0f0fa;
  --muted: #b9b9d5;
  --accent: #5959a5;
  --line: #505077;
  font: 15px/1.5 "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--ink); }
header { height: 78px; display: flex; align-items: center; gap: 24px; padding: 0 4vw; background: var(--foreground); border-bottom: 1px solid var(--line); }
.brand { color: var(--ink); text-decoration: none; font-size: 24px; letter-spacing: -.8px; display: inline-flex; gap: 7px; align-items: center; }
.brand-icon { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; }
.local-badge, .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.8px; color: var(--muted); }
#account { margin-left: auto; display: flex; gap: 16px; align-items: center; }
main { max-width: 1540px; margin: auto; padding: 34px 4vw 70px; }
h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 650; letter-spacing: -1.5px; line-height: 1.15; margin: 10px 0 14px; }
h2 { font-size: 19px; margin: 0; }
h3 { font-size: 17px; }
p { margin: 12px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.page-heading { margin: 24px 0 30px; }
button, .button { border: 1px solid var(--line); border-radius: 9px; padding: 8px 13px; background: var(--foreground); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.35; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; max-width: 100%; transition: background .15s, border-color .15s, box-shadow .15s; }
button:hover, .button:hover { background: #3d3d68; }
button.primary, .button.primary, .bot-tabs .active { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { background: #6868b6; }
button.danger { color: #ffb4be; }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid #618caf; outline-offset: 3px; }
.toolbar, .bot-tabs { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pill { padding: 4px 9px; font-size: 10px; font-weight: 700; border-radius: 20px; letter-spacing: .5px; background: var(--background); color: var(--muted); white-space: nowrap; }
.pill.online { color: #285d49; background: #bcd8cd; }
.login-panel { max-width: 580px; margin: 8vh auto; text-align: center; padding: 48px; background: var(--surface); border-radius: 24px; border: 1px solid var(--line); }
.login-icon { width: 70px; height: 70px; border-radius: 20px; }
.login-button { margin: 12px 0; padding: 14px 28px; }
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; margin-top: 30px; }
.guild-card { display: flex; flex-direction: column; padding: 28px 16px; background: var(--surface); min-height: 184px; border-radius: 16px; }
.guild-icon { width: 82px; height: 82px; border-radius: 24px; object-fit: cover; margin-bottom: 10px; }
.guild-name { text-align: center; overflow-wrap: anywhere; }
.stats-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(72px, 1fr); gap: 5px; overflow-x: auto; padding-bottom: 5px; }
.stat-card { display: flex; flex-direction: column; background: var(--foreground); border: 1px solid var(--line); border-radius: 8px; padding: 8px 6px; min-width: 0; font-size: 10px; }
.stat-card .small { font-size: 10px; }
.stat-number { font-size: 22px; line-height: 1.3; font-weight: 650; }
.stat-status { font-size: 12px; line-height: 2.4; }
.field-group { margin: 15px 0; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 650; text-transform: capitalize; }
.entity-picker { position: relative; font-weight: 400; text-transform: none; }
.entity-values { display: flex; flex-wrap: wrap; gap: 5px; }
.entity-chip { display: inline-flex; gap: 5px; align-items: center; padding: 3px 6px; background: var(--background); border-radius: 5px; font-size: 11px; overflow-wrap: anywhere; max-width: 100%; }
.entity-chip button { padding: 0 5px; }
.entity-options { position: relative; max-height: 220px; overflow-y: auto; background: var(--background); border: 1px solid var(--line); border-radius: 6px; padding: 5px; margin-top: 5px; }
.entity-options[hidden] { display: none; }
.entity-options button { width: 100%; justify-content: flex-start; text-align: left; font-size: 11px; overflow-wrap: anywhere; }
.nested-fields { margin: 12px 0 12px 8px; padding-left: 10px; border-left: 1px solid var(--line); }
.uploaded-file { display: flex; flex-direction: column; gap: 7px; border-top: 1px solid var(--line); padding: 12px 0; }
.drop-zone { position: relative; flex: 0 0 0; height: 0; min-height: 0; pointer-events: none; }
.drop-zone.horizontal { width: 0; height: auto; align-self: stretch; }
.discord-container > .drop-zone { margin-block: -6px; }
.discord-row > .drop-zone.horizontal { margin-inline: -4px; }
.drop-zone::after { content: ""; position: absolute; inset: -7px 0; border-radius: 3px; }
.drop-zone.horizontal::after { inset: 0 -7px; }
.dragging-components .drop-zone { pointer-events: auto; z-index: 3; }
.dragging-components .drop-active::after { background: #5865f2; }
.color-control { display: flex; gap: 10px; align-items: center; }
.color-control input[type=color] { width: 52px; height: 40px; padding: 3px; flex-shrink: 0; }
.mode-toggle { margin-top: 7px; text-transform: capitalize; width: fit-content; min-width: 0; background: #38385f; border-color: #686895; box-shadow: inset 0 1px 0 #ffffff0a; }
.mode-toggle:hover { border-color: #9595c7; box-shadow: 0 2px 8px #00000020; }
.toggle-slider { display: inline-flex; width: fit-content; align-items: center; gap: 10px; margin-top: 7px; padding: 7px 11px; border-radius: 20px; background: #242441; }
.toggle-slider[aria-checked=true] { border-color: #7777b5; background: #35355d; }
.toggle-slider .toggle-track { flex-shrink: 0; }
.toggle-field { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.toggle-field > button { margin: 0 0 0 auto; flex-shrink: 0; }
.component-media-panel { margin-top: 18px; }
.file-upload-control > input[hidden] { display: none; }
.media-cards { display: grid; gap: 12px; margin-top: 20px; }
.media-card { position: relative; background: var(--background); border: 1px solid var(--line); border-radius: 10px; min-height: 72px; }
.media-card-preview { display: block; width: 100%; max-height: 220px; object-fit: contain; border-radius: 10px; }
.media-file { padding: 26px 56px 26px 16px; overflow-wrap: anywhere; }
.media-more { position: absolute; top: 8px; right: 8px; background: #1a1932e6; min-width: 34px; padding: 4px 8px; font-size: 18px; }
.media-item-menu { position: absolute; top: 42px; right: 8px; z-index: 4; padding: 6px; background: var(--foreground); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 12px #00000040; }
.media-item-menu[hidden] { display: none; }
.media-item-menu button { display: block; width: 100%; text-align: left; border: 0; }
.toggle-track { width: 38px; height: 22px; border-radius: 12px; background: #646478; padding: 3px; }
.toggle-track::after { content: ""; display: block; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform .15s; }
.toggle-slider[aria-checked=true] .toggle-track { background: #5865f2; }
.toggle-slider[aria-checked=true] .toggle-track::after { transform: translateX(16px); }
.color-control input[type=text] { flex: 1; min-width: 0; font-family: Consolas, monospace; }
.preview-component img, .preview-component video { -webkit-user-drag: none; }
.preview-component { touch-action: none; user-select: none; cursor: grab; }
.dragging-components, .dragging-components * { cursor: grabbing !important; }
.uploading .editor-controls > :not(.upload-panel), .uploading .editor-toolbar, .uploading .preview-panel { pointer-events: none; opacity: .6; }
.feature-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); gap: 22px; margin-top: 30px; align-items: start; }
.feature-section, .editor-controls, .preview-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.section-heading { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 14px; }
.entry-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.entry-row strong { margin-right: auto; overflow-wrap: anywhere; }
.empty { padding: 20px 0; }
.editor-layout { display: grid; grid-template-columns: minmax(320px, .85fr) minmax(400px, 1.15fr); gap: 24px; align-items: start; }
.settings-panel { background: var(--foreground); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.editor-toolbar .primary { margin-left: auto; }
.editor-controls { max-height: 78vh; overflow-y: auto; }
.feature-settings { margin: 0 0 20px; padding: 0 0 16px; border-top: 0; border-bottom: 1px solid var(--line); }
.selector-choice-notice { padding: 12px; margin-bottom: 16px; border: 1px solid #80caff; border-radius: 6px; }
.selector-choice-notice button { margin-left: 12px; }
.preview-panel { position: sticky; top: 20px; background: var(--foreground); min-height: 400px; }
label { display: block; font-size: 12px; color: var(--muted); font-weight: 650; margin: 15px 0; text-transform: capitalize; }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; margin-top: 7px; background: var(--background); border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 10px; font: inherit; font-size: 13px; }
textarea { resize: vertical; text-transform: none; min-height: 48px; }
input[type=checkbox] { margin-left: 14px; width: 18px; height: 18px; vertical-align: middle; }
.code-input { font: 12px/1.5 Consolas, monospace; }
details { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 20px; }
summary { cursor: pointer; font-size: 12px; font-weight: 650; }
.reference { overflow-wrap: anywhere; }
.create-dialog { background: var(--background); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; width: 440px; padding: 28px; }
.create-dialog::backdrop { background: #243c5070; }
.create-dialog .toolbar { justify-content: flex-end; margin-top: 24px; }
.component-dialog { width: min(700px, calc(100vw - 32px)); max-height: 85vh; overflow-y: auto; }
.media-dialog { width: min(600px, calc(100vw - 32px)); max-height: 85vh; overflow-y: auto; }
.media-dialog [hidden] { display: none; }
.file-drop-area { border: 2px dashed var(--line); border-radius: 10px; padding: 18px; margin: 14px 0; text-align: center; }
.file-drop-area.file-drop-hover { border-color: #80caff; background: #80caff18; }
.file-drop-area input { text-align: left; }
.component-groups { display: grid; gap: 18px; }
.component-group { border-top: 1px solid var(--line); padding-top: 10px; }
.component-group h3 { margin: 0 0 10px; font-size: 14px; }
.component-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 8px; }
.component-choice { justify-content: flex-start; text-align: left; text-transform: capitalize; }
.preview-panel > .section-heading { flex-wrap: wrap; }
.preview-panel > .section-heading .primary { margin-left: auto; }
#error { margin: 18px 4vw 0; border: 1px solid #c39399; background: #f0dadc; color: #742934; padding: 14px 20px; border-radius: 8px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #294d43; color: #fff; border-radius: 10px; padding: 14px 24px; z-index: 20; max-width: 90vw; }
.good { color: #9cddbe; }
.bad { color: #ffb4be; }
.message-author { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: #e5e7eb; background: #313338; padding: 18px 18px 10px; border-radius: 10px 10px 0 0; }
.bot-avatar { width: 35px; height: 35px; border-radius: 50%; margin-right: 5px; }
.bot-badge { background: #5865f2; font-size: 10px; padding: 0 4px; border-radius: 3px; color: white; }
.discord-preview { background: #313338; color: #dbdee1; padding: 0 18px 24px 65px; min-height: 220px; border-radius: 0 0 10px 10px; font: 14px/1.4 "Segoe UI", Arial, sans-serif; overflow-wrap: anywhere; }
.discord-container { background: #2b2d31; border: 1px solid #1e1f22; border-left: 4px solid transparent; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 12px; max-width: 100%; }
.discord-container.empty-container { min-height: 88px; }
.markdown h2 { font-size: 23px; line-height: 1.2; margin: 8px 0; color: #f2f3f5; }
.markdown h3 { font-size: 19px; margin: 6px 0; color: #f2f3f5; }
.markdown h4 { font-size: 16px; margin: 4px 0; }
.markdown a { color: #00a8fc; }
.markdown code { background: #1e1f22; padding: 2px 4px; border-radius: 4px; font-family: Consolas, monospace; }
.discord-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.discord-row.empty-row { min-height: 36px; }
.discord-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 14px; min-height: 34px; border-radius: 4px; background: #4e5058; font-size: 13px; font-weight: 600; color: #f2f3f5; user-select: none; }
.discord-button.style-1 { background: #5865f2; }
.discord-button.style-3 { background: #248046; }
.discord-button.style-4 { background: #da373c; }
.discord-button.disabled { opacity: .6; }
.discord-select { background: #1e1f22; border-radius: 4px; padding: 10px 12px; color: #b5bac1; width: 100%; }
.discord-section { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.section-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.discord-thumbnail { width: 80px; height: 80px; border-radius: 8px; object-fit: cover; }
.discord-gallery { display: grid; gap: 4px; border-radius: 8px; overflow: hidden; }
.discord-gallery:not(.gallery-1) { grid-template-columns: 1fr 1fr; }
.discord-gallery img, .discord-gallery video { width: 100%; max-height: 330px; object-fit: cover; }
.discord-gallery .spoiler { filter: blur(18px); }
.discord-separator { height: 1px; border-top: 1px solid #4e5058; margin: 4px 0; }
.discord-separator.large { margin: 12px 0; }
.discord-separator.no-line { border-color: transparent; }
.discord-file, .attachment { background: #232428; border-radius: 6px; padding: 12px; font-size: 12px; }
.preview-component { position: relative; cursor: grab; outline: 2px solid transparent; outline-offset: 3px; border-radius: 4px; }
.preview-component:hover { outline-color: #7098b880; }
.preview-component.selected { outline-color: #80b8e3; background-image: linear-gradient(#71a9d322, #71a9d322); }
.preview-component.selector-target { outline: 3px solid #80caff; outline-offset: 3px; cursor: crosshair; }
.preview-component.drop-target { outline: 3px dashed #b5dfff; }
.preview-invalid { padding-top: 20px; color: #ecc3c8; }
.discord-embed { background: #2b2d31; border-left: 4px solid #5865f2; border-radius: 4px; padding: 16px; max-width: 520px; }
.embed-title { font-size: 16px; color: #00a8fc; margin: 8px 0; }
.embed-author { font-weight: 600; }
.embed-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.embed-field { grid-column: span 3; }
.embed-field.inline { grid-column: span 1; }
.embed-thumbnail { width: 80px; height: 80px; object-fit: cover; float: right; margin-left: 16px; border-radius: 4px; }
.embed-image { width: 100%; max-height: 350px; object-fit: contain; margin-top: 16px; border-radius: 4px; }
.embed-footer { display: block; font-size: 11px; margin-top: 12px; }
.emoji { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; }
@media (max-width: 960px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-controls { max-height: none; }
  .preview-panel { position: static; grid-row: 1; }
  .local-badge { display: none; }
  .discord-preview { padding-left: 18px; }
}
@media (max-width: 500px) {
  header { gap: 10px; padding: 0 16px; }
  main { padding: 20px 16px 50px; }
  .login-panel { padding: 28px 20px; }
  .preview-panel, .editor-controls { padding: 14px; }
  .discord-preview { padding: 0 10px 18px; }
  .editor-toolbar .primary { margin-left: 0; }
}
