:root {
  --bg-root: #090a0c;
  --bg-sidebar: rgba(13, 14, 18, 0.88);
  --bg-workspace: rgba(12, 14, 18, 0.76);
  --bg-surface: rgba(24, 27, 33, 0.94);
  --bg-surface-2: rgba(31, 35, 42, 0.92);
  --bg-surface-3: rgba(17, 20, 26, 0.9);
  --border: rgba(74, 83, 100, 0.46);
  --border-soft: rgba(255, 255, 255, 0.08);
  --text-primary: #edf2fb;
  --text-secondary: #d7deea;
  --text-muted: #8e95a3;
  --text-faint: #6f7685;
  --accent: #66d4ff;
  --accent-2: #4fa3ff;
  --accent-soft: rgba(102, 212, 255, 0.16);
  --accent-border: rgba(102, 212, 255, 0.3);
  --success: #8fe2b8;
  --warning: #ffd37a;
  --danger: #ff8b97;
  --shadow-panel: 0 24px 64px rgba(0, 0, 0, 0.45);
  --shadow-card: 0 18px 36px rgba(0, 0, 0, 0.3);
  --radius-panel: 24px;
  --radius-card: 20px;
  --radius-control: 14px;
  --radius-pill: 999px;
  --transition-speed: 0.2s;
  --sidebar-width: 264px;
}

* {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: #436d98 #0d1218;
}

*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

*::-webkit-scrollbar-track {
  background: linear-gradient(180deg, #0d1218, #131922);
}

*::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid #0d1218;
  background: linear-gradient(180deg, #507ea9, #2f587f);
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #6695c3, #3f6a96);
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  background:
    radial-gradient(1100px circle at -10% 8%, rgba(28, 46, 76, 0.75) 0%, transparent 82%),
    radial-gradient(900px circle at 115% 90%, rgba(40, 26, 63, 0.6) 0%, transparent 58%),
    linear-gradient(180deg, #090a0c 0%, #0b0d11 100%);
  color: var(--text-primary);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  line-height: 1.55;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6, 8, 12, 0.08), rgba(6, 8, 12, 0.5)),
    radial-gradient(circle at top, rgba(120, 188, 255, 0.06), transparent 38%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 88%);
  opacity: 0.28;
}

body.legal-body::after {
  opacity: 0;
}

a,
button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.72;
}

.sidebar,
.main,
.ai-assist-toggle,
.ai-assist-panel,
.transcript-viewer {
  position: relative;
  z-index: 2;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 120px),
    var(--bg-sidebar);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.sidebar h2 {
  margin: 0;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: #f3f8ff;
  letter-spacing: 0.01em;
}

.sidebar h2::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe483, #78e6c5);
  box-shadow: 0 0 12px rgba(120, 230, 197, 0.7);
}

.sidebar-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-sidebar-footer {
  display: none;
}

.nav-link {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition:
    background var(--transition-speed) ease,
    border-color var(--transition-speed) ease,
    color var(--transition-speed) ease,
    transform var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.nav-link:hover {
  transform: translateX(2px);
  color: #f3f7ff;
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(92, 103, 122, 0.38);
}

.nav-link.active {
  background:
    linear-gradient(180deg, rgba(31, 51, 74, 0.96), rgba(22, 34, 49, 0.96)),
    rgba(102, 212, 255, 0.08);
  border-color: var(--accent-border);
  color: #f0f9ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar .nav-link {
  font-weight: 600;
}

.sidebar .nav-link i,
.sidebar .nav-link .nav-icon,
.mobile-footer-card img {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.sidebar .nav-link i {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  font-style: normal;
  color: #ebf6ff;
}

.sidebar .nav-link .nav-icon {
  object-fit: contain;
  padding: 2px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  filter: brightness(1.15) contrast(1.08);
}

.sidebar .nav-link:hover i,
.sidebar .nav-link:hover .nav-icon,
.sidebar .nav-link.active i,
.sidebar .nav-link.active .nav-icon {
  background: rgba(102, 212, 255, 0.14);
}

#auth-mini {
  margin-top: 8px;
  padding: 12px 14px !important;
  border-radius: 16px;
  border: 1px solid rgba(74, 83, 100, 0.4);
  background:
    linear-gradient(180deg, rgba(26, 29, 35, 0.95), rgba(18, 21, 27, 0.95)),
    radial-gradient(circle at top right, rgba(73, 128, 190, 0.18), transparent 42%);
  color: var(--text-secondary);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

#auth-mini b {
  color: var(--text-primary);
}

#auth-mini img {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#auth-mini img:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 2px rgba(102, 212, 255, 0.3);
}

