body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #050505;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: white;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* カメラ映像を隠すが、動作のために必要 */
.input_video {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 160px;
    height: 120px;
    z-index: 0;
    opacity: 0; /* カメラフィードを見たい場合は1にする */
    pointer-events: none;
}

/* UIパネル */
#ui-panel {
    display: none;
    position: absolute;
    top: 20px;
    left: 20px;
    width: 280px;
    background: rgba(20, 20, 30, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 20px;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease;
}

.section {
    margin-bottom: 24px;
}

.section:last-child {
    margin-bottom: 0;
}

h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #8899aa;
    font-weight: 600;
}

/* ボタン */
.btn-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.shape-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #eee;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.shape-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.shape-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
    font-weight: bold;
}

/* カラーセレクタ */
.color-options {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.2s;
}

.color-btn.active {
    border-color: white;
    transform: scale(1.1);
}

.color-picker-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #555;
    background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red);
    cursor: pointer;
}

#custom-color {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    opacity: 0;
    cursor: pointer;
}

/* ステータス */
#status-text {
    font-size: 16px;
    font-weight: bold;
    color: #00ff88;
    margin-bottom: 8px;
}

.gesture-hints p {
    margin: 4px 0;
    font-size: 13px;
    color: #ccc;
}

/* ローディング */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* PC以外の端末でのレスポンシブ調整 */
@media (max-width: 600px) {
    #ui-panel {
        width: calc(100% - 40px);
        bottom: 20px;
        top: auto;
    }
}