:root {
    --bg-color: #e8e6e1; /* Aged paper / Washi texture color */
    --ink-color: #1a1a1a;
    --structure-color: #7a7a7a;
    --ui-bg: rgba(255, 255, 255, 0.8);
    --accent: #4a4a4a;
}

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

html,
body {
    width: 100%;
    height: 100%;
    min-height: 100%;
}

body {
    background-color: var(--bg-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    color: var(--ink-color);
    overscroll-behavior: none;
}

#canvas-main {
    display: block;
    cursor: crosshair;

    /*
     * The canvas is the artwork interaction surface. This prevents Android
     * browsers from interpreting a canvas gesture as page pan/zoom.
     */
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 10;
    pointer-events: none;
}

.panel {
    background: var(--ui-bg);
    padding: 20px;
    max-width: min(300px, calc(100vw - 40px));
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    pointer-events: auto;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

h1 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
}

p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 15px;
    opacity: 0.8;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

button {
    background: var(--ink-color);
    color: var(--bg-color);
    border: none;
    padding: 10px 12px;
    min-height: 40px;
    font-size: 0.75rem;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 0.2s;
}

button:hover {
    opacity: 0.8;
}

button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* A quiet mineral-jade accent gives the live integrity readout its own identity. */
.stats {
    margin: 4px 0 20px;
    padding: 12px 14px;
    background: rgba(113, 141, 121, 0.10);
    border-left: 3px solid #718d79;
    font-family: monospace;
}

.stats-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 9px;
}

.stats-label {
    color: #526b5c;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stats-value {
    color: #344d40;
    font-size: 1.05rem;
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.stats-track {
    width: 100%;
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: #d1d8d0;
}

.stats-fill {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: #718d79;
    transition: width 300ms ease;
}

.philosophy {
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    padding-top: 10px;
}

@media (max-width: 480px) {
    #ui-layer {
        top: 12px;
        left: 12px;
        right: 12px;
    }

    .panel {
        padding: 14px;
        max-width: 100%;
    }

    h1 {
        font-size: 1.05rem;
    }

    .controls {
        gap: 8px;
    }
}