.main {
  flex: 1;
  min-width: 0;
  padding: 24px;
  overflow-y: auto;
}

.server-header {
  margin: 0 auto 22px;
  padding: 18px 22px;
  border-radius: var(--radius-panel);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, rgba(79, 163, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(21, 24, 30, 0.92), rgba(14, 17, 22, 0.92));
  box-shadow: var(--shadow-panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.server-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.server-logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  object-fit: contain;
  padding: 10px;
  background: linear-gradient(180deg, rgba(31, 52, 76, 0.9), rgba(20, 32, 46, 0.95));
  border: 1px solid rgba(95, 168, 225, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.server-title {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: 700;
  color: #f4f8ff;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
}

.status-block {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-label {
  color: var(--text-muted);
  font-size: 0.86rem;
}

#status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

.loading-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
  margin-left: 4px;
  pointer-events: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.invite-btn,
.btn {
  min-height: 42px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(95, 168, 225, 0.44);
  background: linear-gradient(180deg, #225981, #183f5d);
  color: #f5fbff;
  padding: 10px 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--transition-speed) ease,
    border-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease,
    background var(--transition-speed) ease;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
}

.invite-btn:hover,
.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 196, 244, 0.65);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.26);
  background: linear-gradient(180deg, #286795, #1b496b);
}

.btn.btn-ghost,
.settings-row-link,
.help-header-meta strong + .btn {
  border-color: rgba(74, 83, 100, 0.58);
  background: linear-gradient(180deg, rgba(43, 49, 59, 0.92), rgba(35, 40, 49, 0.92));
  color: var(--text-secondary);
}

.btn.btn-ghost:hover,
.settings-row-link:hover {
  border-color: rgba(102, 212, 255, 0.34);
  color: var(--text-primary);
  background: linear-gradient(180deg, rgba(49, 57, 68, 0.98), rgba(38, 45, 55, 0.98));
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.tab-content {
  display: none;
  animation: fadeIn 220ms ease-out;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-box {
  margin-bottom: 20px;
  padding: 24px;
  border-radius: var(--radius-panel);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top right, rgba(79, 163, 255, 0.08), transparent 26%),
    linear-gradient(180deg, rgba(20, 23, 29, 0.95), rgba(14, 17, 22, 0.95));
  box-shadow: var(--shadow-panel);
}

.section-box h3 {
  margin: 0 0 10px;
  color: #f2f6ff;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-box h3 i,
.card h4 i {
  font-style: normal;
}

.section-box p,
.card p,
.commands-docs-breadcrumb,
.commands-docs-category-count,
.editor-status,
.status-label,
.server-pill,
.help-header-meta,
.help-config-type-label,
.transcript-meta,
.ai-assist-runtime,
.mobile-footer-subtitle {
  color: var(--text-muted);
}

.section-box p {
  margin: 0 0 16px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.card-grid.wide {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

#servers-grid {
  justify-items: center;
}

#servers-grid .server-card {
  width: 100%;
  max-width: 320px;
}

.card {
  border-radius: var(--radius-card);
  border: 1px solid rgba(74, 83, 100, 0.38);
  background:
    linear-gradient(180deg, rgba(31, 35, 42, 0.94), rgba(23, 27, 33, 0.96)),
    radial-gradient(circle at top right, rgba(79, 163, 255, 0.08), transparent 36%);
  box-shadow: var(--shadow-card);
  padding: 18px;
  transition:
    transform var(--transition-speed) ease,
    border-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(102, 212, 255, 0.22);
}

.card h4 {
  margin: 0 0 8px;
  color: #eef4ff;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  font-size: 0.92rem;
}

.server-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.server-card-icon {
  width: 74px;
  height: 74px;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(95, 168, 225, 0.22);
}

.server-card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.server-card-name {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-primary);
}

.server-card-role {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.server-card-open {
  margin-top: 2px;
}

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(74, 83, 100, 0.48);
  background: rgba(24, 28, 34, 0.78);
  margin: 0 0 14px;
  font-size: 0.84rem;
}

.command-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
}

.command-list li,
.role-pill {
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(74, 83, 100, 0.44);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.role-csv-picker-row,
.role-single-picker-row,
.channel-single-picker-row {
  flex-wrap: wrap;
}

.command-config,
.bind-form,
.application-form-list,
.application-recent-list,
.security-event-list,
.bind-list,
.help-panel-grid .card,
.transcript-list {
  display: grid;
  gap: 10px;
}

.command-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 10px;
  align-items: center;
}

.command-row.fun-row {
  grid-template-columns: minmax(150px, 220px) auto;
}

.fun-level-rewards {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.fun-level-rewards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fun-level-rewards-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.fun-level-rewards-list {
  display: grid;
  gap: 10px;
}

.fun-level-reward-entry {
  display: grid;
  grid-template-columns: minmax(90px, 120px) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.fun-level-reward-add {
  min-width: 44px;
  padding-inline: 0;
  font-size: 1.15rem;
}

.fun-level-reward-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.command-name,
.bind-label,
.editor-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.command-input,
.bind-input,
.editor-textarea,
select.bind-input,
textarea.bind-input {
  width: 100%;
  min-height: 44px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(74, 83, 100, 0.52);
  background: linear-gradient(180deg, rgba(48, 53, 62, 0.92), rgba(38, 43, 50, 0.92));
  color: #f2f6fd;
  padding: 10px 12px;
  outline: none;
  transition:
    border-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease,
    background var(--transition-speed) ease;
}

select.bind-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 42px;
  background-image:
    linear-gradient(180deg, rgba(48, 53, 62, 0.92), rgba(38, 43, 50, 0.92)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M3 5.25L7 9.25L11 5.25' stroke='%23d7deea' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-size: auto, 14px 14px;
  background-position: 0 0, right 14px center;
}

select.bind-input:hover {
  border-color: rgba(102, 212, 255, 0.34);
  box-shadow: 0 0 0 1px rgba(102, 212, 255, 0.08);
}

select.bind-input[multiple] {
  padding-right: 12px;
  background-image: linear-gradient(180deg, rgba(48, 53, 62, 0.92), rgba(38, 43, 50, 0.92));
  min-height: 132px;
}

select.bind-input option,
select.bind-input optgroup {
  background: #151a22;
  color: #edf2fb;
}

select.bind-input::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

select.bind-input::-webkit-scrollbar-track {
  background: linear-gradient(180deg, rgba(16, 20, 26, 0.96), rgba(20, 25, 33, 0.96));
  border-radius: 999px;
}

select.bind-input::-webkit-scrollbar-thumb {
  border-radius: 999px;
  border: 2px solid rgba(16, 20, 26, 0.96);
  background: linear-gradient(180deg, rgba(102, 212, 255, 0.72), rgba(79, 163, 255, 0.58));
}

select.bind-input::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(122, 222, 255, 0.86), rgba(102, 212, 255, 0.7));
}

select.bind-input {
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 212, 255, 0.72) rgba(16, 20, 26, 0.96);
}

.command-input::placeholder,
.bind-input::placeholder,
.editor-textarea::placeholder {
  color: #98a2b2;
}

.command-input:focus,
.bind-input:focus,
.editor-textarea:focus,
select.bind-input:focus,
textarea.bind-input:focus {
  border-color: rgba(102, 212, 255, 0.5);
  box-shadow: 0 0 0 1px rgba(102, 212, 255, 0.22);
}

.editor-textarea,
textarea.bind-input,
#applications-panel-description {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.command-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.command-toggle input,
.bind-form input[type="checkbox"] {
  accent-color: var(--accent-2);
}

.editor-actions,
.bind-actions,
.bind-actions-inline,
.help-config-card .help-actions,
.help-setup-card .help-actions,
.help-transcripts-controls,
.commands-docs-toolbar,
.skysync-platform-tabs,
.status-block {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.editor-status {
  font-size: 0.84rem;
}

#applications-op-status {
  display: block;
  margin: 4px 0 10px;
  color: #b7efff;
}

.is-hidden {
  display: none !important;
}

.commands-docs-toolbar {
  grid-column: 1 / -1;
  justify-content: space-between;
}

.commands-docs-toolbar .btn {
  flex-shrink: 0;
}

.commands-docs-breadcrumb {
  font-size: 0.84rem;
}

.commands-docs-category-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.commands-docs-category-count {
  margin: 0;
  font-size: 0.82rem;
}

.skysync-platform-tab,
.rank-group-toggle {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
}

.skysync-platform-tab.active {
  border-color: rgba(102, 212, 255, 0.42);
  color: #f4fbff;
  background: linear-gradient(180deg, rgba(34, 89, 129, 0.94), rgba(24, 63, 93, 0.94));
}

.sky-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.module-stat {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(74, 83, 100, 0.42);
  background: rgba(18, 23, 31, 0.7);
}

.module-stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.module-stat-value {
  font-size: 1rem;
  color: var(--text-primary);
}

.security-event-row,
.application-form-row,
.application-recent-row,
.bind-item,
.rank-bind-row,
.transcript-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(74, 83, 100, 0.36);
  background: rgba(17, 21, 28, 0.72);
}

