/* ═══════════════════════════════════════════════
   CS2 Panel — Signal Intelligence Console
   2026 · oklch · @layer · @property · glass
   ═══════════════════════════════════════════════ */

/* ── Self-hosted variable fonts (DSGVO-konform, kein CDN) ── */
@font-face {
  font-family: 'Syne';
  src: url('/fonts/syne-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── MPA View Transitions (Chrome 126+, zero JS) ── */
@view-transition {
  navigation: auto;
}

/* ── Cascade layers ── */
@layer reset, tokens, base, layout, nav, buttons, forms, panels, cards, console,
       status, modal, toasts, skeleton, footer, utils, anim;

/* ── Animatable custom property for status dot glow intensity ── */
@property --dot-glow {
  syntax: '<number>';
  initial-value: 0;
  inherits: false;
}

/* ════════════════════════════════════════════════
   TOKENS
   ════════════════════════════════════════════════ */
@layer tokens {
  :root {
    /* Backgrounds */
    --bg-deep:    oklch(6.5% 0.009 250);
    --bg-surface: oklch(10%  0.011 250);
    --bg-card:    oklch(13.5% 0.013 250);
    --bg-input:   oklch(16%  0.015 250);

    /* Borders */
    --border-subtle: oklch(21%   0.017 250);
    --border-accent: oklch(25.5% 0.019 250);

    /* Text */
    --text-primary:   oklch(90%  0.006 250);
    --text-secondary: oklch(57%  0.025 250);
    --text-muted:     oklch(58%  0.022 250);

    /* Pink accent */
    --accent:      oklch(72% 0.22 350);
    --accent-dim:  oklch(72% 0.22 350 / 0.15);
    --accent-glow: oklch(72% 0.22 350 / 0.28);
    --accent-hi:   color-mix(in oklch, var(--accent), white 12%);

    /* Semantic */
    --success:     oklch(72%   0.185 145);
    --success-dim: oklch(72%   0.185 145 / 0.15);
    --danger:      oklch(62.5% 0.225 26);
    --danger-dim:  oklch(62.5% 0.225 26 / 0.15);
    --warning:     oklch(70%   0.15  77);
    --warning-dim: oklch(70%   0.15  77 / 0.15);
    --info:        oklch(70%   0.14  240);
    --info-dim:    oklch(70%   0.14  240 / 0.12);

    /* Typography */
    --font-display: 'Syne', sans-serif;
    --font-mono:    'JetBrains Mono', monospace;

    /* Shape */
    --radius:    3px;
    --radius-lg: 6px;
    --radius-xl: 12px;

    /* Motion */
    --fast:       100ms ease;
    --transition: 160ms ease;
    --slow:       280ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Enable height: auto transitions (Chrome 129+) */
    interpolate-size: allow-keywords;
  }
}

/* ════════════════════════════════════════════════
   RESET
   ════════════════════════════════════════════════ */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  html {
    color-scheme: dark;
    scroll-behavior: smooth;
  }
}

/* ════════════════════════════════════════════════
   BASE
   ════════════════════════════════════════════════ */
@layer base {
  body {
    font-family: var(--font-mono);
    font-weight: 500;
    background-color: var(--bg-deep);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;

    /* Cinematic background: pink accent glow at top fading to deep dark */
    background-image:
      radial-gradient(ellipse 80% 55% at 50% -10%,
        oklch(72% 0.22 350 / 0.05),
        transparent 70%),
      linear-gradient(180deg, var(--bg-surface), var(--bg-deep) 60%);
    background-attachment: fixed;
  }

  /* Subtle grid overlay */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
      linear-gradient(oklch(100% 0 0 / 0.018) 1px, transparent 1px),
      linear-gradient(90deg, oklch(100% 0 0 / 0.018) 1px, transparent 1px);
    background-size: 44px 44px;
    pointer-events: none;
    z-index: 0;
  }

  body > * { position: relative; z-index: 1; }

  a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);

    &:hover { color: var(--text-primary); }
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-mono);
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin: 0;
    text-wrap: balance;
  }

  /* Skip link */
  .skip-link {
    position: absolute;
    left: -9999px;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: var(--bg-deep);
    font-weight: 700;
    border-radius: var(--radius);

    &:focus { left: 1rem; top: 1rem; }
  }
}

