:root {
    --bg: #0f172a;
    --panel: #111827;
    --muted: #94a3b8;
    --text: #e5e7eb;
    --accent: #22c55e;
    --accent2: #3b82f6;
    --line: #1f2937;
}
* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
    margin: 0;
}
body {
    font-family:
        system-ui,
        -apple-system,
        "Segoe UI",
        Roboto,
        Helvetica,
        Arial,
        "Apple Color Emoji",
        "Segoe UI Emoji";
    background: var(--bg);
    color: var(--text);
}
.app {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100vh;
    width: 100vw;
}
.sidebar {
    background: rgba(17, 24, 39, 0.92);
    /* border-right: 1px solid rgba(255, 255, 255, 0.06); */
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 16px;
    gap: 14px;
    overflow: auto;
    scrollbar-width: thin;
}
.brand {
    font-weight: 800;
    letter-spacing: 0.3px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.brand .dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
}
.card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 12px;
}
.label {
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}
.row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.btn {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition:
        0.2s background,
        0.06s transform;
    user-select: none;
    font-size: 13px;
}
.btn:hover {
    background: rgba(255, 255, 255, 0.1);
}
.btn:active {
    transform: translateY(1px) scale(0.99);
}
.btn.primary {
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-color: transparent;
}
.btn.block {
    display: block;
    width: 100%;
}

.tools-grid .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    font-size: 13px;
    line-height: 1.3;
}

.tools-grid .btn .icon {
    font-size: 22px;
    margin-bottom: 4px;
    line-height: 1;
}

.tools-grid .btn .txt {
    font-size: 12px;
    color: var(--text);
    opacity: 0.9;
    text-align: center;
}

.group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.group3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}
input[type="range"] {
    width: 100%;
}
input[type="color"] {
    width: 100%;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    background: #111827;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
}

/* WebKit (Chrome, Edge, Safari) */
input[type="color"]::-webkit-color-swatch-wrapper{ padding: 0; }
input[type="color"]::-webkit-color-swatch{
  border: none;
  border-radius: 8px;     /* matcha hörnen */
}

/* Firefox */
input[type="color"]::-moz-color-swatch{
  border: none;
  border-radius: 8px;
}

/* Behåll tydlig fokus, men utan standard-outline */
input[type="color"]:focus{ outline: none; }
input[type="color"]:focus-visible{
  box-shadow: 0 0 0 3px rgba(59,130,246,.6); /* egen fokusring */
  border-radius: 10px;
}

#fillToggle, #eyedrop {
  cursor: pointer;
}

.badge {
    font-size: 12px;
    padding: 6px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
}
.muted {
    color: var(--muted);
    font-size: 12px;
}
.swatches {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.swatch {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    cursor: pointer;
}
.layers {
    display: grid;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
}
.layerItem {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
    align-items: center;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.layerItem.active {
    border: 2px solid rgba(255, 255, 255, 0.14);
}
.layerName {
    font-weight: 600;
    font-size: 13px;
}
.toggle {
    cursor: pointer;
}
.stage {
    position: relative;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
}
#board {
    background: #ffffff;
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    touch-action: none;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.12), rgba(59, 130, 246, 0.12));
}
.crumb {
    font-size: 12px;
    color: var(--muted);
}
.dotSep {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.3);
    display: inline-block;
    margin: 0 6px;
}
@media (max-width: 950px) {
    .app {
        grid-template-columns: 1fr;
    }
}