.security-event-info,
.application-form-main,
.application-form-meta,
.application-recent-main,
.rank-group-info,
.transcript-metadata {
  display: grid;
  gap: 2px;
}

.security-event-info span,
.application-form-main span,
.application-form-meta span,
.application-recent-main span,
.rank-bind-meta,
.transcript-metadata span {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.status-chip {
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}

.status-chip.status-on {
  color: #dff9ea;
  background: rgba(44, 127, 84, 0.28);
  border-color: rgba(111, 211, 157, 0.38);
}

.status-chip.status-off {
  color: #ffe7ea;
  background: rgba(123, 45, 58, 0.28);
  border-color: rgba(255, 139, 151, 0.35);
}

.status-chip.status-pending {
  color: #fff0c4;
  background: rgba(126, 94, 26, 0.26);
  border-color: rgba(255, 211, 122, 0.34);
}

.status-online {
  color: var(--success);
}

.status-offline {
  color: var(--danger);
}

.status-idle {
  color: var(--warning);
}

.rank-group {
  border-radius: 18px;
  border: 1px solid rgba(74, 83, 100, 0.4);
  background:
    linear-gradient(180deg, rgba(28, 33, 40, 0.94), rgba(19, 23, 29, 0.94)),
    radial-gradient(circle at top right, rgba(79, 163, 255, 0.07), transparent 40%);
  padding: 14px;
}

.rank-group-header,
.rank-group-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-group-header {
  justify-content: space-between;
}

.rank-group-emblem,
.rank-group-emblem-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(95, 168, 225, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

.rank-group-emblem {
  object-fit: cover;
}

.rank-group-title {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.rank-group-count {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.rank-group-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-group-body.collapsed {
  display: none;
}

.role-input-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  border: 0 !important;
  padding: 0 !important;
  clip: rect(0 0 0 0) !important;
  overflow: hidden !important;
  white-space: nowrap !important;
}

.role-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.role-pill-remove {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
}

.role-pill-remove:hover {
  color: var(--text-primary);
}

.role-pill-empty {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.overlay-preview-wrap {
  margin-top: 4px;
  padding: 18px 12px;
  border-radius: 18px;
  border: 1px solid rgba(74, 83, 100, 0.4);
  background: rgba(11, 15, 20, 0.58);
  overflow: hidden;
}

.overlay-pill-stage {
  position: relative;
  width: 100%;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-pill-svg {
  width: min(286px, 100%);
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.45));
}

.skypaint-logo-preview {
  width: min(220px, 100%);
  height: auto;
  display: block;
  user-select: none;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.38));
}

.overlay-pill {
  position: relative;
  width: 210px;
  height: 26px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(12, 17, 23, 0.95), rgba(20, 28, 37, 0.92));
  border: 1px solid rgba(80, 160, 210, 0.35);
  box-shadow:
    inset 0 0 12px rgba(255, 255, 255, 0.03),
    0 6px 18px rgba(0, 0, 0, 0.45),
    0 0 18px rgba(57, 200, 255, 0.14);
  color: #ecf3f8;
  font-size: 11px;
}

