:root {
    --bg-color: #0F0F0F;
    --primary: #00D4FF;
    --secondary: #FF6B35;
    --panel-bg: rgba(20, 20, 20, 0.9);
    --text: #E0E0E0;
    --border: #333;
    --guide-h: rgba(0, 212, 255, 0.8);
    --guide-v: rgba(255, 107, 53, 0.8);
    --grid-color: rgba(255, 255, 255, 0.05);

    --radius: 6px;
    --font: 'Inter', system-ui, sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text);
    font-family: var(--font);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    position: relative;
    user-select: none;
}

/* Rulers */
canvas {
    position: absolute;
    z-index: 10;
    pointer-events: none;
}

#ruler-h {
    top: 0;
    left: 20px;
    height: 20px;
    width: calc(100vw - 20px);
    background: #1A1A1A;
    border-bottom: 1px solid var(--border);
}

#ruler-v {
    top: 20px;
    left: 0;
    width: 20px;
    height: calc(100vh - 20px);
    background: #1A1A1A;
    border-right: 1px solid var(--border);
}

/* Corner block */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: #222;
    z-index: 11;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* Grids */
#grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
}

/* Breakpoints */
#breakpoints-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
}

.bp-marker {
    position: absolute;
    top: 20px;
    bottom: 0;
    border-right: 1px dashed rgba(255, 255, 255, 0.2);
}

.bp-label {
    position: absolute;
    top: 25px;
    right: 5px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

/* Guides */
#guides-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 30;
    pointer-events: none;
    /* Let children receive pointer events */
}

.guide {
    position: absolute;
    pointer-events: auto;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
}

.guide:active {
    cursor: grabbing;
}

.guide.selected {
    z-index: 31;
}

.guide-label {
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 3px;
    pointer-events: none;
    user-select: none;
    font-family: monospace;
}

/* Horizontal guide */
.guide.h {
    left: 0;
    width: 100vw;
    height: 7px;
    /* larger hit area */
    margin-top: -3px;
    /* visual center */
}

.guide.h .line {
    width: 100%;
    height: 1px;
    background-color: var(--guide-h);
}

.guide.h.selected .line {
    height: 2px;
    box-shadow: 0 0 5px var(--guide-h);
}

.guide.h .guide-label {
    margin-left: 30px;
}

/* Vertical guide */
.guide.v {
    top: 0;
    height: 100vh;
    width: 7px;
    /* larger hit area */
    margin-left: -3px;
    /* visual center */
    flex-direction: column;
}

.guide.v .line {
    height: 100%;
    width: 1px;
    background-color: var(--guide-v);
}

.guide.v.selected .line {
    width: 2px;
    box-shadow: 0 0 5px var(--guide-v);
}

.guide.v .guide-label {
    margin-top: 30px;
}

/* Cursor Crosshair */
.crosshair {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    z-index: 5;
    display: none;
}

#crosshair-h {
    left: 0;
    width: 100vw;
    height: 1px;
}

#crosshair-v {
    top: 0;
    height: 100vh;
    width: 1px;
}

.cursor-info {
    position: absolute;
    padding: 2px 6px;
    background: var(--primary);
    color: #000;
    font-size: 10px;
    border-radius: 3px;
    font-family: monospace;
    pointer-events: none;
    z-index: 40;
}

/* Measurement Area */
#measure-display {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--primary);
    pointer-events: none;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
}

.measure-text {
    background: var(--primary);
    color: #000;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
}

/* Controls Panel */
.controls-panel {
    position: absolute;
    top: 40px;
    right: 40px;
    width: 280px;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    border-radius: var(--radius);
    z-index: 100;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
}

.controls-panel header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    cursor: move;
    /* Indicate draggable */
}

.controls-panel h1 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

.panel-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-group {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.control-group label {
    font-size: 12px;
    color: #aaa;
}

/* UI Elements */
.btn {
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: var(--font);
    transition: background 0.2s;
    flex: 1;
}

.w-full {
    width: 100%;
    border-radius: 4px;
    padding: 8px;
}

.mt-2 {
    margin-top: 8px;
}

.btn-primary {
    background: rgba(0, 212, 255, 0.2);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: rgba(0, 212, 255, 0.3);
}

.btn-secondary {
    background: #2A2A2A;
    color: #fff;
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #333;
}

.btn-danger {
    background: rgba(255, 107, 53, 0.2);
    color: var(--secondary);
    border: 1px solid var(--secondary);
}

.btn-danger:hover {
    background: rgba(255, 107, 53, 0.3);
}

.icon-btn {
    background: transparent;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
}

.icon-btn:hover {
    color: #fff;
}

select {
    background: #2A2A2A;
    color: #fff;
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
}

.color-display {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

#picked-color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background-color: transparent;
    border: 1px solid var(--border);
}

#picked-color-hex {
    flex: 1;
    background: #2A2A2A;
    border: 1px solid var(--border);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.instructions {
    background: #1A1A1A;
    padding: 10px;
    border-radius: 4px;
    font-size: 10px;
    color: #aaa;
    margin-top: 10px;
    line-height: 1.5;
}

.instructions strong {
    color: white;
    display: block;
    margin-bottom: 4px;
}

.hidden {
    display: none !important;
}