/* ════════════════════════════════════════════════
   LAYOUT
   ════════════════════════════════════════════════ */
@layer layout {
  .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
  }

  .manage-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding-bottom: 2rem;

    @media (max-width: 900px) {
      grid-template-columns: 1fr;
    }
  }

  /* Page header */
  .page-header {
    padding: 1.5rem 0 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;

    h1 {
      font-size: 1rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-secondary);
    }
  }

  /* Manage page header */
  .manage-header {
    text-align: center;
    padding: 1.5rem 0 1rem;

    h1 {
      font-family: var(--font-mono);
      font-size: 1.3rem;
      font-weight: 800;
      color: var(--text-primary);
    }

    .manage-header-right {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
      margin-top: 0.3rem;
      flex-wrap: wrap;
    }

    .server-addr {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }
  }

  /* Expert mode toggle */
  .mode-toggle {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;

    &:hover { color: var(--text-primary); border-color: var(--text-secondary); }
    &.mode-toggle--active { color: var(--accent); border-color: var(--accent); }
  }

  /* Hide expert-only elements in normal mode */
  body:not([data-mode="expert"]) .expert-only { display: none !important; }

  /* Utilities */
  .w-100 { width: 100%; }
  .w-50  { width: 50%;  }
  .d-flex { display: flex; }
  .align-items-center { align-items: center; }
  .gap-2 { gap: 0.5rem; }
  .me-1 { margin-right: 0.25rem; }
  .ms-auto { margin-left: auto; }
  .mb-2 { margin-bottom: 0.6rem; }
  .mb-3 { margin-bottom: 0.85rem; }
  .mb-4 { margin-bottom: 1.25rem; }
  .mt-3 { margin-top: 0.85rem; }
  .mt-sm { margin-top: 6px; }
  .mb-sm { margin-bottom: 0.75rem; }
}

/* ════════════════════════════════════════════════
   NAVIGATION
   ════════════════════════════════════════════════ */
@layer nav {
  .panel-nav {
    background: oklch(10% 0.011 250 / 0.85);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    view-transition-name: panel-nav;

    .nav-inner {
      max-width: 1200px;
      margin: 0 auto;
      display: flex;
      align-items: center;
      height: 54px;
      gap: 2rem;
    }

    .nav-brand {
      font-family: var(--font-mono);
      font-weight: 300;
      font-size: 1.05rem;
      color: var(--accent);
      letter-spacing: 0.12em;
      text-transform: uppercase;
      text-decoration: none;
      display: flex;
      align-items: center;
      gap: 0.55rem;
      transition: opacity var(--transition);

      &:hover { opacity: 0.85; color: var(--accent); }

      /* Animated crosshair mark */
      &::before {
        content: '';
        display: flex;
        width: 8px;
        height: 8px;
        background: var(--accent);
        clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
        animation: brand-spin 12s linear infinite;
        flex-shrink: 0;
      }
    }

    .nav-links {
      display: flex;
      gap: 0.25rem;
      list-style: none;
      margin: 0;
      padding: 0;

      a {
        display: block;
        padding: 0.4rem 0.8rem;
        color: var(--text-secondary);
        font-size: 0.8rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        border-radius: var(--radius);
        transition: color var(--transition), background var(--transition);
        text-decoration: none;

        &:hover, &.active, &[aria-current="page"] {
          color: var(--text-primary);
          background: oklch(100% 0 0 / 0.05);
        }

        &[aria-current="page"] {
          color: var(--accent);
          background: var(--accent-dim);
        }
      }
    }

    .nav-actions {
      margin-left: auto;
      form { margin: 0; }
    }
  }

  .nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-accent);
    color: var(--text-secondary);
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: border-color var(--transition), color var(--transition);

    &:hover {
      border-color: var(--text-muted);
      color: var(--text-primary);
    }
  }

  @media (max-width: 640px) {
    .nav-toggle { display: block; }

    .panel-nav .nav-links {
      display: none;
      position: absolute;
      top: 54px;
      left: 0;
      right: 0;
      background: oklch(10% 0.011 250 / 0.95);
      backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--border-subtle);
      flex-direction: column;
      padding: 0.5rem 1rem;

      &.open { display: flex; }
    }

    .panel-nav .nav-inner { flex-wrap: wrap; }
  }
}