.overlay-pill::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(57, 200, 255, 0.16), rgba(57, 200, 255, 0));
  opacity: 0.6;
  pointer-events: none;
}

.overlay-pill-label {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  color: #9fb0bd;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.overlay-pill-value {
  color: #ecf3f8;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.overlay-pill-icon,
.overlay-pill-arrow {
  position: absolute;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(96, 207, 255, 0.42);
  border-radius: 50%;
  box-shadow:
    0 6px 14px rgba(0, 0, 0, 0.45),
    0 0 14px rgba(57, 200, 255, 0.2);
  z-index: 2;
}

.overlay-pill-icon {
  left: -16px;
  background: radial-gradient(circle at 30% 28%, rgba(120, 220, 255, 0.24), transparent 58%),
    linear-gradient(145deg, rgba(30, 46, 62, 0.98), rgba(20, 31, 44, 0.96));
}

.overlay-pill-icon-img {
  width: 23px;
  height: 23px;
  object-fit: contain;
}

.overlay-pill-icon::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 2px solid transparent;
  border-top-color: rgba(57, 200, 255, 0.9);
  border-right-color: rgba(57, 200, 255, 0.9);
  opacity: 0;
}

.overlay-pill-icon.cleaning::before {
  opacity: 1;
  animation: overlay-rocket-spin 0.8s linear infinite;
}

