:root {
  --bg: #151519;
  --panel: #202027;
  --panel-2: #252631;
  --ink: #f4f4f5;
  --muted: #a1a1aa;
  --line: #3b3d4d;
  --pink: #fc1570;
  --cyan: #20d6ff;
  --green: #20d69b;
  --yellow: #ffb000;
  --danger: #ff3d57;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(252, 21, 112, 0.10) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(32, 214, 255, 0.08) 0 1px, transparent 1px 100%),
    #141418;
  background-size: 52px 52px;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.12;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0);
  background-size: 13px 13px;
  mix-blend-mode: overlay;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 3px solid #050507;
  background: rgba(20, 20, 24, 0.92);
  box-shadow: 0 8px 0 #050507;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(4px 4px 0 #000);
}

.brand p,
.brand h1 {
  margin: 0;
}

.brand p {
  color: var(--pink);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

.brand h1 {
  font-size: clamp(24px, 4vw, 48px);
  line-height: 0.94;
  font-weight: 950;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}

.status-pill,
.icon-btn,
.primary-btn,
.secondary-btn,
.template-card,
.logout-btn,
#addChangeBtn {
  border: 2px solid #050507;
  box-shadow: 4px 4px 0 #050507;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 10px 12px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 800;
  font-size: 13px;
}

.status-pill svg {
  flex: 0 0 auto;
  width: 18px;
}

.status-pill span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  background: var(--danger);
  color: #fff;
  font-size: 13px;
  font-weight: 950;
  text-decoration: none;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

.logout-btn svg {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  stroke-width: 3;
}

.logout-btn span {
  display: block;
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(420px, 1fr) minmax(360px, 520px);
  gap: 16px;
  padding: 22px;
}

.panel {
  position: relative;
  min-width: 0;
  background: var(--panel);
  border: 3px solid #050507;
  box-shadow: 8px 8px 0 #050507;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 12px 14px;
  border-bottom: 3px solid #050507;
  background: #f4f4f5;
  color: #101014;
  font-weight: 950;
  text-transform: uppercase;
}

.panel-head svg {
  width: 20px;
}

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

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 34px;
  background: var(--yellow);
  color: #101014;
  cursor: pointer;
}

.template-grid {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.template-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 2px 10px;
  align-items: center;
  width: 100%;
  padding: 14px;
  background: #2a2b35;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.template-card i {
  grid-row: span 2;
  color: var(--cyan);
  font-size: 24px;
}

.template-card span {
  font-weight: 950;
  text-transform: uppercase;
}

.template-card small {
  color: var(--muted);
  font-weight: 700;
}

.template-card.active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 #050507;
  background: var(--pink);
}

.template-card.active i,
.template-card.active small {
  color: #fff;
}