/* ════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════ */
@layer buttons {
  .btn {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    line-height: 1.2;
    white-space: nowrap;
    position: relative;

    &:disabled {
      opacity: 0.35;
      cursor: not-allowed;
      pointer-events: none;
    }

    &:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    /* Loading spinner */
    &.btn-loading {
      color: transparent !important;

      &::after {
        content: '';
        position: absolute;
        inset: 0;
        margin: auto;
        width: 1em;
        height: 1em;
        border: 2px solid var(--text-muted);
        border-top-color: var(--text-primary);
        border-radius: 50%;
        animation: btn-spin 0.6s linear infinite;
      }
    }
  }

  .btn-sm {
    font-size: 0.72rem;
    padding: 0.35rem 0.65rem;
  }

  .btn-primary {
    background: var(--accent);
    color: var(--bg-deep);
    border-color: var(--accent);

    &:hover {
      background: var(--accent-hi);
      border-color: var(--accent-hi);
      box-shadow: 0 0 16px var(--accent-glow);
    }
  }

  .btn-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
    border-color: var(--border-subtle);

    &:hover {
      color: var(--text-primary);
      border-color: var(--border-accent);
      background: oklch(18% 0.016 250);
    }
  }

  .btn-success {
    background: var(--success-dim);
    color: var(--success);
    border-color: oklch(72% 0.185 145 / 0.25);

    &:hover { background: oklch(72% 0.185 145 / 0.25); }
  }

  .btn-danger {
    background: var(--danger-dim);
    color: var(--danger);
    border-color: oklch(62.5% 0.225 26 / 0.25);

    &:hover { background: oklch(62.5% 0.225 26 / 0.25); }
  }

  .btn-warning {
    background: var(--warning-dim);
    color: var(--warning);
    border-color: oklch(70% 0.15 77 / 0.25);

    &:hover { background: oklch(70% 0.15 77 / 0.25); }
  }

  .btn-info {
    background: var(--info-dim);
    color: var(--info);
    border-color: oklch(70% 0.14 240 / 0.22);

    &:hover { background: oklch(70% 0.14 240 / 0.22); }
  }

  .btn-outline-info {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-accent);

    &:hover {
      color: var(--info);
      border-color: oklch(70% 0.14 240 / 0.35);
      background: var(--info-dim);
    }
  }

  .btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: 0.35rem 0.6rem;

    &:hover {
      color: var(--text-primary);
      background: oklch(100% 0 0 / 0.05);
    }
  }

  /* Button layouts */
  .btn-grid {
    display: grid;
    gap: 5px;

    &.cols-2 { grid-template-columns: repeat(2, 1fr); }
    &.cols-3 { grid-template-columns: repeat(3, 1fr); }
    &.cols-4 { grid-template-columns: repeat(4, 1fr); }
    &.cols-5 { grid-template-columns: repeat(5, 1fr); }
  }

  .btn-pair {
    display: flex;
    gap: 3px;

    .btn { flex: 1; font-size: 0.7rem; padding: 0.4rem 0.4rem; }
  }

  /* Active preset (selected state) */
  .btn-active {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    color: var(--accent) !important;
  }

  /* Touch target */
  @media (pointer: coarse) {
    .btn { min-height: 44px; }
  }

  /* Mobile grid collapse */
  @media (max-width: 480px) {
    .btn-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .btn-grid.cols-5 { grid-template-columns: repeat(3, 1fr); }
    .btn-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  }
}