.overlay-pill-arrow {
  right: -16px;
  background: radial-gradient(circle at 34% 30%, rgba(120, 220, 255, 0.16), transparent 58%),
    linear-gradient(145deg, rgba(28, 39, 50, 0.96), rgba(20, 31, 44, 0.94));
}

.overlay-pill-arrow-glyph {
  display: inline-block;
  font-size: 18px;
  font-weight: 600;
  color: #d8f2ff;
  text-shadow: 0 0 8px rgba(57, 200, 255, 0.25);
}

.overlay-pill-arrow.is-open .overlay-pill-arrow-glyph {
  transform: rotate(180deg) translateX(1px);
}

@keyframes overlay-rocket-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.help-header,
.help-transcripts-header,
.transcript-viewer-header,
.ai-assist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.help-panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.help-config-card .help-config-type {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(74, 83, 100, 0.36);
  background: rgba(255, 255, 255, 0.03);
}

.help-transcripts-card {
  display: grid;
  gap: 12px;
}

.help-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.help-config-type-label {
  display: inline-flex;
  margin-bottom: 6px;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.transcript-list {
  min-height: 80px;
}

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

.transcript-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(1200px circle at -15% 12%, rgba(34, 67, 114, 0.28) 0%, transparent 42%),
    radial-gradient(1100px circle at 125% 100%, rgba(43, 31, 73, 0.24) 0%, transparent 40%),
    rgba(5, 7, 12, 0.78);
  backdrop-filter: blur(10px);
}

.transcript-viewer:not(.is-hidden) {
  display: flex;
}

