:root {
  --page-bg: #eef3f8;
  --ink: #17202c;
  --muted: #5f6b7a;
  --accent: #165dff;
  --accent-soft: #dbe7ff;
  --line: #d8e0ea;
  --card: rgba(255, 255, 255, 0.86);
  --card-strong: #ffffff;
  --shadow: 0 18px 45px rgba(18, 38, 63, 0.08);
  --embed: #2b2d31;
  --discord-text: #dbdee1;
  --discord-muted: #949ba4;
}

html[data-theme="dark"] {
  --page-bg: #0d131a;
  --ink: #edf3f8;
  --muted: #9ba8b6;
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.18);
  --line: #2a3543;
  --card: rgba(20, 28, 37, 0.9);
  --card-strong: #141c25;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.32);
}

body {
  min-height: 100vh;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(22, 93, 255, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 182, 173, 0.12), transparent 24%),
    linear-gradient(180deg, #f7fafc 0%, #eef3f8 100%);
  transition: background-color 180ms ease, color 180ms ease;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at top left, rgba(58, 123, 255, 0.16), transparent 24%),
    radial-gradient(circle at top right, rgba(15, 182, 173, 0.1), transparent 20%),
    linear-gradient(180deg, #0b1016 0%, #101720 100%);
}

a {
  text-decoration: none;
}

.muted {
  color: var(--muted);
}

.page-shell {
  min-height: 100vh;
}

.hero-band {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.85), rgba(243, 248, 255, 0.95)),
    linear-gradient(90deg, rgba(22, 93, 255, 0.08), rgba(15, 182, 173, 0.08));
  backdrop-filter: blur(12px);
}

html[data-theme="dark"] .hero-band {
  background:
    linear-gradient(135deg, rgba(18, 25, 34, 0.88), rgba(13, 19, 26, 0.96)),
    linear-gradient(90deg, rgba(58, 123, 255, 0.1), rgba(15, 182, 173, 0.08));
}

.eyebrow {
  color: #3567d6;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-copy {
  max-width: 64ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero-card,
.dashboard-card {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

html[data-theme="dark"] .hero-card,
html[data-theme="dark"] .dashboard-card {
  border-color: rgba(255, 255, 255, 0.06);
}

.dashboard-card {
  border-radius: 1.25rem;
}

.history-card,
.preview-card {
  position: sticky;
  top: 1.5rem;
}

.editor-card .card-body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(250, 252, 255, 0.9)),
    var(--card-strong);
  border-radius: 1.25rem;
}

html[data-theme="dark"] .editor-card .card-body {
  background:
    linear-gradient(180deg, rgba(18, 25, 34, 0.98), rgba(14, 20, 28, 0.98)),
    var(--card-strong);
}

.section-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(248, 251, 255, 0.88);
}

html[data-theme="dark"] .section-card {
  background: rgba(19, 27, 36, 0.92);
}

html[data-theme="dark"] .text-secondary,
html[data-theme="dark"] .text-secondary-emphasis,
html[data-theme="dark"] .history-meta,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .hero-copy,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .form-label span {
  color: #aab8c7 !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .display-6,
html[data-theme="dark"] .h3,
html[data-theme="dark"] .h4,
html[data-theme="dark"] .h5,
html[data-theme="dark"] strong {
  color: #eef3f8;
}

.form-label,
.form-label span {
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}

.form-control,
.form-select {
  border-color: var(--line);
  border-radius: 0.85rem;
  min-height: 2.9rem;
  background-color: rgba(255, 255, 255, 0.86);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select {
  color: var(--ink);
  background-color: rgba(10, 15, 21, 0.82);
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] input[type="datetime-local"] {
  color: #d7e1ea;
}

.form-control:focus,
.form-select:focus,
.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(22, 93, 255, 0.14);
  border-color: rgba(22, 93, 255, 0.28);
}

textarea.form-control {
  min-height: auto;
  resize: vertical;
}

.color-row {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.75rem;
}

.form-control-color {
  padding: 0.35rem;
}

.mention-toggle {
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: rgba(255, 255, 255, 0.72);
}

html[data-theme="dark"] .mention-toggle {
  background: rgba(17, 24, 33, 0.9);
}

.history-list,
.fields-list {
  display: grid;
  gap: 0.9rem;
}

.history-item {
  padding: 0.95rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.92);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

html[data-theme="dark"] .history-item {
  background: rgba(17, 24, 33, 0.94);
}

.history-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(18, 38, 63, 0.08);
}

.history-item.selected {
  border-color: rgba(22, 93, 255, 0.5);
  box-shadow: inset 0 0 0 1px rgba(22, 93, 255, 0.25);
}

.history-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.field-row {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.84);
}

html[data-theme="dark"] .field-row {
  background: rgba(17, 24, 33, 0.9);
}

.discord-surface {
  min-height: 760px;
  padding: 1.25rem;
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 18%),
    #1e1f22;
}

html[data-theme="dark"] .discord-surface {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

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

.discord-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3a7bff, #165dff);
}

.discord-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.discord-name {
  color: #ffffff;
  font-weight: 700;
}

.discord-time {
  color: var(--discord-muted);
  font-size: 12px;
}

.discord-content {
  color: var(--discord-text);
  white-space: pre-wrap;
  margin-bottom: 8px;
}

.discord-embed {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 12px;
  max-width: 760px;
  background: var(--embed);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
}

.discord-embed-bar {
  background: #3a7bff;
}

.discord-embed-main {
  min-width: 0;
  padding: 12px 0;
}

.embed-author,
.embed-footer {
  color: var(--discord-text);
  font-size: 12px;
}

.embed-author {
  margin-bottom: 8px;
}

.embed-author a,
.embed-title {
  color: #00a8fc;
}

.embed-title {
  display: inline-block;
  font-weight: 700;
  margin-bottom: 8px;
}

.embed-description {
  color: var(--discord-text);
  font-size: 14px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.embed-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.embed-field {
  min-width: 0;
}

.embed-field.full-width {
  grid-column: 1 / -1;
}

.embed-field-name {
  color: var(--discord-text);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.embed-field-value {
  color: var(--discord-text);
  font-size: 13px;
  white-space: pre-wrap;
}

.embed-image,
.embed-thumbnail {
  object-fit: cover;
}

.embed-image {
  display: none;
  width: 100%;
  margin-top: 14px;
  border-radius: 4px;
  max-height: 320px;
}

.embed-thumbnail {
  display: none;
  width: 88px;
  height: 88px;
  margin: 12px 12px 12px 0;
  border-radius: 4px;
}

.embed-footer {
  display: none;
  margin-top: 12px;
  color: var(--discord-muted);
}

#upload-result a {
  word-break: break-all;
}

@media (min-width: 1600px) {
  .dashboard-grid {
    align-items: start;
  }

  .editor-card .card-body {
    padding: 2rem;
  }
}

@media (max-width: 1399.98px) {
  .history-card,
  .preview-card {
    position: static;
  }

  .discord-surface {
    min-height: 540px;
  }
}

@media (max-width: 991.98px) {
  .embed-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .color-row {
    grid-template-columns: 1fr;
  }

  .embed-fields {
    grid-template-columns: 1fr;
  }

  .discord-embed {
    grid-template-columns: 4px minmax(0, 1fr);
  }

  .embed-thumbnail {
    display: none !important;
  }
}
