:root {
      --bg: #0f172a;
      --text: #e5e7eb;
      --muted: #94a3b8;
      --accent: #38bdf8;
      --success: #22c55e;
      --danger: #ef4444;
      --shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
      --radius: 18px;
    }

    * {
      box-sizing: border-box;
    }

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

    body {
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 28%),
        radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.08), transparent 24%),
        var(--bg);
      color: var(--text);
      overflow: hidden;
    }

    .app {
      width: 100vw;
      height: 100vh;
      padding: 16px;
      display: grid;
      grid-template-columns: var(--sidebar-width, 360px) minmax(0, 1fr);
      gap: 16px;
      overflow: hidden;
      transition: grid-template-columns 0.22s ease, gap 0.22s ease;
    }

    .app.sidebar-collapsed {
      grid-template-columns: 0 minmax(0, 1fr);
      gap: 0;
    }

    .panel {
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      backdrop-filter: none;
    }

    .sidebar {
      padding: 20px;
      height: calc(100vh - 32px);
      overflow: auto;
      -ms-overflow-style: none;
      scrollbar-width: none;
      min-width: 0;
      transition: opacity 0.2s ease, transform 0.22s ease, padding 0.22s ease;
    }

    .sidebar::-webkit-scrollbar {
      display: none;
      width: 0;
      height: 0;
    }

    .app.sidebar-collapsed .sidebar {
      opacity: 0;
      pointer-events: none;
      transform: translateX(-18px);
      padding-left: 0;
      padding-right: 0;
      border-width: 0;
    }

    h1 {
      margin: 0 0 8px;
      font-size: 1.75rem;
      line-height: 1.1;
    }

    .sub {
      color: var(--muted);
      margin: 0 0 20px;
      font-size: 0.96rem;
      line-height: 1.5;
    }

    .group {
      margin-bottom: 18px;
      padding: 14px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .group h2 {
      margin: 0 0 12px;
      font-size: 0.95rem;
      color: #f8fafc;
    }

    .app-title-card {
      text-align: center;
      padding: 10px 12px 12px;
    }

    .app-title-link,
    .app-title-link:link,
    .app-title-link:visited,
    .app-title-link:hover,
    .app-title-link:active {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      width: 100%;
      text-align: center;
      text-decoration: none;
      color: #f8fafc !important;
      cursor: pointer;
      line-height: 1.1;
      transition: transform 0.15s ease;
    }

    .app-title-link:hover {
      transform: translateY(-1px);
    }

    .app-title-link h1 {
      margin: 0;
      width: 100%;
      text-align: center;
      font-size: 2.2rem;
      line-height: 1.05;
      font-weight: 800;
      letter-spacing: -0.03em;
      color: #f8fafc !important;
    }

    .app-title-meta {
      margin-top: 6px;
      display: flex;
      flex-direction: column;
      gap: 2px;
      align-items: center;
      justify-content: center;
      width: 100%;
      text-align: center;
    }

    .app-title-meta .credit {
      color: #7fb3ff !important;
      font-size: 0.9rem;
      font-weight: 700;
      text-align: center;
    }

    .app-title-meta .version {
      color: #dbeafe !important;
      font-size: 0.92rem;
      font-weight: 500;
      text-align: center;
    }

    .app-title-actions {
      margin-top: 12px;
      display: flex;
      justify-content: center;
    }

    label {
      display: block;
      margin-bottom: 8px;
      font-size: 0.9rem;
      color: #dbeafe;
    }

    input[type="file"],
    input[type="number"],
    input[type="range"],
    input[type="text"],
    button,
    textarea {
      width: 100%;
      font: inherit;
    }

    input[type="number"],
    input[type="text"],
    textarea,
    input[type="file"] {
      background: rgba(15, 23, 42, 0.9);
      color: var(--text);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 14px;
      padding: 12px 14px;
      font-size: 0.95rem;
      outline: none;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
    }

    textarea {
      resize: vertical;
      min-height: 72px;
    }

    input[type="text"] {
      min-height: 46px;
    }

    input[type="file"] {
      color: var(--muted);
      font-size: 0.92rem;
    }

    input[type="range"] {
      accent-color: var(--accent);
    }

    .row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
    }

    .hint {
      color: var(--muted);
      font-size: 0.83rem;
      line-height: 1.45;
      margin-top: 8px;
    }

    .stat {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.92rem;
      padding: 8px 0;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    .stat:last-child {
      border-bottom: none;
    }

    .btn-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px;
      margin-top: 10px;
    }

    .btn-row.btn-row-full {
      display: block !important;
      width: 100% !important;
      margin-top: 10px;
    }

    .btn-row.btn-row-full>* {
      display: flex !important;
      width: 100% !important;
      max-width: none !important;
      box-sizing: border-box !important;
    }

    .btn-row.triple {
      grid-template-columns: 1fr 1fr 1fr;
    }

    button,
    .button-link {
      border: none;
      border-radius: 14px;
      padding: 10px 14px;
      font-size: 0.96rem;
      font-weight: 600;
      cursor: pointer;
      transition: transform 0.15s ease, opacity 0.2s ease, box-shadow 0.2s ease;
      box-shadow: 0 10px 22px rgba(14, 165, 233, 0.12);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-decoration: none;
      min-height: 40px;
      height: 40px;
      line-height: 1;
    }

    button:hover,
    .button-link:hover {
      transform: translateY(-1px);
    }

    button:active,
    .button-link:active {
      transform: translateY(1px);
    }

    button:disabled {
      opacity: 0.45;
      cursor: not-allowed;
      transform: none;
    }

    .primary {
      background: linear-gradient(180deg, #38bdf8, #0ea5e9);
      color: white;
      box-shadow: 0 10px 22px rgba(14, 165, 233, 0.28);
    }

    .secondary {
      background: rgba(255, 255, 255, 0.08);
      color: var(--text);
      border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .button-link.is-disabled {
      opacity: 0.45;
      pointer-events: none;
      cursor: not-allowed;
      transform: none;
    }

    .danger {
      background: rgba(239, 68, 68, 0.14);
      color: #fecaca;
      border: 1px solid rgba(239, 68, 68, 0.22);
    }

    body.running .running-hide {
      display: none !important;
    }

    .toolbar-stats {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .sidebar-bottom-status {
      margin-top: auto;
    }

    .status-toast {
      position: fixed;
      top: 16px;
      left: 50%;
      transform: translate(-50%, -10px);
      min-width: 220px;
      max-width: min(80vw, 680px);
      z-index: 30000;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.22s ease, transform 0.22s ease;
      display: inline-flex;
      align-items: center;
      justify-content: center !important;
      min-height: 42px;
      height: auto;
      padding: 10px 16px;
      border-radius: 999px;
      background: #0f172a;
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: #f8fafc;
      box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
      white-space: nowrap;
    }

    .status-toast.warn {
      background: #7f1d1d;
      border-color: rgba(254, 202, 202, 0.24);
      color: #fee2e2;
    }

    .status-toast.ok {
      background: #14532d;
      border-color: rgba(187, 247, 208, 0.24);
      color: #dcfce7;
    }

    .status-toast.show {
      opacity: 1;
      transform: translate(-50%, 0);
    }

    .board-shell {
      padding: 14px;
      height: calc(100vh - 32px);
      display: flex;
      flex-direction: column;
      gap: 12px;
      overflow: hidden;
      min-height: 0;
    }

    .toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 12px;
      flex-wrap: wrap;
    }

    .toolbar-actions,
    .toolbar-left {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
    }

    .toolbar-preview {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.08);
      /* min-width: 230px; */
    }

    .toolbar-preview label {
      margin: 0;
      font-size: 0.86rem;
      color: #e2e8f0;
      white-space: nowrap;
    }

    .toolbar-preview input[type="range"] {
      width: 120px;
      margin: 0;
    }

    .toolbar-preview-value {
      min-width: 42px;
      text-align: right;
      color: #f8fafc;
      font-size: 0.84rem;
    }

    .toolbar .toolbar-layer-select {
      appearance: none;
      -webkit-appearance: none;
      -moz-appearance: none;
      display: inline-block;
      vertical-align: middle;
      width: auto;
      min-width: 108px;
      max-width: 144px;
      color-scheme: dark;
      background-color: rgba(255, 255, 255, 0.08);
      color: var(--text);
      border: 1px solid rgba(255, 255, 255, 0.08) !important;
      border-radius: 999px;
      padding: 8px 28px 8px 9px;
      min-height: 40px;
      height: 40px;
      font: inherit;
      font-size: 0.92rem;
      font-weight: 600;
      line-height: 1.2;
      box-shadow: 0 10px 22px rgba(15, 23, 42, 0.14);
      outline: none;
      cursor: pointer;
      background-image:
        linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.72) 50%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.72) 50%, transparent 50%);
      background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
      background-size: 6px 6px, 6px 6px;
      background-repeat: no-repeat;
      transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
    }

    .toolbar .toolbar-layer-select:hover {
      border-color: rgba(255, 255, 255, 0.18);
      background-color: rgba(255, 255, 255, 0.11);
    }

    .toolbar .toolbar-layer-select:focus {
      border-color: rgba(56, 189, 248, 0.7);
      box-shadow: 0 0 0 0.2rem rgba(56, 189, 248, 0.18);
    }

    .toolbar .toolbar-layer-select option {
      color: #e5e7eb;
      background: #0f172a;
    }

    .completion-modal {
      position: fixed;
      inset: 0;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(2, 6, 23, 0.78);
      z-index: 60;
    }

    .completion-modal.show {
      display: flex;
    }

    .completion-modal-card {
      width: min(100%, 520px);
      padding: 18px;
      border-radius: 20px;
      background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
      border: 1px solid rgba(255, 255, 255, 0.08);
      box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    }

    .completion-modal-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 12px;
    }

    .completion-modal-title {
      margin: 0;
      font-size: 1.2rem;
    }

    .completion-modal-subtitle {
      margin: 4px 0 0;
      color: var(--muted);
      font-size: 0.92rem;
      line-height: 1.45;
    }

    .completion-modal-close {
      border: 0;
      background: rgba(255, 255, 255, 0.08);
      color: var(--text);
      width: 34px;
      height: 34px;
      border-radius: 999px;
      cursor: pointer;
      font-size: 1rem;
    }

    .completion-modal-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      margin-bottom: 14px;
    }

    .completion-modal-stat,
    .completion-modal-section {
      padding: 12px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .completion-modal-stat strong,
    .completion-modal-section strong {
      display: block;
      font-size: 0.8rem;
      color: var(--muted);
      margin-bottom: 4px;
      font-weight: 600;
    }

    .completion-modal-stat span {
      font-size: 1rem;
      font-weight: 700;
      color: #f8fafc;
    }

    .completion-modal-section {
      margin-bottom: 14px;
      background: rgba(255, 255, 255, 0.03);
    }

    .completion-modal-list {
      margin: 8px 0 0;
      padding-left: 18px;
      color: #dbe4f0;
      font-size: 0.92rem;
    }

    .completion-modal-list li+li {
      margin-top: 6px;
    }

    .completion-modal-note {
      margin: 10px 0 0;
      color: var(--muted);
      font-size: 0.84rem;
      line-height: 1.45;
    }

    .completion-modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      flex-wrap: wrap;
    }

    .completion-modal-actions button {
      min-width: 146px;
    }

    .shortcut-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      margin-top: 6px;
    }

    .shortcut-item {
      padding: 12px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .shortcut-item strong {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 3.2rem;
      padding: 0.28rem 0.55rem;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: #f8fafc;
      font-size: 0.82rem;
      margin-bottom: 0.45rem;
    }

    .shortcut-item p {
      margin: 0;
      color: #cbd5e1;
      font-size: 0.9rem;
      line-height: 1.45;
    }

    .guide-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      margin-top: 6px;
    }

    .guide-section {
      padding: 14px;
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.06);
    }

    .guide-section h3 {
      margin: 0 0 8px;
      font-size: 1rem;
      color: #f8fafc;
    }

    .guide-section p {
      margin: 0;
      color: #cbd5e1;
      font-size: 0.92rem;
      line-height: 1.5;
    }

    .guide-section p+p {
      margin-top: 8px;
    }

    .guide-modal-card {
      width: min(1080px, 96vw);
      max-height: min(90vh, 980px);
      overflow: auto;
    }

    .local-config-meta {
      color: var(--muted);
      font-size: 0.84rem;
      line-height: 1.45;
      margin-top: 10px;
    }

    .local-config-modal-card {
      width: min(1180px, 96vw);
      max-height: min(90vh, 1000px);
      overflow: auto;
    }

    .local-config-grid {
      display: grid;
      grid-template-columns: minmax(360px, 1fr) minmax(380px, 520px);
      gap: 18px;
      align-items: start;
    }

    .local-config-preview {
      padding: 14px;
      border-radius: 16px;
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.06);
      position: sticky;
      top: 0;
    }

    .local-config-preview canvas {
      width: 100%;
      height: auto;
      display: block;
      border-radius: 12px;
      background: rgba(15, 23, 42, 0.92);
      margin-top: 12px;
    }

    .local-config-actions {
      display: flex;
      justify-content: flex-end;
      gap: 10px;
      flex-wrap: wrap;
      margin-top: 14px;
    }

    .toolbar .badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 40px;
      height: 40px;
      padding: 0 14px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.08);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: var(--text);
      font-size: 0.92rem;
      white-space: nowrap;
    }

    .zoom-btn,
    .toggle-sidebar-btn {
      width: auto;
      min-width: 44px;
      padding: 8px 12px;
      border-radius: 12px;
    }

    .status.ok {
      color: #bbf7d0;
    }

    .status.warn {
      color: #fde68a;
    }

    .board-wrap {
      position: relative;
      isolation: isolate;
      flex: 1;
      min-height: 0;
      border-radius: 24px;
      overflow: hidden;
      border: 1px solid rgba(255, 255, 255, 0.08);
      background:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(180deg, var(--board-base-top), var(--board-base-bottom));
      background-size: 28px 28px, 28px 28px, 100% 100%;
      cursor: default;
    }

    .play-area {
      position: absolute;
      left: 0;
      top: 0;
      overflow: visible;
      will-change: transform;
      transform-origin: top left;
      z-index: 5;
    }

    .target-frame {
      position: absolute;
      border: 2px dashed rgba(255, 255, 255, 0.2);
      box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.02);
      pointer-events: none;
    }

    /* original .piece filter:
    .piece { position: absolute; touch-action: none; user-select: none; cursor: grab; filter: drop-shadow(0 10px 14px rgba(0,0,0,0.38)); transition: filter .18s ease, transform .18s ease, opacity .18s ease; }
    */
    .piece {
      position: absolute;
      touch-action: none;
      user-select: none;
      cursor: grab;
      transition: filter .18s ease, transform .18s ease, opacity .18s ease;
      transform: rotate(var(--piece-rotation, 0deg));
      transform-origin: center center;
    }

    .piece.dragging {
      cursor: grabbing;
      transform: rotate(var(--piece-rotation, 0deg)) scale(1.03);
      z-index: 9999 !important;
      filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.5));
    }

    .piece.dragging.selected {
      filter:
        drop-shadow(0 18px 24px rgba(0, 0, 0, 0.5)) drop-shadow(0 0 8px rgba(255, 225, 130, 0.62)) drop-shadow(0 0 18px rgba(255, 200, 70, 0.32));
    }

    /* /* /* original .piece.locked filter:
    .piece.locked { cursor: default; z-index: 10 !important; filter: drop-shadow(0 6px 8px rgba(34,197,94,0.18)); }
    */
    .piece.locked {
      cursor: default;
      z-index: 10 !important;
    }

    */ .piece.locked {
      cursor: default;
      z-index: 10 !important;
    }

    */ .piece.locked {
      cursor: default;
      z-index: 10 !important;
    }

    .piece.selected {
      filter:
        drop-shadow(0 10px 14px rgba(0, 0, 0, 0.38)) drop-shadow(0 0 6px rgba(255, 220, 110, 0.55)) drop-shadow(0 0 14px rgba(255, 200, 70, 0.28));
    }

    .piece.locked.selected {
      filter:
        drop-shadow(0 6px 8px rgba(34, 197, 94, 0.18)) drop-shadow(0 0 6px rgba(255, 220, 110, 0.45)) drop-shadow(0 0 12px rgba(255, 200, 70, 0.22));
    }

    .piece canvas {
      display: block;
      pointer-events: none;
    }

    .footer-note {
      color: var(--muted);
      font-size: 0.82rem;
      line-height: 1.5;
    }

    .pan-hint {
      position: absolute;
      left: 16px;
      bottom: 16px;
      z-index: 5;
      padding: 8px 12px;
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.78);
      border: 1px solid rgba(255, 255, 255, 0.08);
      color: #cbd5e1;
      font-size: 0.85rem;
      pointer-events: none;
    }

    .selection-box {
      position: absolute;
      border: 1px solid rgba(56, 189, 248, 0.9);
      background: rgba(56, 189, 248, 0.18);
      pointer-events: none;
      z-index: 40000;
      display: none;
    }

    .checkbox-line {
      display: flex;
      align-items: center;
      gap: 10px;
      margin: 8px 0;
    }

    .checkbox-line input[type="checkbox"] {
      width: auto;
      transform: scale(1.15);
      accent-color: var(--accent);
    }

    @media (max-width: 1080px) {
      .app {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr);
      }

      .sidebar {
        height: auto;
        max-height: 42vh;
      }

      .board-shell {
        height: auto;
        min-height: 0;
      }
    }

    @media (max-width: 640px) {
      .local-config-grid {
        grid-template-columns: 1fr;
      }

      .local-config-preview {
        position: static;
      }

      .completion-modal-grid {
        grid-template-columns: 1fr;
      }

      .completion-modal-card {
        padding: 16px;
      }

      .completion-modal-actions button {
        width: 100%;
      }

      .guide-grid,
      .shortcut-grid {
        grid-template-columns: 1fr;
      }
    }

    #toolbarResetBtn {
      display: none !important;
    }

    body.running .sidebar-collapsed #toolbarResetBtn,
    .sidebar-collapsed body.running #toolbarResetBtn {
      display: inline-flex !important;
    }

    #pieceDesignSelect {
      width: 100%;
      margin-top: 6px;
      padding: 10px 12px;
      border-radius: 14px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      background: rgba(15, 23, 42, 0.92);
      color: #e5e7eb;
      font: inherit;
      outline: none;
      transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    }

    #pieceDesignSelect:hover {
      border-color: rgba(255, 255, 255, 0.22);
      background: rgba(15, 23, 42, 0.98);
    }

    #pieceDesignSelect:focus {
      border-color: rgba(168, 85, 247, 0.72);
      box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.16);
      background: rgba(15, 23, 42, 1);
    }

    #pieceDesignSelect option {
      background: #0f172a;
      color: #e5e7eb;
    }


    .board-color-row {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-top: 12px;
    }

    #boardColorInput {
      width: 50px;
      min-width: 50px;
      height: 50px;
      padding: 0;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.96);
      cursor: pointer;
      overflow: hidden;
      appearance: none;
      -webkit-appearance: none;
      box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.05),
        0 10px 22px rgba(0, 0, 0, 0.18);
      transition: transform .15s ease, border-color .18s ease, box-shadow .18s ease;
    }

    #boardColorInput:hover {
      transform: translateY(-1px);
      border-color: rgba(255, 255, 255, 0.24);
      box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.08),
        0 12px 26px rgba(0, 0, 0, 0.24);
    }

    #boardColorInput:focus {
      outline: none;
      border-color: rgba(56, 189, 248, 0.72);
      box-shadow:
        0 0 0 3px rgba(56, 189, 248, 0.16),
        0 12px 26px rgba(0, 0, 0, 0.24);
    }

    #boardColorInput::-webkit-color-swatch-wrapper {
      padding: 6px;
      border-radius: 999px;
    }

    #boardColorInput::-webkit-color-swatch {
      border: 2px solid rgba(255, 255, 255, 0.12);
      border-radius: 999px;
    }

    #boardColorInput::-moz-color-swatch {
      border: 2px solid rgba(255, 255, 255, 0.12);
      border-radius: 999px;
    }

    .puzzle-wallpaper-modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 80;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 18px;
      background: rgba(2, 6, 23, 0.72);
    }

    .puzzle-wallpaper-modal-backdrop.open {
      display: flex;
    }

    .puzzle-wallpaper-modal {
      width: min(760px, 100%);
      max-height: min(760px, calc(100vh - 36px));
      overflow: hidden;
      display: flex;
      flex-direction: column;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 22px;
      background: #0f172a;
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
    }

    .puzzle-wallpaper-modal-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 14px;
      padding: 18px 20px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .puzzle-wallpaper-modal-head h2 {
      margin: 0;
      font-size: 1.22rem;
    }

    .puzzle-wallpaper-modal-head p,
    .puzzle-wallpaper-status {
      margin: 3px 0 0;
      color: var(--muted);
      line-height: 1.5;
    }

    .puzzle-wallpaper-modal-body {
      min-height: 0;
      overflow: auto;
      padding: 18px 20px 20px;
    }

    .puzzle-wallpaper-icon-button {
      width: 38px;
      height: 38px;
      display: grid;
      place-items: center;
      border: 1px solid rgba(255, 255, 255, 0.14);
      border-radius: 12px;
      color: var(--text);
      background: rgba(255, 255, 255, 0.08);
      cursor: pointer;
    }

    .puzzle-wallpaper-settings,
    .puzzle-wallpaper-field,
    .puzzle-wallpaper-choice-group {
      display: grid;
      gap: 12px;
    }

    .puzzle-wallpaper-field {
      color: var(--muted);
      font-size: 0.9rem;
      font-weight: 700;
    }

    .puzzle-wallpaper-field input,
    .puzzle-wallpaper-field select {
      width: 100%;
      min-height: 38px;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 12px;
      color: var(--text);
      background: rgba(15, 23, 42, 0.96);
      padding: 0 10px;
    }

    .puzzle-wallpaper-field input[type="range"] {
      padding: 0;
      accent-color: var(--accent);
    }

    .puzzle-wallpaper-field select option {
      color: var(--text);
      background: #0f172a;
    }

    .puzzle-wallpaper-choice-group {
      margin: 0;
      padding: 12px;
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 14px;
    }

    .puzzle-wallpaper-choice-group legend {
      padding: 0 6px;
      color: var(--muted);
      font-size: 0.8rem;
      font-weight: 800;
      text-transform: uppercase;
    }

    .puzzle-wallpaper-switch-row {
      display: flex;
      align-items: center;
      gap: 10px;
      min-height: 38px;
      color: var(--text);
      font-weight: 700;
      cursor: pointer;
    }

    .puzzle-wallpaper-switch-row input {
      width: 18px;
      height: 18px;
      accent-color: var(--accent);
    }

    .puzzle-wallpaper-set-options[hidden] {
      display: none !important;
    }

