body{
    margin:0;
    font-family:Arial, Helvetica, sans-serif;
    background:#f5f3ef;
    color:#222;
}

*{
    box-sizing:border-box;
}

.container{
    max-width:1280px;
    margin:auto;
    padding:40px 20px;
}

.topbar{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:20px;
    margin-bottom:25px;
}

.topbar-actions{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}

.subtitle{
    color:#666;
    margin-top:6px;
}

.panel{
    background:#fff;
    padding:25px;
    border-radius:16px;
    box-shadow:0 6px 18px rgba(0,0,0,0.08);
    margin-bottom:20px;
}

.form-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
    gap:18px;
}

.form-grid-3{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
    gap:18px;
}

label{
    display:block;
    font-weight:bold;
    margin-bottom:8px;
    color:#355e3b;
}

input[type="text"],
input[type="number"],
select,
textarea{
    width:100%;
    padding:12px;
    border:1px solid #d8d8d8;
    border-radius:10px;
    font-size:15px;
    background:#fff;
}

textarea{
    resize:vertical;
}

.btn{
    display:inline-block;
    border:none;
    border-radius:10px;
    padding:12px 16px;
    text-decoration:none;
    font-weight:bold;
    cursor:pointer;
    font-size:14px;
}

.btn-primary{
    background:#355e3b;
    color:#fff;
}

.btn-light{
    background:#ece7df;
    color:#222;
}

.btn-danger{
    background:#a94442;
    color:#fff;
}

.btn-small{
    padding:8px 10px;
    font-size:13px;
}

.section-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:20px;
    margin-bottom:20px;
}

.figure-card{
    border:1px solid #e2ddd5;
    border-radius:14px;
    padding:18px;
    margin-bottom:16px;
    background:#fcfbf9;
}

.figure-card-head{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    margin-bottom:14px;
}

.figure-card-actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.check-group{
    display:flex;
    flex-direction:column;
    gap:12px;
}

.checkbox-label{
    display:flex;
    align-items:center;
    gap:10px;
    font-weight:normal;
    color:#333;
}

.actions-panel{
    display:flex;
    gap:12px;
    flex-wrap:wrap;
}

pre{
    background:#1f2430;
    color:#e6edf3;
    padding:16px;
    border-radius:12px;
    overflow:auto;
    font-size:13px;
}

.draw-box{
    margin-top:16px;
    padding:16px;
    border:1px solid #ddd5ca;
    border-radius:12px;
    background:#f8f4ee;
}

.draw-controls{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
    gap:14px;
    align-items:end;
    margin-bottom:16px;
}

.draw-stage{
    background:#fff;
    border:1px solid #ddd;
    border-radius:12px;
    padding:10px;
    overflow:auto;
}

.figure-svg{
    width:100%;
    height:auto;
    display:block;
}

.trace-list{
    margin-top:14px;
}

.trace-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding:10px 12px;
    border:1px solid #e4ddd3;
    border-radius:10px;
    background:#fff;
    margin-bottom:8px;
    font-size:14px;
}

.trace-empty{
    margin:0;
    color:#7a6d5d;
    font-style:italic;
}

.helper-box{
    margin-top:10px;
    padding:10px 12px;
    background:#fff;
    border:1px solid #e4ddd3;
    border-radius:10px;
    color:#6e6254;
    font-size:13px;
}

.hidden{
    display:none !important;
}

.legend-inline{
    display:flex;
    gap:14px;
    flex-wrap:wrap;
    margin-top:10px;
    font-size:13px;
    color:#555;
}

.legend-chip{
    display:flex;
    align-items:center;
    gap:6px;
}

.legend-line{
    width:24px;
    height:4px;
    border-radius:999px;
}

.multi-letter-wrap{
    display:flex;
    flex-direction:column;
    gap:10px;
}

.multi-letter-controls{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.multi-letter-list{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    padding:10px;
    min-height:48px;
    border:1px solid #d8d8d8;
    border-radius:10px;
    background:#fff;
}

.letter-chip{
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:8px 10px;
    border-radius:999px;
    background:#ece7df;
    font-size:13px;
    font-weight:bold;
}

.letter-chip button{
    border:none;
    background:transparent;
    cursor:pointer;
    font-weight:bold;
    padding:0;
    line-height:1;
}

.info-note{
    color:#7a6d5d;
    font-size:13px;
    margin-top:6px;
}

@media (max-width: 760px){
    .topbar,
    .section-head,
    .figure-card-head,
    .trace-row{
        flex-direction:column;
        align-items:stretch;
    }
}