@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;600&display=swap');

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

body {
    min-height: 100vh;
    background: #f5f3f0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    color: #2a2a2a;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
}

.sidebar {
    width: clamp(190px, 19vw, 255px);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 16px 12px;
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(245, 243, 240, 0.95);
}

.canvas-area {
    flex: 1;
    min-width: 0;
    height: 100vh;
}

h1 {
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    margin-bottom: 10px;
    color: #3a3a3a;
}

.subtitle {
    font-size: 0.95rem;
    font-weight: 300;
    opacity: 0.6;
    margin-bottom: 12px;
    letter-spacing: 0.15em;
}

#canvas-container {
    position: relative;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

#glCanvas,
#drawCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

#drawCanvas {
    position: absolute;
    inset: 0;
    touch-action: none;
    cursor: crosshair;
}

.controls {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: none;
    width: 100%;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(0, 0, 0, 0.09);
    background: rgba(255, 255, 255, 0.45);
    min-width: 0;
    width: 100%;
}

.control-group > * {
    max-width: 100%;
}

label {
    font-size: 0.82rem;
    letter-spacing: 0.1em;
    opacity: 0.8;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #555;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="file"],
select,
button {
    font-family: inherit;
    font-size: 0.85rem;
    border: 1px solid #9b9b9b;
    background: #fbfbfb;
    color: #222;
    padding: 6px 8px;
}

input[type="file"] {
    display: block;
    width: 100%;
    min-width: 0;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

button {
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

button:hover {
    background: #ece9e4;
}

input[type="file"]:disabled,
input[type="range"]:disabled,
button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

button:disabled:hover {
    background: #fbfbfb;
}

.toggle.active {
    background: #474747;
    color: #fff;
    border-color: #474747;
}

.mode-button.active {
    background: #bcbcbc;
    color: #1f1f1f;
    border-color: #8a8a8a;
}

.button-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.image-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
}

.image-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: rgba(255, 255, 255, 0.72);
}

.image-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    flex-shrink: 0;
    background: #e5dfd6;
}

.image-item.selected {
    border-color: rgba(183, 153, 73, 0.9);
    box-shadow: 0 0 0 1px rgba(239, 220, 143, 0.8), 0 0 14px rgba(239, 220, 143, 0.45);
    background: rgba(255, 250, 236, 0.96);
}

.image-item-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-item-empty {
    font-size: 0.8rem;
    opacity: 0.6;
}

.instructions {
    margin-top: 12px;
    font-size: 0.8rem;
    opacity: 0.6;
    text-align: left;
    max-width: none;
    line-height: 1.5;
}

.sidebar-footer {
    margin-top: auto;
    width: 100%;
}

.attribution {
    margin-top: 10px;
    font-size: 0.72rem;
    opacity: 0.75;
    line-height: 1.35;
    text-align: left;
}

.value-display {
    font-size: 0.8rem;
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
}