/* ════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════ */
@layer forms {
  .form-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
  }

  .form-control,
  .form-select {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    color: var(--text-primary);
    padding: 0.55rem 0.75rem;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;

    &:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px var(--accent-dim);
    }

    &::placeholder { color: var(--text-muted); }

    &:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 1px;
    }
  }

  .form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%237a8394' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;

    option {
      background: var(--bg-card);
      color: var(--text-primary);
    }
  }

  .input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 0.6rem;

    .form-control { flex: 1; }
  }

  /* Section separator label */
  .section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin: 1rem 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;

    &::after {
      content: '';
      flex: 1;
      height: 1px;
      background: var(--border-subtle);
    }
  }

  /* Neutralise browser autofill background flash */
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    caret-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
  }

  @media (max-width: 480px) {
    .input-row {
      flex-direction: column;

      .btn { width: 100%; }
    }
  }
}

/* ════════════════════════════════════════════════
   PANELS & CARDS
   ════════════════════════════════════════════════ */
@layer panels {
  /* Glassmorphic base panel */
  .panel {
    position: relative;
    background: oklch(13.5% 0.013 250 / 0.88);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid oklch(21% 0.017 250 / 0.75);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;

    /* Entry animation via @starting-style (no JS) */
    opacity: 1;
    translate: 0 0;
    transition: opacity 0.35s var(--slow), translate 0.35s var(--slow);
  }

  @starting-style {
    .panel {
      opacity: 0;
      translate: 0 12px;
    }
  }

  .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);

    h2 {
      font-family: var(--font-mono);
      font-size: 0.82rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-secondary);
    }

    .badge {
      font-family: var(--font-mono);
      font-size: 0.68rem;
      padding: 0.18rem 0.5rem;
      border-radius: 2px;
      font-weight: 500;
    }
  }

  /* Staggered entry delays */
  .manage-grid .panel:nth-child(2) { transition-delay: 60ms; }
  .manage-grid .panel:nth-child(3) { transition-delay: 120ms; }
  .manage-grid .panel:nth-child(4) { transition-delay: 180ms; }
  .manage-grid .panel:nth-child(5) { transition-delay: 240ms; }
  .manage-grid .panel:nth-child(6) { transition-delay: 300ms; }

  @starting-style {
    .manage-grid .panel:nth-child(2),
    .manage-grid .panel:nth-child(3),
    .manage-grid .panel:nth-child(4),
    .manage-grid .panel:nth-child(5),
    .manage-grid .panel:nth-child(6) {
      opacity: 0;
      translate: 0 12px;
    }
  }
}

/* ════════════════════════════════════════════════
   SERVER CARDS
   ════════════════════════════════════════════════ */
