:root {
  --bg: #031421;
  --bg-soft: #0d2739;
  --card: rgba(9, 36, 54, 0.95);
  --line: rgba(65, 198, 214, 0.3);
  --line-strong: rgba(65, 198, 214, 0.55);
  --txt: #e7f7ff;
  --muted: #90b8ca;
  --danger: #ef5b7a;
  --accent-a: #18c9a7;
  --accent-b: #00a8d1;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  color: var(--txt);
  background: var(--bg);
}

body.cookie-locked .layout,
body.cookie-locked #dirtyBar {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 700px at 10% -20%, rgba(43, 212, 176, 0.25), transparent),
    radial-gradient(900px 500px at 90% 0%, rgba(84, 157, 255, 0.19), transparent),
    linear-gradient(160deg, #031421 0%, #071b2b 42%, #041522 100%);
  z-index: -1;
}

.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px;
}

.card {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  backdrop-filter: blur(6px);
}

.landing-card {
  max-width: 1180px;
  margin: 24px auto;
}

.landing-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

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

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(117, 194, 214, 0.35);
  background: rgba(8, 33, 49, 0.55);
}

.brand-text h1 {
  margin-bottom: 2px;
  font-size: 28px;
}

.brand-text small {
  color: var(--muted);
}

.landing-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.lang-select {
  min-width: 130px;
}

.landing-hero {
  border: 1px solid rgba(65, 198, 214, 0.24);
  border-radius: 14px;
  padding: 18px;
  background: rgba(8, 33, 49, 0.48);
}

.landing-hero h2 {
  margin: 0 0 8px;
}

.hero-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-actions.left {
  justify-content: flex-start;
}

.hero-btn {
  min-width: 190px;
  height: 42px;
}

.hero-link-btn {
  height: 42px;
  border-radius: 10px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--txt);
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
}

.landing-nav {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.landing-nav-btn {
  background: rgba(12, 50, 70, 0.9);
  border: 1px solid rgba(65, 198, 214, 0.28);
  border-radius: 999px;
  padding: 0 14px;
  height: 34px;
}

.landing-nav-btn.active {
  background: linear-gradient(90deg, rgba(24, 201, 167, 0.95), rgba(0, 168, 209, 0.95));
  color: #002635;
}

.landing-grid {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.landing-page {
  margin-top: 12px;
}

.landing-feature-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.landing-feature-list li {
  margin-bottom: 6px;
}

.dashboard-title {
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: 0.2px;
}

.landing-stat {
  position: relative;
  overflow: hidden;
}

.landing-stat::after {
  content: '';
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(24, 201, 167, 0.2), transparent 68%);
}

.landing-box {
  border: 1px solid rgba(65, 198, 214, 0.24);
  border-radius: 12px;
  padding: 12px;
  background: rgba(8, 33, 49, 0.48);
}

.guild-cards {
  margin-top: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.guild-card {
  border: 1px solid rgba(65, 198, 214, 0.25);
  border-radius: 12px;
  background: rgba(8, 33, 49, 0.55);
  padding: 10px;
}

.guild-head {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
}

.guild-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(117, 194, 214, 0.35);
  object-fit: cover;
}

.guild-icon-fallback {
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--txt);
  background: linear-gradient(90deg, rgba(24, 201, 167, 0.25), rgba(0, 168, 209, 0.25));
}

.guild-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.guild-status {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.guild-status.ok {
  color: #6ae7c8;
}

.guild-status.missing {
  color: #f7b06f;
}

.guild-actions {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.guild-dashboard-card {
  max-width: 1180px;
  margin: 18px auto;
}

.guild-topbar {
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(65, 198, 214, 0.24);
  border-radius: 12px;
  background: rgba(8, 33, 49, 0.55);
}

.profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(117, 194, 214, 0.35);
}

.profile-meta {
  display: grid;
  line-height: 1.05;
}

.profile-meta strong {
  font-size: 13px;
}

.profile-meta small {
  margin-top: 2px;
  font-size: 11px;
}

h1, h2, h3, h4 { margin: 0 0 8px; }
p { margin: 0 0 12px; color: var(--muted); line-height: 1.5; }

form { display: flex; gap: 10px; }

input, select, textarea, button {
  border-radius: 10px;
  border: 1px solid rgba(117, 194, 214, 0.35);
  background: #082335;
  color: var(--txt);
}

input, select, button {
  height: 40px;
  padding: 0 10px;
}

.channel-search,
.role-search {
  height: 34px;
}

.channel-live-list,
.role-live-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #062233;
  z-index: 220;
  padding: 4px;
}

.channel-live-item,
.role-live-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--txt);
  font-weight: 500;
}

.channel-live-item:hover,
.role-live-item:hover {
  background: rgba(24, 201, 167, 0.2);
}

.channel-live-item span,
.role-live-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px;
  resize: vertical;
}