.mini-note {
  display: flex;
  gap: 10px;
  margin: 0 14px 14px;
  padding: 12px;
  background: #101014;
  border: 2px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mini-note p {
  margin: 0;
}

.form-grid {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.config-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 2px solid #050507;
  background: var(--green);
  color: #07110d;
  box-shadow: 4px 4px 0 #050507;
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.config-strip svg {
  width: 19px;
  flex: 0 0 auto;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.section-title {
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 2px solid #050507;
  background: #121217;
  color: var(--ink);
  padding: 12px;
  outline: none;
  font: inherit;
  font-weight: 700;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(32, 214, 255, 0.22);
}

input[type="color"] {
  min-height: 48px;
  padding: 4px;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

.textarea-wrap {
  position: relative;
}

.mention-menu {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 8;
  display: none;
  max-height: 240px;
  overflow: auto;
  border: 2px solid #050507;
  background: #f4f4f5;
  color: #101014;
  box-shadow: 5px 5px 0 #050507;
}

.mention-option {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-bottom: 2px solid #050507;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.mention-option:last-child {
  border-bottom: 0;
}

.mention-option:hover,
.mention-option.active {
  background: var(--cyan);
}

.mention-option i {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: #101014;
  color: #fff;
  font-style: normal;
  font-weight: 950;
}

.mention-option b,
.mention-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-option b {
  font-weight: 950;
}

.mention-option small {
  color: #52525b;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.file-field input {
  padding: 9px;
}

.file-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.file-control button {
  display: grid;
  place-items: center;
  border: 2px solid #050507;
  background: var(--danger);
  color: #fff;
  box-shadow: 4px 4px 0 #050507;
  cursor: pointer;
}

.file-control button svg {
  width: 18px;
}

.changelog-box,
.payload-box {
  display: grid;
  gap: 12px;
  padding: 12px;
  background: #181920;
  border: 2px solid var(--line);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title svg {
  width: 18px;
  color: var(--cyan);
}

.change-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 120px;
  gap: 10px;
}

#addChangeBtn,
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  font-weight: 950;
  text-transform: uppercase;
  cursor: pointer;
}

#addChangeBtn {
  background: var(--cyan);
  color: #101014;
}

.change-list {
  display: grid;
  gap: 8px;
}

.change-item {
  display: grid;
  grid-template-columns: 82px 1fr 34px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: #101014;
  border: 2px solid #050507;
}

.change-item b {
  color: var(--pink);
}

.change-item button {
  border: 0;
  background: var(--danger);
  color: #fff;
  height: 30px;
  cursor: pointer;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.primary-btn {
  background: var(--green);
  color: #07110d;
}

.secondary-btn {
  background: var(--yellow);
  color: #101014;
}

button:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 #050507;
}

.preview-panel {
  align-self: start;
}

.discord-screen {
  padding: 16px;
  background: #1b1b20;
}

.discord-message {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
}

.bot-avatar {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #9ca3af;
  font-size: 14px;
}

.message-meta span {
  color: #ff3d93;
  font-size: 19px;
}

.message-meta b {
  padding: 1px 5px;
  border-radius: 4px;
  background: #5865f2;
  color: #fff;
  font-size: 12px;
}

.mention-badge {
  display: inline-block;
  width: max-content;
  margin: 4px 0 8px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #3b4587;
  color: #dce3ff;
}

.embed-preview {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 5px 1fr;
  max-width: 650px;
  border: 1px solid #343743;
  border-radius: 4px;
  background: #24252d;
}

.embed-line {
  background: var(--green);
}

.embed-content {
  padding: 16px 16px 14px;
}

.embed-content h2 {
  margin: 0 0 14px;
  color: #fff;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 950;
}

#previewDescription,
.plain-preview {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #f1f1f3;
  font-size: 16px;
  line-height: 1.38;
}

#previewDescription strong {
  font-weight: 950;
}

#previewImage {
  display: none;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  margin-top: 14px;
  border-radius: 4px;
  border: 1px solid #343743;
}

.embed-content footer {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  color: #d4d4d8;
  font-size: 13px;
  font-weight: 800;
}

.embed-content footer img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.plain-preview {
  display: none;
  margin: 8px 0 0;
  padding: 12px;
  border: 1px solid #343743;
  background: #24252d;
  font-family: inherit;
}

.payload-box {
  margin: 16px;
}

#payloadPreview {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  color: #d6d3d1;
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border: 2px solid #050507;
  background: #f4f4f5;
  color: #101014;
  box-shadow: 5px 5px 0 #050507;
  font-weight: 900;
  transform: translateY(120%);
  transition: transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
}

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
}

.auth-card {
  display: grid;
  justify-items: start;
  gap: 12px;
  width: min(520px, 100%);
  padding: 24px;
  border: 3px solid #050507;
  background: var(--panel);
  box-shadow: 9px 9px 0 #050507;
}

.auth-card img {
  width: 86px;
  height: 86px;
  object-fit: contain;
  filter: drop-shadow(4px 4px 0 #000);
}

.auth-card p,
.auth-card h1,
.auth-card span {
  margin: 0;
}

.auth-card p {
  color: var(--pink);
  font-size: 13px;
  font-weight: 950;
  text-transform: uppercase;
}

.auth-card h1 {
  font-size: clamp(32px, 8vw, 64px);
  line-height: 0.92;
  font-weight: 950;
  text-transform: uppercase;
}

.auth-card span {
  color: var(--muted);
  font-weight: 800;
}

.auth-form {
  display: grid;
  gap: 14px;
  width: 100%;
  margin-top: 12px;
}

.remember-check {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 2px solid #050507;
  background: #15161c;
  box-shadow: 4px 4px 0 #050507;
  color: #e5e7eb;
  cursor: pointer;
  font-weight: 900;
  text-transform: uppercase;
  user-select: none;
}

.remember-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.remember-box {
  position: relative;
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 2px solid #050507;
  background: #f4f4f5;
  box-shadow: inset 0 0 0 5px #f4f4f5;
}

.remember-box::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 4px;
  width: 10px;
  height: 17px;
  border: solid #fff;
  border-width: 0 4px 4px 0;
  opacity: 0;
  transform: rotate(45deg);
}

.remember-check input:checked + .remember-box {
  background: var(--pink);
  box-shadow: inset 0 0 0 5px #f4f4f5, 3px 3px 0 #050507;
}

.remember-check input:checked + .remember-box::after {
  opacity: 1;
}