.transcript-viewer-card {
  width: min(960px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 24px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(22, 25, 31, 0.98), rgba(14, 17, 24, 0.98)),
    radial-gradient(circle at top right, rgba(73, 128, 190, 0.18), transparent 42%);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.46);
}

.transcript-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 0.84rem;
}

.transcript-content {
  min-height: 220px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(74, 83, 100, 0.36);
  background: rgba(8, 12, 17, 0.96);
  color: #dbe7ff;
  white-space: pre-wrap;
  overflow: auto;
  font-size: 0.84rem;
  line-height: 1.55;
}

.runtime-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #dcfff0;
  border: 1px solid rgba(82, 201, 136, 0.34);
  background: rgba(32, 146, 82, 0.18);
}

.ai-assist-toggle {
  position: fixed;
  right: 22px;
  bottom: 20px;
  z-index: 1100;
  border: 1px solid rgba(102, 212, 255, 0.38);
  background:
    linear-gradient(180deg, rgba(34, 89, 129, 0.94), rgba(24, 63, 93, 0.94)),
    rgba(102, 212, 255, 0.12);
  color: #eef9ff;
  border-radius: var(--radius-pill);
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.38);
}

.ai-assist-panel {
  position: fixed;
  right: 20px;
  bottom: 72px;
  z-index: 1100;
  width: min(560px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  max-height: min(78vh, 760px);
  border-radius: 20px;
  border: 1px solid rgba(102, 212, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(22, 25, 31, 0.98), rgba(14, 17, 24, 0.98)),
    radial-gradient(circle at top right, rgba(73, 128, 190, 0.16), transparent 42%);
  box-shadow: 0 20px 38px rgba(0, 0, 0, 0.5);
}

.ai-assist-panel[hidden] {
  display: none !important;
}

.ai-assist-header h4 {
  margin: 0;
}

.ai-assist-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 12px;
  flex: 1;
}

.ai-assist-sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 6px;
  border-right: 1px solid rgba(102, 212, 255, 0.14);
}

.ai-assist-new-chat {
  width: 100%;
}