button {
  cursor: pointer;
  border: none;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  font-weight: 700;
  transition: 0.15s ease;
}
button.secondary { background: #19445f; }
button.danger { background: #5f2230; }
button:hover { filter: brightness(1.08); }

.hidden { display: none !important; }
.error { color: #ff829f; min-height: 20px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
}

.tab-btn {
  height: 38px;
  background: rgba(12, 50, 70, 0.9);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn.active {
  background: linear-gradient(90deg, rgba(24, 201, 167, 0.95), rgba(0, 168, 209, 0.95));
  color: #002635;
}

.tab-page { margin-top: 6px; }

.intro-card {
  border-color: var(--line-strong);
}

[data-page="overview"] {
  display: grid;
  gap: 12px;
  align-content: start;
}

[data-page="overview"] > section {
  margin: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  align-items: stretch;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: var(--bg-soft);
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 700; }

.info-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card-grid-2 {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  align-items: stretch;
}

.card-grid-2 .card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.giveaway-stack {
  display: grid;
  gap: 12px;
}

.giveaway-stack .card {
  margin-bottom: 0;
}

.info-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(11, 41, 60, 0.8);
}

.overview-visuals {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  align-items: stretch;
}

.visual-card {
  margin-bottom: 0;
}

.visual-main {
  font-size: 34px;
  font-weight: 800;
  margin: 4px 0 10px;
}

.progress-row {
  display: grid;
  grid-template-columns: 92px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.progress-label,
.progress-value {
  font-size: 12px;
  color: var(--muted);
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(117, 194, 214, 0.2);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
}

.mini-stats {
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.feature-pill-grid {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 10px;
  border: 1px solid rgba(65, 198, 214, 0.25);
  background: rgba(8, 33, 49, 0.6);
}

.feature-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.feature-pill.on .dot { background: #18c9a7; }
.feature-pill.off .dot { background: #ef5b7a; }

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: start;
}

[data-page="jointocreate"] .settings-grid {
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  align-items: start;
}

[data-page="jointocreate"] .setting-tile {
  min-height: 0;
}

[data-page="jointocreate"] .jtc-switches {
  grid-column: 1 / -1;
}

[data-page="jointocreate"] .jtc-block {
  height: 100%;
}

[data-page="jointocreate"] .jtc-block .field > label {
  white-space: nowrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.setting-tile {
  padding: 10px;
  border: 1px solid rgba(65, 198, 214, 0.22);
  border-radius: 12px;
  background: rgba(8, 33, 49, 0.55);
}

.setting-tile.is-disabled {
  opacity: 0.7;
}

.nested-field {
  margin-top: 8px;
}

.inline-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.tile-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.tiny-btn {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.lang-inline .tiny-btn.active {
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  color: #002635;
}

.field:focus-within {
  z-index: 120;
}

.tab-page .card {
  position: relative;
  z-index: 1;
}

.welcome-preview-tile {
  grid-column: 1 / -1;
}

.welcome-advanced-tile {
  grid-column: 1 / -1;
}

.welcome-settings-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: stretch;
}

.welcome-tile {
  min-height: 118px;
}

.welcome-tile-welcome-channel,
.welcome-tile-leave-channel,
.welcome-tile-text-stack {
  grid-column: span 4;
}

.welcome-tile-text-stack {
  gap: 10px;
}

.welcome-tile-welcome-message,
.welcome-tile-leave-message {
  grid-column: span 6;
}

.welcome-tile-bg-url,
.welcome-tile-upload {
  grid-column: span 6;
}

.welcome-tile-welcome-message textarea,
.welcome-tile-leave-message textarea {
  min-height: 96px;
}

.welcome-advanced-details {
  border: 1px solid rgba(65, 198, 214, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(8, 33, 49, 0.42);
}

.welcome-advanced-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  list-style: none;
}

.welcome-advanced-details summary::-webkit-details-marker {
  display: none;
}

.welcome-advanced-grid {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.welcome-preview-canvas {
  width: 100%;
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(65, 198, 214, 0.28);
  background: rgba(8, 33, 49, 0.4);
  cursor: grab;
}

.welcome-preview-canvas:active {
  cursor: grabbing;
}

.welcome-preview-status {
  min-height: 18px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.welcome-preview-status.loading {
  color: #8ec5dc;
}

.welcome-preview-status.ok {
  color: #78e4c2;
}

.welcome-preview-status.error {
  color: #ff9bad;
}
.field label {
  font-size: 13px;
  color: var(--muted);
}

.check-row {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.check-row .switch-row {
  padding: 10px;
  border: 1px solid rgba(65, 198, 214, 0.22);
  border-radius: 12px;
  background: rgba(8, 33, 49, 0.55);
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.switch-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--txt);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(122, 151, 167, 0.35);
  border: 1px solid rgba(122, 151, 167, 0.45);
  transition: all 0.18s ease;
}

.switch-slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #e7f7ff;
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-slider {
  background: linear-gradient(90deg, rgba(24, 201, 167, 0.9), rgba(0, 168, 209, 0.9));
  border-color: rgba(72, 217, 201, 0.95);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(22px);
}

.switch input:disabled + .switch-slider {
  opacity: 0.55;
  cursor: not-allowed;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.list-grid,
.panel-list,
.warnings-list {
  display: grid;
  gap: 10px;
}

.ticket-card,
.panel-card,
.role-row,
.warn-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: rgba(12, 36, 52, 0.75);
}

.ticket-grid,
.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  align-items: start;
}

.giveaway-form-grid > .field {
  padding: 10px;
  border: 1px solid rgba(65, 198, 214, 0.22);
  border-radius: 12px;
  background: rgba(8, 33, 49, 0.55);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.role-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.welcome-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

@media (max-width: 1280px) {
  .welcome-settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .welcome-tile-welcome-channel,
  .welcome-tile-leave-channel,
  .welcome-tile-text-stack,
  .welcome-tile-bg-url,
  .welcome-tile-welcome-message,
  .welcome-tile-leave-message,
  .welcome-tile-upload {
    grid-column: span 1;
  }
}

@media (max-width: 760px) {
  .welcome-settings-grid {
    grid-template-columns: 1fr;
  }

  .welcome-tile-welcome-channel,
  .welcome-tile-leave-channel,
  .welcome-tile-text-stack,
  .welcome-tile-bg-url,
  .welcome-tile-welcome-message,
  .welcome-tile-leave-message,
  .welcome-tile-upload {
    grid-column: 1 / -1;
  }
}

.warn-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 6px;
}

.dirty-bar {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(8, 31, 46, 0.95);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.dirty-bar.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dirty-actions {
  display: flex;
  gap: 10px;
}

.cookie-gate {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(2, 14, 22, 0.78);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 16px;
}

.cookie-gate.hidden {
  display: none;
}

.cookie-gate-card {
  width: min(660px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(7, 30, 46, 0.98), rgba(5, 24, 37, 0.98));
  padding: 18px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.4);
  transform: translateY(10px) scale(0.985);
  opacity: 0;
  animation: cookieSlideIn .22s ease forwards;
}

.cookie-gate-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(65, 198, 214, 0.45);
  background: rgba(18, 62, 86, 0.55);
  color: #a6e6f3;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
  margin-bottom: 8px;
}

.cookie-gate-card h3 {
  margin: 0;
  font-size: 22px;
}

.cookie-gate-card p {
  margin: 0;
  color: var(--muted);
}

.cookie-gate-sub {
  margin-top: 2px !important;
  font-size: 13px;
  color: #b5d6e7 !important;
}

.cookie-gate-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cookie-gate-actions a {
  text-decoration: none;
}

.cookie-gate-hint {
  margin-top: 10px !important;
  font-size: 12px;
  color: #9fc3d8 !important;
  text-align: right;
}

.cookie-btn {
  height: 40px;
  border-radius: 10px;
  padding: 0 14px;
  font-weight: 700;
  border: 1px solid rgba(65, 198, 214, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, filter 0.16s ease, background 0.16s ease;
}

.cookie-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(65, 198, 214, 0.65);
}

.cookie-btn-ghost {
  background: rgba(8, 33, 49, 0.72);
  color: var(--txt);
}

.cookie-btn-primary {
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  color: #002635;
  border-color: rgba(65, 198, 214, 0.75);
}

.cookie-btn-neutral {
  background: rgba(12, 38, 56, 0.92);
  color: #d6eaf6;
}

@keyframes cookieSlideIn {
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

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

@media (max-width: 900px) {
  .layout { padding: 12px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .landing-topbar { flex-direction: column; align-items: flex-start; }
  .landing-actions { width: 100%; }
  .landing-actions > * { flex: 1; }
  .landing-nav { width: 100%; }
  .landing-nav-btn { flex: 1 1 calc(50% - 8px); }
  .hero-btn { width: 100%; min-width: 0; }
  .dirty-bar { left: 12px; right: 12px; bottom: 12px; flex-direction: column; align-items: stretch; }
  .dirty-actions { width: 100%; }
  .dirty-actions button { flex: 1; }
  [data-page="jointocreate"] .settings-grid { grid-template-columns: 1fr; }
  [data-page="jointocreate"] .jtc-switches { grid-column: auto; }
  .overview-visuals,
  .stats,
  .info-grid,
  .feature-pill-grid {
    grid-template-columns: 1fr;
  }
  .stat,
  .visual-card,
  .info-box {
    min-height: 0;
  }
  .guild-actions {
    grid-template-columns: 1fr;
  }
  .profile-chip {
    width: 100%;
    justify-content: flex-start;
  }
}