.remember-check:has(input:checked) {
  background: var(--green);
  color: #07110d;
}

.remember-copy {
  display: grid;
  gap: 2px;
  color: inherit;
  line-height: 1.1;
}

.remember-copy b {
  color: inherit;
  font-size: 14px;
}

.remember-copy small {
  color: inherit;
  font-size: 11px;
  opacity: 0.78;
}

@supports not selector(:has(*)) {
  .remember-check {
    background: var(--green);
    color: #07110d;
  }
}

.auth-card.denied {
  border-color: var(--danger);
}

.auth-btn {
  margin-top: 10px;
  text-decoration: none;
  width: max-content;
  min-width: 190px;
}

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

  .preview-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  body {
    background-size: 34px 34px;
    overflow-x: hidden;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    box-shadow: 0 5px 0 #050507;
  }

  .brand {
    gap: 10px;
  }

  .brand img {
    width: 48px;
    height: 48px;
  }

  .brand p {
    font-size: 11px;
  }

  .brand h1 {
    font-size: 28px;
  }

  .status-pill {
    width: 100%;
    justify-content: center;
    min-width: 0;
    padding: 9px 10px;
    text-align: center;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
    gap: 8px;
  }

  .logout-btn {
    min-height: 42px;
    padding: 0 12px;
  }

  .auth-card {
    padding: 20px;
  }

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

  .workspace,
  .split,
  .change-row {
    grid-template-columns: 1fr;
  }

  .workspace {
    gap: 12px;
    padding: 10px 10px 86px;
  }

  .panel {
    box-shadow: 5px 5px 0 #050507;
  }

  .panel-head {
    min-height: 46px;
    padding: 10px 11px;
    font-size: 13px;
  }

  .left-panel {
    order: 1;
    position: sticky;
    top: 0;
    z-index: 4;
  }

  .editor-panel {
    order: 2;
  }

  .preview-panel {
    order: 3;
  }

  .template-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .template-grid::-webkit-scrollbar {
    display: none;
  }

  .template-card {
    grid-template-columns: 28px minmax(0, 1fr);
    flex: 0 0 196px;
    min-height: 72px;
    padding: 11px;
    scroll-snap-align: start;
  }

  .template-card i {
    font-size: 20px;
  }

  .template-card span {
    font-size: 14px;
  }

  .mini-note {
    margin: 0 12px 12px;
  }

  .form-grid {
    gap: 12px;
    padding: 12px 11px 14px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    padding: 10px;
    font-size: 16px;
  }

  textarea {
    min-height: 190px;
  }

  .config-strip {
    align-items: flex-start;
    font-size: 12px;
    line-height: 1.25;
  }

  .change-row {
    gap: 8px;
  }

  .change-item {
    grid-template-columns: 70px 1fr 34px;
    font-size: 13px;
  }

  .actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0 -11px -14px;
    padding: 10px;
    border-top: 3px solid #050507;
    background: rgba(32, 32, 39, 0.96);
    backdrop-filter: blur(10px);
  }

  .primary-btn,
  .secondary-btn,
  #addChangeBtn {
    width: 100%;
    min-height: 48px;
    padding: 0 8px;
    font-size: 13px;
    white-space: nowrap;
  }

  .discord-screen {
    padding: 12px;
    overflow-x: hidden;
  }

  .discord-message {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 9px;
  }

  .bot-avatar {
    width: 34px;
    height: 34px;
  }

  .message-meta {
    flex-wrap: wrap;
  }

  .message-meta span {
    font-size: 16px;
  }

  .embed-preview {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 4px minmax(0, 1fr);
  }

  .embed-content {
    padding: 12px;
  }

  .embed-content h2 {
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  #previewDescription,
  .plain-preview {
    font-size: 13px;
    line-height: 1.34;
  }

  #previewImage {
    max-height: 190px;
    object-fit: contain;
    background: #111217;
  }

  .embed-content footer {
    flex-wrap: wrap;
    font-size: 11px;
  }

  .payload-box {
    margin: 12px;
  }

  #payloadPreview {
    max-height: 220px;
  }
}

@media (max-width: 420px) {
  .brand h1 {
    font-size: 24px;
  }

  .template-card {
    flex-basis: 178px;
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .template-card small {
    display: none;
  }

  .top-actions {
    grid-template-columns: 1fr;
  }

  .logout-btn {
    width: 100%;
    min-height: 44px;
  }

  .remember-check {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .remember-box {
    width: 30px;
    height: 30px;
  }

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

  .file-control {
    grid-template-columns: 1fr;
  }

  .file-control button {
    min-height: 42px;
  }
}
