/* ============================================================
       DRAUGHTS DESIGN SYSTEM — TOKENS
       ============================================================ */

    :root {
      /* --- Brand Color Tokens (HSL) --- */
      --board-dark:        29  39%  17%;   /* Deep brown board square #3d2b1a */
      --board-light:       33  43%  84%;   /* Cream board square     #e9dac5 */
      --piece-black:       29  39%  12%;   /* Dark piece             */
      --piece-white:       33  43%  96%;   /* Light piece            */
      --primary:           183 95%  16%;   /* Dark teal — primary brand #024d51 */
      --primary-hover:     183 95%  12%;
      --primary-active:    183 95%   9%;
      --primary-soft:      150 38%  93%;   /* Light mint #e7f4ef */
      --accent:            12 100%  66%;   /* Coral — highlight/CTA  #ff7351 */
      --accent-soft:       41  94%  93%;   /* Light warm yellow #fef3db */
      --accent-hover:      12 100%  58%;
      --red:               4   72%  46%;   /* Red piece / danger          */
      --red-soft:          4   72%  94%;
      --green:             158 57%  27%;   /* Victory / success    #1e6c55 */
      --green-soft:        158 57%  93%;
      --blue:              270 47%  35%;   /* Info / strategy      #592f83 */
      --blue-soft:         270 47%  93%;

      /* --- Neutral Tokens --- */
      --background:        36  29%  96%;   /* #f7f5f2 */
      --surface:           36  25%  99%;
      --card:              0   0%  100%;   /* #ffffff */
      --secondary:         30  24%  88%;   /* Warm beige #eae2da */
      --border:            28  16%  81%;   /* #d7cec6 */
      --border-strong:     28  16%  70%;
      --overlay:           0   0%   0%  / 0.45;

      /* --- Text Tokens --- */
      --text-primary:      183 95%  16%;   /* Dark teal #024c50 */
      --text-secondary:    185 20%  34%;   /* Muted teal #446669 */
      --text-muted:        180 11%  48%;   /* Teal gray #6d8888 */
      --text-inverse:      0   0%  100%;   /* #ffffff */
      --text-on-accent:    33  43%  11%;   /* Dark brown #261c10 */

      /* --- Semantic Tokens --- */
      --success:           158 57%  27%;   /* #1e6c55 */
      --success-soft:      158 57%  93%;
      --info:              270 47%  35%;   /* Purple #592f83 */
      --info-soft:         270 47%  93%;
      --warning:           41  94%  52%;
      --warning-soft:      41  94%  92%;
      --error:             4   72%  46%;
      --error-soft:        4   72%  94%;

      /* --- Spacing Scale --- */
      --space-1:  4px;
      --space-2:  8px;
      --space-3:  12px;
      --space-4:  16px;
      --space-5:  20px;
      --space-6:  24px;
      --space-8:  32px;
      --space-10: 40px;
      --space-12: 48px;
      --space-16: 64px;
      --space-20: 80px;
      --space-24: 96px;

      /* --- Border Radius --- */
      --radius-sm:  4px;
      --radius-md:  8px;
      --radius-lg:  12px;
      --radius-xl:  16px;
      --radius-2xl: 24px;
      --radius-full: 9999px;

      /* --- Typography Scale --- */
      --font-display: 'Outfit', sans-serif;
      --font-body:    'Inter', sans-serif;

      --text-xs:   12px;
      --text-sm:   14px;
      --text-base: 16px;
      --text-lg:   18px;
      --text-xl:   20px;
      --text-2xl:  24px;
      --text-3xl:  30px;
      --text-4xl:  36px;
      --text-5xl:  48px;

      --leading-tight:  1.1;
      --leading-snug:   1.2;
      --leading-normal: 1.5;
      --leading-relaxed:1.6;

      /* --- Shadows --- */
      --shadow-sm:  0 1px 3px 0 hsl(25 40% 10% / 0.08), 0 1px 2px -1px hsl(25 40% 10% / 0.06);
      --shadow:     0 4px 8px -2px hsl(25 40% 10% / 0.10), 0 2px 4px -2px hsl(25 40% 10% / 0.06);
      --shadow-md:  0 8px 16px -4px hsl(25 40% 10% / 0.12), 0 4px 6px -2px hsl(25 40% 10% / 0.05);
      --shadow-lg:  0 16px 32px -8px hsl(25 40% 10% / 0.16), 0 8px 16px -4px hsl(25 40% 10% / 0.08);
      --shadow-xl:  0 24px 48px -12px hsl(25 40% 10% / 0.20);

      /* --- Transition --- */
      --transition-fast:   80ms ease;
      --transition-normal: 160ms ease;
      --transition-slow:   300ms ease;

      /* --- Z-index --- */
      --z-base:    0;
      --z-raised:  10;
      --z-overlay: 100;
      --z-modal:   200;
      --z-toast:   300;
      --z-tooltip: 400;
    }

    /* ============================================================
       BASE RESET & GLOBAL STYLES
       ============================================================ */

    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    html { scroll-behavior: smooth; font-size: 16px; }

    body {
      font-family: var(--font-body);
      font-size: var(--text-base);
      line-height: var(--leading-normal);
      color: hsl(var(--text-primary));
      background: hsl(var(--background));
      -webkit-font-smoothing: antialiased;
    }

    a { color: hsl(var(--primary)); text-decoration: none; transition: color var(--transition-fast); }
    a:hover { color: hsl(var(--primary-hover)); text-decoration: underline; }
    a:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: 3px; border-radius: var(--radius-sm); }

    img, svg { display: block; max-width: 100%; }

    /* ============================================================
       LAYOUT UTILITIES
       ============================================================ */

    .ds-container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-6); }
    .ds-section { padding: var(--space-12) 0; }
    .ds-section + .ds-section { border-top: 1px solid hsl(var(--border)); }

    .ds-grid { display: grid; gap: var(--space-4); }
    .ds-grid-2 { grid-template-columns: repeat(2, 1fr); }
    .ds-grid-3 { grid-template-columns: repeat(3, 1fr); }
    .ds-grid-4 { grid-template-columns: repeat(4, 1fr); }

    @media (max-width: 1023px) {
      .ds-grid-3 { grid-template-columns: repeat(2, 1fr); }
      .ds-grid-4 { grid-template-columns: repeat(2, 1fr); }
    }

    @media (max-width: 639px) {
      .ds-grid-2 { grid-template-columns: 1fr; }
      .ds-grid-3 { grid-template-columns: 1fr; }
      .ds-grid-4 { grid-template-columns: 1fr; }
    }

    .ds-flex       { display: flex; }
    .ds-flex-wrap  { flex-wrap: wrap; }
    .ds-items-center { align-items: center; }
    .ds-gap-2      { gap: var(--space-2); }
    .ds-gap-3      { gap: var(--space-3); }
    .ds-gap-4      { gap: var(--space-4); }
    .ds-gap-6      { gap: var(--space-6); }

    /* ============================================================
       SIDEBAR NAVIGATION
       ============================================================ */

    .ds-shell { display: flex; min-height: 100vh; }

    .ds-sidebar {
      width: 240px;
      flex-shrink: 0;
      background: hsl(var(--card));
      border-right: 1px solid hsl(var(--border));
      position: sticky;
      top: 0;
      height: 100vh;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      z-index: var(--z-raised);
    }

    .ds-sidebar-header {
      padding: var(--space-5) var(--space-5) var(--space-4);
      border-bottom: 1px solid hsl(var(--border));
    }

    .ds-sidebar-logo {
      display: flex;
      align-items: center;
      gap: var(--space-3);
    }

    .ds-sidebar-logo-icon {
      width: 36px;
      height: 36px;
      background: hsl(var(--primary));
      border-radius: var(--radius-md);
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 2px;
      padding: 6px;
    }

    .ds-sidebar-logo-icon span {
      display: block;
      border-radius: 50%;
    }

    .ds-sidebar-logo-icon span:nth-child(odd)  { background: hsl(var(--board-light)); }
    .ds-sidebar-logo-icon span:nth-child(even) { background: hsl(var(--accent)); }

    .ds-sidebar-brand { font-family: var(--font-display); font-weight: 700; font-size: var(--text-base); color: hsl(var(--text-primary)); }
    .ds-sidebar-version { font-size: var(--text-xs); color: hsl(var(--text-muted)); margin-top: 2px; }

    .ds-sidebar-nav { padding: var(--space-3) 0; flex: 1; }

    .ds-sidebar-group { padding: var(--space-2) var(--space-4) var(--space-1); }
    .ds-sidebar-group-label {
      font-size: var(--text-xs);
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: hsl(var(--text-muted));
    }

    .ds-sidebar-item {
      display: block;
      padding: var(--space-2) var(--space-4);
      font-size: var(--text-sm);
      color: hsl(var(--text-secondary));
      border-radius: 0;
      transition: background var(--transition-fast), color var(--transition-fast);
      cursor: pointer;
      border: none;
      background: none;
      width: 100%;
      text-align: left;
    }

    .ds-sidebar-item:hover {
      background: hsl(var(--secondary));
      color: hsl(var(--text-primary));
      text-decoration: none;
    }

    .ds-sidebar-item.active {
      background: hsl(var(--primary-soft));
      color: hsl(var(--primary));
      font-weight: 600;
    }

    .ds-sidebar-item:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: -2px; }

    .ds-main { flex: 1; min-width: 0; }

    /* ============================================================
       SECTION HEADER
       ============================================================ */

    .ds-page-header {
      background: hsl(var(--card));
      border-bottom: 1px solid hsl(var(--border));
      padding: var(--space-8) var(--space-12);
    }

    .ds-version-badge {
      display: inline-flex;
      align-items: center;
      gap: var(--space-1);
      font-size: var(--text-xs);
      font-weight: 600;
      padding: var(--space-1) var(--space-3);
      background: hsl(var(--secondary));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-full);
      color: hsl(var(--text-secondary));
      margin-bottom: var(--space-4);
    }

    .ds-page-title {
      font-family: var(--font-display);
      font-size: var(--text-5xl);
      font-weight: 800;
      line-height: var(--leading-tight);
      letter-spacing: -0.02em;
      color: hsl(var(--text-primary));
      margin-bottom: var(--space-4);
    }

    .ds-page-description {
      font-size: var(--text-lg);
      color: hsl(var(--text-secondary));
      max-width: 600px;
      line-height: var(--leading-relaxed);
      margin-bottom: var(--space-8);
    }

    .ds-pillars {
      display: flex;
      gap: var(--space-6);
      flex-wrap: wrap;
    }

    .ds-pillar {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-2);
    }

    .ds-pillar-swatch {
      width: 56px;
      height: 56px;
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-sm);
    }

    .ds-pillar-name { font-family: var(--font-display); font-size: var(--text-sm); font-weight: 700; }
    .ds-pillar-desc { font-size: var(--text-xs); color: hsl(var(--text-muted)); }

    /* ============================================================
       CONTENT SECTIONS
       ============================================================ */

    .ds-content { padding: var(--space-8) var(--space-12); }

    .ds-section-label {
      display: inline-flex;
      align-items: center;
      gap: var(--space-2);
      font-size: var(--text-xs);
      font-weight: 600;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: hsl(var(--accent));
      margin-bottom: var(--space-3);
    }

    .ds-section-title {
      font-family: var(--font-display);
      font-size: var(--text-3xl);
      font-weight: 700;
      color: hsl(var(--text-primary));
      margin-bottom: var(--space-2);
    }

    .ds-section-description {
      font-size: var(--text-base);
      color: hsl(var(--text-secondary));
      margin-bottom: var(--space-8);
      max-width: 560px;
      line-height: var(--leading-relaxed);
    }

    .ds-subsection-title {
      font-family: var(--font-display);
      font-size: var(--text-xl);
      font-weight: 700;
      color: hsl(var(--text-primary));
      margin: var(--space-8) 0 var(--space-4);
    }

    /* ============================================================
       COLOR TOKENS
       ============================================================ */

    .ds-color-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
      gap: var(--space-4);
      margin-bottom: var(--space-8);
    }

    .ds-color-chip {
      border-radius: var(--radius-lg);
      overflow: hidden;
      border: 1px solid hsl(var(--border));
      background: hsl(var(--card));
      box-shadow: var(--shadow-sm);
    }

    .ds-color-chip-swatch {
      height: 72px;
    }

    .ds-color-chip-meta {
      padding: var(--space-3);
    }

    .ds-color-chip-name {
      font-family: var(--font-display);
      font-size: var(--text-sm);
      font-weight: 700;
      color: hsl(var(--text-primary));
    }

    .ds-color-chip-hex {
      font-size: var(--text-xs);
      color: hsl(var(--text-secondary));
      font-family: 'Courier New', monospace;
    }

    .ds-color-chip-var {
      font-size: var(--text-xs);
      color: hsl(var(--text-muted));
      font-family: 'Courier New', monospace;
    }

    /* ============================================================
       TYPOGRAPHY SPECIMENS
       ============================================================ */

    .ds-type-specimen {
      display: flex;
      align-items: baseline;
      gap: var(--space-6);
      padding: var(--space-4) 0;
      border-bottom: 1px solid hsl(var(--border));
    }

    .ds-type-specimen:last-child { border-bottom: none; }

    .ds-type-specimen-label {
      width: 80px;
      flex-shrink: 0;
      font-size: var(--text-xs);
      font-weight: 600;
      color: hsl(var(--text-muted));
      letter-spacing: 0.06em;
      text-transform: uppercase;
      padding-top: 4px;
    }

    .ds-type-specimen-content { flex: 1; }

    .ds-type-specimen-meta {
      font-size: var(--text-xs);
      color: hsl(var(--text-muted));
      margin-top: var(--space-1);
      font-family: 'Courier New', monospace;
    }

    /* ============================================================
       SPACING DISPLAY
       ============================================================ */

    .ds-spacing-row {
      display: flex;
      align-items: center;
      gap: var(--space-4);
      padding: var(--space-3) 0;
      border-bottom: 1px solid hsl(var(--border));
    }

    .ds-spacing-row:last-child { border-bottom: none; }

    .ds-spacing-bar {
      background: hsl(var(--primary));
      height: 20px;
      border-radius: var(--radius-sm);
      flex-shrink: 0;
    }

    .ds-spacing-label { font-size: var(--text-sm); color: hsl(var(--text-secondary)); width: 80px; font-family: 'Courier New', monospace; }
    .ds-spacing-value { font-size: var(--text-sm); color: hsl(var(--text-muted)); }

    .ds-radius-grid { display: flex; flex-wrap: wrap; gap: var(--space-6); margin-bottom: var(--space-8); }

    .ds-radius-chip {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-3);
    }

    .ds-radius-box {
      width: 60px;
      height: 60px;
      background: hsl(var(--primary-soft));
      border: 2px solid hsl(var(--primary));
    }

    .ds-radius-label { font-size: var(--text-xs); color: hsl(var(--text-secondary)); text-align: center; font-family: 'Courier New', monospace; }

    .ds-shadow-grid { display: flex; flex-wrap: wrap; gap: var(--space-6); }

    .ds-shadow-chip {
      width: 100px;
      height: 80px;
      background: hsl(var(--card));
      border-radius: var(--radius-lg);
      display: flex;
      align-items: flex-end;
      justify-content: center;
      padding-bottom: var(--space-3);
    }

    .ds-shadow-name { font-size: var(--text-xs); color: hsl(var(--text-muted)); font-family: 'Courier New', monospace; }

    /* ============================================================
       BUTTONS
       ============================================================ */

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: var(--space-2);
      font-family: var(--font-body);
      font-weight: 500;
      font-size: var(--text-sm);
      line-height: 1;
      letter-spacing: 0.02em;
      white-space: nowrap;
      cursor: pointer;
      border: 1px solid transparent;
      border-radius: var(--radius-md);
      transition: background var(--transition-fast), color var(--transition-fast),
                  border-color var(--transition-fast), box-shadow var(--transition-fast),
                  transform var(--transition-fast);
      text-decoration: none;
      padding: 0 var(--space-4);
      height: 38px;
      position: relative;
      user-select: none;
    }

    .btn:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: 3px; }
    .btn:active { transform: translateY(1px); }
    .btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

    /* Sizes */
    .btn-sm  { height: 30px; padding: 0 var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-sm); }
    .btn-lg  { height: 48px; padding: 0 var(--space-6); font-size: var(--text-base); border-radius: var(--radius-lg); }
    .btn-xl  { height: 56px; padding: 0 var(--space-8); font-size: var(--text-lg); border-radius: var(--radius-xl); }
    .btn-icon { width: 38px; padding: 0; }
    .btn-icon.btn-sm { width: 30px; }
    .btn-icon.btn-lg { width: 48px; }

    /* Variants */
    .btn-primary {
      background: hsl(var(--primary));
      color: hsl(var(--text-inverse));
      border-color: hsl(var(--primary));
    }
    .btn-primary:hover { background: hsl(var(--primary-hover)); border-color: hsl(var(--primary-hover)); text-decoration: none; color: hsl(var(--text-inverse)); }
    .btn-primary:active { background: hsl(var(--primary-active)); }

    .btn-secondary {
      background: hsl(var(--secondary));
      color: hsl(var(--text-primary));
      border-color: hsl(var(--border));
    }
    .btn-secondary:hover { background: hsl(var(--border)); text-decoration: none; color: hsl(var(--text-primary)); }

    .btn-accent {
      background: hsl(var(--accent));
      color: hsl(var(--text-on-accent));
      border-color: hsl(var(--accent));
    }
    .btn-accent:hover { background: hsl(var(--accent-hover)); border-color: hsl(var(--accent-hover)); text-decoration: none; color: hsl(var(--text-on-accent)); }

    .btn-outline {
      background: transparent;
      color: hsl(var(--primary));
      border-color: hsl(var(--primary));
    }
    .btn-outline:hover { background: hsl(var(--primary-soft)); text-decoration: none; }

    .btn-ghost {
      background: transparent;
      color: hsl(var(--text-secondary));
      border-color: transparent;
    }
    .btn-ghost:hover { background: hsl(var(--secondary)); color: hsl(var(--text-primary)); text-decoration: none; }

    .btn-danger {
      background: hsl(var(--error));
      color: #fff;
      border-color: hsl(var(--error));
    }
    .btn-danger:hover { background: hsl(4 72% 38%); border-color: hsl(4 72% 38%); text-decoration: none; color: #fff; }

    .btn-success {
      background: hsl(var(--success));
      color: #fff;
      border-color: hsl(var(--success));
    }

    /* Button group */
    .btn-group { display: flex; }
    .btn-group .btn { border-radius: 0; }
    .btn-group .btn:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
    .btn-group .btn:last-child  { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
    .btn-group .btn + .btn { border-left: none; }

    /* ============================================================
       FORM CONTROLS
       ============================================================ */

    .form-field { display: flex; flex-direction: column; gap: var(--space-1); }

    .form-label {
      font-size: var(--text-sm);
      font-weight: 600;
      color: hsl(var(--text-primary));
    }

    .form-helper {
      font-size: var(--text-xs);
      color: hsl(var(--text-muted));
    }

    .form-error {
      font-size: var(--text-xs);
      color: hsl(var(--error));
      display: flex;
      align-items: center;
      gap: var(--space-1);
    }

    .form-input,
    .form-select,
    .form-textarea {
      font-family: var(--font-body);
      font-size: var(--text-sm);
      color: hsl(var(--text-primary));
      background: hsl(var(--card));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-md);
      padding: var(--space-2) var(--space-3);
      height: 38px;
      transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
      width: 100%;
      outline: none;
    }

    .form-textarea { height: auto; resize: vertical; padding-top: var(--space-3); }

    .form-input::placeholder,
    .form-textarea::placeholder { color: hsl(var(--text-muted)); }

    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
      border-color: hsl(var(--primary));
      box-shadow: 0 0 0 3px hsl(var(--primary-soft));
    }

    .form-input.input-error { border-color: hsl(var(--error)); }
    .form-input.input-error:focus { box-shadow: 0 0 0 3px hsl(var(--error-soft)); }

    .form-input.input-success { border-color: hsl(var(--success)); }
    .form-input.input-success:focus { box-shadow: 0 0 0 3px hsl(var(--success-soft)); }

    .form-input:disabled,
    .form-select:disabled,
    .form-textarea:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      background: hsl(var(--secondary));
    }

    /* Input with icon */
    .input-wrapper { position: relative; }
    .input-icon-left  { position: absolute; left: var(--space-3);  top: 50%; transform: translateY(-50%); color: hsl(var(--text-muted)); pointer-events: none; }
    .input-icon-right { position: absolute; right: var(--space-3); top: 50%; transform: translateY(-50%); color: hsl(var(--text-muted)); pointer-events: none; }
    .input-wrapper .form-input.has-icon-left  { padding-left: 36px; }
    .input-wrapper .form-input.has-icon-right { padding-right: 36px; }

    /* Checkbox & Radio */
    .form-check { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; }

    .form-check-input {
      width: 18px;
      height: 18px;
      border: 2px solid hsl(var(--border-strong));
      border-radius: var(--radius-sm);
      background: hsl(var(--card));
      appearance: none;
      cursor: pointer;
      transition: background var(--transition-fast), border-color var(--transition-fast);
      flex-shrink: 0;
      position: relative;
    }

    .form-check-input[type="radio"] { border-radius: var(--radius-full); }

    .form-check-input:checked {
      background: hsl(var(--primary));
      border-color: hsl(var(--primary));
    }

    .form-check-input:checked::after {
      content: '';
      position: absolute;
      inset: 0;
      background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 12 10' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
      background-position: center;
      background-repeat: no-repeat;
      background-size: 10px;
    }

    .form-check-input[type="radio"]:checked::after {
      background-image: none;
      background: white;
      border-radius: 50%;
      width: 6px;
      height: 6px;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      inset: auto;
    }

    .form-check-input:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: 2px; }

    .form-check-label { font-size: var(--text-sm); color: hsl(var(--text-primary)); user-select: none; }

    /* Toggle */
    .toggle-wrapper { display: flex; align-items: center; gap: var(--space-3); }

    .toggle {
      width: 44px;
      height: 24px;
      background: hsl(var(--border-strong));
      border-radius: var(--radius-full);
      position: relative;
      cursor: pointer;
      transition: background var(--transition-normal);
      border: none;
      flex-shrink: 0;
    }

    .toggle::after {
      content: '';
      position: absolute;
      width: 18px;
      height: 18px;
      background: white;
      border-radius: 50%;
      top: 3px;
      left: 3px;
      transition: transform var(--transition-normal);
      box-shadow: var(--shadow-sm);
    }

    .toggle.on { background: hsl(var(--primary)); }
    .toggle.on::after { transform: translateX(20px); }
    .toggle:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: 2px; }

    /* Range */
    .form-range {
      width: 100%;
      height: 4px;
      background: hsl(var(--border));
      border-radius: var(--radius-full);
      appearance: none;
      cursor: pointer;
      outline: none;
    }

    .form-range::-webkit-slider-thumb {
      appearance: none;
      width: 18px;
      height: 18px;
      border-radius: 50%;
      background: hsl(var(--primary));
      box-shadow: var(--shadow-sm);
      cursor: pointer;
    }

    .form-range:focus-visible::-webkit-slider-thumb { outline: 2px solid hsl(var(--accent)); outline-offset: 2px; }

    /* Select */
    .form-select {
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23999' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right var(--space-3) center;
      background-size: 18px;
      padding-right: 36px;
    }

    /* ============================================================
       CARDS
       ============================================================ */

    .card {
      background: hsl(var(--card));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-xl);
      padding: var(--space-6);
      box-shadow: var(--shadow-sm);
      transition: box-shadow var(--transition-normal), transform var(--transition-normal);
    }

    .card:hover { box-shadow: var(--shadow-md); }

    .card-interactive { cursor: pointer; }
    .card-interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

    .card-header { margin-bottom: var(--space-4); }
    .card-title {
      font-family: var(--font-display);
      font-size: var(--text-xl);
      font-weight: 700;
      color: hsl(var(--text-primary));
      margin-bottom: var(--space-1);
    }
    .card-subtitle { font-size: var(--text-sm); color: hsl(var(--text-muted)); }

    .card-body { color: hsl(var(--text-secondary)); font-size: var(--text-sm); line-height: var(--leading-relaxed); }

    .card-footer {
      margin-top: var(--space-5);
      padding-top: var(--space-4);
      border-top: 1px solid hsl(var(--border));
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: var(--space-3);
    }

    .card-meta { font-size: var(--text-xs); color: hsl(var(--text-muted)); }

    /* Board preview card */
    .card-board {
      background: hsl(var(--card));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-xl);
      overflow: hidden;
      box-shadow: var(--shadow);
    }

    .card-board-header {
      padding: var(--space-4) var(--space-5);
      border-bottom: 1px solid hsl(var(--border));
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .card-board-body { padding: var(--space-5); }

    /* Stat card */
    .card-stat {
      background: hsl(var(--card));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-xl);
      padding: var(--space-5);
      box-shadow: var(--shadow-sm);
    }

    .card-stat-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: hsl(var(--text-muted)); margin-bottom: var(--space-2); }
    .card-stat-value { font-family: var(--font-display); font-size: var(--text-4xl); font-weight: 800; color: hsl(var(--text-primary)); line-height: 1; }
    .card-stat-delta { font-size: var(--text-sm); margin-top: var(--space-2); display: flex; align-items: center; gap: var(--space-1); }
    .card-stat-delta.up   { color: hsl(var(--success)); }
    .card-stat-delta.down { color: hsl(var(--error)); }

    /* Player card */
    .card-player {
      background: hsl(var(--card));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-xl);
      padding: var(--space-5);
      display: flex;
      align-items: center;
      gap: var(--space-4);
      box-shadow: var(--shadow-sm);
    }

    .card-player-avatar {
      width: 52px;
      height: 52px;
      border-radius: var(--radius-full);
      background: hsl(var(--primary));
display: flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-display);
      font-size: var(--text-xl);
      font-weight: 800;
      color: white;
      flex-shrink: 0;
    }

    .card-player-info { flex: 1; min-width: 0; }
    .card-player-name { font-family: var(--font-display); font-size: var(--text-base); font-weight: 700; color: hsl(var(--text-primary)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .card-player-rating { font-size: var(--text-sm); color: hsl(var(--text-muted)); }
    .card-player-badge { flex-shrink: 0; }

    /* Insight card */
    .card-insight {
      background: hsl(var(--primary-soft));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-xl);
      padding: var(--space-5);
      position: relative;
      overflow: hidden;
    }

    .card-insight::before {
      content: '';
      position: absolute;
      top: 0; left: 0;
      width: 4px; height: 100%;
      background: hsl(var(--primary));
      border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    }

    .card-insight-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--primary)); margin-bottom: var(--space-2); }
    .card-insight-body  { font-size: var(--text-sm); color: hsl(var(--text-secondary)); line-height: var(--leading-relaxed); }
    .card-insight-meta  { font-size: var(--text-xs); color: hsl(var(--text-muted)); margin-top: var(--space-3); }

    /* ============================================================
       BADGES & TAGS
       ============================================================ */

    .badge {
      display: inline-flex;
      align-items: center;
      gap: var(--space-1);
      font-family: var(--font-body);
      font-size: var(--text-xs);
      font-weight: 600;
      line-height: 1;
      padding: 3px var(--space-2);
      border-radius: var(--radius-full);
      white-space: nowrap;
      border: 1px solid transparent;
    }

    .badge-dot {
      width: 6px; height: 6px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    /* Status variants */
    .badge-default    { background: hsl(var(--secondary));    color: hsl(var(--text-secondary)); border-color: hsl(var(--border)); }
    .badge-primary    { background: hsl(var(--primary));      color: white; }
    .badge-accent     { background: hsl(var(--accent));       color: hsl(var(--text-on-accent)); }
    .badge-success    { background: hsl(var(--success-soft)); color: hsl(var(--success)); border-color: hsl(150 55% 70%); }
    .badge-info       { background: hsl(var(--info-soft));    color: hsl(var(--info)); border-color: hsl(220 55% 70%); }
    .badge-warning    { background: hsl(var(--warning-soft)); color: hsl(var(--warning)); border-color: hsl(38 95% 60%); }
    .badge-error      { background: hsl(var(--error-soft));   color: hsl(var(--error)); border-color: hsl(4 72% 70%); }
    .badge-outline    { background: transparent; color: hsl(var(--primary)); border-color: hsl(var(--primary)); }

    /* Tag pill */
    .tag {
      display: inline-flex;
      align-items: center;
      gap: var(--space-1);
      font-size: var(--text-xs);
      font-weight: 500;
      padding: var(--space-1) var(--space-3);
      border-radius: var(--radius-full);
      background: hsl(var(--secondary));
      color: hsl(var(--text-secondary));
      border: 1px solid hsl(var(--border));
      cursor: default;
      transition: background var(--transition-fast), color var(--transition-fast);
    }

    .tag:hover { background: hsl(var(--border)); color: hsl(var(--text-primary)); }

    .tag-primary  { background: hsl(var(--primary-soft)); color: hsl(var(--primary)); border-color: hsl(25 40% 72%); }
    .tag-accent   { background: hsl(var(--accent-soft));  color: hsl(var(--accent-hover)); border-color: hsl(38 95% 72%); }
    .tag-red      { background: hsl(var(--red-soft));     color: hsl(var(--red)); border-color: hsl(4 72% 72%); }

    /* Rank badge (numbered) */
    .rank-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px; height: 24px;
      border-radius: var(--radius-full);
      font-size: var(--text-xs);
      font-weight: 700;
      flex-shrink: 0;
    }

    .rank-badge-gold   { background: hsl(var(--accent));       color: hsl(var(--text-on-accent)); }
    .rank-badge-silver { background: hsl(var(--border-strong)); color: hsl(var(--text-primary)); }
    .rank-badge-bronze { background: hsl(15 60% 55%);           color: white; }
    .rank-badge-other  { background: hsl(var(--secondary));     color: hsl(var(--text-muted)); }

    /* ============================================================
       ALERTS & TOASTS
       ============================================================ */

    .alert {
      display: flex;
      align-items: flex-start;
      gap: var(--space-3);
      padding: var(--space-4) var(--space-5);
      border-radius: var(--radius-lg);
      border: 1px solid transparent;
      font-size: var(--text-sm);
    }

    .alert-icon { flex-shrink: 0; margin-top: 1px; font-size: 16px; line-height: 1; }

    .alert-content { flex: 1; min-width: 0; }
    .alert-title   { font-weight: 600; margin-bottom: var(--space-1); }
    .alert-body    { color: inherit; opacity: 0.85; line-height: var(--leading-relaxed); }

    .alert-close {
      flex-shrink: 0;
      background: none;
      border: none;
      cursor: pointer;
      opacity: 0.5;
      font-size: 18px;
      line-height: 1;
      padding: 0;
      color: inherit;
      transition: opacity var(--transition-fast);
    }
    .alert-close:hover { opacity: 1; }

    .alert-success { background: hsl(var(--success-soft)); color: hsl(var(--success)); border-color: hsl(150 55% 70%); }
    .alert-info    { background: hsl(var(--info-soft));    color: hsl(var(--info));    border-color: hsl(220 55% 70%); }
    .alert-warning { background: hsl(var(--warning-soft)); color: hsl(var(--warning)); border-color: hsl(38 95% 60%);  }
    .alert-error   { background: hsl(var(--error-soft));   color: hsl(var(--error));   border-color: hsl(4 72% 70%);   }

    /* Toast */
    .toast-container {
      position: fixed;
      bottom: var(--space-6);
      right: var(--space-6);
      display: flex;
      flex-direction: column;
      gap: var(--space-3);
      z-index: var(--z-toast);
      pointer-events: none;
    }

    .toast {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      padding: var(--space-3) var(--space-5);
      background: hsl(var(--text-primary));
      color: white;
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg);
      font-size: var(--text-sm);
      font-weight: 500;
      min-width: 260px;
      max-width: 360px;
      pointer-events: all;
      animation: toast-in 0.25s ease forwards;
    }

    .toast-icon { font-size: 16px; flex-shrink: 0; }
    .toast-body { flex: 1; }
    .toast-title { font-weight: 600; }
    .toast-desc  { font-size: var(--text-xs); opacity: 0.7; margin-top: 2px; }

    .toast-success { background: hsl(var(--success)); }
    .toast-warning { background: hsl(var(--warning)); color: hsl(var(--text-on-accent)); }
    .toast-error   { background: hsl(var(--error)); }
    .toast-info    { background: hsl(var(--info)); }

    @keyframes toast-in {
      from { opacity: 0; transform: translateX(20px); }
      to   { opacity: 1; transform: translateX(0); }
    }

    /* ============================================================
       TABS
       ============================================================ */

    .tabs { display: flex; flex-direction: column; }

    .tabs-list {
      display: flex;
      border-bottom: 2px solid hsl(var(--border));
      gap: 0;
    }

    .tabs-trigger {
      padding: var(--space-3) var(--space-5);
      font-size: var(--text-sm);
      font-weight: 500;
      color: hsl(var(--text-muted));
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
      cursor: pointer;
      transition: color var(--transition-fast), border-color var(--transition-fast);
      white-space: nowrap;
    }

    .tabs-trigger:hover { color: hsl(var(--text-primary)); }

    .tabs-trigger.active {
      color: hsl(var(--primary));
      border-bottom-color: hsl(var(--primary));
      font-weight: 600;
    }

    .tabs-trigger:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: -1px; border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

    .tabs-panel { padding: var(--space-6) 0; }
    .tabs-panel:not(.active) { display: none; }

    /* Pill tabs */
    .tabs-pill-list {
      display: flex;
      gap: var(--space-1);
      background: hsl(var(--secondary));
      padding: var(--space-1);
      border-radius: var(--radius-lg);
      width: fit-content;
    }

    .tabs-pill-trigger {
      padding: var(--space-2) var(--space-4);
      font-size: var(--text-sm);
      font-weight: 500;
      color: hsl(var(--text-muted));
      background: none;
      border: none;
      border-radius: var(--radius-md);
      cursor: pointer;
      transition: background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
      white-space: nowrap;
      svg {
        flex: 0 0 auto;
      }
    }

    .tabs-pill-trigger:hover { color: hsl(var(--text-primary)); }

    .tabs-pill-trigger.active {
      background: hsl(var(--card));
      color: hsl(var(--text-primary));
      font-weight: 600;
      box-shadow: var(--shadow-sm);
    }

    /* ============================================================
       PAGINATION
       ============================================================ */

    .pagination {
      display: flex;
      align-items: center;
      gap: var(--space-1);
    }

    .pagination-item {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 36px;
      height: 36px;
      padding: 0 var(--space-2);
      font-size: var(--text-sm);
      font-weight: 500;
      color: hsl(var(--text-secondary));
      background: hsl(var(--card));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-md);
      cursor: pointer;
      transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
      text-decoration: none;
      user-select: none;
    }

    .pagination-item:hover { background: hsl(var(--secondary)); color: hsl(var(--text-primary)); text-decoration: none; }
    .pagination-item.active { background: hsl(var(--primary)); color: white; border-color: hsl(var(--primary)); }
    .pagination-item:disabled, .pagination-item.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
    .pagination-item:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: 2px; }

    /* ============================================================
       TABLE
       ============================================================ */

    .table-wrapper {
      width: 100%;
      overflow-x: auto;
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-xl);
      box-shadow: var(--shadow-sm);
    }

    .table {
      width: 100%;
      border-collapse: collapse;
      font-size: var(--text-sm);
      background: hsl(var(--card));
    }

    .table thead {
      background: hsl(var(--secondary));
      border-bottom: 2px solid hsl(var(--border));
    }

    .table th {
      padding: var(--space-3) var(--space-4);
      text-align: left;
      font-size: var(--text-xs);
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: hsl(var(--text-muted));
      white-space: nowrap;
    }

    .table th.sortable { cursor: pointer; user-select: none; }
    .table th.sortable:hover { color: hsl(var(--text-primary)); }

    .table td {
      padding: var(--space-3) var(--space-4);
      color: hsl(var(--text-secondary));
      border-bottom: 1px solid hsl(var(--border));
      vertical-align: middle;
    }

    .table tbody tr:last-child td { border-bottom: none; }

    .table tbody tr:hover td { background: hsl(var(--secondary)); }

    .table .col-rank { width: 48px; text-align: center; }
    .table .col-player { min-width: 180px; }
    .table .col-rating { width: 90px; text-align: right; font-family: 'Courier New', monospace; font-weight: 700; color: hsl(var(--text-primary)); }
    .table .col-games  { width: 80px; text-align: right; }
    .table .col-winrate { width: 90px; text-align: right; }

    /* ============================================================
       AVATAR
       ============================================================ */

    .avatar {
      border-radius: var(--radius-full);
      background: hsl(var(--primary));
      color: white;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-display);
      font-weight: 700;
      flex-shrink: 0;
      overflow: hidden;
    }

    .avatar-xs  { width: 24px;  height: 24px;  font-size: var(--text-xs);  }
    .avatar-sm  { width: 32px;  height: 32px;  font-size: var(--text-sm);  }
    .avatar-md  { width: 40px;  height: 40px;  font-size: var(--text-base);}
    .avatar-lg  { width: 52px;  height: 52px;  font-size: var(--text-xl);  }
    .avatar-xl  { width: 72px;  height: 72px;  font-size: var(--text-3xl); }

    .avatar-amber  { background: hsl(var(--accent)); color: hsl(var(--text-on-accent)); }
    .avatar-red    { background: hsl(var(--red)); }
    .avatar-green  { background: hsl(var(--green)); }
    .avatar-blue   { background: hsl(var(--blue)); }

    .avatar-group { display: flex; }
    .avatar-group .avatar { border: 2px solid hsl(var(--card)); margin-left: -8px; }
    .avatar-group .avatar:first-child { margin-left: 0; }

    /* ============================================================
       PROGRESS & RATING BAR
       ============================================================ */

    .progress-wrapper { display: flex; flex-direction: column; gap: var(--space-1); }
    .progress-header  { display: flex; justify-content: space-between; align-items: baseline; }
    .progress-label   { font-size: var(--text-sm); font-weight: 600; color: hsl(var(--text-secondary)); }
    .progress-value   { font-size: var(--text-sm); color: hsl(var(--text-muted)); font-family: 'Courier New', monospace; }

    .progress-track {
      height: 8px;
      background: hsl(var(--secondary));
      border-radius: var(--radius-full);
      overflow: hidden;
    }

    .progress-track.track-sm { height: 4px; }
    .progress-track.track-lg { height: 12px; }

    .progress-bar {
      height: 100%;
      border-radius: var(--radius-full);
      background: hsl(var(--primary));
      transition: width 0.6s ease;
    }

    .progress-bar.bar-accent   { background: hsl(var(--accent)); }
    .progress-bar.bar-success  { background: hsl(var(--success)); }
    .progress-bar.bar-error    { background: hsl(var(--error)); }
    .progress-bar.bar-gradient {
      background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--accent)));
    }

    /* ============================================================
       DRAUGHTS BOARD MINI-PREVIEW
       ============================================================ */

    .board-mini {
      display: grid;
      grid-template-columns: repeat(8, 1fr);
      border: 2px solid hsl(var(--border-strong));
      border-radius: var(--radius-md);
      overflow: hidden;
      aspect-ratio: 1;
      box-shadow: var(--shadow-md);
    }

    .board-cell {
      aspect-ratio: 1;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .board-cell.light { background: hsl(var(--board-light)); }
    .board-cell.dark  { background: hsl(var(--board-dark)); }

    .board-piece {
      width: 72%;
      height: 72%;
      border-radius: 50%;
      box-shadow: 0 2px 4px hsl(0 0% 0% / 0.4), inset 0 1px 2px hsl(0 0% 100% / 0.3);
    }

    .board-piece.piece-black { background: radial-gradient(circle at 35% 35%, hsl(25 20% 35%), hsl(25 30% 10%)); }
    .board-piece.piece-white { background: radial-gradient(circle at 35% 35%, hsl(35 80% 98%), hsl(35 55% 82%)); }
    .board-piece.piece-king::after {
      content: '♛';
      position: absolute;
      font-size: 8px;
      color: hsl(var(--accent));
    }
    .board-piece.piece-king { position: relative; display: flex; align-items: center; justify-content: center; }

    /* ============================================================
       MODAL / DIALOG
       ============================================================ */

    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: hsl(var(--overlay));
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: var(--z-modal);
      padding: var(--space-4);
      backdrop-filter: blur(2px);
    }

    .modal {
      background: hsl(var(--card));
      border-radius: var(--radius-2xl);
      box-shadow: var(--shadow-xl);
      width: 100%;
      max-width: 480px;
      max-height: 90vh;
      overflow-y: auto;
      border: 1px solid hsl(var(--border));
    }

    .modal-header {
      padding: var(--space-6) var(--space-6) var(--space-4);
      border-bottom: 1px solid hsl(var(--border));
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--space-4);
    }

    .modal-title {
      font-family: var(--font-display);
      font-size: var(--text-xl);
      font-weight: 700;
      color: hsl(var(--text-primary));
    }

    .modal-close {
      background: none;
      border: none;
      cursor: pointer;
      color: hsl(var(--text-muted));
      font-size: 20px;
      line-height: 1;
      padding: 2px;
      border-radius: var(--radius-sm);
      transition: color var(--transition-fast), background var(--transition-fast);
      flex-shrink: 0;
    }

    .modal-close:hover { color: hsl(var(--text-primary)); background: hsl(var(--secondary)); }
    .modal-close:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: 2px; }

    .modal-body    { padding: var(--space-6); font-size: var(--text-sm); color: hsl(var(--text-secondary)); line-height: var(--leading-relaxed); }
    .modal-footer  { padding: var(--space-4) var(--space-6) var(--space-6); display: flex; justify-content: flex-end; gap: var(--space-3); }

    /* ============================================================
       TOOLTIP
       ============================================================ */

    .tooltip-wrapper { position: relative; display: inline-flex; }

    .tooltip {
      position: absolute;
      bottom: calc(100% + var(--space-2));
      left: 50%;
      transform: translateX(-50%);
      background: hsl(var(--text-primary));
      color: white;
      font-size: var(--text-xs);
      font-weight: 500;
      padding: var(--space-1) var(--space-3);
      border-radius: var(--radius-md);
      white-space: nowrap;
      pointer-events: none;
      opacity: 0;
      transition: opacity var(--transition-fast);
      z-index: var(--z-tooltip);
      box-shadow: var(--shadow);
    }

    .tooltip::after {
      content: '';
      position: absolute;
      top: 100%; left: 50%;
      transform: translateX(-50%);
      border: 5px solid transparent;
      border-top-color: hsl(var(--text-primary));
    }

    .tooltip-wrapper:hover .tooltip { opacity: 1; }

    /* ============================================================
       DROPDOWN MENU
       ============================================================ */

    .dropdown { position: relative; display: inline-block; }

    .dropdown-menu {
      position: absolute;
      top: calc(100% + var(--space-1));
      left: 0;
      min-width: 180px;
      background: hsl(var(--card));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-lg);
      box-shadow: var(--shadow-lg);
      padding: var(--space-1) 0;
      z-index: var(--z-overlay);
    }

    .dropdown-menu.right { left: auto; right: 0; }

    .dropdown-item {
      display: flex;
      align-items: center;
      gap: var(--space-3);
      padding: var(--space-2) var(--space-4);
      font-size: var(--text-sm);
      color: hsl(var(--text-secondary));
      cursor: pointer;
      background: none;
      border: none;
      width: 100%;
      text-align: left;
      transition: background var(--transition-fast), color var(--transition-fast);
    }

    .dropdown-item:hover { background: hsl(var(--secondary)); color: hsl(var(--text-primary)); }
    .dropdown-item.danger { color: hsl(var(--error)); }
    .dropdown-item.danger:hover { background: hsl(var(--error-soft)); }
    .dropdown-item:focus-visible { outline: 2px solid hsl(var(--accent)); outline-offset: -2px; }

    .dropdown-divider { height: 1px; background: hsl(var(--border)); margin: var(--space-1) 0; }

    .dropdown-label {
      padding: var(--space-2) var(--space-4) var(--space-1);
      font-size: var(--text-xs);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: hsl(var(--text-muted));
    }

    /* ============================================================
       NAVIGATION BAR (top nav)
       ============================================================ */

    .navbar {
      background: hsl(var(--card));
      border-bottom: 1px solid hsl(var(--border));
      height: 60px;
      display: flex;
      align-items: center;
      padding: 0 var(--space-6);
      gap: var(--space-6);
      position: sticky;
      top: 0;
      z-index: var(--z-raised);
      box-shadow: var(--shadow-sm);
    }

    .navbar-brand {
      display: flex;
      align-items: center;
      gap: var(--space-2);
      font-family: var(--font-display);
      font-size: var(--text-lg);
      font-weight: 800;
      color: hsl(var(--text-primary));
      text-decoration: none;
    }

    .navbar-brand:hover { text-decoration: none; color: hsl(var(--primary)); }

    .navbar-nav {
      display: flex;
      align-items: center;
      gap: var(--space-1);
      flex: 1;
    }

    .navbar-link {
      padding: var(--space-2) var(--space-3);
      font-size: var(--text-sm);
      font-weight: 500;
      color: hsl(var(--text-muted));
      border-radius: var(--radius-md);
      transition: color var(--transition-fast), background var(--transition-fast);
      text-decoration: none;
    }

    .navbar-link:hover { color: hsl(var(--text-primary)); background: hsl(var(--secondary)); text-decoration: none; }
    .navbar-link.active { color: hsl(var(--primary)); background: hsl(var(--primary-soft)); font-weight: 600; }

    .navbar-actions { display: flex; align-items: center; gap: var(--space-2); margin-left: auto; }

    /* ============================================================
       BREADCRUMB
       ============================================================ */

    .breadcrumb {
      display: flex;
      align-items: center;
      gap: var(--space-2);
      font-size: var(--text-sm);
      color: hsl(var(--text-muted));
      flex-wrap: wrap;
    }

    .breadcrumb-item { display: flex; align-items: center; gap: var(--space-2); }
    .breadcrumb-link { color: hsl(var(--text-muted)); transition: color var(--transition-fast); }
    .breadcrumb-link:hover { color: hsl(var(--primary)); }
    .breadcrumb-current { color: hsl(var(--text-primary)); font-weight: 500; }
    .breadcrumb-sep { color: hsl(var(--border-strong)); font-size: 12px; }

    /* ============================================================
       SCORE / MATCH RESULT
       ============================================================ */

    .match-card {
      background: hsl(var(--card));
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-xl);
      padding: var(--space-4) var(--space-5);
      display: flex;
      align-items: center;
      gap: var(--space-4);
      box-shadow: var(--shadow-sm);
    }

    .match-player {
      flex: 1;
      display: flex;
      align-items: center;
      gap: var(--space-3);
    }

    .match-player.right {
      flex-direction: row-reverse;
      text-align: right;
    }

    .match-player-name { font-weight: 600; font-size: var(--text-sm); color: hsl(var(--text-primary)); }
    .match-player-rating { font-size: var(--text-xs); color: hsl(var(--text-muted)); }

    .match-score {
      display: flex;
      align-items: center;
      gap: var(--space-2);
      flex-shrink: 0;
    }

    .match-score-num {
      font-family: var(--font-display);
      font-size: var(--text-2xl);
      font-weight: 800;
      width: 40px;
      text-align: center;
      color: hsl(var(--text-primary));
    }

    .match-score-sep { color: hsl(var(--text-muted)); font-size: var(--text-sm); }

    .match-score-num.winner { color: hsl(var(--success)); }
    .match-score-num.loser  { color: hsl(var(--text-muted)); }

    /* ============================================================
       EMPTY STATE
       ============================================================ */

    .empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: var(--space-16) var(--space-8);
      gap: var(--space-4);
    }

    .empty-state-icon {
      font-size: 48px;
      opacity: 0.35;
    }

    .empty-state-title {
      font-family: var(--font-display);
      font-size: var(--text-xl);
      font-weight: 700;
      color: hsl(var(--text-primary));
    }

    .empty-state-desc {
      font-size: var(--text-sm);
      color: hsl(var(--text-muted));
      max-width: 320px;
      line-height: var(--leading-relaxed);
    }

    /* ============================================================
       SKELETON LOADER
       ============================================================ */

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

    .skeleton {
      background: linear-gradient(90deg,
        hsl(var(--secondary)) 25%,
        hsl(var(--border)) 50%,
        hsl(var(--secondary)) 75%
      );
      background-size: 600px 100%;
      animation: shimmer 1.4s infinite linear;
      border-radius: var(--radius-md);
    }

    .skeleton-text  { height: 14px; width: 100%; border-radius: var(--radius-sm); }
    .skeleton-title { height: 22px; width: 60%;  border-radius: var(--radius-sm); }
    .skeleton-avatar { border-radius: var(--radius-full); }
    .skeleton-card { height: 120px; width: 100%; border-radius: var(--radius-xl); }

    /* ============================================================
       CODE BLOCK
       ============================================================ */

    .code-block {
      background: hsl(25 25% 12%);
      color: hsl(35 60% 85%);
      border-radius: var(--radius-lg);
      padding: var(--space-5);
      font-family: 'Courier New', monospace;
      font-size: var(--text-sm);
      line-height: 1.7;
      overflow-x: auto;
      border: 1px solid hsl(25 25% 20%);
    }

    .code-block .token-keyword  { color: hsl(38 95% 65%); }
    .code-block .token-string   { color: hsl(130 40% 65%); }
    .code-block .token-comment  { color: hsl(25 15% 50%); font-style: italic; }
    .code-block .token-property { color: hsl(200 65% 70%); }

    /* ============================================================
       TOKEN TABLE (design tokens display)
       ============================================================ */

    .token-table-wrapper {
      border: 1px solid hsl(var(--border));
      border-radius: var(--radius-xl);
      overflow: hidden;
      box-shadow: var(--shadow-sm);
      margin-bottom: var(--space-8);
    }

    .token-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); background: hsl(var(--card)); }

    .token-table thead {
      background: hsl(var(--secondary));
      border-bottom: 2px solid hsl(var(--border));
    }

    .token-table th {
      padding: var(--space-3) var(--space-4);
      text-align: left;
      font-size: var(--text-xs);
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.07em;
      color: hsl(var(--text-muted));
    }

    .token-table td {
      padding: var(--space-3) var(--space-4);
      color: hsl(var(--text-secondary));
      border-bottom: 1px solid hsl(var(--border));
      vertical-align: middle;
    }

    .token-table tbody tr:last-child td { border-bottom: none; }

    .token-name { font-family: 'Courier New', monospace; color: hsl(var(--primary)); font-size: var(--text-xs); }
    .token-value { font-family: 'Courier New', monospace; font-size: var(--text-xs); color: hsl(var(--text-muted)); }
    .token-preview { width: 32px; height: 32px; border-radius: var(--radius-md); border: 1px solid hsl(var(--border)); }
    .token-desc { color: hsl(var(--text-secondary)); }

    /* ============================================================
       UTILITY CLASSES
       ============================================================ */

    .text-primary-color { color: hsl(var(--primary)); }
    .text-accent-color  { color: hsl(var(--accent)); }
    .text-muted         { color: hsl(var(--text-muted)); }
    .text-success       { color: hsl(var(--success)); }
    .text-error         { color: hsl(var(--error)); }
    .text-warning       { color: hsl(var(--warning)); }

    .font-display { font-family: var(--font-display); }
    .font-mono    { font-family: 'Courier New', monospace; }
    .font-bold    { font-weight: 700; }
    .font-semibold{ font-weight: 600; }

    .mt-2 { margin-top: var(--space-2); }
    .mt-4 { margin-top: var(--space-4); }
    .mt-6 { margin-top: var(--space-6); }
    .mt-8 { margin-top: var(--space-8); }
    .mb-2 { margin-bottom: var(--space-2); }
    .mb-4 { margin-bottom: var(--space-4); }
    .mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

    .p-4 { padding: var(--space-4); }
    .p-6 { padding: var(--space-6); }
    .px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
    .py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
    .py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

    .w-full  { width: 100%; }
    .h-full  { height: 100%; }
    .block   { display: block; }
    .inline  { display: inline; }
    .hidden  { display: none; }

    .rounded-sm   { border-radius: var(--radius-sm); }
    .rounded-md   { border-radius: var(--radius-md); }
    .rounded-lg   { border-radius: var(--radius-lg); }
    .rounded-xl   { border-radius: var(--radius-xl); }
    .rounded-full { border-radius: var(--radius-full); }

    .shadow-sm { box-shadow: var(--shadow-sm); }
    .shadow    { box-shadow: var(--shadow); }
    .shadow-md { box-shadow: var(--shadow-md); }
    .shadow-lg { box-shadow: var(--shadow-lg); }

    .truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .sr-only  { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

    /* ============================================================
       DEMO PAGE CHROME
       ============================================================ */

    .demo-label {
      font-size: var(--text-xs);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: hsl(var(--text-muted));
      margin-bottom: var(--space-3);
    }

    .demo-row {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--space-3);
      margin-bottom: var(--space-6);
    }

    .demo-block {
      background: hsl(var(--secondary));
      border-radius: var(--radius-lg);
      padding: var(--space-6);
      margin-bottom: var(--space-6);
    }

    .demo-block-dark {
      background: hsl(var(--primary));
      border-radius: var(--radius-lg);
      padding: var(--space-6);
      margin-bottom: var(--space-6);
    }

    .divider {
      height: 1px;
      background: hsl(var(--border));
      margin: var(--space-8) 0;
    }