@layer cards {
  /* Container query host */
  #serverList {
    container-type: inline-size;
    container-name: server-list;

    @media (min-width: 641px) {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
      gap: 0.75rem;

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

  /* Container-query-based card layout */
  @container server-list (min-width: 700px) {
    .server-card .server-card-actions {
      margin-top: 0;
    }
  }

  .server-card {
    background: oklch(13.5% 0.013 250 / 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid oklch(21% 0.017 250 / 0.8);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    transition:
      border-color var(--transition),
      box-shadow var(--transition),
      transform var(--transition),
      --card-shadow var(--transition);

    /* Entry animation */
    opacity: 1;
    translate: 0 0;
    transition: opacity 0.35s var(--slow), translate 0.35s var(--slow),
                border-color var(--transition), box-shadow var(--transition);

    &:hover {
      --card-shadow: 1;
      border-color: var(--border-accent);
      box-shadow: 0 4px 24px oklch(0% 0 0 / 0.35);
    }

    .card-header {
      background: none;
      border: none;
      padding: 0;
      margin-bottom: 0.75rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .card-title {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 1rem;
      color: var(--text-primary);
      margin: 0;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      transition: color var(--transition);
    }

    &:hover .card-title { color: var(--accent); }

    .card-body { padding: 0; }

    .server-addr-line {
      font-family: var(--font-mono);
      font-size: 0.78rem;
      color: var(--text-muted);
      margin: 0 0 0.75rem;
      letter-spacing: 0.02em;
    }

    .server-player-count {
      margin-left: 0.6em;
      color: var(--accent);
      font-size: 0.78rem;
    }

    .status { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-secondary); margin: 0.25rem 0; }
  }

  .server-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  @starting-style {
    .server-card {
      opacity: 0;
      translate: 0 10px;
    }
  }

  /* Auth pages (login, add-server) */
  .auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem 1rem;

    /* Centered spotlight behind the card */
    &::before {
      content: '';
      position: fixed;
      width: 500px;
      height: 500px;
      background: radial-gradient(circle, oklch(72% 0.22 350 / 0.06), transparent 70%);
      border-radius: 50%;
      pointer-events: none;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -60%);
    }
  }

  .auth-card {
    width: 100%;
    max-width: 400px;
    position: relative;

    .panel {
      padding: 2.25rem 2rem;
      border-color: oklch(25.5% 0.019 250 / 0.7);

      /* Gold top-edge accent line */
      &::before {
        content: '';
        position: absolute;
        top: 0;
        left: 2rem;
        right: 2rem;
        height: 1px;
        background: linear-gradient(90deg, transparent, var(--accent), transparent);
        border-radius: 1px;
      }
    }

    .auth-title {
      font-family: var(--font-mono);
      font-size: 1.45rem;
      font-weight: 300;
      text-align: center;
      margin-bottom: 0.2rem;
      color: var(--accent);
      letter-spacing: 0.12em;
    }

    .auth-subtitle {
      font-size: 0.75rem;
      font-weight: 600;
      text-align: center;
      color: var(--text-muted);
      margin-bottom: 1.75rem;
      letter-spacing: 0.05em;
      text-transform: uppercase;
    }

    .btn-container {
      display: flex;
      gap: 0.5rem;
      margin-top: 1.25rem;

      .btn { flex: 1; }
    }
  }
}

/* ════════════════════════════════════════════════
   RCON CONSOLE
   ════════════════════════════════════════════════ */
@layer console {
  .rcon-response {
    display: none;
    background: oklch(6.5% 0.009 250 / 0.95);
    border: 1px solid var(--border-subtle);
    border-left: 2px solid var(--accent);
    border-radius: var(--radius);
    margin-top: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-secondary);
    overflow: hidden;
  }

  .rcon-response-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.35rem 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-input);
  }

  .rcon-response-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
  }

  .rcon-response pre {
    margin: 0;
    padding: 0.75rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.65;
  }

  .data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  .data-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .data-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
  }

  .data-value {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
  }
}

/* ════════════════════════════════════════════════
   STATUS, BADGES, ALERTS
   ════════════════════════════════════════════════ */
