      /* ============================================================
   CHESSCIPHER — "FIELD CONSOLE" DESIGN SYSTEM
   A completely different structural approach from the previous
   dashboard: a fixed icon rail for navigation, single-column
   dossier-style panels instead of a card grid, and a distinct
   amber/cyan accent language on a balanced (not light, not dark)
   canvas. Same engine underneath — every id/class the script
   depends on is preserved exactly.
   ============================================================ */
      *,
      *::before,
      *::after {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }

      :root {
        /* Chessboard — blue glass, carried over because it reads well */
        --board-light: #dce9f8;
        --board-dark: #2f6690;

        /* Rail */
        --rail-bg: #1b2131;
        --rail-bg-2: #232a3d;
        --rail-text: rgba(226, 230, 245, 0.62);
        --rail-text-active: #f4f6fb;

        /* Canvas — balanced mid-tone, not light, not dark */
        --canvas-1: #4b5674;
        --canvas-2: #3c4560;

        /* Paper panels */
        --paper: #f7f5f1;
        --paper-2: #efece5;
        --ink: #26232a;
        --ink-soft: #675f80;
        --ink-mid: #6a6560;
        --ink-muted: #9b93b0;

        --line: rgba(38, 35, 42, 0.1);
        --line-mid: rgba(38, 35, 42, 0.18);
        --line-bright: rgba(38, 35, 42, 0.28);
        --line-oncanvas: rgba(255, 255, 255, 0.16);

        /* Accents — amber + cyan, distinct from any prior version */
        --amber: #e2932e;
        --amber-bright: #f2ab4c;
        --cyan: #1fa7c9;
        --cyan-bright: #38c3e6;
        --red: #d6555a;
        --green: #3f9d6e;

        --gold: var(--amber);
        --gold-bright: var(--amber-bright);
        --teal: var(--cyan);
        --teal-dim: #14839f;

        --text-primary: var(--ink);
        --text-secondary: var(--ink-soft);
        --text-muted: var(--ink-muted);

        --radius-sm: 6px;
        --radius-md: 10px;
        --radius-lg: 14px;

        --font-display: "Poppins", sans-serif;
        --font-body: "Nunito", "Poppins", system-ui, sans-serif;
        --font-mono: "JetBrains Mono", "Courier New", monospace;

        --transition: all 0.17s cubic-bezier(0.4, 0, 0.2, 1);

        --shadow-sm: 0 2px 6px rgba(20, 18, 12, 0.1);
        --shadow-md: 0 10px 26px rgba(15, 15, 30, 0.22);
        --shadow-lg: 0 22px 52px rgba(10, 12, 26, 0.32);

        --rail-w: 92px;
      }

      html {
        scroll-behavior: smooth;
      }
      body {
        font-family: var(--font-body);
        color: var(--ink);
        background: linear-gradient(
          150deg,
          var(--canvas-1) 0%,
          var(--canvas-2) 100%
        );
        min-height: 100vh;
      }
      ::selection {
        background: rgba(226, 147, 46, 0.28);
      }
      :focus-visible {
        outline: 2px solid var(--amber);
        outline-offset: 2px;
      }
      ::-webkit-scrollbar {
        width: 7px;
        height: 7px;
      }
      ::-webkit-scrollbar-thumb {
        background: linear-gradient(180deg, var(--amber), var(--cyan));
        border-radius: 6px;
      }

      /* ============================================================
   APP SHELL
   ============================================================ */
      .app-shell {
        display: flex;
        min-height: 100vh;
      }

      /* ============================================================
   RAIL — fixed left icon navigation (replaces top navbar entirely)
   ============================================================ */
      .rail {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--rail-w);
        background: linear-gradient(180deg, var(--rail-bg), var(--rail-bg-2));
        display: flex;
        flex-direction: column;
        align-items: center;
        z-index: 200;
        border-right: 1px solid rgba(255, 255, 255, 0.06);
        box-shadow: 4px 0 22px rgba(0, 0, 0, 0.25);
      }
      .rail-logo {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 18px 0 14px;
        text-decoration: none;
        cursor: pointer;
      }
      .rail-logo-icon {
        font-size: 26px;
        color: var(--amber-bright);
        filter: drop-shadow(0 2px 6px rgba(226, 147, 46, 0.4));
      }
      .rail-logo-text {
        font-family: var(--font-mono);
        font-size: 8.5px;
        font-weight: 700;
        letter-spacing: 1px;
        color: rgba(255, 255, 255, 0.5);
        text-transform: uppercase;
      }
      .rail-divider {
        width: 32px;
        height: 1px;
        background: rgba(255, 255, 255, 0.1);
        margin: 4px 0 10px;
      }
      .rail-tabs {
        display: flex;
        flex-direction: column;
        gap: 14px;
        width: 100%;
        align-items: center;
        flex: 1;
        padding-top: 4px;
      }
      .nav-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 72px;
        min-height: 52px;
        padding: 10px 4px;
        border: none;
        background: transparent;
        color: var(--rail-text);
        cursor: pointer;
        border-radius: var(--radius-md);
        transition: var(--transition);
        font-family: var(--font-body);
        position: relative;
      }
      .nav-tab .ico {
        font-size: 18px;
        line-height: 1;
        display: block;
      }
      .nav-tab .lbl {
        font-size: 9.5px;
        font-weight: 700;
        letter-spacing: 0.2px;
        text-align: center;
        line-height: 1.2;
        display: block;
      }
      .nav-tab:hover {
        color: var(--rail-text-active);
        background: rgba(255, 255, 255, 0.06);
      }
      .nav-tab.active {
        color: var(--rail-bg);
        background: linear-gradient(135deg, var(--amber-bright), var(--amber));
        box-shadow: 0 4px 14px rgba(226, 147, 46, 0.35);
      }
      .rail-bottom {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 14px;
        padding: 16px 8px 22px;
        width: 100%;
      }
      .nav-link {
        font-size: 15px;
        color: var(--rail-text);
        cursor: pointer;
        transition: var(--transition);
        display: block;
      }
      .nav-link:hover {
        color: var(--cyan-bright);
      }
      .nav-support {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 64px;
        height: 64px;
        border-radius: 50%;
        border: 1.5px solid var(--amber);
        background: rgba(226, 147, 46, 0.12);
        color: var(--amber-bright);
        font-family: var(--font-mono);
        cursor: pointer;
        transition: var(--transition);
      }
      .nav-support .ico {
        font-size: 16px;
        line-height: 1;
        display: block;
      }
      .nav-support .lbl {
        font-size: 8.5px;
        font-weight: 700;
        letter-spacing: 0.3px;
        line-height: 1;
        display: block;
      }
      .nav-support:hover {
        background: var(--amber);
        color: var(--rail-bg);
        transform: scale(1.05);
      }

      /* Mobile info strip (kept for parity, shown under top bar on small screens) */
      .nav-mobile-bar {
        display: none;
        width: 100%;
        background: rgba(27, 33, 49, 0.92);
        padding: 7px 14px;
        font-size: 11px;
        font-family: var(--font-body);
        font-weight: 700;
        color: rgba(255, 255, 255, 0.65);
        align-items: center;
        justify-content: space-between;
        gap: 8px;
      }
      .nav-mobile-bar .upi-inline {
        color: var(--cyan-bright);
        cursor: pointer;
        background: rgba(31, 167, 201, 0.14);
        border: 1px solid rgba(31, 167, 201, 0.3);
        border-radius: var(--radius-sm);
        padding: 3px 9px;
        font-size: 10.5px;
      }
      .nav-mobile-bar .yt-inline {
        color: var(--amber-bright);
        cursor: pointer;
        font-size: 10.5px;
      }

      /* ============================================================
   MAIN AREA
   ============================================================ */
      .main-area {
        flex: 1;
        margin-left: var(--rail-w);
        min-height: 100vh;
        position: relative;
      }

      #supportStrip {
        background: rgba(255, 255, 255, 0.06) !important;
        border-bottom: 1px solid var(--line-oncanvas) !important;
        color: rgba(255, 255, 255, 0.7) !important;
        font-family: var(--font-body) !important;
        font-weight: 600;
        padding: 7px 20px !important;
      }
      #supportStrip span {
        color: var(--cyan-bright) !important;
      }

      .page {
        display: none;
      }
      .page.active {
        display: block;
        animation: pageIn 0.3s ease;
      }
      @keyframes pageIn {
        from {
          opacity: 0;
          transform: translateY(6px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }

      .main-wrap {
        max-width: 900px;
        margin: 0 auto;
        padding: 36px 28px 60px;
      }

      /* Page head — replaces the old centered "hero" */
      .hero {
        margin-bottom: 24px;
      }
      .hero-pill {
        display: inline-block;
        font-family: var(--font-mono);
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: 1px;
        text-transform: uppercase;
        color: var(--cyan-bright);
        background: rgba(31, 167, 201, 0.14);
        border: 1px solid rgba(31, 167, 201, 0.32);
        padding: 4px 11px;
        border-radius: var(--radius-sm);
        margin-bottom: 12px;
      }
      .hero-title {
        font-family: var(--font-display);
        font-size: clamp(1.6rem, 3vw, 2.3rem);
        font-weight: 700;
        color: #ffffff;
        line-height: 1.2;
        margin-bottom: 8px;
      }
      .hero-sub {
        font-family: var(--font-body);
        font-size: 14px;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.68);
        max-width: 560px;
        line-height: 1.6;
      }

      /* ============================================================
   PANEL — the paper-toned dossier section (replaces .card grid)
   ============================================================ */
      .card {
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-md);
        overflow: hidden;
        margin-bottom: 18px;
      }
      .card-header {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 14px 18px;
        background: var(--paper-2);
        border-bottom: 1px solid var(--line);
      }
      .card-icon {
        width: 30px;
        height: 30px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(
          135deg,
          rgba(226, 147, 46, 0.16),
          rgba(31, 167, 201, 0.1)
        );
        border: 1px solid var(--line-mid);
        border-radius: var(--radius-sm);
        font-size: 15px;
        flex-shrink: 0;
      }
      .card-title {
        font-family: var(--font-mono);
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        color: var(--ink);
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .card-badge {
        margin-left: auto;
        font-size: 10px;
        font-weight: 700;
        font-family: var(--font-mono);
        color: var(--cyan);
        background: rgba(31, 167, 201, 0.12);
        border: 1px solid rgba(31, 167, 201, 0.28);
        padding: 3px 9px;
        border-radius: var(--radius-sm);
      }
      .card > .field,
      .card > .btn-row,
      .card > .stats-row,
      .card > .out-header,
      .card > .out-box,
      .card > .divider,
      .card > #fenOut,
      .card > #encAlert,
      .card > #decAlert,
      .card > #encBoardSection,
      .card > .toggle-row,
      .card > .two-col,
      .card > .dd-card,
      .card > .decode-status,
      .card > .ctrl-row,
      .card > p {
        margin-left: 18px;
        margin-right: 18px;
      }
      .card > .field:first-of-type {
        margin-top: 18px;
      }
      .card > .field:last-child,
      .card > .btn-row {
        margin-bottom: 18px;
      }
      .card > .btn-row {
        margin-top: 4px;
      }
      .card > .divider {
        margin-top: 16px;
        margin-bottom: 16px;
      }
      .card > #fenOut {
        padding-bottom: 18px;
      }
      .card > #encBoardSection {
        padding-bottom: 18px;
      }
      .card > .dd-card {
        margin-bottom: 18px;
      }
      .card > p {
        padding-bottom: 16px;
      }

      /* ============================================================
   FORM ELEMENTS
   ============================================================ */
      .field {
        margin-bottom: 14px;
      }
      .field-label {
        display: block;
        font-size: 10.5px;
        font-family: var(--font-mono);
        font-weight: 700;
        color: var(--ink-muted);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 6px;
      }
      .key-status {
        font-size: 11px;
        font-family: var(--font-body);
        font-weight: 600;
        color: var(--ink-muted);
        margin-top: 6px;
      }
      .field-input,
      .field-textarea,
      .field-select {
        width: 100%;
        background: #ffffff;
        border: 1.5px solid var(--line-mid);
        border-radius: var(--radius-sm);
        padding: 10px 13px;
        color: var(--ink);
        font-size: 14px;
        font-weight: 600;
        font-family: var(--font-body);
        outline: none;
        transition: var(--transition);
        line-height: 1.5;
      }
      .field-textarea {
        resize: vertical;
        min-height: 96px;
      }
      .field-input:focus,
      .field-textarea:focus,
      .field-select:focus {
        border-color: var(--amber);
        box-shadow: 0 0 0 3px rgba(226, 147, 46, 0.15);
      }
      .field-input::placeholder,
      .field-textarea::placeholder {
        color: var(--ink-muted);
        font-weight: 500;
      }
      .field-select {
        cursor: pointer;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23e2932e' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 13px center;
        padding-right: 30px;
      }

      /* ============================================================
   BUTTONS
   ============================================================ */
      .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        padding: 10px 20px;
        font-size: 13px;
        font-weight: 700;
        font-family: var(--font-body);
        border: none;
        border-radius: var(--radius-sm);
        cursor: pointer;
        transition: var(--transition);
        white-space: nowrap;
      }
      .btn:active {
        transform: scale(0.97);
      }
      .btn-primary {
        background: linear-gradient(135deg, var(--amber), var(--amber-bright));
        color: #211505;
        box-shadow: 0 4px 14px rgba(226, 147, 46, 0.35);
      }
      .btn-primary:hover {
        box-shadow: 0 6px 18px rgba(226, 147, 46, 0.45);
        transform: translateY(-1px);
      }
      .btn-teal {
        background: linear-gradient(135deg, var(--cyan), var(--cyan-bright));
        color: #08222a;
        box-shadow: 0 4px 14px rgba(31, 167, 201, 0.32);
      }
      .btn-teal:hover {
        box-shadow: 0 6px 18px rgba(31, 167, 201, 0.42);
        transform: translateY(-1px);
      }
      .btn-ghost {
        background: transparent;
        border: 1.5px solid var(--line-mid);
        color: var(--ink-soft);
      }
      .btn-ghost:hover {
        border-color: var(--ink-mid);
        color: var(--ink);
        background: rgba(38, 35, 42, 0.04);
      }
      .btn-sm {
        padding: 7px 14px;
        font-size: 11.5px;
      }
      .btn-row {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
      }
      .btn-full {
        width: 100%;
      }

      /* ============================================================
   OUTPUT BOXES
   ============================================================ */
      .out-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 7px;
      }
      .out-label {
        font-size: 9.5px;
        font-family: var(--font-mono);
        font-weight: 700;
        color: var(--ink-muted);
        text-transform: uppercase;
        letter-spacing: 0.7px;
      }
      .copy-btn {
        font-size: 10.5px;
        font-family: var(--font-mono);
        font-weight: 700;
        color: var(--amber);
        cursor: pointer;
        background: none;
        border: none;
        padding: 3px 7px;
        transition: var(--transition);
        white-space: nowrap;
        flex-shrink: 0;
        line-height: 1;
      }
      .copy-btn:hover {
        color: var(--amber-bright);
      }
      .out-box {
        background: #fbfaf7;
        border: 1px solid var(--line);
        border-left: 3px solid var(--amber);
        border-radius: var(--radius-sm);
        padding: 12px 14px;
        font-family: var(--font-mono);
        font-size: 11.5px;
        color: var(--teal-dim);
        line-height: 1.7;
        word-break: break-all;
        white-space: pre-wrap;
        min-height: 72px;
        max-height: 180px;
        overflow-y: auto;
      }
      .out-box::-webkit-scrollbar {
        width: 4px;
      }
      .out-box::-webkit-scrollbar-thumb {
        background: var(--line-bright);
        border-radius: 4px;
      }

      /* ============================================================
   STATS CHIPS
   ============================================================ */
      .stats-row {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        margin-bottom: 12px;
      }
      .stat-chip {
        background: #ffffff;
        border: 1px solid var(--line-mid);
        border-radius: var(--radius-sm);
        padding: 4px 10px;
        font-size: 10.5px;
        font-family: var(--font-mono);
        font-weight: 600;
        color: var(--ink-muted);
      }
      .stat-chip b {
        color: var(--amber);
        font-weight: 700;
      }

      /* ============================================================
   DIVIDER
   ============================================================ */
      .divider {
        height: 1px;
        background: var(--line);
      }

      /* ============================================================
   TOGGLE
   ============================================================ */
      .toggle-row {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
      }
      .toggle {
        width: 38px;
        height: 21px;
        background: var(--line-mid);
        border-radius: 999px;
        position: relative;
        cursor: pointer;
        transition: background 0.2s;
        flex-shrink: 0;
      }
      .toggle.on {
        background: linear-gradient(135deg, var(--amber), var(--cyan));
      }
      .toggle::after {
        content: "";
        width: 17px;
        height: 17px;
        background: white;
        border-radius: 50%;
        position: absolute;
        top: 2px;
        left: 2px;
        transition: transform 0.2s;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
      }
      .toggle.on::after {
        transform: translateX(17px);
      }
      .toggle-label {
        font-family: var(--font-body);
        font-size: 12px;
        font-weight: 600;
        color: var(--ink-soft);
      }

      /* ============================================================
   ALERT
   ============================================================ */
      .alert {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 9px 13px;
        border-radius: var(--radius-sm);
        font-size: 12px;
        font-family: var(--font-body);
        font-weight: 700;
        margin-top: 8px;
      }
      .alert-err {
        background: rgba(214, 85, 90, 0.09);
        border: 1px solid rgba(214, 85, 90, 0.25);
        color: #b8383d;
      }
      .alert-ok {
        background: rgba(63, 157, 110, 0.09);
        border: 1px solid rgba(63, 157, 110, 0.25);
        color: #2c7a51;
      }

      /* ============================================================
   CHESSBOARD — blue glass viewport
   ============================================================ */
      .board-wrap {
        position: relative;
        max-width: 380px;
        margin: 0 auto;
        border-radius: var(--radius-md);
        overflow: hidden;
        box-shadow:
          0 0 0 1px rgba(255, 255, 255, 0.25),
          0 8px 26px rgba(10, 20, 45, 0.3);
      }
      .board-coord-wrap {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 6px;
        background: linear-gradient(
          135deg,
          rgba(84, 149, 214, 0.55),
          rgba(20, 66, 107, 0.65)
        );
        backdrop-filter: blur(16px) saturate(160%);
        -webkit-backdrop-filter: blur(16px) saturate(160%);
        border: 1px solid rgba(255, 255, 255, 0.28);
      }
      .board-grid {
        display: grid;
        grid-template-columns: repeat(8, 1fr);
        width: 100%;
        aspect-ratio: 1;
        user-select: none;
        border-radius: 7px;
        overflow: hidden;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
      }
      .sq {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: default;
        transition: background-color 0.15s ease;
        aspect-ratio: 1;
        overflow: hidden;
      }
      .sq::before {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(
          160deg,
          rgba(255, 255, 255, 0.3) 0%,
          rgba(255, 255, 255, 0.04) 35%,
          rgba(255, 255, 255, 0) 55%,
          rgba(0, 0, 0, 0.06) 100%
        );
        pointer-events: none;
      }
      .sq.light {
        background-color: var(--board-light);
      }
      .sq.dark {
        background-color: var(--board-dark);
      }
      .sq.hl-from {
        background-color: rgba(255, 205, 90, 0.55) !important;
      }
      .sq.hl-to {
        background-color: rgba(255, 205, 90, 0.72) !important;
      }
      .sq.hl-check {
        background-color: rgba(239, 68, 68, 0.62) !important;
      }
      .piece {
        width: 88%;
        height: 88%;
        display: block;
        position: relative;
        z-index: 2;
        transition: transform 0.15s ease;
        flex-shrink: 0;
      }
      .piece svg {
        filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45));
      }
      .sq-rank {
        position: absolute;
        bottom: 1px;
        left: 2px;
        font-size: 8.5px;
        font-weight: 700;
        font-family: var(--font-body);
        opacity: 0.85;
        line-height: 1;
        z-index: 1;
      }
      .sq-file {
        position: absolute;
        bottom: 1px;
        right: 2px;
        font-size: 8.5px;
        font-weight: 700;
        font-family: var(--font-body);
        opacity: 0.85;
        line-height: 1;
        z-index: 1;
      }
      .sq.light .sq-rank,
      .sq.light .sq-file {
        color: var(--board-dark);
      }
      .sq.dark .sq-rank,
      .sq.dark .sq-file {
        color: var(--board-light);
      }
      @keyframes pieceMove {
        0% {
          transform: scale(1.18) translateY(-4px);
          filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.45));
        }
        100% {
          transform: scale(1) translateY(0);
          filter: none;
        }
      }
      .piece.just-moved {
        animation: pieceMove 0.28s ease forwards;
      }

      /* ============================================================
   DECODE STATUS / PROGRESS / MESSAGE REVEAL
   ============================================================ */
      .progress-track {
        height: 4px;
        background: var(--line-mid);
        border-radius: 999px;
        overflow: hidden;
        margin-bottom: 10px;
        margin-top: 14px;
      }
      .progress-fill {
        height: 100%;
        background: linear-gradient(90deg, var(--cyan), var(--amber));
        width: 0%;
        transition: width 0.3s ease;
      }
      .decode-status {
        font-family: var(--font-mono);
        font-weight: 700;
        font-size: 12px;
        color: var(--teal);
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 6px;
        min-height: 18px;
      }
      .msg-reveal {
        background: #fbfaf7;
        border: 1.5px solid var(--line-mid);
        border-left: 4px solid var(--amber);
        border-radius: var(--radius-sm);
        padding: 16px 18px;
        font-family: var(--font-body);
        font-weight: 700;
        font-size: 16px;
        line-height: 1.6;
        color: var(--ink);
        min-height: 60px;
        transition:
          border-color 0.4s,
          box-shadow 0.4s;
        word-break: break-word;
        margin: 0 18px 14px;
      }
      .msg-reveal.glow {
        border-color: var(--amber);
        box-shadow: 0 0 0 3px rgba(226, 147, 46, 0.14);
      }
      .cursor {
        display: inline-block;
        width: 2px;
        height: 1.1em;
        background: var(--amber);
        vertical-align: middle;
        animation: blink-cursor 0.65s ease-in-out infinite;
        margin-left: 1px;
      }
      @keyframes blink-cursor {
        0%,
        100% {
          opacity: 1;
        }
        50% {
          opacity: 0;
        }
      }
      .ctrl-row {
        display: flex;
        align-items: center;
        gap: 6px;
        margin-top: 10px;
        flex-wrap: wrap;
      }
      .ctrl-btn {
        padding: 6px 12px;
        font-size: 10.5px;
        font-family: var(--font-mono);
        font-weight: 700;
        background: #ffffff;
        border: 1px solid var(--line-mid);
        border-radius: var(--radius-sm);
        color: var(--ink-muted);
        cursor: pointer;
        transition: var(--transition);
      }
      .ctrl-btn:hover {
        border-color: var(--line-bright);
        color: var(--ink-soft);
      }
      .ctrl-btn.active {
        border-color: var(--amber);
        color: var(--amber);
        background: rgba(226, 147, 46, 0.1);
      }
      .ctrl-spacer {
        flex: 1;
      }

      /* ============================================================
   DEAD DROP
   ============================================================ */
      .dd-card {
        background: #fbfaf7;
        border: 1px solid var(--line-mid);
        border-left: 3px solid var(--cyan);
        border-radius: var(--radius-sm);
        padding: 15px;
        font-family: var(--font-mono);
        font-size: 11.5px;
        line-height: 1.9;
        color: var(--ink);
        white-space: pre;
        overflow-x: auto;
      }

      /* ============================================================
   ABOUT PAGE — numbered dossier entries
   ============================================================ */
      .about-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
        background: var(--paper);
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        overflow: hidden;
        box-shadow: var(--shadow-md);
      }
      .about-item {
        padding: 18px 20px;
        border-bottom: 1px solid var(--line);
      }
      .about-item:last-child {
        border-bottom: none;
      }
      .about-item-title {
        font-family: var(--font-mono);
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin-bottom: 8px;
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--ink);
      }
      .about-item p {
        font-family: var(--font-body);
        font-weight: 500;
        font-size: 13px;
        color: var(--ink-soft);
        line-height: 1.65;
      }

      /* ============================================================
   MODAL
   ============================================================ */
      .modal-bg {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 15, 30, 0.6);
        backdrop-filter: blur(4px);
        z-index: 1000;
        align-items: center;
        justify-content: center;
      }
      .modal-bg.open {
        display: flex;
      }
      .modal-box {
        background: var(--paper);
        border: 1px solid var(--line-mid);
        border-radius: var(--radius-lg);
        padding: 26px;
        max-width: 340px;
        width: 90%;
        text-align: center;
        box-shadow: var(--shadow-lg);
        position: relative;
      }
      .modal-close {
        position: absolute;
        top: 12px;
        right: 14px;
        background: none;
        border: none;
        color: var(--ink-muted);
        font-size: 20px;
        cursor: pointer;
        line-height: 1;
      }
      .modal-close:hover {
        color: var(--ink);
      }
      .modal-title {
        font-family: var(--font-display);
        font-weight: 700;
        font-size: 18px;
        color: var(--amber);
        margin-bottom: 6px;
      }
      .modal-sub {
        font-family: var(--font-body);
        font-size: 12.5px;
        font-weight: 500;
        color: var(--ink-muted);
        margin-bottom: 18px;
      }
      .upi-block {
        background: #ffffff;
        border: 1.5px solid var(--line-mid);
        border-radius: var(--radius-sm);
        padding: 11px;
        font-family: var(--font-mono);
        font-size: 12.5px;
        color: var(--teal);
        cursor: pointer;
        transition: var(--transition);
        margin-bottom: 10px;
      }
      .upi-block:hover {
        border-color: var(--amber);
      }
      .upi-copied {
        font-size: 11px;
        font-weight: 700;
        color: var(--teal);
        height: 16px;
        font-family: var(--font-body);
      }

      /* ============================================================
   TOAST
   ============================================================ */
      #toast {
        position: fixed;
        bottom: 22px;
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        background: var(--rail-bg);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 999px;
        padding: 10px 20px;
        font-size: 12.5px;
        font-family: var(--font-body);
        font-weight: 700;
        color: #ffffff;
        z-index: 9999;
        opacity: 0;
        transition:
          opacity 0.25s,
          transform 0.25s;
        pointer-events: none;
        box-shadow: var(--shadow-lg);
      }
      #toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
      }

      /* ============================================================
   FOOTER
   ============================================================ */
      footer {
        border-top: 1px solid var(--line-oncanvas);
        padding: 16px 28px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 11px;
        font-family: var(--font-mono);
        font-weight: 600;
        color: rgba(255, 255, 255, 0.5);
        max-width: 900px;
        margin: 0 auto;
      }
      footer a,
      footer span.lnk {
        color: rgba(255, 255, 255, 0.5);
        cursor: pointer;
        transition: var(--transition);
        text-decoration: none;
      }
      footer a:hover,
      footer span.lnk:hover {
        color: var(--cyan-bright);
      }

      /* ============================================================
   LAYOUT — single centered column (structurally different from
   the previous two-column grid dashboard)
   ============================================================ */
      .two-col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 14px;
      }

      /* ============================================================
   RESPONSIVE
   ============================================================ */
      *,
      *::before,
      *::after {
        max-width: 100%;
      }
      html,
      body {
        overflow-x: hidden;
        width: 100%;
      }

      @media (max-width: 900px) {
        .main-wrap {
          padding: 24px 18px 40px;
        }
        .two-col {
          grid-template-columns: 1fr;
        }
      }

      @media (max-width: 640px) {
        :root {
          --rail-w: 0px;
        }
        .rail {
          top: auto;
          bottom: 0;
          left: 0;
          right: 0;
          width: 100%;
          height: 60px;
          flex-direction: row;
          align-items: center;
          justify-content: space-between;
          border-right: none;
          border-top: 1px solid rgba(255, 255, 255, 0.08);
          padding: 0;
        }
        .rail-logo,
        .rail-divider {
          display: none;
        }
        .rail-tabs {
          display: flex;
          flex: 1 1 auto;
          flex-direction: row;
          justify-content: space-evenly;
          align-items: center;
          height: 100%;
          width: auto;
          gap: 0;
          padding-top: 0;
        }
        .nav-tab {
          width: auto;
          flex: 0 1 auto;
          min-height: auto;
          padding: 6px 6px;
          gap: 3px;
        }
        .nav-tab .lbl {
          font-size: 8.5px;
        }
        .rail-bottom {
          flex: 0 0 auto;
          flex-direction: row;
          align-items: center;
          padding: 0 12px;
          gap: 10px;
          width: auto;
        }
        .nav-support {
          width: 42px;
          height: 42px;
          gap: 1px;
        }
        .nav-support .ico {
          font-size: 13px;
        }
        .nav-support .lbl {
          font-size: 6.5px;
        }
        .nav-link {
          display: none;
        }
        .main-area {
          margin-left: 0;
          padding-bottom: 60px;
        }
        .nav-mobile-bar {
          display: flex;
        }

        .main-wrap {
          padding: 16px 14px 32px;
        }
        .hero-title {
          font-size: 1.5rem;
        }
        .hero-sub {
          font-size: 13px;
        }

        .card-header {
          padding: 12px 14px;
          flex-wrap: wrap;
        }
        .card-title {
          white-space: normal;
          overflow: visible;
          text-overflow: clip;
        }
        .card > .field,
        .card > .btn-row,
        .card > .stats-row,
        .card > .out-header,
        .card > .out-box,
        .card > .divider,
        .card > #fenOut,
        .card > #encAlert,
        .card > #decAlert,
        .card > #encBoardSection,
        .card > .toggle-row,
        .card > .two-col,
        .card > .dd-card,
        .card > .decode-status,
        .card > .ctrl-row,
        .card > p {
          margin-left: 14px;
          margin-right: 14px;
        }
        .msg-reveal {
          margin-left: 14px;
          margin-right: 14px;
        }

        .btn-row {
          flex-direction: column;
        }
        .btn-row .btn {
          width: 100%;
          padding: 12px 16px;
          font-size: 13.5px;
        }

        .out-box {
          font-size: 10.5px;
          max-height: 140px;
        }

        .board-coord-wrap {
          padding: 4px;
        }
        .sq-rank,
        .sq-file {
          font-size: 7px;
        }

        .dd-card {
          font-size: 10px;
          line-height: 1.75;
          white-space: pre-wrap;
          word-break: break-word;
        }

        footer {
          flex-direction: column;
          text-align: center;
          padding: 12px 14px;
        }
      }

      /* ============================================================
   ANIMATIONS
   ============================================================ */
      .fade-up,
      .fade-up-2,
      .fade-up-3 {
        animation: fadeUp 0.32s ease both;
      }
      .fade-up-2 {
        animation-delay: 0.06s;
      }
      .fade-up-3 {
        animation-delay: 0.12s;
      }
      @keyframes fadeUp {
        from {
          opacity: 0;
          transform: translateY(10px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }
      @keyframes resultFlash {
        0% {
          box-shadow: 0 0 0 0 rgba(226, 147, 46, 0.45);
        }
        60% {
          box-shadow: 0 0 0 6px rgba(226, 147, 46, 0.12);
        }
        100% {
          box-shadow: 0 0 0 0 rgba(226, 147, 46, 0);
        }
      }
      .result-flash {
        animation: resultFlash 0.8s ease;
      }

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