/* index.css — extracted from inline <style> blocks. Generated by scripts/h1-extract.mjs */
:root {
    --bg: #0f1115;
    --bg-2: #161922;
    --bg-3: #1d2230;
    --line: #262c3a;
    --line-2: #323949;
    --fg: #e6e9f2;
    --fg-dim: #8b93a7;
    --accent: #ff8a4c;
    --accent-2: #ffb37a;
    --danger: #ff5a5f;
    --ok: #4ade80;
    --blue: #60a5fa;
  }
  * { box-sizing: border-box; }
  html, body { height: 100%; margin: 0; }
  body {
    font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--fg);
    background: var(--bg);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
  }
  button, input, select { font: inherit; color: inherit; }
  button {
    background: var(--bg-3);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: background .12s, border-color .12s, transform .05s;
  }
  button:hover { background: var(--line); border-color: var(--line-2); }
  button:active { transform: translateY(1px); }
  button.primary { background: var(--accent); color: #1a0e00; border-color: var(--accent); font-weight: 600; }
  button.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
  button.icon {
    width: 34px; height: 34px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
  }
  button.tool {
    width: 40px; height: 40px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
  }
  button.tool.active {
    background: var(--accent);
    color: #1a0e00;
    border-color: var(--accent);
  }
  input[type="number"], input[type="text"], select {
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 5px;
    padding: 5px 8px;
    color: var(--fg);
    outline: none;
    width: 100%;
  }
  input[type="number"]:focus, input[type="text"]:focus, select:focus {
    border-color: var(--accent);
  }
  input[type="range"] { width: 100%; accent-color: var(--accent); }
  input[type="color"] {
    width: 40px; height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg-2);
    cursor: pointer;
    padding: 2px;
  }

  /* Layout */
  #app {
    display: grid;
    grid-template-rows: 48px 1fr 96px;
    grid-template-columns: 220px 1fr 260px;
    grid-template-areas:
      "topbar topbar topbar"
      "left   center right"
      "left   frames right";
    height: 100%;
    width: 100%;
  }
  #topbar {
    grid-area: topbar;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    background: var(--bg-2);
    border-bottom: 1px solid var(--line);
  }
  #topbar .brand {
    font-weight: 700;
    letter-spacing: .5px;
    margin-right: 10px;
    color: var(--accent);
  }
  #topbar .brand span { color: var(--fg); }
  #topbar .spacer { flex: 1; }
  #topbar .zoom-label {
    min-width: 50px;
    text-align: center;
    color: var(--fg-dim);
  }
  #left {
    grid-area: left;
    background: var(--bg-2);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
  }
  #center {
    grid-area: center;
    position: relative;
    overflow: hidden;
    background:
      repeating-conic-gradient(#1a1e29 0% 25%, #151925 0% 50%) 0 0 / 24px 24px;
  }
  #right {
    grid-area: right;
    background: var(--bg-2);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #frames-area {
    grid-area: frames;
    background: var(--bg-2);
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 8px 12px;
    gap: 10px;
    overflow: hidden;
  }

  .section {
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }
  .section h3 {
    margin: 0 0 10px 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--fg-dim);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .section h3 .actions { display: flex; gap: 4px; }
  .section h3 .actions button {
    padding: 2px 6px;
    font-size: 14px;
    line-height: 1;
    min-height: 22px;
  }

  /* Tools grid */
  .tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  /* Color picker / current color */
  .color-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  .color-swatch-big {
    width: 50px; height: 50px;
    border-radius: 8px;
    border: 2px solid var(--line-2);
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .color-swatch-big::after {
    content: '';
    position: absolute; inset: 0;
    background-image: linear-gradient(45deg, #555 25%, transparent 25%),
                      linear-gradient(-45deg, #555 25%, transparent 25%),
                      linear-gradient(45deg, transparent 75%, #555 75%),
                      linear-gradient(-45deg, transparent 75%, #555 75%);
    background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
    z-index: -1;
  }

  /* Palette */
  .palette {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 3px;
    margin-top: 8px;
  }
  .palette .swatch {
    aspect-ratio: 1;
    border-radius: 3px;
    cursor: pointer;
    border: 1px solid rgba(255,255,255,.08);
    position: relative;
  }
  .palette .swatch.active {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    z-index: 2;
  }
  .palette .swatch.empty {
    background:
      linear-gradient(45deg, transparent 45%, #555 45%, #555 55%, transparent 55%),
      var(--bg-3);
  }

  /* Layers */
  #layers-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
  }
  .layer-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: var(--bg-3);
    border: 1px solid var(--line);
    border-radius: 6px;
    margin-bottom: 4px;
    cursor: pointer;
  }
  .layer-item.active {
    border-color: var(--accent);
    background: #2a2315;
  }
  .layer-item .preview {
    width: 32px; height: 32px;
    border-radius: 4px;
    background:
      repeating-conic-gradient(#444 0% 25%, #333 0% 50%) 0 0 / 8px 8px;
    border: 1px solid var(--line-2);
    image-rendering: pixelated;
    flex-shrink: 0;
  }
  .layer-item .name {
    flex: 1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .layer-item .vis {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 4px;
    font-size: 14px;
    color: var(--fg-dim);
  }
  .layer-item .vis:hover { background: var(--line); color: var(--fg); }
  .layer-item.hidden .name { opacity: .4; text-decoration: line-through; }

  /* Frames */
  #frames-list {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    flex: 1;
    align-items: center;
    height: 100%;
    padding: 4px 0;
  }
  .frame-item {
    position: relative;
    width: 72px;
    height: 72px;
    background: var(--bg-3);
    border: 2px solid var(--line);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
  }
  .frame-item canvas {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
    background:
      repeating-conic-gradient(#444 0% 25%, #333 0% 50%) 0 0 / 8px 8px;
  }
  .frame-item.active { border-color: var(--accent); }
  .frame-item .num {
    position: absolute;
    top: 2px; left: 4px;
    font-size: 10px;
    color: var(--fg-dim);
    font-weight: 600;
  }
  .frame-item .del {
    position: absolute;
    top: 2px; right: 2px;
    width: 16px; height: 16px;
    background: rgba(0,0,0,.6);
    border-radius: 3px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--fg);
    border: none;
    cursor: pointer;
    padding: 0;
  }
  .frame-item:hover .del { display: flex; }
  .frame-item .del:hover { background: var(--danger); }

  #center-wrap {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  #canvas-stack {
    position: relative;
    image-rendering: pixelated;
    box-shadow: 0 0 0 1px #000, 0 20px 60px rgba(0,0,0,.5);
  }
  #canvas-stack canvas {
    position: absolute;
    top: 0; left: 0;
    image-rendering: pixelated;
    display: block;
  }
  #canvas-bg { position: relative !important; }

  /* Modal */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
  }
  .modal {
    background: var(--bg-2);
    border: 1px solid var(--line-2);
    border-radius: 10px;
    padding: 20px;
    min-width: 320px;
    box-shadow: 0 10px 40px rgba(0,0,0,.5);
  }
  .modal h2 { margin: 0 0 16px 0; font-size: 16px; }
  .modal .row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
  .modal .row label { flex: 1; color: var(--fg-dim); }
  .modal .row input, .modal .row select { flex: 1; }
  .modal .buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

  #status {
    position: absolute;
    bottom: 8px; left: 8px;
    background: rgba(0,0,0,.6);
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--fg-dim);
    font-family: ui-monospace, monospace;
    font-size: 11px;
    pointer-events: none;
  }
  #toast {
    position: fixed;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    padding: 8px 14px;
    border-radius: 8px;
    opacity: 0;
    transition: opacity .25s;
    pointer-events: none;
    z-index: 200;
    box-shadow: 0 4px 20px rgba(0,0,0,.4);
  }
  #toast.show { opacity: 1; }

  .divider {
    width: 1px;
    height: 24px;
    background: var(--line);
    margin: 0 4px;
  }

  .kbd {
    display: inline-block;
    padding: 1px 5px;
    background: var(--bg-3);
    border: 1px solid var(--line-2);
    border-radius: 3px;
    font-family: ui-monospace, monospace;
    font-size: 10px;
    color: var(--fg-dim);
  }

  /* Mobile */
  @media (max-width: 768px) {
    #app {
      grid-template-rows: 48px auto 1fr 80px auto;
      grid-template-columns: 1fr;
      grid-template-areas:
        "topbar"
        "left"
        "center"
        "frames"
        "right";
    }
    #topbar {
      padding: 0 8px;
      gap: 4px;
      overflow-x: auto;
      flex-wrap: nowrap;
    }
    #topbar button, #topbar .divider { flex-shrink: 0; }
    #topbar button { min-height: 44px; min-width: 44px; }
    #topbar .brand { font-size: 12px; }
    #topbar .zoom-label { min-width: 42px; font-size: 11px; }
    #left {
      border-right: none;
      border-bottom: 1px solid var(--line);
      max-height: 180px;
      overflow-y: auto;
      flex-direction: row;
      flex-wrap: nowrap;
      overflow-x: auto;
    }
    #left .section {
      border-bottom: none;
      border-right: 1px solid var(--line);
      flex-shrink: 0;
      min-width: 180px;
    }
    #left .section:last-child { display: none; }
    .tools-grid { grid-template-columns: repeat(4, 44px); }
    .tool { width: 44px !important; height: 44px !important; }
    #right {
      border-left: none;
      border-top: 1px solid var(--line);
      max-height: 200px;
      overflow-y: auto;
    }
    #layers-list { max-height: 120px; }
    .layer-item { min-height: 44px; }
    .layer-item .vis { min-width: 44px; min-height: 44px; }
    #frames-area { padding: 4px 6px; gap: 6px; }
    .frame-item { width: 60px; height: 60px; }
    #frames-area button.icon { min-height: 44px; min-width: 44px; }
    .palette .swatch { min-height: 28px; }
    .section h3 .actions button { min-height: 32px; min-width: 32px; font-size: 13px; }
    #center { min-height: 180px; }
    button { min-height: 38px; font-size: 12px; }
    input[type="number"], input[type="text"], select { min-height: 38px; font-size: 12px; }
  }
  @media (max-width: 480px) {
    #app {
      grid-template-rows: 44px auto 1fr 64px auto;
    }
    #topbar { padding: 0 6px; }
    #topbar .brand { display: none; }
    #left { max-height: 160px; }
    #left .section { min-width: 160px; padding: 8px; }
    .tools-grid { grid-template-columns: repeat(4, 40px); gap: 4px; }
    .tool { width: 40px !important; height: 40px !important; font-size: 16px; }
    #right { max-height: 160px; }
    #layers-list { max-height: 90px; padding: 4px; }
    .frame-item { width: 52px; height: 52px; }
    .section h3 { font-size: 10px; }
    button { min-height: 44px; }
    #center { min-height: 140px; }
    #status { font-size: 10px; bottom: 4px; left: 4px; }
  }

  /* Scrollbars */
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: var(--bg-2); }
  ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid var(--bg-2); }
  ::-webkit-scrollbar-thumb:hover { background: #404a60; }
