body {
    margin: 0;
    background-color: rgb(8, 6, 0);
    overflow: hidden;
}

#container {
    display: flex;
    flex-direction: row;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#parent {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#parent img {
    box-shadow: rgb(51, 29, 0) 0px -1px 29px 5px;
    display: block;
    max-width: 90%;
    max-height: 90%;
    height: auto;
    border-radius: 50px;
}

#canvas_container {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game {
    display: block;
    cursor: grab;
}
#game:active {
    cursor: grabbing;
}

#hint {
    position: absolute;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.7);
    color: rgb(167, 167, 167);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    transform: translate(10px, 10px) scale(0.95);
    display: none;
    z-index: 10;
}

/* =====================================================
   CUSTOMIZE PANEL — right sidebar
   ===================================================== */
#customize_panel {
    width: 290px;
    min-width: 290px;
    height: 84%;
    background: rgb(20, 20, 20);
    border-radius: 30px 0 0 30px;
    border-color: rgb(60, 34, 0);
    padding: 18px 15px 28px;
    display: flex;
    flex-direction: column;
    align-self: center;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #616161 transparent;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#customize_panel::-webkit-scrollbar       { width: 1px; }
#customize_panel::-webkit-scrollbar-thumb { background: #505050; border-radius: 2px; }

.panel_title {
    text-align: center;
    font-size: 13px;
    color: #999;
    letter-spacing: 0.08em;
    padding-bottom: 10px;
}

/* Section label above each box */
.section_label {
    font-size: 12px;
    color: #b69f44;
    padding-left: 2px;
    letter-spacing: 0.01em;
}

/* Rounded dark boxes */
.section_box {
    background: #212121;
    border-radius: 12px;
    padding: 0 8px 4px;
    overflow-x: hidden;
    overflow-y: auto;
}

/* ---- Vertex table ---- */
.vertex_header {
    display: grid;
    grid-template-columns: 38px 1fr 1fr 1fr 28px;
    gap: 2px;
    padding: 8px 4px 6px;
    font-size: 11px;
    color: #888;
    text-align: center;
    border-bottom: 1px solid #4a4a4a;
}

.col_index  { text-align: center; }
.col_coord  { text-align: center; }
.col_action { width: 28px; }

.vertex_row {
    display: grid;
    grid-template-columns: 38px 1fr 1fr 1fr 28px;
    gap: 2px;
    align-items: center;
    padding: 2px 4px;
    border-bottom: 1px solid #484848;
    transition: background 0.1s;
}
.vertex_row:last-child { border-bottom: none; }
.vertex_row:hover      { background: rgba(255,255,255,0.03); }

.vertex_index {
    text-align: center;
    font-size: 12px;
    color: #999;
    font-variant-numeric: tabular-nums;
}

.vertex_row input {
    background: transparent;
    border: none;
    color: #eeeeee;
    text-align: center;
    font-size: 14px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    width: 100%;
    outline: none;
    padding: 5px 2px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    /* -moz-appearance: textfield; */
}
.vertex_row input::-webkit-outer-spin-button,
.vertex_row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.vertex_row input:focus { background: rgba(255,255,255,0.07); color: #fff; }
.vertex_row input.error { color: #ff6b6b; background: rgba(255,80,80,0.09); }

/* ---- Lines list ---- */
.line_row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px 8px 10px;
    border-bottom: 1px solid #484848;
    gap: 6px;
    transition: background 0.1s;
}
.line_row:last-child { border-bottom: none; }
.line_row:hover      { background: rgba(255,255,255,0.03); }

.line_text {
    color: #e8e8e8;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    flex: 1;
    word-break: break-all;
    line-height: 1.5;
}
.line_arrow { color: #777; }

.line_row.has_error .line_text { color: #ff6b6b; }

.error_tag {
    display: inline-block;
    font-size: 10px;
    color: #ff9090;
    background: rgba(255,80,80,0.13);
    border-radius: 4px;
    padding: 2px 5px;
    margin-left: 5px;
    line-height: 1.3;
    cursor: help;
}

/* ---- Add row (pencil at bottom of each section) ---- */
.add_row {
    display: flex;
    justify-content: flex-end;
    padding: 4px 4px 2px;
}

/* ---- Icon buttons (trash / pencil) ---- */
.icon_btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.icon_btn:hover     { background: rgba(255,255,255,0.09); color: #ccc; }
.delete_btn:hover   { background: rgba(255,80,80,0.15);   color: #ff6b6b; }
.pencil_btn         { font-size: 17px; }
.pencil_btn:hover   { color: #a8cfff; background: rgba(100,180,255,0.1); }

/* ---- Add-line inline form ---- */
.add_line_form {
    padding: 8px 4px 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid #484848;
}
.add_line_form label {
    font-size: 10.5px;
    color: #888;
    letter-spacing: 0.03em;
}
.add_line_form input {
    background: #484848;
    border: 1px solid #565656;
    border-radius: 7px;
    color: #f0f0f0;
    padding: 7px 10px;
    font-size: 12.5px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    outline: none;
    width: 100%;
    transition: border-color 0.15s;
}
.add_line_form input:focus        { border-color: #707070; background: #4e4e4e; }
.add_line_form input.error        { border-color: #ff6b6b; background: rgba(255,80,80,0.07); }

.form_error {
    font-size: 10.5px;
    color: #ff9090;
    line-height: 1.4;
    white-space: pre-line;
}
.form_actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}
.btn_confirm {
    background: #585858;
    border: none;
    border-radius: 7px;
    color: #f0f0f0;
    padding: 5px 14px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.15s;
}
.btn_confirm:hover { background: #686868; }

.btn_cancel {
    background: transparent;
    border: 1px solid #565656;
    border-radius: 7px;
    color: #999;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}
.btn_cancel:hover { color: #cccccc; border-color: #777; }

/* ---- Toggle row ---- */
.toggle_row {
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-top: 2px;
    margin-bottom: 2px;
}
.toggle_btn {
    flex: 1;
    padding: 9px 4px;
    border: none;
    border-radius: 20px;
    background: #444;
    color: #777;
    cursor: pointer;
    font-size: 12px;
    letter-spacing: 0.02em;
    transition: background 0.2s, color 0.2s;
}
.toggle_btn.active       { background: #555; color: #eeeeee; }
.toggle_btn:hover        { background: #505050; color: #ccc; }
.toggle_btn.active:hover { background: #5e5e5e; }