@layer status {
  /* Status dot with animated ring */
  .status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    vertical-align: middle;
    flex-shrink: 0;
    position: relative;

    &.online {
      --dot-glow: 4;
      background: var(--success);
      box-shadow:
        0 0 0 0 oklch(72% 0.185 145 / 0),
        0 0 calc(var(--dot-glow) * 1px) oklch(72% 0.185 145 / 0.7);
      animation:
        dot-ring 2.4s cubic-bezier(0.4, 0, 0.6, 1) infinite,
        dot-glow  2s ease-in-out infinite;
    }

    &.offline {
      background: var(--danger);
      box-shadow: 0 0 5px oklch(62.5% 0.225 26 / 0.35);
    }
  }

  /* Badges */
  .badge-connected {
    background: var(--success-dim);
    color: var(--success);
    border: 1px solid oklch(72% 0.185 145 / 0.25);
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
    font-weight: 600;
    letter-spacing: 0.04em;
  }

  .badge-disconnected {
    background: var(--danger-dim);
    color: var(--danger);
    border: 1px solid oklch(62.5% 0.225 26 / 0.25);
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 0.15rem 0.45rem;
    font-weight: 600;
    letter-spacing: 0.04em;
  }

  /* Alerts */
  .alert {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    border: 1px solid;
  }

  .alert-secondary {
    background: var(--bg-input);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
  }

  .alert-primary {
    background: var(--accent-dim);
    border-color: oklch(72% 0.22 350 / 0.28);
    color: var(--accent);
  }

  .alert-danger {
    background: var(--danger-dim);
    border-color: oklch(62.5% 0.225 26 / 0.25);
    color: var(--danger);
  }

  .alert-disconnected {
    background: var(--danger-dim);
    border-color: oklch(62.5% 0.225 26 / 0.25);
    color: var(--danger);
    margin-bottom: 1rem;
    text-align: center;
    border-radius: var(--radius);
    padding: 0.65rem 1rem;
    font-size: 0.82rem;

    a { color: var(--text-primary); text-decoration: underline; }
  }

  /* Coming soon */
  option.coming-soon { color: var(--text-muted); font-style: italic; }
  .coming-soon-badge {
    display: inline-block;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-style: italic;
    margin-left: 0.25rem;
  }
}

/* ════════════════════════════════════════════════
   CONFIRM MODAL
   ════════════════════════════════════════════════ */
@layer modal {
  .cs-modal-overlay {
    position: fixed;
    inset: 0;
    background: oklch(0% 0 0 / 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
  }

  .cs-modal {
    position: relative;
    background: oklch(16% 0.015 250 / 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid oklch(28% 0.02 250 / 0.8);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    max-width: 380px;
    width: 90%;
    box-shadow:
      0 0 0 1px oklch(100% 0 0 / 0.04),
      0 24px 48px oklch(0% 0 0 / 0.5);

    /* Gold top-edge accent */
    &::before {
      content: '';
      display: block;
      height: 1px;
      background: linear-gradient(90deg, transparent, var(--accent), transparent);
      margin: -1.75rem -1.75rem 1.5rem;
      border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }
  }

  .cs-modal-message {
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
  }

  .cs-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;

    .btn { min-width: 85px; }
  }
}

/* ════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ════════════════════════════════════════════════ */
@layer toasts {
  #cs-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    left: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none;

    @media (min-width: 641px) { left: auto; }
  }

  .cs-toast {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid;
    background: oklch(16% 0.015 250 / 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text-primary);
    opacity: 0;
    transform: translateX(16px) scale(0.96);
    transition: opacity 200ms ease, transform 200ms ease;
    pointer-events: auto;
    max-width: 320px;
    word-break: break-word;
    border-color: var(--border-accent);
    box-shadow: 0 8px 24px oklch(0% 0 0 / 0.35);

    &.cs-toast--visible {
      opacity: 1;
      transform: translateX(0) scale(1);
    }

    &.cs-toast--success { border-color: var(--success); color: var(--success); background: oklch(72% 0.185 145 / 0.1); }
    &.cs-toast--error   { border-color: var(--danger);  color: var(--danger);  background: oklch(62.5% 0.225 26 / 0.1); }
    &.cs-toast--info    { border-color: var(--info);    color: var(--info);    background: oklch(70% 0.14 240 / 0.1); }
  }
}

/* ════════════════════════════════════════════════
   SKELETON LOADING
   ════════════════════════════════════════════════ */