.ai-assist-history-list {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.ai-assist-history-item {
  position: relative;
  width: 100%;
}

.ai-assist-history-select {
  width: 100%;
  padding: 10px 32px 10px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
}

.ai-assist-history-select:hover {
  border-color: rgba(102, 212, 255, 0.22);
  background: rgba(79, 163, 255, 0.08);
}

.ai-assist-history-item.is-active .ai-assist-history-select {
  border-color: rgba(102, 212, 255, 0.28);
  background: rgba(79, 163, 255, 0.12);
}

.ai-assist-history-delete {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.ai-assist-history-delete:hover {
  color: var(--text-main);
}

.ai-assist-history-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  font-weight: 600;
}

.ai-assist-history-meta {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.74rem;
}

.ai-assist-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ai-assist-messages {
  min-height: 300px;
  max-height: min(58vh, 560px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.ai-assist-message {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.92rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.ai-assist-message--assistant {
  align-self: flex-start;
  width: 100%;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.ai-assist-message--user {
  align-self: flex-end;
  width: fit-content;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  text-align: left;
}

.ai-assist-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: end;
}

.ai-assist-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-assist-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(102, 212, 255, 0.2);
  background: rgba(79, 163, 255, 0.1);
  font-size: 0.8rem;
  line-height: 1.2;
}

.ai-assist-attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-assist-attachment-remove {
  padding: 0;
  min-width: 18px;
  min-height: 18px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.ai-assist-attachment-remove:hover {
  color: var(--text-main);
}

.ai-assist-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
}

.ai-assist-attach img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  pointer-events: none;
}

.ai-assist-input {
  min-height: 42px;
  max-height: 140px;
  resize: none;
  overflow-y: auto;
  white-space: pre-wrap;
}

.ai-assist-caret::after {
  content: "";
  display: inline-block;
  width: 0.62ch;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -0.14em;
  background: rgba(102, 212, 255, 0.9);
  animation: ai-assist-caret-blink 1s steps(1) infinite;
}

@keyframes ai-assist-caret-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

.legal-body {
  display: block !important;
  min-height: 100vh !important;
  background:
    radial-gradient(1200px 680px at 16% 8%, rgba(79, 163, 255, 0.12), transparent 58%),
    radial-gradient(900px 600px at 88% 18%, rgba(102, 212, 255, 0.08), transparent 52%),
    linear-gradient(180deg, #090a0c, #0c0f14) !important;
  font-family: "Space Grotesk", "Segoe UI", sans-serif !important;
}

.legal-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 56px 16px;
  position: relative;
  z-index: 2;
}

.legal-card {
  width: min(920px, 100%);
  padding: 30px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(22, 25, 31, 0.98), rgba(14, 17, 24, 0.98)),
    radial-gradient(circle at top right, rgba(73, 128, 190, 0.16), transparent 42%);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.legal-top {
  margin-bottom: 18px;
}

.legal-back {
  display: inline-flex;
  width: auto;
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(74, 83, 100, 0.52);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}

.legal-back i {
  font-style: normal;
}

.legal-content h1 {
  margin: 0 0 18px;
  color: #f1f6ff;
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  letter-spacing: -0.02em;
}

.legal-content p,
.legal-content li {
  color: #b9c3d4;
}

.legal-content p {
  margin: 0 0 18px;
  line-height: 1.75;
}

.legal-content h3 {
  margin: 28px 0 10px;
  font-size: 1.08rem;
  color: #edf3fc;
}

.legal-content h3::before {
  content: "";
  display: block;
  height: 1px;
  margin: 0 0 14px;
  background: rgba(255, 255, 255, 0.08);
}

.legal-content ul {
  margin: 8px 0 18px 20px;
}

.legal-content li {
  margin: 8px 0;
}

.legal-content a {
  color: #b8eaff;
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 230px;
  }

  .card-grid.wide {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

@media (max-width: 900px) {
  :root {
    --sidebar-width: 208px;
  }

  .main {
    padding: 18px;
  }

  .server-header,
  .section-box {
    padding: 20px;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

@media (max-width: 768px) {
  body {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-scroll {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-right: 0;
  }

  .sidebar-footer {
    display: none;
  }

  .mobile-sidebar-footer {
    display: block;
    padding: 14px 16px;
    border-top: 1px solid var(--border-soft);
    background: rgba(11, 13, 18, 0.86);
  }

  .mobile-footer-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
  }

  .mobile-footer-links a {
    color: #b8eaff;
    text-decoration: none;
  }

  .main {
    padding: 14px;
  }

  .nav-link {
    width: auto;
    white-space: nowrap;
  }

  .server-header {
    align-items: flex-start;
  }

  .command-row,
  .command-row.fun-row,
  .fun-level-reward-entry {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .server-logo {
    width: 52px;
    height: 52px;
  }

  .server-title {
    font-size: 1.28rem;
  }

  .section-box,
  .card,
  .transcript-viewer-card,
  .legal-card {
    padding: 18px;
  }

  .help-config-grid,
  .card-grid,
  .card-grid.wide {
    grid-template-columns: 1fr;
  }

  .transcript-viewer {
    padding: 12px;
  }

  .ai-assist-toggle {
    right: 14px;
    bottom: 14px;
  }

  .ai-assist-panel {
    right: 10px;
    left: 10px;
    bottom: 62px;
    width: auto;
  }

  .ai-assist-body {
    grid-template-columns: 1fr;
  }

  .ai-assist-sidebar {
    max-height: 140px;
    padding-right: 0;
    padding-bottom: 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(102, 212, 255, 0.14);
  }

  .ai-assist-history-list {
    max-height: 88px;
  }

  .ai-assist-form {
    grid-template-columns: 1fr auto auto;
  }

  .ai-assist-form .btn[type="submit"] {
    grid-column: auto;
  }

  .legal-page {
    padding: 24px 12px;
  }

  .legal-content h1 {
    font-size: 1.6rem;
  }
}