@layer skeleton {
  .skeleton-card { pointer-events: none; user-select: none; }

  .skeleton-line {
    border-radius: var(--radius);
    background: linear-gradient(
      90deg,
      var(--bg-input) 25%,
      oklch(20% 0.015 250) 50%,
      var(--bg-input) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.6s ease-in-out infinite;
  }

  .skeleton-title  { height: 15px; width: 55%; }
  .skeleton-badge  { height: 15px; width: 76px; }
  .skeleton-addr   { height: 12px; width: 42%; margin: 0.5rem 0 0.75rem; }
  .skeleton-btn    { height: 26px; width: 68px; border-radius: var(--radius); }
  .skeleton-actions { display: flex; gap: 6px; }

  @keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
  }
}

/* ════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════ */
@layer footer {
  .site-footer {
    display: flex;
    justify-content: center;
    padding: 1.5rem 1rem 1.25rem;
    margin-top: auto;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 300;
    letter-spacing: 0.04em;
    text-transform: lowercase;
  }

  .footer-love {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
  }

  .footer-heart {
    width: 1em;
    height: 0.85em;
    color: var(--accent);
    flex-shrink: 0;
  }

  .footer-dom {
    width: 1.1em;
    height: 0.85em;
    color: var(--text-muted);
    flex-shrink: 0;
  }
}

/* ════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════ */
@layer utils {
  .text-muted    { color: var(--text-muted) !important; }
  .text-success  { color: var(--success) !important; }
  .text-danger   { color: var(--danger) !important; }
  .text-accent   { color: var(--accent) !important; }
  .small         { font-size: 0.8rem; }
  .visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
  }

  /* Scrollbar */
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border-accent); border-radius: 4px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
  * { scrollbar-width: thin; scrollbar-color: var(--border-accent) transparent; }
}

/* ════════════════════════════════════════════════
   ANIMATIONS & KEYFRAMES
   ════════════════════════════════════════════════ */
@layer anim {
  @keyframes btn-spin {
    to { transform: rotate(360deg); }
  }

  /* Animated pulsing ring around online status dot */
  @keyframes dot-ring {
    0%   { box-shadow: 0 0 0 0   oklch(72% 0.185 145 / 0.7); }
    70%  { box-shadow: 0 0 0 6px oklch(72% 0.185 145 / 0);   }
    100% { box-shadow: 0 0 0 0   oklch(72% 0.185 145 / 0);   }
  }

  /* Animated glow on online status dot (drives via @property) */
  @keyframes dot-glow {
    0%, 100% { --dot-glow: 4; }
    50%       { --dot-glow: 10; }
  }

  /* Nav brand star spin */
  @keyframes brand-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }

  /* Scroll-triggered fade in for server cards */
  @supports (animation-timeline: scroll()) {
    @media (prefers-reduced-motion: no-preference) {
      .server-card {
        animation: card-appear linear both;
        animation-timeline: view();
        animation-range: entry 0% entry 25%;
      }

      @keyframes card-appear {
        from { opacity: 0; translate: 0 16px; }
        to   { opacity: 1; translate: 0 0;    }
      }
    }
  }

  /* MPA View Transition animations — navbar is pinned, content slides */
  @media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(panel-nav),
    ::view-transition-new(panel-nav) {
      animation: none;
    }

    ::view-transition-old(root) {
      animation: 160ms ease-in vt-out;
    }
    ::view-transition-new(root) {
      animation: 260ms ease-out vt-in;
    }

    @keyframes vt-out {
      to { opacity: 0; scale: 0.985; }
    }
    @keyframes vt-in {
      from { opacity: 0; scale: 1.012; translate: 0 10px; }
    }
  }

  /* Respect reduced motion */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ════════════════════════════════════════════════
   RESPONSIVE OVERRIDES
   ════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .manage-header h1 { font-size: 1rem; }
  .panel { padding: 1rem; }
  .panel-header h2 { font-size: 0.78rem; }
  .container { padding: 0 0.75rem; }
}

@media (max-width: 340px) {
  .auth-card { padding: 0.75rem; }
  .server-card .card-header { flex-wrap: wrap; gap: 0.5rem; }
  .server-card-actions { flex-wrap: wrap; }
  .server-card-actions .btn { flex: 1 1 auto; }
}
